Switch between OpenMPI and Intel MPI

Run an MPI program 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-Intel MPI users. Of course, you must compile your program with the appropriate MPI library.

Set up a pair of scripts:


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



mpiexec -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).