I have both mpich and openmpi in my Ubuntu 20.04.
$ dpkg -l | grep mpi | grep lib
...
ii libmpich-dev:amd64 3.3.2-2build1 amd64 Development files for MPICH
ii libmpich12:amd64 3.3.2-2build1 amd64 Shared libraries for MPICH
...
ii libopenmpi-dev:amd64 4.0.3-0ubuntu1 amd64 high performance message passing library -- header files
ii libopenmpi3:amd64 4.0.3-0ubuntu1 amd64 high performance message passing library -- shared library
...
ii openmpi-bin 4.0.3-0ubuntu1 amd64 high performance message passing library -- binaries
ii openmpi-common 4.0.3-0ubuntu1 all high performance message passing library -- common files
..
$ dpkg -l | grep mpich
...
ii mpich 3.3.2-2build1 amd64 Implementation of the MPI Message Passing Interface standard
The default (probably because it was installed later) appears to be mpich.
How would I change to openmpi?
I want to make sure that everything that needs to be changed actually is. So far, I am thinking about headers, executable, libraries. I do not know which are all directories, links, etc., that have to change.
For instance, here it is suggested cmake -DMPI_CC_COMPILER=/.../mpicc
.
And it was mentioned in comments that it worked. But:
I am not sure it actually fixes all headers, etc.
I need a method that:
2.1. Works for all users in the system
2.2. Does not require those macros
2.3. Works also for other compilation methods other than
cmake
As for 2.3, I tried now to configure petsc
$ ./configure --with-cc=mpicc --with-fc=mpif90 -with-cxx=mpicxx --with- make-np=10 --with-shared-libraries --download-f2cblaslapack --download-mumps --download-scalapack --with-debugging=0 COPTFLAGS="-O -O3 -march=native -mtune=native" FOPTF LAGS="-O -O3 -march=native -mtune=native" CXXOPTFLAGS="-O -O3 -march=native -mtune=native"
and I got
Your libraries are from MPICH but it appears your mpiexec is from OpenMPI
Can this be fixed with update-alternatives
?
I found this, which makes me think it can, but in my system it is not correctly configured:
$ type mpiexec
mpiexec is hashed (/usr/bin/mpiexec)
$ ll /usr/bin/mpiexec
lrwxrwxrwx 1 root root 25 Jan 21 11:11 /usr/bin/mpiexec -> /etc/alternatives/mpiexec
$ ll /etc/alternatives/mpiexec
lrwxrwxrwx 1 root root 24 Jan 21 11:11 /etc/alternatives/mpiexec -> /usr/bin/mpiexec.openmpi
$ ll /usr/bin/mpiexec.openmpi
lrwxrwxrwx 1 root root 7 Apr 15 2020 /usr/bin/mpiexec.openmpi -> orterun
$ type mpirun
mpirun is /usr/bin/mpirun
$ ll /usr/bin/mpirun
lrwxrwxrwx 1 root root 24 Jan 21 11:11 /usr/bin/mpirun -> /etc/alternatives/mpirun
$ ll /etc/alternatives/mpirun
lrwxrwxrwx 1 root root 23 Jan 21 11:11 /etc/alternatives/mpirun -> /usr/bin/mpirun.openmpi
$ ll /usr/bin/mpirun.openmpi
lrwxrwxrwx 1 root root 7 Apr 15 2020 /usr/bin/mpirun.openmpi -> orterun
$ type mpicc
mpicc is hashed (/usr/bin/mpicc)
$ ll /usr/bin/mpicc
lrwxrwxrwx 1 root root 21 Feb 25 18:54 /usr/bin/mpicc -> /etc/alternatives/mpi
$ ll /etc/alternatives/mpi
lrwxrwxrwx 1 root root 20 Feb 25 18:54 /etc/alternatives/mpi -> /usr/bin/mpicc.mpich
Related
- Replace MPICH Installation by OpenMPI
- CMake : Selecting mpich over openmpi
- https://unix.stackexchange.com/questions/413099/flip-between-openmpi-and-mpich-as-default-using-linux-terminal
- Difference between mpi and mpich2 folder?
- CMake : Selecting mpich over openmpi
- Switch from MPICH to OpenMPI
- This? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896189
- This? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912437
- https://unix.stackexchange.com/questions/81992/better-way-to-add-alternative-using-update-alternatives
- https://askubuntu.com/questions/964600/how-to-add-slave-to-existing-update-alternatives-link-group