http://www.walkingrandomly.com/?p=4400
And let's emphasize the summary:
The moral of the story is that if you want your compute to scale, you need to ensure that your licensing scales too.
A blog about software, tools, programming languages, programming models and trends in high-performance computing and Molecular Dynamics (MD) simulations.
The moral of the story is that if you want your compute to scale, you need to ensure that your licensing scales too.
MPI_Sendrecv that can be used to shift data along a group of processes. Within ESPResSo, this is not used at all so far. Instead, shifting data is done manually via calls to MPI_Send and MPI_Recv which have to be interleaved correctly.void do_sendrecv() {
float send_data = rank;
float recv_data;
for (int i=0; i < N; i++) {
MPI_Sendrecv(&send_data, 1, MPI_FLOAT, next, 42,
&recv_data, 1, MPI_FLOAT, prev, 42,
comm, 0);
}
}
void do_sendrecv_replace() {
float data = rank;
for (int i=0; i < N; i++) {
MPI_Sendrecv_replace(&data, 1, MPI_FLOAT,
next, 42, prev, 42,
comm, 0);
}
}
void do_manual() {
float data = rank;
for (int i=0; i < N; i++) {
if (rank%2) {
MPI_Send(&data, 1, MPI_INT, next, 42, comm);
MPI_Recv(&data, 1, MPI_INT, prev, 42, comm, 0);
} else {
MPI_Recv(&data, 1, MPI_INT, prev, 42, comm, 0);
MPI_Send(&data, 1, MPI_INT, next, 42, comm);
}
}
}
sendrecv: 1.487827 s (1.000000) sendrecv_replace: 1.490810 s (1.002005) manual: 2.062941 s (1.386547)That is a difference of 40%! From the results it seems obvious to me that it is a very good idea to use
MPI_Sendrecv whenever it is applicable instead of doing so manually!