testing sizeof MPI_Offset

William Gropp gropp at mcs.anl.gov
Fri Nov 7 08:29:15 CST 2003


At 03:15 PM 11/6/2003, Robert Latham wrote:
>As a result of the large file support added in the recent release, it
>is more important that MPI_Offset is big enough.  Right now we assume
>the underlying MPI implementation uses an 8 byte type to represent
>MPI_Offset.  It would be ideal to have a configure-time test that
>checks the size of MPI_Offset and exits early if it is not large
>enough.
>
>With MPICH, this is not too hard to do with autoconf macros.  However,
>on platforms like the SP and the NEC machines, I'm not sure how to
>compile a test program that both understands 'MPI_Offset' and can run
>w/in the context of a configure script.
>
>Does anyone here have suggestions how to test for this possible
>problem in a portable way?
>
>In the worst case, we can check this at runtime and exit, but that's
>less than ideal.

We might be able to do one of the following (roughly, this is untested):

cat > conftest.c <<EOF
#include "mpi.h"
EOF
basetype=`$CPP conftest.c | egrep 'typedef.*MPI_Offset' | sed -e 's/typedef 
*\(.*\) *MPI_Offset.*/\1/'`

and then find the size of basetype, using the regular, not MPI, C compiler. 
This isn't guaranteed to work, but might work with all existing MPI 
implementations.

Bill





More information about the parallel-netcdf mailing list