[mpich-discuss] basic datatype for MPI_Offset

Wei-keng Liao wkliao at ece.northwestern.edu
Mon Apr 27 13:38:29 CDT 2009


Hi, Rob and Dave,

Thanks for the suggestions.

I have a question for Rob's approach that defines a new datatype, as  
it does
not work for MPI functions like MPI_Reduce() that have operations to  
be done
on the message buffers. The example I used
> MPI_Allreduce(MPI_IN_PLACE, offsets, nprocs, MPI_???, MPI_MAX,  
> MPI_COMM_WORLD);
actually failed with error message:
MPIR_MAXF_check_dtype(289): MPI_Op MPI_MAX operation not defined for  
this datatype

I think the implementation of this functions uses a temporary variable  
(or
variable array) to calculate the maximum. And, the declaration of this  
temporary
variable depends on this datatype.

Dave's approach sticks with MPI predefined basic datatype and works  
just fine.
It is great to know MPI 2.2  will incorporate MPI_AINT and MPI_OFFSET.
thanks.

Wei-keng


On Apr 27, 2009, at 8:22 AM, Rob Latham wrote:

> On Mon, Apr 27, 2009 at 08:08:13AM -0500, Dave Goodell wrote:
>> If you are running in some sort of heterogeneous environment then  
>> this
>> code might not work correctly if different processes might select
>> different types as aliases for MPI_Offset.
>
> Even more options for you!
>
> You can make a type consisting of sizeof(MPI_offset) instances of
> MPI_BYTE:
>
> MPI_Type_contiguous(sizeof(MPI_Offset), MPI_BYTE, &offsettype);
>
> And if you are hacking ROMIO, there are preprocessor macros so that
> you can use 'ADIO_OFFSET' as the MPI type and the preprocessor will
> replace it with a big-enough type.
>
> ==rob
>
> -- 
> Rob Latham
> Mathematics and Computer Science Division
> Argonne National Lab, IL USA
>



More information about the mpich-discuss mailing list