SKPS
SKPS

Reputation: 5836

Fortran mpi runtime error

I am trying to understand parallel data writing from Fortran code with MPI. I came across a simple program from here.

I compiled and run the program with MPI compiler and getting the following error:

sathish@HP-EliteBook:~/Desktop$ mpif90 test.F90 -o test
sathish@HP-EliteBook:~/Desktop$ mpirun -np 4 test
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------

I see similar issues in other forums mentioning this is due to wrong mpi installation location or so. The following was one of the solutions suggesting use of LD_PRELOAD:

sathish@HP-EliteBook:~/Desktop$ mpirun -x LD_PRELOAD=libmpi.so -np 4 test
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------

The issue still persists. I could not figure what the issue is for such a simple program.

Upvotes: 2

Views: 433

Answers (1)

innoSPG
innoSPG

Reputation: 4656

Short answer: run as

mpirun -np 4 ./test

instead of:

mpirun -np 4 test

Details: That is a common problem that happens when your working directory is not in your path. The simple solution is to add the full path to the executable. Another alternative might be to add the current directory to your path variable. However, in this case, even if you add the current directory to the path, the order will matter. Linux systems (it seems to be your case) usually come with a program named test that is usually in the path by default.

What is going on is that you do not start mpi program directly, instead, you start mpirun that will start the mpi machinery, and start your program that will make use of that machinery. mpirun has to find your program. And there is where comes the two options I suggested above: full path to your executable or add your directory to your search path.

Upvotes: 4

Related Questions