Openmpi on Fedora 21

7.2k views Asked by At

I am trying to compile some code in Fedora 21 using 'mpif90'.

First I install openmpi with 'yum':

[root@localhost Inversion]# yum install openmpi
Loaded plugins: langpacks
Package openmpi-1.8.3-2.fc21.x86_64 already installed and latest version
Nothing to do

But then when I compile using 'make' it doesn't work:

[root@localhost Inversion]# make all
mpif90 -O3 -c src/dispersion.f90
make: mpif90: Command not found
Makefile:18: recipe for target 'obj' failed
make: *** [obj] Error 127

As you can see I've downloaded openmpi package but it wont compile.

2

There are 2 answers

0
Jakuje On
dnf whatprovides "*/mpif90"

tells you what package provides this binary. In Fedora, you can get it from openmpi-devel or mpich packages. So running

yum install openmpi-devel

should do the job for you.

0
Joshua T On

You cannot compile because you haven't loaded the necessary module.

You need to load the environmental module, this is how Fedora is handling openmpi when you install it using:

dnf install openmpi

(in Fedora 25)

Just follow the following steps:

  1. In your terminal, do:

    module avail
    

    You should see an output something like this:

    --------------------- /usr/share/Modules/modulefiles ----------------------
    dot         module-git  module-info modules     null        use.own
    ---------------------------- /etc/modulefiles -----------------------------
    mpi/openmpi-x86_64
    

    Notice there is the mpi/openmpi-x86_64 module available for you to 'load'.

  2. In your terminal, you just do:

    module load mpi/openmpi-x86_64
    
  3. Now you have access to all the mpi compilers like mpif90 and mpic++ etc. You can see that the compiler binaries are stored in: /usr/lib64/openmpi/bin:

    $ which mpif90 
    

    and you see the output is:

    /usr/lib64/openmpi/bin/mpif90