diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2011-11-28 21:49:33 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 19:55:02 +0000 |
commit | ddafbb7057488f4601e60646d0446bf86082370f (patch) | |
tree | a8821268744e49f334868882d0b2547bf36c4c88 /Carpet/Carpet/src/CallFunction.cc | |
parent | f4c02ad00cace0fca0aa286dbe0ff2a814a08abb (diff) |
Carpet: Use unique ids in schedule barriers
Use an Adler-32 checksum to ensure that the ids in schedule barriers
are unique, so that the code really tests that the same functions are
called at the same time on all processes.
Diffstat (limited to 'Carpet/Carpet/src/CallFunction.cc')
-rw-r--r-- | Carpet/Carpet/src/CallFunction.cc | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/Carpet/Carpet/src/CallFunction.cc b/Carpet/Carpet/src/CallFunction.cc index 53a3e80c0..7c524c21e 100644 --- a/Carpet/Carpet/src/CallFunction.cc +++ b/Carpet/Carpet/src/CallFunction.cc @@ -4,6 +4,7 @@ #include <cstring> #include <map> #include <string> +#include <sstream> #include <cctk.h> #include <cctk_Parameters.h> @@ -14,6 +15,8 @@ #include <carpet.hh> #include <Timers.hh> +#include "adler32.hh" + namespace Carpet { @@ -277,23 +280,24 @@ namespace Carpet { } if (schedule_barriers) { -#if 0 - static unsigned int magic = 0xe8932329UL; // a random starting value - unsigned int recv = magic; - Checkpoint ("About to Bcast %u", magic); - MPI_Bcast (& recv, 1, MPI_UNSIGNED, 0, dist::comm()); - Checkpoint ("Finished Bcast"); - if (recv != magic) { - CCTK_WARN (CCTK_WARN_ABORT, - "Inconsistent communication schedule: not all processes return to CallFunction at the same time"); - } - ++ magic; - Checkpoint ("About to Barrier"); - MPI_Barrier (dist::comm()); - Checkpoint ("Finished Barrier"); -#endif - static int id = 513400912; // arbitrary starting value - Carpet::NamedBarrier (NULL, id++); + // Create an ID that is almost unique for this scheduled + // function call + stringstream buf; + buf << attribute->meta + << attribute->meta_early + << attribute->meta_late + << attribute->global + << attribute->global_early + << attribute->global_late + << attribute->level + << attribute->singlemap + << attribute->local << "\n"; + buf << attribute->where << "\n"; + buf << attribute->thorn << "\n"; + buf << attribute->routine << "\n"; + string const str = buf.str(); + int const id = adler32(str.c_str(), str.length()); + Carpet::NamedBarrier (NULL, id); } total_timer.stop(); |