Skip to content

How to add make option to package compilation?

5 messages · Duncan Murdoch, Martin Møller Skarbiniks Pedersen, Michael Dewey +1 more

#
Hi,

  I am installing a lot of packages to a new R installation and it takes a
long time.
  However the machine got 4 cpus and most of the packages are written in
C/C++.

  So is it possible to add a -j4 flag to the make command when I use the
install.packages() function?
  That will probably speed up the package installation process 390%.

Regards
Martin M. S. Pedersen
#
On 15/09/2017 8:11 AM, Martin M?ller Skarbiniks Pedersen wrote:
See the Ncpus argument in ?install.packages.

Duncan Murdoch
#
On 15 September 2017 at 14:13, Duncan Murdoch <murdoch.duncan at gmail.com>
wrote:
Thanks.

However it looks like Ncpus=4 tries to compile four R packages at the same
time using one cpu for each packages.
#
In line
On 15/09/2017 13:30, Martin M?ller Skarbiniks Pedersen wrote:
But you said you had lots to install so would that not speed things up too?

  
    
  
#
On 09/15/2017 08:57 AM, Michael Dewey wrote:
The variable MAKE is defined in ${R_HOME}/etc/Renviron, and can be 
over-written with ~/.Renviron

     MAKE=make -j

There is further discussion in

 
https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Configuration-variables

and ?Renviron.

One could configure a source installation to always compile with make 
-j, something like ./configure MAKE="make -j"

Martin
This email message may contain legally privileged and/or...{{dropped:2}}