aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2011-11-29 15:09:03 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 19:55:02 +0000
commit01b7b58d2ba75324fadebba2cdd41b0c8ff77227 (patch)
treeba1d88dd835bac050004f883284bf4a590ff3025
parent535cc3699a7a27cbe3e6e0e697aa890c38f3c61a (diff)
Carpet: Allow all unsigned int values in named barriers
Don't restrict the range to non-negative signed integers.
-rw-r--r--Carpet/Carpet/src/functions.hh2
-rw-r--r--Carpet/Carpet/src/helpers.cc11
2 files changed, 6 insertions, 7 deletions
diff --git a/Carpet/Carpet/src/functions.hh b/Carpet/Carpet/src/functions.hh
index 152fdd07d..99cd24a09 100644
--- a/Carpet/Carpet/src/functions.hh
+++ b/Carpet/Carpet/src/functions.hh
@@ -37,7 +37,7 @@ namespace Carpet {
int GroupStorageDecrease (const cGH* cgh, int n_groups, const int* groups,
const int* timelevels, int* status);
int Barrier (const cGH* cgh);
- int NamedBarrier (const cGH* cgh, int id);
+ int NamedBarrier (const cGH* cgh, unsigned int id);
int Exit (const cGH* cgh, int retval);
int Abort (const cGH* cgh, int retval);
int MyProc (const cGH* cgh) CCTK_ATTRIBUTE_CONST;
diff --git a/Carpet/Carpet/src/helpers.cc b/Carpet/Carpet/src/helpers.cc
index f947c3a5c..147cee109 100644
--- a/Carpet/Carpet/src/helpers.cc
+++ b/Carpet/Carpet/src/helpers.cc
@@ -198,22 +198,21 @@ namespace Carpet {
return 0;
}
- int NamedBarrier (const cGH* const cgh, const int id)
+ int NamedBarrier (const cGH* const cgh, const unsigned int id)
{
const void *dummy = &dummy;
dummy = &cgh;
- assert (id >= 0);
const int root = 0;
- int my_id = dist::rank()==root ? id : -1;
- Checkpoint ("About to Bcast %d", id);
+ unsigned int my_id = dist::rank()==root ? id : id+1;
+ Checkpoint ("About to Bcast %ud", id);
MPI_Bcast (&my_id, 1, MPI_INT, root, dist::comm());
Checkpoint ("Finished Bcast");
if (my_id != id) {
CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
- "Wrong Barrier name: expected %d, found %d", id, my_id);
+ "Wrong Barrier name: expected %ud, found %ud", id, my_id);
}
- Checkpoint ("About to Barrier %d", id);
+ Checkpoint ("About to Barrier %ud", id);
MPI_Barrier (dist::comm());
Checkpoint ("Finished Barrier");
return 0;