Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question on linking MPI programs with ifc

0 views
Skip to first unread message

andrey

unread,
Sep 30, 2004, 5:36:09 AM9/30/04
to
Hi!

We use mpich with Redhat Linux 9 and want to set ifc as the default
compiler of Fortran 90. When I changed mpif90 file in the way to use it
with ifc (changed variables like F90BASE, F90LINKERBASE and some
others), and tried to get an executable file out of the preinstalled
example pi3f90.f90, on the stage of linking I got the error message like
this:
pi3f90.o(.text+0x21): In function `MAIN__':
: undefined reference to `mpi_init_'
pi3f90.o(.text+0x35): In function `MAIN__':
: undefined reference to `mpi_comm_rank_'
pi3f90.o(.text+0x4c): In function `MAIN__':
: undefined reference to `mpi_comm_size_'
pi3f90.o(.text+0x1b3): In function `MAIN__':
: undefined reference to `mpi_bcast_'
pi3f90.o(.text+0x2e0): In function `MAIN__':
: undefined reference to `mpi_reduce_'
pi3f90.o(.text+0x374): In function `MAIN__':
: undefined reference to `mpi_finalize_'

What should I do to get rid of this message?
Thank you very much :)

Randy

unread,
Sep 30, 2004, 11:53:58 AM9/30/04
to


To see exactly how mpif90 is invoking ifc, add the -echo flag (or -show) when
you compile. You should see something like:

$ mpif90 -show foo.f
...
efc -L/usr/local/MPICH/lib foo.o -lmpichf90 -lpmpich -lmpich -lpmpich -lmpich
-lpthread -lPEPCF90

(I removed a couple of extraneous lines of output.) If you don't see something
very much like this, you'll need to further edit mpif90's F90* parameters.

My mpif90 fortran and MPICH parameters are (for Intel 7.1):

F90BASE="efc"
F90LINKERBASE="efc"
F90MODINC="-I"
F90MODINCSPEC="-I<dir>"
F90LIB_PATH_LEADER="-L"
F90LIB_PATH="${libdir}"

and

prefix=/usr/local/MPICH
FLIB_LIST="-lPEPCF90"
MPILIBNAME="mpich"
MPIVERSION="1.2.5 (release) of : 2003/01/13 16:21:53"
FWRAPNAME="fmpich"
FLIBNAME="mpich"
MPI_WITH_PMPI="no"
proflib=-lp${MPILIBNAME}
proflibfullname=${libdir}/libp${MPILIBNAME}.a

Or you may be having problems with GNU g77's *INSANE* practice of appending
double underscore suffixes to symbols instead of singles underscores. To
confirm this, do this:

$ nm /usr/local/MPICH/lib/libmpich.a | grep mpi_init

You *should* see something like

0000000000000000 T mpi_init_

However, you may see:

0000000000000000 T mpi_init__

If so, you'll need to recompile your MPICH library using the intel compilers
instead of the GNU compilers. Unfortunately, the Intel compilers do not provide
a flag that will automatically append a second underscore to symbol names (as
other compilers do, like Portland Group).

Randy

--
Randy Crawford http://www.ruf.rice.edu/~rand rand AT rice DOT edu

Greg Lindahl

unread,
Sep 30, 2004, 2:14:58 PM9/30/04
to
In article <cjha6m$7mt$1...@joe.rice.edu>, Randy <j...@burgershack.com> wrote:

>Or you may be having problems with GNU g77's *INSANE* practice of appending
>double underscore suffixes to symbols instead of singles underscores.

You could argue that the insane practice of ignoring the platform
de-facto ABI (AND not providing a switch for compatibility) is worse
than the g2c style of mangling, but I digress. BTW, the actual g2c
algorithm appends one _ to symbols without any _'s.

-- greg

andrey

unread,
Oct 1, 2004, 6:30:02 AM10/1/04
to
Thanks a lot!

It was because of the second underscore in the MPI libraries. I
recompiled them using switch -fc=ifc, and everything is ok now with
compiling and linking :)

Andrey

0 new messages