[R-sig-hpc] r script using foreach hangs at loop
John Denton
jdenton at amnh.org
Sat Apr 23 21:14:21 CEST 2016
Hi, all.
I have am R script I'm trying to run on a cluster, using OpenMPI and mpirun, but after the non-mpi elements of the function are produced, the execution hangs at the foreach step:
##RUN MPI BOOTSTRAP (set MPI in script itself):
iters <- list.files(pattern="\\.nex")
clust <- startMPIcluster(ncores)
registerDoMPI(clust)
foreach(i=1:length(iters)) %dopar% {
system(paste("mb", iters[i], sep=" "))
}
closeCluster(clust)
where ncores is set to be equal to the value nodes x ppn in the sh file:
# qsub -V myjob-pbs.sh
#PBS -V
#PBS -N tully_bt.name
#PBS -q batch
#PBS -S /bin/bash
#PBS -m abe
#PBS -l nodes=13:ppn=4
#PBS -l walltime=500:00:00
cd $PBS_O_WORKDIR
echo Working directory is $PBS_O_WORKDIR
NPROCS=`wc -l < $PBS_NODEFILE`
NNODES=`uniq $PBS_NODEFILE | wc -l`
echo Running on host `hostname`
echo Time is `date`
echo Directory is `pwd`
echo Using ${NPROCS} processors across ${NNODES} nodes
module load openmpi-1.10.1
MPIRUN=`which mpirun`
${MPIRUN} -machinefile $PBS_NODEFILE -np 1 R --slave -f test.r
The function itself loads doMPI, which loads foreach and Rmpi as dependencies.
The R script is test.r, which has only the lines source (the function), function (call function with options), mpi.quit. The function works without a submission script, and I suspect the problem might have something to do with the mpirun line, but I am not sure.
Any help would be appreciated!
John S. S. Denton, Ph.D.
Department of Vertebrate Paleontology
American Museum of Natural History
www.johnssdenton.com
More information about the R-sig-hpc
mailing list