Hi,
I am trying to make Rstudio using multiple threads/cores when installing a new package. all of my search results are skewed and relating to the multicore package. Is there a way to do this?
I am running Linux if that helps.
Thanks
Hi,
I am trying to make Rstudio using multiple threads/cores when installing a new package. all of my search results are skewed and relating to the multicore package. Is there a way to do this?
I am running Linux if that helps.
Thanks
Do you mean during compilation of code used by the package? If so, you can set the MAKEFLAGS
variable, e.g. in your ~/.R/Makevars
:
MAKEFLAGS = -j4
I am curious if the Ncpus
argument in install.packages
does the same or differently ?
Ncpus
the number of parallel processes to use for a parallel install of more than one source package. Values greater than one are supported if the make command specified by Sys.getenv("MAKE", "make") accepts argument -k -j Ncpus.
@kevinushey's suggestion did not work for some reason. Sys.getenv()
would show the variable MAKEFLAGS
set but it would not go into effect.
I ended up changing the MAKE
variable in my Renviron file from make
to make -j4
and that did it.
My understanding is that Ncpus
allows one to install multiple packages in parallel, while the change I described (MAKEFLAGS = -j4
in ~/.R/Makevars
) is specifically for the parallel compilation of C/C++ sources within a single package.