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
9 subroutine uop( cin, cout, count, datatype )
12 integer cin(*), cout(*)
13 integer count, datatype
16 C if (datatype .ne. MPI_INTEGER) then
17 C print *, 'Invalid datatype (',datatype,') passed to user_op()'
22 cout(i) = cin(i) + cout(i)
31 integer count, sumop, vin(65000), vout(65000), i, size
37 call mpi_op_create( uop, .true., sumop, ierr )
40 call mpi_comm_size( comm, size, ierr )
42 do while (count .lt. 65000)
47 call mpi_allreduce( vin, vout, count, MPI_INTEGER, sumop,
49 C Check that all results are correct
51 if (vout(i) .ne. i * size) then
53 if (errs .lt. 10) print *, "vout(",i,") = ", vout(i)
59 call mpi_op_free( sumop, ierr )
61 call mtest_finalize(errs)
62 call mpi_finalize(ierr)