Hi,
I’m trying to compile a program that uses mpi with mpif90 from the portland group on OSX. I get the following error:
mpif90 -DUSEMPI -DHAVE_MPI_WTIME -g -o xbeach xbeach-xmpi.o xbeach-general_mpi.o [several .o files here …] xbeach-xbeach.o
Undefined symbols:
“mpi_sizeof0dl”, referenced from:
_L.350_34_0_1 in xbeach-xmpi.o
[… several .o files here]
I get this error for the following symbols:
“mpi_sizeof0dl” <- logicals?
“mpi_sizeof1dl”
“mpi_sizeof2dl”
“mpi_sizeof3dl”
“mpi_sizeof4dl”
“mpi_sizeof0dch” <- complex?
“mpi_sizeof1dch”
“mpi_sizeof2dch”
“mpi_sizeof3dch”
“mpi_sizeof4dch”
I have one call to a sizeof function:
call MPI_Bcast(par,sizeof(par),MPI_BYTE,xmpi_master,xmpi_comm,ierror)
where par is of a derived type with quite a lot of variables (chars, reals, logicals) and a few pointers that are broadcasted separately.
I noticed that symbols like these are present in /opt/pgi/osx86-64/2011/mpi/openmpi/lib/libmpi_f90.a
I tried compiling with openmpi and gfortran and that works fine. Does anybody have a suggestion on how to solve this?
We would need a simple program to show that. Can you provide us?
The precompiled OpenMPI that comes with PGI compiler is version 1.2.7. Perhaps it might be a bit old?
program testbcast
use mpi
implicit none
logical :: a
integer :: ierror, rank, size
a = .true.
call mpi_init(ierror)
call mpi_sizeof(a, size, ierror)
call mpi_finalize(ierror)
end program testbcast
This is the output I get.
$ mpif90 ./testbc.F90
./testbc.F90:
NOTE: your trial license will expire in 2 days, 13.6 hours.
NOTE: your trial license will expire in 2 days, 13.6 hours.
Undefined symbols:
“mpi_sizeof0dl”, referenced from: MAIN in testbc.o
ld: symbol(s) not found
The mpi_sizeof functions are made by the mpi_sizeof.f90.sh script in openmpi. I tested this program also with openmpi 1.5 from macports + gfortran 4.4 and that gives the same error.
This might be a bug in OpenMPI. There is an interface for mpi_sizeof for logical but the mpi_sizeof.f90.sh does not create a routine because lkinds is not there in fortran_kinds.sh.
A workaround is to use mpi_type_size.
call mpi_type_size(MPI_LOGICAL, size, ierror)
You mentioned in the first post that you have used gfortran to compile Openmpi and that works for you. Which version of OpenMPI? On Mac OSX?
This simple example I made does not work for gfortran 4.4 + openmpi 1.5 +gcc44 (build with macports). My original code works with gfortran + openmpi but I don’t call the mpi_sizeof directly. I think it’s called by some mpi subroutine that I call with a derived type with a logical, or with a logical.
As Hongyon notes, it looks to her as a problem with OpenMPI not generating “mpi_sizeof” routine. Unfortunately, I don’t know if this has been resolved by OpenMPI.
However, if this is a case where there is just a external reference and the routine is never called directly, you can add the flag “-Mnoref_externals” to eliminate these references.