Closed mark-andrews closed 4 years ago
It's OpenBLAS which will grab all cores, which, when coupled with parallel code, leads to a cross-product -- see #412.
@eddelbuettel Thank you. I have set environment variables
export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
And that solves it.
For completeness, in one container, I tried just
export OMP_NUM_THREADS=1
And that seemed to be sufficient to solve the problem above.
In another container, I did
export OPENBLAS_NUM_THREADS=1
but that did not seem to be sufficient.
@mark-andrews thanks for the report on this. @eddelbuettel @noamross do you think we should reconfigure the default openblas settings? This doesn't happen on the older openblas on the debian:stretch containers. Might be worth seeing if we swap libopenblas-openmp-dev
for one of the other flavors of libopenblas
that was now introduced?
https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_R.sh#L22
It is my recollection that this has always been that way with OpenBLAS so we could throttle it, say with a max of four, in Renviron.site
. That would be a CRAN-alike compromise to give the better library but prevent overscaling. Of course we'd have to tell power users (in non-forked/non-parallel use) how to comment it out. Or we could go back to a non-OpenBLAS.
The following R code will usually be completed in less than one second and does not (as far as I can) need to use
parallel::mclapply
or otherparallel
tools.When I run it in
rocker/rstudio:latest
, all 36 cores of a Xeon workstation are processing at 100% for about 30 seconds. The sha256 of the rocker/rstudio:latest image is as follows.I can recreate this by
In the bash shell in the container type
R
and thenWhen I try this in
rocker/r-base:latest
, everything is fine.In my title, I say "amongst other things". I have not tracked down all the details yet, but all I can say is that I was running a RMarkdown script using
psych::fa
andlavaan::sem
and it run at 36 cores for around 30 minutes before I killed it. On a regular, non-docker non-rocker but up to date R installation, it took around 30 seconds to render the document.