Sorry fort he late reply, your mail ended up in my spam and I've just seen it 
recently.

> Does the behaviour change if you temporarily move away
> /usr/local/lib/libomp.dylib?

It does not change the behavior after loading (or attaching) data.table using 
"library(data.table)". It is still loaded with multiple threads:
"data.table 1.15.4 using 4 threads (see ?getDTthreads). Latest news: 
r-datatable.com"

It does however make it impossible to install data.table from source with these 
flags (set in ~/.R/Makevars; I also temporarily removed the omp files from 
/usr/local/include that are bundled in the tarball)
"""
CPPFLAGS += -Xclang -fopenmp
LDFLAGS += -lomp
"""

This is the error that happens then:
"""
...
In file included from ./data.table.h:1:
./myomp.h:2:12: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
make: *** [assign.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing 
‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/data.table’
* restoring previous 
‘/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/data.table’
Warning in install.packages :
installation of package ‘data.table’ had non-zero exit status
"""
So, the libomp.dylib does indeed seem to be necessary for installing from 
source with OpenMP support, but not for executing the code


> When you reproduce the crash, what does the backtrace say?

I haven't done that yet, since I was on the non-OpenMP version right now. I'll 
come back to you once I tried.

Thanks,
Philipp



Am 08.04.24, 11:13 schrieb "Ivan Krylov" <ikry...@disroot.org 
<mailto:ikry...@disroot.org>>:


В Mon, 8 Apr 2024 10:29:53 +0200
gernophil--- via R-help <r-help@r-project.org <mailto:r-help@r-project.org>> 
пишет:


> I have some weird issue with using multithreaded data.table in macOS
> and I am trying to figure out, if it’s connected to my libomp.dylib.
> I started using libomp as stated here:
> https://mac.r-project.org/openmp/ 
> <https://mac.r-project.org/openmp/[https://mac.r-project.org/openmp/]>


Does the behaviour change if you temporarily move away
/usr/local/lib/libomp.dylib?


> P.S.: If you need some more details about the actual issue with
> data.table you can also check here
> (https://github.com/rstudio/rstudio/issues/14517[https://github.com/rstudio/rstudio/issues/14517]
>  
> <https://github.com/rstudio/rstudio/issues/14517[https://github.com/rstudio/rstudio/issues/14517]>)
>  and here
> (https://github.com/Rdatatable/data.table/issues/5957[https://github.com/Rdatatable/data.table/issues/5957]
>  
> <https://github.com/Rdatatable/data.table/issues/5957[https://github.com/Rdatatable/data.table/issues/5957]>)


The debugger may be able to shed more light on the problem than just
"yes, this is due to OpenMP":
https://github.com/rstudio/rstudio/issues/14517#issuecomment-2040231196[https://github.com/rstudio/rstudio/issues/14517#issuecomment-2040231196]
 
<https://github.com/rstudio/rstudio/issues/14517#issuecomment-2040231196[https://github.com/rstudio/rstudio/issues/14517#issuecomment-2040231196]>


When you reproduce the crash, what does the backtrace say?


--
Best regards,
Ivan


 

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to