Arjun J Rao
Arjun J Rao

Reputation: 935

Sending multiple 3D arrays to a process in MPI

I have a function which needs to be sent 3 NxNxN arrays (N=300) to perform its calculations. Individual MPI_Sends and MPI_Receives will not work well.

Is there some other construct that I can use ?

Upvotes: 0

Views: 236

Answers (1)

Wesley Bland
Wesley Bland

Reputation: 9072

If the data is stored contiguously, you can send as much of the data at once as you like. Just do:

MPI_Send(&data[i][j], 300, MPI_SOMETHING, ...);

to send an entire row at a time or:

MPI_Send(&data[i], 900, MPI_SOMETHING, ...);

to send a 2D slice. Depending on your implementation, there may be some size after which it becomes faster or slower to send your messages so feel free to experiment.

Upvotes: 1

Related Questions