Skip to main content

Latest Tweets

Compiling code (C, Fortran, R packages)

Print Friendly

If your project involves compiled code, or R packages that are not available in the system-wide install, you should read this page.

Compiling R packages

On Linux, when installing R packages, the actual source code is compiled upon installation. You thus need access to compilers. The GNU compiler suite is installed on all nodes, and it is suggested that you do such a compile as part of your program sequence. For instance:

01_first_step.R:
install.packages(c("mypak1","mypak2"))

02_my_analysis.R:
library(mypak1)
library(mypak2)
mypak1(magic=yes,data=mine)

You would first submit the 01_first.R, which will download, compile, and install the packages in your home directory. The home directory is accessible to all compute nodes, and can thus be accessed by all subsequent R jobs, regardless of where they are run.

Additional things to take into account:

  • R packages are stored in R-version-specific directories, unless you specifically override that (or use packrat or similar). So you will need to run the 01_first_step.R every time you switch R versions (see the Module page on how to figure out which R versions are available).
  • Even when using the MKL or ACML R versions we provide, you will use the GNU compiler (or rather, the system will use the GNU compiler). Using Intel compilers is more involved.

Compiling C or Fortran

If you need to compile C or its flavors, or Fortran, you may want to use the Intel compiler suite. The Intel compiler suite is installed on the head node, accessible using the Module command from the command line. You should compile your programs on the head node, before submitting them to compute nodes. Careful about shared libraries! Contact us if you need assistance.

Intel compilers

By default, Linux uses gcc. To use Intel compilers (installed thanks to Chris), load modules to set appropriate paths:

module load intel/intel-compilers-15.0.3

MPI

To use MPI tools, please see the MPI page.