Switching between OpenMPI and IntelMPI

To run a program compiled with mpif90, mpifort or mpiifort is accomplished like

mpirun -np 4 ./myprog <parameters>

where -np 4 arbitrarily chooses to run 4 parallel processes via MPI. Pick a number suitable for your system (e.g. number of CPU cores)

However, if you also have Intel MPI installed, you might also want to try your program on OpenMPI for validation and sharing your program with a wider set of non-IntelMPI users. Of course, you must compile your program with the appropriate MPI library.

I do this by setting up a pair of tiny Bash scripts:


LD_LIBRARY_PATH= /usr/bin/mpirun.openmpi -np 4 ./myprog_openmpi



mpirun -np 4 ./myprog_intelmpi

The LD_LIBRARY_PATH= (notice the blank space) wipes out the Intel MPI libraries from interfering with OpenMPI (only for this Bash script scope).




Leave a Comment