Loading modules

So I was trying the Discovery node. I am an R user and I was used to just load R by sourcing /usr/usc/R… so I was quick to realize that that was not going to be the case. Loading modules sounds like a nice idea, but as soon as I tried module load r it said it did not have that module available:

[vegayon@e21-15 sifter]$ module load r/4.0.0
Lmod has detected the following error:  These module(s) or extension(s) exist but cannot be loaded as requested: "r/4.0.0"
   Try: "module spider r/4.0.0" to see how to load the module(s).

To solve it went through the following steps

$ module spider r
$ module spider r/4.0.0
$ module load gcc/8.3.0
$ module load openblas/0.3.8
$ module load r/4.0.0

Which seems to be a bit overkill to load R. Surely I’m doing something wrong, but I don’t know,I thought that module load r would be enough!

I agree that’s an excessive amount of steps to take just to load R.

When you log in, you should have a usc module loaded.

$ module list

Currently Loaded Modules:
  1) gcc/8.3.0   2) openblas/0.3.8   3) openmpi/4.0.2   4) pmix/3.1.3   5) usc

R was built with gcc/8.3.0 and openblas/0.3.8 so those are prerequisite modules. Since they are in the default usc module you should only have to type

module load r

If that doesn’t work you’ll need to load at least gcc and openblas first

module load gcc/8.3.9
module load openblas/0.3.8
module load r/4.0.0

If you don’t like typing you can do it all in one line like so:

module load gcc openblas r

Leaving off the version number will use the default one. I hope that helps!

– Edit –
One more thing, if you get confused from loading/unloading modules too many times you can reset by doing

module purge # unload all modules
module load usc # load default 'usc' modules

and you’ll be back to the default state.


Keep in mind that you will need to explicitly load all the dependency modules in order in Slurm job scripts, starting with the compiler:

module load gcc/8.3.0
module load openblas/0.3.8
module load r/4.0.0

If there are other library dependencies for R packages, like libxml2 for example, then you will need to load those modules as well.

You don’t necessarily have to specify the version numbers, but it helps document the job and computing environment. The defaults may change over time too.