[MPICH] about MPI_Reduce
Rajeev Thakur
thakur at mcs.anl.gov
Mon Oct 17 11:13:00 CDT 2005
If you use a derived datatype, you need to provide the reduction function
that does the reduction operation locally on the derived datatype. MPI will
do the communication and call this function to do the reduction. So if the
reduction is not happening, the myOp function you provide is probably not
right.
Rajeev
> -----Original Message-----
> From: owner-mpich-discuss at mcs.anl.gov
> [mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of llwaeva at 21cn.com
> Sent: Monday, October 17, 2005 9:30 AM
> To: mpich
> Subject: [MPICH] about MPI_Reduce
>
> Hi there,
> I use LAM/MPI under Linux and change to MPICH now. A
> similar question
> about MPI_Reduce has been asked in the forum of LAM/MPI months ago. I
> get some information from that reply but still have a
> question about that. I am
> wondering if there is any way to reduce a data of a special
> datatype(like
> checkboard-shape, with data located on the black grid)
>
> It is easy to create such datatype(says CSData), however,
> the following
> calling is invalid in MPI as mentioned before
>
> MPI_Reduce( &src, &dest, 1, CSData, myOp, 0, MPI_COMM_WORLD);
>
> MPI_Reduce knows nothing about the CSData and only ONE
> element will be
> reduced actually.
>
> I am going to reduce the data limited by CSData. For that, I
> will first
> copy all data needed into a temporary buffer and then reduce
> the buffer, at
> last copy the buffer to the destionation accordingly to the
> checkboard
> structure. This method is too raw and the inefficient. I am
> looking for a
> better way!
>
>
>
>
More information about the mpich-discuss
mailing list