maxloc_allreduce_real_array Subroutine

private subroutine maxloc_allreduce_real_array(a, i)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(inout), dimension (:) :: a
integer, intent(inout), dimension (:) :: i

Contents


Source Code

  subroutine maxloc_allreduce_real_array (a,i)
    implicit none
    real, dimension (:), intent (in out) :: a
    integer, dimension (:), intent (in out) :: i
# ifdef MPI
    real, dimension(:,:), allocatable :: ai
    integer :: ierror

    allocate (ai(size(a),2))
    ai(:,1)=a(:)
    ai(:,2)=real(i(:),kind=kind(a(1)))
!$OMP MASTER
    call time_message(.false., time_mp_collectives, ' MPI Collectives')
!$OMP END MASTER
    call mpi_allreduce &
         (MPI_IN_PLACE, ai, size(a), mpi2real, MPI_MAXLOC, mp_comm, ierror)
!$OMP MASTER
    call time_message(.false., time_mp_collectives, ' MPI Collectives')
!$OMP END MASTER
    a(:)=ai(:,1)
    i(:)=int(ai(:,2))
    deallocate(ai)
# else
    UNUSED_DUMMY(a) ; UNUSED_DUMMY(i)
# endif
  end subroutine maxloc_allreduce_real_array