aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/dist.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-12-22 20:41:47 -0600
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 18:25:51 +0000
commit7f50283cd92479e4d22d833500fa82debc4fc354 (patch)
tree4e20494315fe975213bfe97b9e4b21d95c2346a8 /Carpet/CarpetLib/src/dist.cc
parent9cf3756873d5606f91b2c4c7fe564b7fd742d4a0 (diff)
CarpetLib: Check that MPI datatypes are defined before using them
Diffstat (limited to 'Carpet/CarpetLib/src/dist.cc')
-rw-r--r--Carpet/CarpetLib/src/dist.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/Carpet/CarpetLib/src/dist.cc b/Carpet/CarpetLib/src/dist.cc
index 67ebe35a6..eb9adff32 100644
--- a/Carpet/CarpetLib/src/dist.cc
+++ b/Carpet/CarpetLib/src/dist.cc
@@ -43,18 +43,27 @@ namespace dist {
#ifdef HAVE_CCTK_REAL4
CCTK_REAL4 dummy4;
+ assert (mpi_datatype(dummy4) != MPI_DATATYPE_NULL);
MPI_Type_contiguous (2, mpi_datatype(dummy4), &mpi_complex8);
MPI_Type_commit (&mpi_complex8);
#endif
#ifdef HAVE_CCTK_REAL8
CCTK_REAL8 dummy8;
+ assert (mpi_datatype(dummy8) != MPI_DATATYPE_NULL);
MPI_Type_contiguous (2, mpi_datatype(dummy8), &mpi_complex16);
MPI_Type_commit (&mpi_complex16);
#endif
#ifdef HAVE_CCTK_REAL16
CCTK_REAL16 dummy16;
- MPI_Type_contiguous (2, mpi_datatype(dummy16), &mpi_complex32);
- MPI_Type_commit (&mpi_complex32);
+ if (mpi_datatype(dummy16) != MPI_DATATYPE_NULL) {
+ MPI_Type_contiguous (2, mpi_datatype(dummy16), &mpi_complex32);
+ MPI_Type_commit (&mpi_complex32);
+ } else {
+ // CCTK_REAL16 is not supported by MPI
+ CCTK_WARN (CCTK_WARN_ALERT,
+ "CCTK_REAL16 support is enabled in Cactus, but is not supported by MPI. All MPI operations with this datatype will fail.");
+ mpi_complex32 = MPI_DATATYPE_NULL;
+ }
#endif
// Output startup time
@@ -94,6 +103,16 @@ namespace dist {
char const * const name, size_t const size)
{
DECLARE_CCTK_PARAMETERS;
+ for (size_t n=0; n<count; ++n) {
+ if (descr[n].type == MPI_DATATYPE_NULL) {
+ CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "While creating new MPI type for C type %s: "
+ "MPI datatype for field #%d (blocklength %d, displacement %d) is not defined",
+ name,
+ (int)n,
+ (int)descr[n].blocklength, (int)descr[n].displacement);
+ }
+ }
int blocklengths[count];
MPI_Aint displacements[count];
MPI_Datatype types[count];