diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-07-15 12:11:40 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-07-15 13:30:25 -0500 |
commit | eab9c028bf17183891b2687d028eaefa67a37c2a (patch) | |
tree | 51abc65069742967a6d41c2d81ba983ac9cb6dc0 | |
parent | b962688a49b6a86b1dc6d52ce28c195671fc06a6 (diff) |
Move implementation of create_mpi_datatype from CarpetInterp2 to CarpetLib
-rw-r--r-- | Carpet/CarpetInterp2/src/fasterp.cc | 20 | ||||
-rw-r--r-- | Carpet/CarpetInterp2/src/fasterp.hh | 14 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/dist.cc | 21 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/dist.hh | 13 |
4 files changed, 34 insertions, 34 deletions
diff --git a/Carpet/CarpetInterp2/src/fasterp.cc b/Carpet/CarpetInterp2/src/fasterp.cc index 1de7c7863..44a2e8d6d 100644 --- a/Carpet/CarpetInterp2/src/fasterp.cc +++ b/Carpet/CarpetInterp2/src/fasterp.cc @@ -17,26 +17,6 @@ namespace CarpetInterp2 { - // Create an MPI datatype from a C datatype description - void - create_mpi_datatype (size_t const count, - mpi_struct_descr_t const descr[], - MPI_Datatype & newtype) - { - int blocklengths[count]; - MPI_Aint displacements[count]; - MPI_Datatype types[count]; - for (size_t n=0; n<count; ++n) { - blocklengths [n] = descr[n].blocklength; - displacements[n] = descr[n].displacement; - types [n] = descr[n].type; - } - MPI_Type_struct (count, blocklengths, displacements, types, &newtype); - MPI_Type_commit (&newtype); - } - - - // Create an MPI datatype for location information MPI_Datatype fasterp_iloc_t::mpi_datatype () diff --git a/Carpet/CarpetInterp2/src/fasterp.hh b/Carpet/CarpetInterp2/src/fasterp.hh index d2a13a35f..84b20da80 100644 --- a/Carpet/CarpetInterp2/src/fasterp.hh +++ b/Carpet/CarpetInterp2/src/fasterp.hh @@ -27,20 +27,6 @@ namespace CarpetInterp2 { - // Map C structures to MPI datatypes - struct mpi_struct_descr_t { - int blocklength; - MPI_Aint displacement; - MPI_Datatype type; - }; - - void - create_mpi_datatype (size_t count, - mpi_struct_descr_t const descr[], - MPI_Datatype & newtype); - - - // A global location, given by its global coordinates struct fasterp_glocs_t { vector<CCTK_REAL> coords[dim]; diff --git a/Carpet/CarpetLib/src/dist.cc b/Carpet/CarpetLib/src/dist.cc index 7ac6f73f6..c870990fb 100644 --- a/Carpet/CarpetLib/src/dist.cc +++ b/Carpet/CarpetLib/src/dist.cc @@ -53,6 +53,27 @@ namespace dist { MPI_Finalize (); } + + + // Create an MPI datatype from a C datatype description + void create_mpi_datatype (size_t const count, + mpi_struct_descr_t const descr[], + MPI_Datatype & newtype) + { + int blocklengths[count]; + MPI_Aint displacements[count]; + MPI_Datatype types[count]; + for (size_t n=0; n<count; ++n) { + blocklengths [n] = descr[n].blocklength; + displacements[n] = descr[n].displacement; + types [n] = descr[n].type; + } + MPI_Type_struct (count, blocklengths, displacements, types, &newtype); + MPI_Type_commit (&newtype); + } + + + void checkpoint (const char* file, int line) { DECLARE_CCTK_PARAMETERS; if (verbose) { diff --git a/Carpet/CarpetLib/src/dist.hh b/Carpet/CarpetLib/src/dist.hh index ae7953f99..cf4cbd70c 100644 --- a/Carpet/CarpetLib/src/dist.hh +++ b/Carpet/CarpetLib/src/dist.hh @@ -30,6 +30,19 @@ namespace dist { void pseudoinit (MPI_Comm const c); void finalize (); + // Create MPI datatypes from C structures + struct mpi_struct_descr_t { + int blocklength; + MPI_Aint displacement; + MPI_Datatype type; + }; + + void create_mpi_datatype (size_t const count, + mpi_struct_descr_t const descr[], + MPI_Datatype & newtype); + + + // Debugging output #define CHECKPOINT dist::checkpoint(__FILE__, __LINE__) void checkpoint (const char* file, int line); |