Hello, a tool developer reported a problem with MPI_Cart_create. The function seems to be non-standard conform.
The parameter "reorder" is a logical flag. According to section 2.6.3 from the MPI standard, a value "0" means false, and a non-zero value means "true". However, anything other than "0" and "1" leads to program abortion for this parameter. I attach the trivial patch I propose for this (to be applied in "ompi/mpi/c/") and the test program used. Regards, Kiril -- Dipl.-Inf. Kiril Dichev Tel.: +49 711 685 60492 E-mail: dic...@hlrs.de High Performance Computing Center Stuttgart (HLRS) Universität Stuttgart 70550 Stuttgart Germany
#include <stdio.h> #include <stdlib.h> #include <mpi.h> #define BOOL_VAL -1 int main(int argc, char** argv) { int dims[2], periods[2]; MPI_Comm comm; int size, rank; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &size); if (size != 4) { fprintf(stderr, "Please run with exactly 4 processes!\n"); MPI_Finalize(); exit(1); } dims[0] = 2; dims[1] = 2; periods[0] = BOOL_VAL; periods[1] = BOOL_VAL; MPI_Cart_create(MPI_COMM_WORLD, 2, dims, periods, BOOL_VAL, &comm); MPI_Barrier(comm); MPI_Comm_rank(comm, &rank); printf("Hello from rank %d\n", rank); MPI_Barrier(comm); MPI_Comm_free(&comm); MPI_Finalize(); return 0; }
Index: cart_create.c =================================================================== --- cart_create.c (revision 21810) +++ cart_create.c (working copy) @@ -66,10 +66,6 @@ return OMPI_ERRHANDLER_INVOKE (old_comm, MPI_ERR_ARG, FUNC_NAME); } - if (0 > reorder || 1 < reorder) { - return OMPI_ERRHANDLER_INVOKE (old_comm, MPI_ERR_ARG, - FUNC_NAME); - } /* check if the number of processes on the grid are corrct */ { @@ -114,7 +110,7 @@ * the new cartesian communicator */ - re_order = (1 == reorder)? true :false; + re_order = (0 == reorder)? false : true; err = ompi_topo_create (old_comm, ndims,