From c53a7c342f2568d21f0fdf9581b9a515f396056b Mon Sep 17 00:00:00 2001 From: David Goz <david.goz@inaf.it> Date: Thu, 20 Jun 2024 11:11:40 +0200 Subject: [PATCH] mpi/miscellaneous/cartesian.cpp bugfix --- jacobi/mpi/miscellaneous/cartesian.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jacobi/mpi/miscellaneous/cartesian.cpp b/jacobi/mpi/miscellaneous/cartesian.cpp index c4a9703..7b5a7e5 100644 --- a/jacobi/mpi/miscellaneous/cartesian.cpp +++ b/jacobi/mpi/miscellaneous/cartesian.cpp @@ -14,7 +14,7 @@ int main(int argc, char **argv) MPI_Comm_size(MPI_COMM_WORLD, &ntasks); MPI_Comm_rank(MPI_COMM_WORLD, &task); - if (argc < 1) + if (argc <= 1) { if (!task) { @@ -23,7 +23,7 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } } - + const int cartesian_grid_x = (int)strtol(argv[1], NULL, 10); const int cartesian_grid_y = ((ntasks % cartesian_grid_x == 0) ? (ntasks / cartesian_grid_x) : -1); if (cartesian_grid_y == -1) @@ -63,7 +63,7 @@ int main(int argc, char **argv) cout << endl; } } - + MPI_Comm_free(&comm2d); MPI_Finalize(); -- GitLab