MPirun open MPI output with error on a simple program

I recently installed OpenMPI on my computer, and when I try to run a simple Hello World program, it exits with the following error:

------------------------------------------------------- Primary job terminated normally, but 1 process returned a non-zero exit code.. Per user-direction, the job has been aborted. ------------------------------------------------------- 

This is the source code of the program:

 #include <mpi.h> #include <stdio.h> int main(int argc, char *argv[]) { int size, rank; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD, &rank); printf("Hello\n"); MPI_Finalize(); return 0; } 

This is how I compile the program:

 mpicc -o hello hello.c 

and I execute it with

 mpirun -np 2 hello 

It does not generate compilation errors, and if I run ./hello , it works fine.

Sorry my english, any correction would be welcome.

+7
source share
1 answer

Try:

 mpirun -x LD_PRELOAD=libmpi.so -np 2 hello 

If this works, you probably have a problem installing OpenMPI. A simple workaround would be to define an alias. If you are using bash, add ~ / .bashrc:

 alias mpirun='mpirun -x LD_PRELOAD=libmpi.so' 
0
source

All Articles