Heberto Mayorquin
Heberto Mayorquin

Reputation: 11071

Difference between mpi and mpich2 folder?

so configuring the MPI flags I have realized that in the /usr/include directory there are two folders with the same files. So two related questions:

All the best and thanks in advance,

Upvotes: 1

Views: 983

Answers (1)

m0nhawk
m0nhawk

Reputation: 24168

This can depend on your installation, but this is a common way for providing several parallel MPI installation.

I have both MPICH2 and OpenMPI installed, and this folders in /usr/include:

lrwxrwxrwx  1 root root     21 Apr  1 17:03 mpi -> /etc/alternatives/mpi/
drwxr-xr-x  3 root root   4096 Apr  1 17:03 mpich/
lrwxrwxrwx  1 root root     22 Nov 30 01:21 openmpi -> ../lib/openmpi/include/

And mpi folder is a folder which should be used as #include to make use of alternatives mechanism (I recommend starting from this and this, it's available on other than Debian based distros).

If you run update-alternatives --config mpi you can change the default MPI distribution.

Example, /etc/alternatives/mpi before and after update-alternatives:

# before, pointing to MPICH2
lrwxrwxrwx 1 root root 18 Apr  1 17:14 /etc/alternatives/mpi -> /usr/include/mpich/
# and after, pointing to OpenMPI
lrwxrwxrwx 1 root root 24 Apr  1 17:07 /etc/alternatives/mpi -> /usr/lib/openmpi/include/

Summarizing:

  1. Use /usr/include/mpi/ to make your code as much portable as possible.
  2. Use update-alternatives to change the desired MPI distro.
  3. This is a mechanism of alternatives to provide easy way of multiple version (and distributions) of software.

Upvotes: 2

Related Questions