Switching between OpenMPI and IntelMPI

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

mpiexec -np 4 ./myprog <parameters>
-np 4
run 4 parallel processes via MPI.

Pick an -np number suitable for your system (e.g. number of CPU cores)


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.

Set up a pair of scripts:

#!/bin/sh

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

and

#!/bin/sh

mpiexec -np 4 ./myprog_intelmpi

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