RStudio and MS R Open - setMKLthreads() crashes

I'm just following up on this previous post - Rstudio crashes when using setMKLthreads() from Microsoft R open

We have a multiuser VM with RStudio and MS R Open .. we have problems with core usage (supposedly), in that any user doing something intensive hogs all the cores. It is possibly linked to the MKL using all cores by default. Ideally setMKLthreads(something_less_than_all_cores) would help but it crashes RStudio.

I did some searching on the MKL adn found this page - Using Parallelism of the Intel(R) Math Kernel Library . It mentions setting the environmental variable OMP_NUM_THREADS . If I set this environmental variable - importantly, outside of R/RStudio, so before they start - I see the MKL cores/threads is set to this value (either with getMKLthreads() or viewing the default startup message, shown below in the comment). The small benchmark shows difference in time given core number.

I hope this is the solution to our problem. I will have admin set this variable, and we will soon see the results.


Just a friendly warning:
Version 4.0.2 will be the last release of the MRO runtime.
source: Microsoft Machine Learning Server (R Server) retirement on July 1, 2022 - Microsoft Lifecycle | Microsoft Docs

A welcomed enforced change when this SOE is updated in future :slight_smile: