Re: [R] How to set the correct libomp for R

2024-04-09 Thread Ivan Krylov via R-help
В Tue, 9 Apr 2024 09:55:06 +0200
gernop...@gmx.net пишет:

> If I only move away /usr/local/lib/libomp.dylib, I can still install
> it. So it seems that also here the internal libomp.dylib from R is
> used. Just the bundled omp files at /usr/local/include (omp-tools.h,
> omp.h, ompt.h) seem to be used. So maybe this is caused by a mismatch
> of these file and the used libomp.dylib?

This is valuable information, thank you. This is evidence in favour of
libomp.dylib mismatch causing the problem. I hope that the backtrace
will help shine more light on the problem.

I'm out of ideas for now, but if I get any, I'll send another message.
If you don't get an answer here, try r-sig-...@r-project.org.

-- 
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.


Re: [R] How to set the correct libomp for R

2024-04-09 Thread gernophil--- via R-help
Sorry, if have to correct this. If I only move away 
/usr/local/lib/libomp.dylib, I can still install it. So it seems that also here 
the internal libomp.dylib from R is used. Just the bundled omp files at 
/usr/local/include (omp-tools.h, omp.h, ompt.h) seem to be used. So maybe this 
is caused by a mismatch of these file and the used libomp.dylib?
 
 

Gesendet: Dienstag, 09. April 2024 um 09:47 Uhr
Von: gernop...@gmx.net
An: "Ivan Krylov" , "gernophil--- via R-help" 

Cc: gernop...@gmx.net
Betreff: Re: [R] How to set the correct libomp for R
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 
^~~
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" mailto:ikry...@disroot.org>>:


В Mon, 8 Apr 2024 10:29:53 +0200
gernophil--- via R-help 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/][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]]
>  
> <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]]
>  
> <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]]
 
<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.


Re: [R] How to set the correct libomp for R

2024-04-09 Thread gernophil--- via R-help


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 
^~~
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" mailto:ikry...@disroot.org>>:


В Mon, 8 Apr 2024 10:29:53 +0200
gernophil--- via R-help 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/ 
> 


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]
>  
> )
>  and here
> (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]
 



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.


Re: [R] How to set the correct libomp for R

2024-04-08 Thread Ivan Krylov via R-help
В Mon, 8 Apr 2024 10:29:53 +0200
gernophil--- via R-help  пишет:

> 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/

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) and here
> (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

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.