check that nmpi divides n_global

This commit is contained in:
Bryce Allen
2022-10-24 11:32:49 -04:00
parent 88e2d23c7f
commit c9a375df4a
2 changed files with 17 additions and 9 deletions

View File

@@ -193,6 +193,12 @@ int main(int argc, char** argv)
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
if (n_global % world_size != 0) {
printf("%d nmpi (%d) must be divisor of domain size (%d), exiting\n",
world_rank, world_size, n_global);
exit(1);
}
const int n_local = n_global / world_size;
const int n_local_with_ghost = n_local + 2 * n_bnd;