1 ! This file created from test/mpi/f77/coll/uallreducef.f with f77tof90
2 ! -*- Mode: Fortran; -*-
4 ! (C) 2003 by Argonne National Laboratory.
5 ! See COPYRIGHT in top-level directory.
8 ! Test user-defined operations. This tests a simple commutative operation
14 integer count, sumop, i, size
15 integer, DIMENSION(:), ALLOCATABLE :: vin, vout
20 ALLOCATE(vin(65000), STAT=status)
21 ALLOCATE(vout(65000), STAT=status)
24 call mpi_op_create( uop, .true., sumop, ierr )
27 call mpi_comm_size( comm, size, ierr )
29 do while (count .lt. 65000)
34 call mpi_allreduce( vin, vout, count, MPI_INTEGER, sumop, &
36 ! Check that all results are correct
38 if (vout(i) .ne. i * size) then
40 if (errs .lt. 10) print *, "vout(",i,") = ", vout(i)
46 call mpi_op_free( sumop, ierr )
49 call mtest_finalize(errs)
50 call mpi_finalize(ierr)
53 subroutine uop( cin, cout, count, datatype )
55 integer cin(*), cout(*)
56 integer count, datatype
59 if (datatype .ne. MPI_INTEGER) then
60 print *, 'Invalid datatype (',datatype,') passed to user_op()'
65 cout(i) = cin(i) + cout(i)