MPI collect data from process in array

MPI collect data from process in array

Hi,

I am trying to use mpi to split computations on n process on a array.
So say process have computed the values for their ranges for eg:

process 1: Array[1 to a1]
process 2: Array[a1+1 to a2]
process 3: Array[a2+1 to a3]
process 4: Array[a3+1 to a4]

What is the best way to send and receive data when it comes to arrays?

Also can the same be applied it the processing of data is in contiguous memory locations? for eg:

process1: Array[1,5,9,13 ...]
​process2: Array[2,6,10,14 ...]
​process3: Array[3,7,11,15 ...]
​process4: Array[4,8,12,16...]

Thanks
Ajay

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The goal being to recieve the all the data computed by each process in the same array by the master contiguously

Hi Ajay,

With the data layouts you have here, if you can keep the data for each rank contiguous, I would recommend using MPI_Scatter and MPI_Gather.  If you need the data to remain strided, the use MPI_Scatterv and MPI_Gatherv instead.

Sincerely,
James Tullos
Technical Consulting Engineer
Intel® Cluster Tools

Leave a Comment

Please sign in to add a comment. Not a member? Join today