Skip to content

Configure openMPI on a Computing Cluster

Colby Ford edited this page Aug 15, 2018 · 1 revision

Requirements/Notes:

  • Must use openMPI 1.X on the cluster
  • Cannot use InfiniBand-version of the compiled openMPI library
  • Ensure that both Rmpi and doMPI are installed and load properly

Example Cluster Submission (Torque)

#!/bin/sh

#PBS -q clustername
#PBS -N myrunname
#PBS -l nodes=16:ppn=16
#PBS -l walltime=24:00:00

module load openmpi/1.10.0 R/3.4.3
cd $PBS_O_WORKDIR

nodecnt=`wc -l $PBS_NODEFILE | awk '{print $1}'`
echo "Node File:"
cat $PBS_NODEFILE
echo ""

echo "Executing: mpirun -quiet -np 1 --hostfile $PBS_NODEFILE R --slave -f myRscript.R"
echo ""
mpirun -quiet -np 1 --hostfile $PBS_NODEFILE R --slave -f myRscript.R
echo ""

Example R doMPI Cluster Configuration

library(doMPI)
# create and register a doMPI cluster if necessary
if (!identical(getDoParName(), 'doMPI')) {
  # set count to (cores_requested-1)
  cl <- startMPIcluster(count=255,verbose=TRUE)
  registerDoMPI(cl)
}