aboutsummaryrefslogtreecommitdiff
path: root/CarpetDev
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-05-19 20:29:56 -0400
committerErik Schnetter <schnetter@gmail.com>2013-05-19 20:29:56 -0400
commitccc6d33d3b356c7b70f759495a7611f5169fd8c5 (patch)
treecbe3d68c1a0c92c2addf274af4efae99ef395127 /CarpetDev
parenta4dc204e712f58cabfc270a5cb158ff9664485cf (diff)
CarpetIOF5: Correct calculating the I/O processor numbers
Diffstat (limited to 'CarpetDev')
-rw-r--r--CarpetDev/CarpetIOF5/src/iof5.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/CarpetDev/CarpetIOF5/src/iof5.cc b/CarpetDev/CarpetIOF5/src/iof5.cc
index 1642bfe0e..0782a84aa 100644
--- a/CarpetDev/CarpetIOF5/src/iof5.cc
+++ b/CarpetDev/CarpetIOF5/src/iof5.cc
@@ -260,7 +260,9 @@ namespace CarpetIOF5 {
max_nioprocs == 0 ? 1 : (nprocs + max_nioprocs - 1) / max_nioprocs;
assert(ioproc_every > 0);
int const nioprocs = nprocs / ioproc_every;
- assert(nioprocs > 0 and nioprocs <= max_nioprocs);
+ assert(nioprocs > 0);
+ assert(max_nioprocs == 0 or nioprocs <= max_nioprocs);
+ assert(nioprocs <= nprocs);
int const myioproc = myproc / ioproc_every * ioproc_every;
// We split processes into "I/O groups" which range from
// myioproc to myioproc+ioproc_every-1 (inclusive). Within each
@@ -318,8 +320,8 @@ namespace CarpetIOF5 {
// If I am not the last process in my I/O group, send a token to
// my successor
- if (myproc < max(myioproc + ioproc_every, nprocs) - 1) {
- MPI_Send(NULL, 0, MPI_INT, myproc+1-1, 0, dist::comm());
+ if (myproc < min(myioproc + ioproc_every, nprocs) - 1) {
+ MPI_Send(NULL, 0, MPI_INT, myproc+1, 0, dist::comm());
}