mpirun was unable to launch the specified application as it could not access or execute an executable in R

229 Views Asked by At

I am trying to run irace on Compute Canada, and when I used openmpi module, it always gave me this error message below:

mpirun was unable to launch the specified application as it could not access or execute an executable:

Executable: /scratch/irace/test.R

Node: niaXXXX

while attempting to start process rank 0.

My bash script is written

#!/bin/sh
#SBATCH --nodes=5
#SBATCH --ntasks-per-node=40
#SBATCH --mem=0
#SBATCH --mail-type=ALL
#SBATCH --output=/scratch/irace/irace-%j.out
#SBATCH --error=/scratch/irace/irace-%j.err

module load NiaEnv/2019b
module load gcc
module load r
module load openmpi

cd /scratch/irace
mpirun -np 5 /scratch/irace/test.R --parallel 4

When I submitted this job script, the run failed. However, when I replaced the last statement

mpirun -np 5 /scratch/irace/test.R --parallel 4

with the statement

Rscript ./test.R 

, it would run all good and give me the results. What are the causes of this and how can I fix this bug and get it run on Compute Canada?

1

There are 1 best solutions below

0
George Ostrouchov On

Consider

cd /scratch/irace
mpirun -np 5 Rscript test.R --parallel 4

mpirun expects an executable (Rscript) rather than an R script (your test.R).

That is also why Rscript test.R worked fine because Rscript is an executable that interprets your test.R R script. But depending on your R script, this probably used only one of your 5 requested nodes.

Consider using the pbdMPI package for simplification of your R code and use of all requested nodes for computation (SPMD style) rather than a manager-workers style that leaves the manager idle much of the time.