ncmpidtype.c and MPI_DATATYPE_NULL

Glaesemann, Kurt R (Kort) kurt.glaesemann at pnl.gov
Tue Jul 31 14:34:25 CDT 2007


In src/lib/ncmpidtype.c, unknown types return MPI_DATATYPE_NULL and cause
P-netCDF to fail.  HP-MPI uses types MPI_LB and MPI_UB.  Since, these should
be pointers (correct me, if I am wrong).  Is this the correct code to add at
the end:

    if (type == MPI_LB || type == MPI_UB )  {
        int test1 = 0;
        int* test2 = &test1;
        int size = sizeof(test2) ; // pointer size
        if (size == 8) return MPI_DOUBLE;
        if (size == 4) return MPI_FLOAT ;
    }

Or can I count on SIZEOF_SIZE_T to be the right size, and the code would
then be cleaner (and a little faster)
    if (type == MPI_LB || type == MPI_UB )  {
        if ( SIZEOF_SIZE_T == 8) return MPI_DOUBLE;
        if ( SIZEOF_SIZE_T == 4) return MPI_FLOAT ;
    }


Kurt
-- 
Kurt R. Glaesemann, Ph.D.
Senior Research Scientist II
MSCF Visualization and User Services Group
Environmental Molecular Sciences Laboratory
Pacific Northwest National Laboratory




More information about the parallel-netcdf mailing list