Help with MPI

Help with MPI

   Dear all,
   I was wondering if anyone in here could help me compile a code on a Linux x86_64 system using MPI.    I was able to compile and run the code for a single processor using the following compiler's options:
CC = cc
CPP = cpp -traditional
F77 = ifort
FORT_FLAGS = -r8 -O3 -convert big_endian -I$(MKLROOT)/include
LOAD_FLAGS = -r8 -O3 -convert big_endian

   The problem starts when I try to compile for MPI.   I've changed the options to:
CC = mpicc
CPP = cpp -traditional
F77 = mpif90
FORT_FLAGS = -r8 -O3 -convert big_endian -I$(MKLROOT)/include
LOAD_FLAGS = -r8 -O3 -convert big_endian
   The compilation seems to go OK, but now I am getting the following error messages during linking
gsmini.ssib.o: In function `gsmini_':
gsmini.ssib.f:(.text+0x28): undefined reference to `mpdimset_'
gsmini.ssib.f:(.text+0x87c): undefined reference to `mpgf2p_'
gsmini.ssib.f:(.text+0xe6d): undefined reference to `mpgf2p_'
gsmini.ssib.f:(.text+0xf52): undefined reference to `mpgf2p_'
gsmini.ssib.f:(.text+0x1040): undefined reference to `mpgf2p_'
gsmini.ssib.f:(.text+0x112e): undefined reference to `mpgf2p_'
output.ssib.f:(.text+0x183): undefined reference to `mpabort_'
output.ssib.f:(.text+0x381): undefined reference to `mpgp2f_'
output.ssib.f:(.text+0x462): undefined reference to `mpgp2f_'
output.ssib.f:(.text+0x543): undefined reference to `mpgp2f_'

   What am I missing?  Shouldn't the mpif90 wrapper take care of all MPI libraries and options?
   This is my first time working on a Linux system. Any suggestion on how to solve this problem will be appreciated.
   Thank you for the help.


publicaciones de 7 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

You don't get the Intel compilers this way:  You need to use the wrappers F77=mpiifort, F90=mpiifort,  CC=mpiicc ( always double 'i') etc.

Using mpif90 will call 'gfortran'.  You can verify this by adding switch "-v" - it will list you all the sub-commands invoked.

Heinz's reply refers to Intel MPI.  You appear to be using an MPI which is a wrapper for pg fortran.  You must not mix implementations of Fortran which have incompatible run-time libraries.

In a correctly set up installation, you will select among various MPI implementations which may be installed by setting PATH and LD_LIBRARY_PATH variables.  In the Intel MPI installation you would

source /opt/impi/<version>/bin64/

for example, so as to make the mpiifort available, and keep the pgi MPI wrappers and libraries out of your paths.

If you are installing an open source mpi yourself, you will build it against your compilers in accordance with the fine manuals provided by that mpi.  Then you will have an mpif90 consistent with your Fortran.

  Thank you HeinzB and TimP.
  To clarify, I am using Intel Fortran 12.1.5 and mpich2 to compile the code.  I believe both the compiler and mpich2 are correctly installed and set up (this system is part of a national laboratory computer cluster).  Both mpif90 and mpiifort wrappers produce the same results and same error messages.
   I used to command 'module' to load the Intel Fortran compiler, MKL and mpich2, so the paths should be properly set.  I haven't loaded any PGI nor GNU applications.
   The LD_LIBRARY_PATH is set to /ncar/opt/intel/
   The code was written to work with MPI.  I used to compile and run it on a IBM system without problems.
   I think I might be missing some compiler option to make the compiler know it is MPI code.
   Any suggestions?
   Thank you so much.

First, as mentioned before, mpif90 uses gfortran by default. You can change this e.g. by using option "-fc=ifort" to use the Intel compiler. Please check your version of mpif90 for details. There might be an environment variable too to change this.  It is a script and in the worst case, look at what is being done there.

Second, I'm wondering about the undefined objects you list above. I don't see, that they are MPI items. Thus you seem to miss some other library.

Please add the output of the mpif90 call after adding the "-v" switch. This will help to debug the issue

mpich2, like any open source MPI, normally has to be built for each compiler.  It may have a flag like some do, on the order of

mpif90 -fc=ifort 

which can over-ride the compiler it was built for.

   Hi HeinzB and TimP.
   I checked the details on my mpif90 version. To override the gfrotran default the option is "-compile ifort".  I will use this option from now on,
   I then recompiled the code adding the -v switch as suggested by HeinzB. The output log (log.txt) is attached to this message.
   ESMF references at the bottom of output are related to the ESMF library which is available in the system, as described below:

whatis("ESMF library version 3.1.0rp3")
help([[This module loads ESMF library version 3.1.0rp3 for Intel Compiler compiled with
  ESMF_COMM = mpich2

    Thank you again for the help and for teaching me about Linux compilers. 

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya