1 C -*- Mode: Fortran; -*-
3 C (C) 2003 by Argonne National Laboratory.
4 C See COPYRIGHT in top-level directory.
7 C Test user-defined operations. This tests a simple commutative operation
14 integer count, sumop, vin(65000), vout(65000), i, size
20 call mpi_op_create( uop, .true., sumop, ierr )
23 call mpi_comm_size( comm, size, ierr )
25 do while (count .lt. 65000)
30 call mpi_allreduce( vin, vout, count, MPI_INTEGER, sumop,
32 C Check that all results are correct
34 if (vout(i) .ne. i * size) then
36 if (errs .lt. 10) print *, "vout(",i,") = ", vout(i)
42 call mpi_op_free( sumop, ierr )
44 call mtest_finalize(errs)
45 call mpi_finalize(ierr)
48 subroutine uop( cin, cout, count, datatype )
51 integer cin(*), cout(*)
52 integer count, datatype
55 C if (datatype .ne. MPI_INTEGER) then
56 C print *, 'Invalid datatype (',datatype,') passed to user_op()'
61 cout(i) = cin(i) + cout(i)