Linux - Command mpi not found

1 comment
Linux systems, such as Ubuntu or Fedora, usually come with a lot of libraries or applications, and OpenMPI is among them.
If you use Ubuntu you probably won't need this because it includes the openmpi binaries folder in the environment variable 'PATH'.

How I know if I it's included or not?


It's quite simple, open a terminal and run:
mpicc
or mpirun or any other mpi command.
If you obtain the message " ... : Command not found... " you have to add it to PATH.

How can I add it?

First open a terminal ( or use the one you opened before ) and run:
find /usr -name "mpirun"
Here we are looking for the executable "mpirun" which we know it's part of the library. I obtain the following output:
/usr/lib64/openmpi/bin/mpirun
Normally it is always under '/usr/lib64/openmpi/bin' if your system is 64bits or only "lib" if not.
Now you only have to add it:
export PATH=$PATH:/usr/lib64/openmpi/bin/
If you use the export command you have to use it for every terminal you open / restart. If you don't want to do this only add it to your ".bashrc" file.

Open a terminal and run:
cd ~
gedit .bashrc
Use gedit or other text editor you like.

And at the end of the file add the previous export command:

1 comentario: