From ccc6d33d3b356c7b70f759495a7611f5169fd8c5 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Sun, 19 May 2013 20:29:56 -0400 Subject: CarpetIOF5: Correct calculating the I/O processor numbers --- CarpetDev/CarpetIOF5/src/iof5.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'CarpetDev') 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()); } -- cgit v1.2.3