X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/db17323a11a3089f492c2cae1be7913673689d5c..c81c99a491282f76757c2673961e3cdee6853539:/teshsuite/smpi/mpich3-test/coll/allred3.c diff --git a/teshsuite/smpi/mpich3-test/coll/allred3.c b/teshsuite/smpi/mpich3-test/coll/allred3.c new file mode 100644 index 0000000000..aaf8a23354 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/coll/allred3.c @@ -0,0 +1,212 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include "mpitest.h" +#include + +/* +static char MTEST_Descrip[] = "Test MPI_Allreduce with non-commutative user-defined operations"; +*/ + +/* We make the error count global so that we can easily control the output + of error information (in particular, limiting it after the first 10 + errors */ +int errs = 0; + +/* This implements a simple matrix-matrix multiply. This is an associative + but not commutative operation. The matrix size is set in matSize; + the number of matrices is the count argument. The matrix is stored + in C order, so that + c(i,j) is cin[j+i*matSize] + */ +#define MAXCOL 256 +static int matSize = 0; /* Must be < MAXCOL */ +static int max_offset = 0; +void uop( void *, void *, int *, MPI_Datatype * ); +void uop( void *cinPtr, void *coutPtr, int *count, MPI_Datatype *dtype ) +{ + const int *cin = (const int *)cinPtr; + int *cout = (int *)coutPtr; + int i, j, k, nmat; + int tempcol[MAXCOL]; + int offset1, offset2; + int matsize2 = matSize*matSize; + + for (nmat = 0; nmat < *count; nmat++) { + for (j=0; j