I have Ubuntu 20.04 installed and need to install OpenMPI 3.1.6 with gcc 8.4.0.
I downloaded the tar ball from OpenMPI and installed it with the following command
tar-xzf openmpi-3.1.6.tar.gz && cd openmpi-3.1.6
PARGS="env CC=/usr/bin/gcc FC=/usr/bin/gfortran CXX=/usr/bin/g++"
ARGS=" --enable-shared --enable-mpi-fortran=usempi"
ARGS+=" --enable-mpi-thread-multiple"
ARGS+=" --prefix=/openmpi/3.1.6/gcc/8.4.0"
mkdir -p build && cd build
$PARGS ../configure $ARGS
$PARGS make -j8 && make install
It installed just fine, no problems. But when I try
mpirun --version
I get the following error
Command 'mpirun' not found, but can be installed with:
and then gives various options using sudo apt-get (which is how I installed it originally, but it doesn't support 3.1.6).
I assumed it had to do with the environmental variables, that Linux just can't find the software. So I went looking and found that in the OpenMPI FAQ, it mentions the following:
"assuming that you have already adjusted your PATH and/or LD_LIBRARY_PATH environment variables to the new location where Open MPI now resides"
...but then it doesn't say how to do that. I tried searching but it talks about all kinds of different ~/.FILE (where file is bash or lib64 or lib32 or other files).
What do I actually have to change in the environment variables and in which file? I use the Ubuntu terminal for pretty much everything.
============================================
Thank you, ubfan1! I had to add the following to /.profile:
# set the OpenMPI path
export OMPI=/openmpi/3.1.6/gcc/8.4.0
export PATH=$PATH:$OMPI/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OMPI/lib
And now it works! My system can find mpirun and the version is 3.1.6!