1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
10 void addem ( int *, int *, int *, MPI_Datatype * );
12 void addem(int *invec, int *inoutvec, int *len, MPI_Datatype *dtype)
15 for ( i=0; i<*len; i++ )
16 inoutvec[i] += invec[i];
19 int main( int argc, char **argv )
28 MTest_Init( &argc, &argv );
29 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
30 MPI_Comm_size( MPI_COMM_WORLD, &size );
33 MPI_Op_create( (MPI_User_function *)addem, 1, &op );
34 MPI_Reduce ( &data, &result, 1, MPI_INT, op, 0, MPI_COMM_WORLD );
35 MPI_Bcast ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
40 if (result != correct_result) errors++;
42 MTest_Finalize( errors );
44 return MTestReturnValue( errors );