X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6c21a15a8a77f76d55fe77ef0d1225bb083d0a40..1c5d13f7fed995154113e221cf139317323637cd:/teshsuite/smpi/topo-cart-sub/topo-cart-sub.c 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