From: Augustin Degomme Date: Thu, 28 Nov 2019 09:32:19 +0000 (+0100) Subject: Add a test for mpi_cart_sub based on the bug report by Jonathan Borne. X-Git-Tag: v3.25~355^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1c5d13f7fed995154113e221cf139317323637cd Add a test for mpi_cart_sub based on the bug report by Jonathan Borne. --- diff --git a/teshsuite/smpi/CMakeLists.txt b/teshsuite/smpi/CMakeLists.txt index d71b18f192..411911d0c5 100644 --- a/teshsuite/smpi/CMakeLists.txt +++ b/teshsuite/smpi/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong type-hvector type-indexed type-struct type-vector bug-17132 gh-139 timers privatization - io-simple io-simple-at io-all io-all-at io-shared io-ordered) + io-simple io-simple-at io-all io-all-at io-shared io-ordered topo-cart-sub) add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) @@ -39,7 +39,7 @@ foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-allto coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong type-hvector type-indexed type-struct type-vector bug-17132 gh-139 timers privatization macro-shared auto-shared macro-partial-shared macro-partial-shared-communication - io-simple io-simple-at io-all io-all-at io-shared io-ordered) + io-simple io-simple-at io-all io-all-at io-shared io-ordered topo-cart-sub) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c) endforeach() @@ -69,7 +69,7 @@ if(enable_smpi) foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong - type-hvector type-indexed type-struct type-vector bug-17132 timers io-simple io-simple-at io-all io-all-at io-shared io-ordered) + type-hvector type-indexed type-struct type-vector bug-17132 timers io-simple io-simple-at io-all io-all-at io-shared io-ordered topo-cart-sub) ADD_TESH_FACTORIES(tesh-smpi-${x} "thread;ucontext;raw;boost" --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/${x} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/${x} ${x}.tesh) endforeach() diff --git a/teshsuite/smpi/topo-cart-sub/topo-cart-sub.c b/teshsuite/smpi/topo-cart-sub/topo-cart-sub.c new file mode 100644 index 0000000000..fc64b7dcbc --- /dev/null +++ b/teshsuite/smpi/topo-cart-sub/topo-cart-sub.c @@ -0,0 +1,117 @@ +/* Copyright (c) 2019. Jonathan Borne. +*/ +/* Copyright (c) 2009-2019. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include +#include + +#define DIM 2 +#define Q 2 +/* Where DIM is the dimension of the Grid (2D) */ +/* and Q is the number of processes per dimension */ +#define N 3 +/* Local matrices size N*N */ + +int main(int argc, char **argv){ + /* Nb of nodes in the grid: + initialized by MPI_Comm_size according to commandline -np value */ + int nbNodes; + + /* Communicators */ + MPI_Comm gridComm, lineComm; + /* Current process ranks */ + int rank, gridSize, myGridRank, myLineRank, myColRank; + /* coords: used to get myLineRank and myColRank + initialized by MPI_Cart_coords + */ + int coords[DIM]; + /* dims: Integer array of size ndims specifying the number + of processes in each dimension. + if init value is 0 it is reset by MPI_Dims_create. + */ + int dims[DIM]; + for(int i=0; i [rank 0] -> Tremblay +> [rank 1] -> Jupiter +> [rank 2] -> Fafard +> [rank 3] -> Ginette +> rank 0: Alive +> rank 1: Alive +> rank 2: Alive +> rank 3: Alive +> process:(0,0) +> ------------------- +> 0 0 0 +> 0 0 0 +> 0 0 0 +> ------------------- +> process:(1,0) +> ------------------- +> 2 0 0 +> 0 2 0 +> 0 0 2 +> ------------------- +> process:(0,1) +> ------------------- +> 0 0 0 +> 0 0 0 +> 0 0 0 +> ------------------- +> process:(1,1) +> ------------------- +> 2 0 0 +> 0 2 0 +> 0 0 2 +> ------------------- +