2

I recently installed Intel's Parallel Studio XE 2019 under an academic license, and I'm trying to compile Fortran90 code that employs MPI. I get the following error:

>> ifort -O3 -ip -ipo -c parallel.f90
parallel.f90(7): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MPI]
  use mpi
------^

Apparently ifort is not able to find an MPI library. As I understood it, the Intel library comes with its own MPI libraries, so I think I shouldn't be concerned with linking to e.g. libopenmpi. When I compile the same code with GNU's mpif90, everything works as intended.

Below I've included the (redacted) output of echo $LD_LIBRARY_PATH. Is there anything missing?

/home/***/intel/compilers_and_libraries_2019.1.144/linux/compiler/lib/intel64_lin
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/libfabric/lib
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/lib/release
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/lib
/home/***/intel/compilers_and_libraries_2019.1.144/linux/ipp/lib/intel64
/home/***/intel/compilers_and_libraries_2019.1.144/linux/compiler/lib/intel64_lin
/home/***/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin
/home/***/intel/compilers_and_libraries_2019.1.144/linux/tbb/lib/intel64/gcc4.7
/home/***/intel/compilers_and_libraries_2019.1.144/linux/tbb/lib/intel64/gcc4.7
/home/***/intel/compilers_and_libraries_2019.1.144/linux/daal/lib/intel64_lin
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/libfabric/lib
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/lib/release
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/lib
/home/***/intel/compilers_and_libraries_2019.1.144/linux/compiler/lib/intel64_lin
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/libfabric/lib
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/lib/release
/home/***/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/lib
/home/***/intel/compilers_and_libraries_2019.1.144/linux/ipp/lib/intel64
/home/***/intel/compilers_and_libraries_2019.1.144/linux/compiler/lib/intel64_lin
/home/***/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin
/home/***/intel/compilers_and_libraries_2019.1.144/linux/tbb/lib/intel64/gcc4.7
/home/***/intel/compilers_and_libraries_2019.1.144/linux/tbb/lib/intel64/gcc4.7
/home/***/intel/compilers_and_libraries_2019.1.144/linux/daal/lib/intel64_lin
/home/***/intel/compilers_and_libraries_2019.1.144/linux/daal/../tbb/lib/intel64_lin/gcc4.4

[EDIT] contents of echo $PATH:

/home/****/intel/intelpython3/bin
/home/****/intel/advisor_2019.1.0.579143/bin64
/home/****/intel/vtune_amplifier_2019.1.0.579888/bin64
/home/****/intel/inspector_2019.1.0.579146/bin64
/home/****/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64
/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/libfabric/bin
/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/bin
/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/libfabric/bin
/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/bin
/home/****/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64
/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/libfabric/bin
/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/bin
/home/****/anaconda3/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
/home/****/intel//parallel_studio_xe_2019.1.053/bin
MPA
  • 1,878
  • 2
  • 26
  • 51
  • You probably should be compiling with mpif90 rather than ifort - does that fix the problem? – Ian Bush Dec 06 '18 at 08:55
  • `mpif90` is linked to `gfortran`. Do you mean `mpiif90` (note double i)? If so: `Command 'mpiif90' not found, did you mean: ...` is what I get when I call `mpiif90` – MPA Dec 06 '18 at 08:58
  • You can have multiple `mpif90` in your computer. How did you install the MPI for the Intel compiler? Do you use the `ifortvars.sh` script as required? – Vladimir F Героям слава Dec 06 '18 at 09:01
  • What about mpiifort ? Inspired by http://www.hpc.cineca.it/center_news/important-use-intel-mpi-wrappers-mpif90-mpicc-mpicxx – Ian Bush Dec 06 '18 at 09:02
  • @VladimirF MPI comes with Parallel Studio XE, but I installed `mpif90` from the system's repository (`apt install libopenmpi-dev`). I sourced `psxevars.sh` as instructed, which supposedly sources `ifortvars.sh` (where do I find `ifortvars.sh` in my `intel` directory?). @IanBush `mpiifort` is not recognised either. – MPA Dec 06 '18 at 09:07
  • Maybe they renamed `ifortvars` to `psxevars` recently, the important thing is that you do source the configuration. – Vladimir F Героям слава Dec 06 '18 at 09:16
  • @VladimirF I suppose the contents of `$LD_LIBRARY_PATH` is a result of sourcing `psxevars`, and it includes references to `mpi`. Is this what you expected? – MPA Dec 06 '18 at 09:18
  • What is the result of `which mpif90`? And of `mpif90 -show`? – Pierre de Buyl Dec 06 '18 at 09:37
  • @PierredeBuyl `which mpif90` > `/usr/bin/mpif90`, `mpif90 -show` > `gfortran -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -I/usr/lib/x86_64-linux-gnu/openmpi/lib -L/usr//lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi` – MPA Dec 06 '18 at 09:38
  • Ok, now `echo $PATH`? – Pierre de Buyl Dec 06 '18 at 09:40
  • On the cluster here, there is a `mpivars.sh` script to source to obtain the proper settings for mpi. I suggest you first source the `ifortvars.sh` script and then the `mpivars.sh` one. – Pierre de Buyl Dec 06 '18 at 09:41
  • @PierredeBuyl I've included the result of `echo $PATH` to the original post. Where do I find `ifortvars.sh` in the `intel` directory? – MPA Dec 06 '18 at 09:43
  • As `/home/****/intel//compilers_and_libraries_2019.1.144/linux/mpi/intel64/bin` is on top of the PATH, the `mpif90`there should have precedence. – Pierre de Buyl Dec 06 '18 at 09:43
  • In `/home/****/intel/compilers_and_libraries_2019.1.144/linux/bin` – Pierre de Buyl Dec 06 '18 at 09:43
  • If there is `mpif90` there of course. What is the result of `ls /home/****/intel/compilers_and_libraries_2019.1.144/linux/bin/intel64` ? – Pierre de Buyl Dec 06 '18 at 09:44
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/184797/discussion-between-mpa-and-pierre-de-buyl). – MPA Dec 06 '18 at 09:46

1 Answers1

4

If you want yo use Intel MPI with Intel Fortran compiler, the wrapper is mpiifort.

If you want to use an other MPI (such as Open MPI) with use mpi then you likely need to rebuild the MPI library because Fortran modules are not interoperable between vendors, and sometimes not even different compiler versions of the same vendor.

I strongly discourage you to use ifort and manually set the include and library path.

FWIW, Intel MPI mpif90 uses the GNU gfortran compiler.

Gilles Gouaillardet
  • 8,193
  • 11
  • 24
  • 30
  • Currently `mpiifort` is not found on my system, nor is it found in the Parallel Studio installation directory. But based on what you're saying, `use mpi` wouldn't work with Intel products? So there is no way one can compile the same code with both `gfortran` and `ifort`? – MPA Dec 06 '18 at 12:49
  • 1
    Maybe there is no license for Intel MPI for academic, and only the runtime (free to use) is installed. If you `use mpi` then you must use the same compiler that was used to build the MPI library. Intel wrappers kind of hide this, but this is not the case for Open MPI. If you plan to use both compilers, then you have to build and install Open MPI twice. Fortran modules interoperability is not limited to MPI. You cannot build module `foo` with `gfortran` and then build an other source that `use foo` with `ifort`. Bottom line, `use MPI` works with `ifort` only if Open MPI was built with `ifort`. – Gilles Gouaillardet Dec 06 '18 at 13:16
  • Only `Parallel Studio XE cluster edition` has the full Intel MPI. If not, only the runtime is available. You might be able to get an academic license for Intel MPI only though. – Gilles Gouaillardet Dec 06 '18 at 13:21
  • Thanks for your suggestion. I will try to compile OpenMPI with the Intel compiler and link it. @VladimirF you mentioned that you can have multiple instances of `mpif90` on one system. How would I do this correctly (without mucking up my GNU configuration)? – MPA Dec 06 '18 at 16:11
  • 2
    @MPA, you can build and install multiple MPI libraries in different directories. As long as they are not simultaneously in `PATH` and `LD_LIBRARY_PATH` things should be fine. You can switch between them by modifying the paths to point to the version you want to work with. This is best done with an environment management tool such as Modules, which is the golden standard on HPC installations nowadays. – Hristo Iliev Dec 07 '18 at 10:15
  • Thanks @HristoIliev. I have attempted to follow your suggestion to use Modules, but I'm struggling to make it work. I have posted [another question](https://stackoverflow.com/q/53673172/1510542) on SO on this topic. – MPA Dec 07 '18 at 16:32