Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] MPI_SCAN
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2012-05-20 20:21:50


On May 19, 2012, at 1:36 PM, Rohan Deshpande wrote:

> I am not understanding how MPI_Reduce would be useful.
>
> Say I have 3 processes and each process has array [1,2,3,4]
>
> When each process calculates the prefix sum using cuda each process will have array as [1,3,6,10]
>
> so if I use MPI_Reduce to gather results it returns me sum as 30.
>
> but the original array is [1,2,3,4,1,2,3,4,1,2,3,4] and the prefix sum of this array should be
>
> [1,3,6,10,11,13,16,20,21,23,26,30]
>
> Is my understanding wrong somewhere?

If that is the operation you are looking for, then MPI_Scan is sufficient.

Your original email was somewhat cryptic; the phrase "When each task returns its result (which would be array) master task needs to combine all the results to get the final result." led me to believe that you might just need MPI_Reduce, instead.

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/