Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.

MPI collect data from process in array

Ajay_N_
Beginner
380 Views

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

0 Kudos
2 Replies
Ajay_N_
Beginner
380 Views

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

0 Kudos
James_T_Intel
Moderator
380 Views

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

0 Kudos
Reply