aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetInterp
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2009-09-21 11:27:23 -0500
committerErik Schnetter <schnetter@cct.lsu.edu>2009-09-21 11:27:23 -0500
commit429c430f1002a26597c8937f12990c9d16892f43 (patch)
tree4fcf9f688f7e333095be9e71086f0a885d8c8372 /Carpet/CarpetInterp
parent91d36f9afac87e713b058db3eb732c9b43295dce (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);
}