Blame test/mpi/f08/coll/allredopttf08.f90

Packit Service c5cf8c
! This file created from test/mpi/f77/coll/allredopttf.f with f77tof90
Packit Service c5cf8c
! -*- Mode: Fortran; -*-
Packit Service c5cf8c
!
Packit Service c5cf8c
!  (C) 2007 by Argonne National Laboratory.
Packit Service c5cf8c
!      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
!
Packit Service c5cf8c
      program main
Packit Service c5cf8c
      use mpi_f08
Packit Service c5cf8c
      integer*8 inbuf, outbuf
Packit Service c5cf8c
      double complex zinbuf, zoutbuf
Packit Service c5cf8c
      integer wsize
Packit Service c5cf8c
      integer errs, ierr
Packit Service c5cf8c
Packit Service c5cf8c
      errs = 0
Packit Service c5cf8c
Packit Service c5cf8c
      call mtest_init( ierr )
Packit Service c5cf8c
      call mpi_comm_size( MPI_COMM_WORLD, wsize, ierr )
Packit Service c5cf8c
!
Packit Service c5cf8c
! A simple test of allreduce for the optional integer*8 type
Packit Service c5cf8c
Packit Service c5cf8c
      inbuf = 1
Packit Service c5cf8c
      outbuf = 0
Packit Service c5cf8c
      call mpi_allreduce(inbuf, outbuf, 1, MPI_INTEGER8, MPI_SUM,  &
Packit Service c5cf8c
      &                   MPI_COMM_WORLD, ierr)
Packit Service c5cf8c
      if (outbuf .ne. wsize ) then
Packit Service c5cf8c
         errs = errs + 1
Packit Service c5cf8c
         print *, "result wrong for sum with integer*8 = got ", outbuf,  &
Packit Service c5cf8c
      & " but should have ", wsize
Packit Service c5cf8c
      endif
Packit Service c5cf8c
      zinbuf = (1,1)
Packit Service c5cf8c
      zoutbuf = (0,0)
Packit Service c5cf8c
      call mpi_allreduce(zinbuf, zoutbuf, 1, MPI_DOUBLE_COMPLEX,  &
Packit Service c5cf8c
      &                   MPI_SUM,  MPI_COMM_WORLD, ierr)
Packit Service c5cf8c
      if (dreal(zoutbuf) .ne. wsize ) then
Packit Service c5cf8c
         errs = errs + 1
Packit Service c5cf8c
         print *, "result wrong for sum with double complex = got ",  &
Packit Service c5cf8c
      & outbuf, " but should have ", wsize
Packit Service c5cf8c
      endif
Packit Service c5cf8c
      if (dimag(zoutbuf) .ne. wsize ) then
Packit Service c5cf8c
         errs = errs + 1
Packit Service c5cf8c
         print *, "result wrong for sum with double complex = got ",  &
Packit Service c5cf8c
      & outbuf, " but should have ", wsize
Packit Service c5cf8c
      endif
Packit Service c5cf8c
      call mtest_finalize( errs )
Packit Service c5cf8c
      end