Fortran 90 and BeoMPI

Martin Siegert siegert at sfu.ca
Wed Mar 14 10:21:10 PST 2001


On Thu, Mar 15, 2001 at 02:26:18AM -0600, Frank Muldoon wrote:
> I just got done trying linking directly to the mpi libraries using 2 F95 compilers (Lahey & NAG).  Both behave the
> same way as before (output below).  I was under the impression that it was often necessary to have separate builds
> for f90/f95 and f77.  For instance the MPICH install guide says "During configuration, a number of F90-specific
> arguments can be specified. See the output of configure -help. In particular, when using the NAG Fortran 90
> compiler, you whould specify -f90nag."
> 
> Thanks,
> Frank
> 
> 
> 
> [root at cfd1 temp]# /usr/local/NAGf95/bin/f95 -lmpif /root/temp/mpi_heat.f90
> Extension: /usr/include/mpi-beowulf/mpif.h, line 233: Byte count on numeric data type
>            detected at *@8
> Warning: /root/temp/mpi_heat.f90, line 109: Unused symbol TIME_INTEGRATION
>          detected at END@<end-of-statement>
> Warning: /root/temp/mpi_heat.f90, line 109: Unused symbol SUM_RES
>          detected at END@<end-of-statement>
> Warning: /root/temp/mpi_heat.f90, line 109: Unused symbol COMM1D
>          detected at END@<end-of-statement>
> Warning: /root/temp/mpi_heat.f90, line 109: Unused symbol NID
>          detected at END@<end-of-statement>
> [f95 continuing despite warning messages]
> Deleted feature used: /root/temp/mpi_heat.f90, line 65: PAUSE statement
> Deleted feature used: /root/temp/mpi_heat.f90, line 66: PAUSE statement
> Deleted feature used: /root/temp/mpi_heat.f90, line 67: PAUSE statement
> Deleted feature used: /root/temp/mpi_heat.f90, line 68: PAUSE statement
> Deleted feature used: /root/temp/mpi_heat.f90, line 103: PAUSE statement
> mpi_heat.o: In function `main':
> mpi_heat.o(.text+0x7e): undefined reference to `mpi_init_'
> mpi_heat.o(.text+0xc7): undefined reference to `mpi_comm_size_'
> mpi_heat.o(.text+0xe8): undefined reference to `mpi_comm_rank_'
> mpi_heat.o(.text+0x486): undefined reference to `mpi_barrier_'
> mpi_heat.o(.text+0x786): undefined reference to `mpi_isend_'
> mpi_heat.o(.text+0x801): undefined reference to `mpi_isend_'
> mpi_heat.o(.text+0x886): undefined reference to `mpi_irecv_'
> mpi_heat.o(.text+0x90b): undefined reference to `mpi_irecv_'
> mpi_heat.o(.text+0xbe1): undefined reference to `mpi_wait_'
> mpi_heat.o(.text+0xc1a): undefined reference to `mpi_wait_'
> mpi_heat.o(.text+0xc53): undefined reference to `mpi_wait_'
> mpi_heat.o(.text+0xc8c): undefined reference to `mpi_wait_'
> mpi_heat.o(.text+0x19c6): undefined reference to `mpi_reduce_'
> mpi_heat.o(.text+0x1ac9): undefined reference to `mpi_finalize_'
> /usr/bin/../lib/libmpif.so: undefined reference to `getarg_'
> /usr/bin/../lib/libmpif.so: undefined reference to `f__xargc'
> collect2: ld returned 1 exit status
> [root at cfd1 temp]#
> [root at cfd1 temp]#
> [root at cfd1 temp]#
> [root at cfd1 temp]# lf95 -lmpif /root/temp/mpi_heat.f90
> Compiling file /root/temp/mpi_heat.f90.
> Compiling program unit main at line 1:
> mpi_heat.o: In function `SSN4':
> mpi_heat.o(.text+0x3d): undefined reference to `mpi_init_'
> mpi_heat.o: In function `SSN6':
> mpi_heat.o(.text+0x61): undefined reference to `mpi_comm_size_'
> mpi_heat.o: In function `SSN7':
> mpi_heat.o(.text+0x78): undefined reference to `mpi_comm_rank_'
> mpi_heat.o: In function `SSN17':
> mpi_heat.o(.text+0x28d): undefined reference to `mpi_barrier_'
> mpi_heat.o: In function `SSN22':
> mpi_heat.o(.text+0x6f5): undefined reference to `mpi_isend_'
> mpi_heat.o: In function `SSN23':
> mpi_heat.o(.text+0x738): undefined reference to `mpi_isend_'
> mpi_heat.o: In function `SSN24':
> mpi_heat.o(.text+0x76e): undefined reference to `mpi_irecv_'
> mpi_heat.o: In function `SSN25':
> mpi_heat.o(.text+0x7b1): undefined reference to `mpi_irecv_'
> mpi_heat.o: In function `SSN27':
> mpi_heat.o(.text+0x97a): undefined reference to `mpi_wait_'
> mpi_heat.o: In function `SSN28':
> mpi_heat.o(.text+0x9b0): undefined reference to `mpi_wait_'
> mpi_heat.o: In function `SSN29':
> mpi_heat.o(.text+0x9e6): undefined reference to `mpi_wait_'
> mpi_heat.o: In function `SSN30':
> mpi_heat.o(.text+0xa1c): undefined reference to `mpi_wait_'
> mpi_heat.o: In function `SSN46':
> mpi_heat.o(.text+0x11d2): undefined reference to `mpi_reduce_'
> mpi_heat.o: In function `SSN50':
> mpi_heat.o(.text+0x12ed): undefined reference to `mpi_finalize_'
> mpi_heat.o(.data+0x0): undefined reference to `mpi_finalize_'
> mpi_heat.o(.data+0x4): undefined reference to `mpi_reduce_'
> mpi_heat.o(.data+0x8): undefined reference to `mpi_wait_'
> mpi_heat.o(.data+0xc): undefined reference to `mpi_irecv_'
> mpi_heat.o(.data+0x10): undefined reference to `mpi_isend_'
> mpi_heat.o(.data+0x14): undefined reference to `mpi_barrier_'
> mpi_heat.o(.data+0x18): undefined reference to `mpi_comm_rank_'
> mpi_heat.o(.data+0x1c): undefined reference to `mpi_comm_size_'
> mpi_heat.o(.data+0x20): undefined reference to `mpi_init_'
> mpi_heat.o(.data+0x24): undefined reference to `mpi_wtime_'
> mpi_heat.o(.data+0x28): undefined reference to `mpi_wtick_'
> mpi_heat.o(.data+0x2c): undefined reference to `mpi_null_copy_fn_'
> mpi_heat.o(.data+0x30): undefined reference to `mpi_null_delete_fn_'
> mpi_heat.o(.data+0x34): undefined reference to `mpi_dup_fn_'
> /usr/bin/../lib/libmpif.so: undefined reference to `f__xargc'

The problem is g77 and libraries built to work with g77:
g77 has the "unfortunate" (to put it mildly) property to append two
underscores to a function name, if the function name already contains
an underscore. E.g., if your fortran program calls MPI_Comm_rank g77
calls mpi_comm_rank__ and looks for that reference in the MPI library.
Hence a library built to work with g77 contains mpi_comm_rank__ and not
mpi_comm_rank_. Sigh. All other compilers I have worked with so far
just append a single underscore (e.g., mpi_comm_rank_) regardless of
whether the function name already contains an underscore.
Solution? As a workaround you could call mpi_comm_rank_ from your program...
Which makes your program non portable, etc. Very ugly.
Otherwise you need a new library. I wish that all libraries that support
fortran would be built by appending a single underscore to function
names by default (and thus breaking compatability with g77). Only if
support for g77 is explicitely required should a wrapper for g77 be
included as well. Performance wise that should be irrelevant: g77 is
the slowest compiler around anyway so an additional wrapper doesn't
matter much.

Martin

========================================================================
Martin Siegert
Academic Computing Services                        phone: (604) 291-4691
Simon Fraser University                            fax:   (604) 291-4242
Burnaby, British Columbia                          email: siegert at sfu.ca
Canada  V5A 1S6
========================================================================




More information about the Beowulf mailing list