5 void addem ( int *, int *, int *, MPI_Datatype * );
7 void addem(invec, inoutvec, len, dtype)
8 int *invec, *inoutvec, *len;
12 for ( i=0; i<*len; i++ )
13 inoutvec[i] += invec[i];
16 int main( int argc, char **argv )
25 MPI_Init( &argc, &argv );
26 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
27 MPI_Comm_size( MPI_COMM_WORLD, &size );
30 MPI_Op_create( (MPI_User_function *)addem, 1, &op );
31 MPI_Reduce ( &data, &result, 1, MPI_INT, op, 0, MPI_COMM_WORLD );
32 MPI_Bcast ( &result, 1, MPI_INT, 0, MPI_COMM_WORLD );
37 if (result != correct_result) errors++;
42 printf( "[%d] done with ERRORS(%d)!\n", rank, errors );