Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Rmpi: An interface (wrapper) to MPI. It also provides interactive R manager and worker environment.

We currently only have version 0.7.1 available.

Note: Loading this module will also load in r/4.2.2

Meaning you have an environment with r/4.2.2 and the Rmpi library.

You do NOT need to load r/4.2.2 as a module separately.

Using

This usage relates to using this library on Beartooth.

Multicore

...

We currently only have version 0.7.1 available, and to use this requires an initial setup step.

...

This R library is designed to run across multiple nodes, and multiple tasks on a node.

ONLY using the Rmpi library

Note

If you are only using the Rmpi library, and no other related parallel libraries such as snow, then allow the use of Rmpi on the cluster, you first need to copy the following file into your home folder. (If you already have a .Rprofile file in your home, you'll need to update it.)

...

Code Block
module load gcc/12.2.0 openmpi/4.1.4 r-rmpi/0.7-1-ompi
Info

Note: Loading this module will also load in r/4.2.2

Meaning you have an environment with r/4.2.2 and the Rmpi library.

You do NOT need to load r/4.2.2 as a module separately.

Multicore

...

Example

This example was based on an example here:

...

Expand
titleExample Run and Output
Code Block
[]$ sbatch run_01.sh
Submitted batch job 13116893

[]$ cat slurm-13116893.out
master (rank 0, comm 1) of size 8 is running on: ttest01
slave1 (rank 1, comm 1) of size 8 is running on: ttest01
slave2 (rank 2, comm 1) of size 8 is running on: ttest01
slave3 (rank 3, comm 1) of size 8 is running on: ttest01
slave4 (rank 4, comm 1) of size 8 is running on: ttest02
slave5 (rank 5, comm 1) of size 8 is running on: ttest02
slave6 (rank 6, comm 1) of size 8 is running on: ttest02
slave7 (rank 7, comm 1) of size 8 is running on: ttest02
Error in mpi.spawn.Rslaves(nslaves = ns) :
  It seems there are some slaves running on comm  1
$slave1
[1] "I am 1 of 8"

$slave2
[1] "I am 2 of 8"

$slave3
[1] "I am 3 of 8"

$slave4
[1] "I am 4 of 8"

$slave5
[1] "I am 5 of 8"

$slave6
[1] "I am 6 of 8"

$slave7
[1] "I am 7 of 8"

[1] 7
           X1          X2         X3         X4         X5         X6
1  0.25231568 -0.70670787 -0.8623333 -1.1538241 -1.3747273 -0.9696954
2 -0.91498764  1.09819580  0.5737269 -0.6856323  0.8941616 -1.7339326
3  1.51865169  1.63120359 -0.9954300  0.2413086  0.2627482  1.6690493
4  1.09594877  0.08905511 -0.1490578  1.2190246 -0.1724257 -1.3822756
5  0.09966169 -1.92527468  0.9805431  1.8346315  0.2773092 -0.7084154
           X7
1 -0.26325262
2 -1.20082024
3 -0.04534522
4 -0.14685414
5  0.34071411
[1] 1
Expand
titleError if no .Rprofile
Code Block
# If you do not copy the .Rprofile file into you home, you'll see an error of the form:
Error in mpi.comm.spawn(slave = system.file("Rslaves.sh", package = "Rmpi"),  :
  MPI_ERR_SPAWN: could not spawn processes
Calls: mpi.spawn.Rslaves -> mpi.comm.spawn
Execution halted

Using the Rmpi library with Snow