aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetInterp
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2009-09-21 11:27:23 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:08 +0000
commitf5b0376823ed3658847fdf2f3447c87fcdec15ff (patch)
tree9ff1937fcb52c06bd5787eb1d37178174d30de9d /Carpet/CarpetInterp
parent797579d71872e279e13e0b93dabd4f670d19fd05 (diff)
CarpetInterp: Avoid possible race condition when creating new MPI datatypes
Ignore-this: 1770a5adf6184bcbb3cef19359d3a0c9
Diffstat (limited to 'Carpet/CarpetInterp')
-rw-r--r--Carpet/CarpetInterp/src/interp.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/Carpet/CarpetInterp/src/interp.cc b/Carpet/CarpetInterp/src/interp.cc
index 4707fd7cc..d6e791261 100644
--- a/Carpet/CarpetInterp/src/interp.cc
+++ b/Carpet/CarpetInterp/src/interp.cc
@@ -509,7 +509,7 @@ namespace CarpetInterp {
}
#endif
{
- MPI_Datatype datatype = dist::mpi_datatype (tmp[0]);
+ MPI_Datatype const datatype = dist::mpi_datatype (tmp[0]);
MPI_Datatype vdatatype;
MPI_Type_vector(1, ndims, 0, datatype, &vdatatype);
MPI_Type_commit(&vdatatype);
@@ -708,8 +708,9 @@ namespace CarpetInterp {
#undef TYPECASE
default: { CCTK_WARN (0, "invalid datatype"); abort(); }
}
- MPI_Type_vector(1, N_output_arrays, 0, datatype, &datatype);
- MPI_Type_commit(&datatype);
+ MPI_Datatype vdatatype;
+ MPI_Type_vector(1, N_output_arrays, 0, datatype, &vdatatype);
+ MPI_Type_commit(&vdatatype);
static Timer * timer = NULL;
if (not timer) {
@@ -718,12 +719,12 @@ namespace CarpetInterp {
timer->start ();
// distribute the results the same way as the coordinates were gathered
// simply by interchanging the send/recv counts/displacements
- MPI_Alltoallv (&outputs_buffer[0], &recvcnt[0], &recvdispl[0], datatype,
- &tmp[0], &sendcnt[0], &senddispl[0], datatype,
+ MPI_Alltoallv (&outputs_buffer[0], &recvcnt[0], &recvdispl[0], vdatatype,
+ &tmp[0], &sendcnt[0], &senddispl[0], vdatatype,
dist::comm());
timer->stop (N_interp_points * N_output_arrays * vtypesize);
- MPI_Type_free(&datatype);
+ MPI_Type_free(&vdatatype);
outputs_buffer.swap (tmp);
}