Sizeof missing when compiling with mpif90

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?

Kind regards,

Fedor

Hi,

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?

Hongyon

I was able to simplify it to this example:

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.

Hi,

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?

Hongyon

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.

I am seeing the errors with pgi 12.4 on mac os x and openmpi 1.6

There is no resolution on this thread, so I’m assuming that pgi compilers do not work with openmpi anymore.

Hi srinath22,

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.

I’ll ask Hongyon what the status of this is.

  • Mat

I still see that it has not been fixed in OpenMPI 1.6. It only happens with logical type. This is not a compiler issue.

workaround:
call mpi_type_size(MPI_LOGICAL, size, ierror)

Thanks,
Hongyon

You should post this to the Open MPI community mailing list so that it can get fixed (I only stumbled across this via Google Alerts).

http://www.open-mpi.org/community/lists/ompi.php