Using MPI-2 (Gropp et al.) says MPI_SIZEOF() only supports numeric intrinsic data types. So, I patched OpenMPI 1.4.2 to remove the declarations of the undefined Logical and Character specific procedures in ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh:

  output_197 MPI_Sizeof ${rank} CH "character${dim}"
  output_197 MPI_Sizeof ${rank} L "logical${dim}"

I also changed all the dummy array declarations in the INTERFACE declarations to use assumed-shape arrays, which is the correct Fortran 90 method to declare the rank and extent of any actual array arguments.

I simplified both ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh and ompi/mpi/f90/scripts/mpi_sizeof.f90.sh. In mpi-f90-interfaces.h.sh, I defined an array, array_dims, with the DIMENSION declarations, then replaced all the copies of dim= throughout the code with a reference to array_dims by rank:

array_dims[0]=''
array_dims[1]=', dimension(:)'
array_dims[2]=', dimension(:,:)'
array_dims[3]=', dimension(:,:,:)'
array_dims[4]=', dimension(:,:,:,:)'
array_dims[5]=', dimension(:,:,:,:,:)'
array_dims[6]=', dimension(:,:,:,:,:,:)'
array_dims[7]=', dimension(:,:,:,:,:,:,:)'

for rank in $allranks
do
  dim=${array_dims[${rank}]}

In mpi_sizeof.f90.sh, I copied the method to enumerate rank 0 with all the other ranks from the code in mpi-f90-interfaces.h.sh:

allranks="0 $ranks"

for rank in $allranks
do
  case "$rank" in  0)  dim=''  ;  esac
  case "$rank" in  1)  dim=', dimension(:)'  ;  esac
  case "$rank" in  2)  dim=', dimension(:,:)'  ;  esac
  case "$rank" in  3)  dim=', dimension(:,:,:)'  ;  esac
  case "$rank" in  4)  dim=', dimension(:,:,:,:)'  ;  esac
  case "$rank" in  5)  dim=', dimension(:,:,:,:,:)'  ;  esac
  case "$rank" in  6)  dim=', dimension(:,:,:,:,:,:)'  ;  esac
  case "$rank" in  7)  dim=', dimension(:,:,:,:,:,:,:)'  ;  esac

Here's the patch I used for OpenMPI 1.4.2:

# Remove declarations of Logical and Character specific procedures from # Generic Subroutine MPI_SIZEOF and fix dummy arrays to be assumed- shape mv openmpi-1.4.2/ompi/mpi/f90/scripts/mpi-f90- interfaces.h.sh{,.original}
sed -e $'34{p;
            s/^.*$/array_dims[0]=\'\'/;p;
            s/^.*$/array_dims[1]=\', dimension(:)\'/;p;
            s/^.*$/array_dims[2]=\', dimension(:,:)\'/;p;
            s/^.*$/array_dims[3]=\', dimension(:,:,:)\'/;p;
            s/^.*$/array_dims[4]=\', dimension(:,:,:,:)\'/;p;
            s/^.*$/array_dims[5]=\', dimension(:,:,:,:,:)\'/;p;
            s/^.*$/array_dims[6]=\', dimension(:,:,:,:,:,:)\'/;p;
            s/^.*$/array_dims[7]=\', dimension(:,:,:,:,:,:,:)\'/;p;
            s/^.*$//;}' \
    -e '/case "$rank" in  [0-6])  dim=/d' \
-e '/case "$rank" in 7) dim=.*$/s//dim=${array_dims[$ {rank}]}/' \
    -e '7129,7130d' \
openmpi-1.4.2/ompi/mpi/f90/scripts/mpi-f90- interfaces.h.sh.original \
    >openmpi-1.4.2/ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh
chmod +x openmpi-1.4.2/ompi/mpi/f90/scripts/mpi-f90-interfaces.h.sh
mv openmpi-1.4.2/ompi/mpi/f90/scripts/mpi_sizeof.f90.sh{,.original}
sed -e '25,84d' \
    -e '85s/^.*$/allranks="0 $ranks"/' \
    -e '87s/\$ranks/$allranks/' \
    -e $'88{p;s/^.*$/  case "$rank" in  0)  dim=\'\'  ;  esac/;}' \
-e $'89,95{s/dim=\'/dim=\', dimension(/;s/1,/:,/g;s/\*\'/:) \'/;}' \
    -e '97,110d' \
    -e '118s/, dimension(\${dim})/${dim}/' \
    -e '133s/, dimension(\${dim})/${dim}/' \
    -e '148s/, dimension(\${dim})/${dim}/' \
    openmpi-1.4.2/ompi/mpi/f90/scripts/mpi_sizeof.f90.sh.original \
    >openmpi-1.4.2/ompi/mpi/f90/scripts/mpi_sizeof.f90.sh
chmod +x openmpi-1.4.2/ompi/mpi/f90/scripts/mpi_sizeof.f90.sh

Larry Baker
US Geological Survey
650-329-5608
ba...@usgs.gov

On Sep 1, 2010, at 5:09 PM, Larry Baker wrote:

OpenMPI 1.4.x and 1.5x fail to link a program that calls Subroutine MPI_SIZEOF using the PGI 10.3 compilers:

$ cat junk.f90
     Use MPI
     Implicit None
     Integer var, size, err
     Call MPI_SIZEOF( var, size, err )
     Write (*,*) 'Size of Integer var is ', size, ' bytes.'
     Stop
     End

$ /opt/pgi/linux86-64/current/openmpi/bin/mpif90 -o junk junk.f90
/opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof1dl_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof4dch_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof3dl_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof4dl_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof2dch_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof2dl_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof3dch_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof1dch_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof0dl_' /opt/pgi/linux86-64/10.3/openmpi/lib/libmpi_f90.so: undefined reference to `mpi_sizeof0dch_'
make: *** [junk] Error 2

This is because the specific procedures declared in ompi/mpi/f90/mpi- f90-interfaces.h are not all implemented in ompi/mpi/f90/ mpi_sizeof.f90. It does not seem to matter to gfortran, but PGI Fortran 90 cares.

The root of the problem is the inconsistency between the methods used to enumerate the specific procedures in ompi/mpi/f90/scripts/ mpi-f90-interfaces.h.sh (the declarations) and ompi/mpi/f90/scripts/ mpi_sizeof.f90.sh (the implementations). The Character and Logical implementations are missing. mpi_sizeof.f90.sh generates lkinds specific Logical procedure implementations. However, since lkinds is not defined in ompi/mpi/f90/fortran_kinds.sh, there are none. Even if lkinds were defined, mpi-f90-interfaces.h.sh declares a single (nameless) kind of Logical procedure, while mpi_sizeof.f90.sh (would, if there were any) decorates the name of each Logical procedure implementation with the kind. And, mpi_sizeof.f90.sh completely leaves out the Character procedure implementations.

I will work out a fix for this in the next few days, unless the author wants to. Is that okay?

Larry Baker
US Geological Survey
650-329-5608
ba...@usgs.gov

On Aug 17, 2010, at 2:18 PM, Jeff Squyres wrote:

We still have one known possible regression:

   https://svn.open-mpi.org/trac/ompi/ticket/2530

But we posted rc5 anyway (there's a bunch of stuff that has been pending for a while that is now in). Please test!

   http://www.open-mpi.org/software/ompi/v1.5/

--
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel

_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel

Reply via email to