X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/aac4ba41ea27fe8168bebed009abebd7e5c3f006..4cdc0f888550cbaefe6094ae801230336d005337:/teshsuite/smpi/mpich3-test/rma/fetchandadd.c diff --git a/teshsuite/smpi/mpich3-test/rma/fetchandadd.c b/teshsuite/smpi/mpich3-test/rma/fetchandadd.c index dd12a4c64a..493e158c6b 100644 --- a/teshsuite/smpi/mpich3-test/rma/fetchandadd.c +++ b/teshsuite/smpi/mpich3-test/rma/fetchandadd.c @@ -3,64 +3,62 @@ * (C) 2001 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ -#include "mpi.h" +#include "mpi.h" #include "stdio.h" #include "stdlib.h" #include "mpitest.h" /* Fetch and add example from Using MPI-2 (the non-scalable version, - Fig. 6.12). */ + Fig. 6.12). */ -#define NTIMES 20 /* no of times each process calls the counter - routine */ +#define NTIMES 20 /* no of times each process calls the counter + * routine */ -int localvalue=0; /* contribution of this process to the counter. We - define it as a global variable because attribute - caching on the window is not enabled yet. */ +int localvalue = 0; /* contribution of this process to the counter. We + * define it as a global variable because attribute + * caching on the window is not enabled yet. */ void Get_nextval(MPI_Win win, int *val_array, MPI_Datatype get_type, int rank, int nprocs, int *value); int compar(const void *a, const void *b); -int main(int argc, char *argv[]) -{ - int rank, nprocs, i, blens[2], disps[2], *counter_mem, *val_array, - *results, *counter_vals; +int main(int argc, char *argv[]) +{ + int rank, nprocs, i, blens[2], disps[2], *counter_mem, *val_array, *results, *counter_vals; MPI_Datatype get_type; MPI_Win win; int errs = 0; - - MTest_Init(&argc,&argv); - MPI_Comm_size(MPI_COMM_WORLD,&nprocs); - MPI_Comm_rank(MPI_COMM_WORLD,&rank); + + MTest_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &nprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0) { /* allocate counter memory and initialize to 0 */ counter_mem = (int *) calloc(nprocs, sizeof(int)); - MPI_Win_create(counter_mem, nprocs*sizeof(int), sizeof(int), + MPI_Win_create(counter_mem, nprocs * sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &win); - MPI_Win_free(&win); + MPI_Win_free(&win); free(counter_mem); - /* gather the results from other processes, sort them, and check - whether they represent a counter being incremented by 1 */ + /* gather the results from other processes, sort them, and check + * whether they represent a counter being incremented by 1 */ - results = (int *) malloc(NTIMES*nprocs*sizeof(int)); - for (i=0; i