ger@ophii m@iii@g oii gmx@@et
2024-Apr-08 08:29 UTC
[R] How to set the correct libomp for R
Hey everyone, 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/ ? Everything worked fine till beginning of this year, but all of a sudden, I get random fatal errors, when using data.table with multithreading. I figured that R (used in RStudio) is not loading this libomp.dylib (located at /usr/local/lib/libomp.dylib), but the one bundled with R (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libomp.dylib). I sued this command to check for this: system(paste("lsof -p", Sys.getpid(), "| grep dylib")) ? I never checked, which one was used before, but this raised some questions for me: ? 1. Was libomp.dylib always bundled with R and if yes, what?s the point of this separate libomp.dylib from this page (https://mac.r-project.org/openmp/)? 2. Is there a way to set the libomp.dylib to another path and does this even make sense or should I always use the one bundled with R? 3. Could it be that one of the libraries is used for installing packages by Xcode?s clang and the other is used during usage of the package? ? Maybe someone could shed some light onto this topic :). ? 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). Or you can of course ask me, but it would be a little overkill to share everything that has been tried yet :).
? Mon, 8 Apr 2024 10:29:53 +0200 gernophil--- via R-help <r-help at 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) 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