LCOV - code coverage report
Current view: top level - shared/common/src/12_hide_mpi - xmpi_max.finc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 49.2 % 59 29
Test Date: 2026-09-19 17:42:43 Functions: 50.0 % 8 4

            Line data    Source code
       1              : !{\src2tex{textfont=tt}}
       2              : !!****f* ABINIT/xmpi_max_int0d_i4b
       3              : !! NAME
       4              : !!  xmpi_max_int0d_i4b
       5              : !!
       6              : !! FUNCTION
       7              : !!  This module contains functions that calls MPI routine,
       8              : !!  if we compile the code using the MPI  CPP flags.
       9              : !!  xmpi_max is the generic function.
      10              : !!
      11              : !! COPYRIGHT
      12              : !!  Copyright (C) 2001-2026 ABINIT group (AR,XG,MB)
      13              : !!  This file is distributed under the terms of the
      14              : !!  GNU General Public License, see ~ABINIT/COPYING
      15              : !!  or http://www.gnu.org/copyleft/gpl.txt .
      16              : !!
      17              : !! SOURCE
      18              : 
      19         8521 : subroutine xmpi_max_int0d_i4b(xval,xmax,comm,ierr)
      20              : 
      21              : !Arguments-------------------------
      22              :  integer ,intent(in) :: xval
      23              :  integer, intent(out) :: xmax
      24              :  integer ,intent(in) :: comm
      25              :  integer ,intent(out) :: ierr
      26              : 
      27              : !Local variables-------------------
      28              : #if defined HAVE_MPI
      29              :  integer :: arr_xmax(1),arr_xval(1)
      30              : #endif
      31              : ! *************************************************************************
      32              : 
      33         8521 :  ierr=0
      34              : #if defined HAVE_MPI
      35         8521 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
      36         7124 :    arr_xval(1) = xval
      37         7124 :    call MPI_ALLREDUCE(arr_xval,arr_xmax,1,MPI_INTEGER,MPI_MAX,comm,ierr)
      38         7124 :    xmax=arr_xmax(1)
      39              :  else
      40              : #endif
      41         1397 :    xmax=xval
      42              : #if defined HAVE_MPI
      43              :  end if
      44              : #endif
      45              : 
      46         8521 : end subroutine xmpi_max_int0d_i4b
      47              : !!***
      48              : 
      49              : 
      50              : !!****f* ABINIT/xmpi_max_int0d_i8b
      51              : !! NAME
      52              : !!  xmpi_max_int0d_i8b
      53              : !!
      54              : !! FUNCTION
      55              : !!
      56              : !! SOURCE
      57              : 
      58            0 : subroutine xmpi_max_int0d_i8b(xval,xmax,comm,ierr)
      59              : 
      60              : !Arguments-------------------------
      61              :  integer(i8b) ,intent(in) :: xval
      62              :  integer(i8b), intent(out) :: xmax
      63              :  integer ,intent(in) :: comm
      64              :  integer ,intent(out) :: ierr
      65              : 
      66              : !Local variables-------------------
      67              : #if defined HAVE_MPI
      68              :  integer(i8b) :: arr_xmax(1),arr_xval(1)
      69              : #endif
      70              : ! *************************************************************************
      71              : 
      72            0 :  ierr=0
      73              : #if defined HAVE_MPI
      74            0 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
      75            0 :    arr_xval(1) = xval
      76            0 :    call MPI_ALLREDUCE(arr_xval,arr_xmax,1,MPI_INTEGER8,MPI_MAX,comm,ierr)
      77            0 :    xmax=arr_xmax(1)
      78              :  else
      79              : #endif
      80            0 :    xmax=xval
      81              : #if defined HAVE_MPI
      82              :  end if
      83              : #endif
      84              : 
      85            0 : end subroutine xmpi_max_int0d_i8b
      86              : !!***
      87              : 
      88              : !!****f* ABINIT/xmpi_max_int
      89              : !! NAME
      90              : !!  xmpi_max_int
      91              : !!
      92              : !! SOURCE
      93              : 
      94          189 : subroutine xmpi_max_int(xval,xmax,comm,ierr)
      95              : 
      96              : !Arguments-------------------------
      97              :  integer, DEV_CONTARRD intent(in) :: xval(:)
      98              :  integer, DEV_CONTARRD intent(out):: xmax(:)
      99              :  integer ,intent(in) :: comm
     100              :  integer ,intent(out) :: ierr
     101              : 
     102              : !Local variables-------------------
     103              :  integer :: s1
     104              : ! *************************************************************************
     105              : 
     106          189 :  ierr=0
     107          189 :  s1 =SIZE(xval)
     108              : #if defined HAVE_MPI
     109          189 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
     110          189 :    call MPI_ALLREDUCE(xval,xmax,s1,MPI_INTEGER,MPI_MAX,comm,ierr)
     111              :  else
     112              : #endif
     113            0 :    xmax=xval
     114              : #if defined HAVE_MPI
     115              :  end if
     116              : #endif
     117              : 
     118          189 : end subroutine xmpi_max_int
     119              : !!***
     120              : 
     121              : !!****f* ABINIT/xmpi_max_dpv
     122              : !! NAME
     123              : !!  xmpi_max_dpv
     124              : !!
     125              : !! FUNCTION
     126              : !!  Combines values from all processes and distribute
     127              : !!  the result back to all processes.
     128              : !!  Target: scalar double precisions.
     129              : !!
     130              : !! INPUTS
     131              : !!  comm= MPI communicator
     132              : !!
     133              : !! OUTPUT
     134              : !!  ierr= exit status, a non-zero value meaning there is an error
     135              : !!
     136              : !! SIDE EFFECTS
     137              : !!  xval= buffer array
     138              : !!  xmax= number of elements in send buffer
     139              : !!
     140              : !! SOURCE
     141              : 
     142        24050 : subroutine xmpi_max_dpv(xval, xmax, comm, ierr)
     143              : 
     144              : !Arguments-------------------------
     145              :  real(dp),intent(in) :: xval
     146              :  real(dp),intent(out) :: xmax
     147              :  integer ,intent(in) :: comm
     148              :  integer ,intent(out) :: ierr
     149              : 
     150              : !Local variables-------------------
     151              : #if defined HAVE_MPI
     152              :  real(dp) :: arr_xmax(1),arr_xval(1)
     153              : #endif
     154              : ! *************************************************************************
     155              : 
     156        24050 :  ierr=0
     157              : #if defined HAVE_MPI
     158        24050 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
     159        19824 :    arr_xval(1) = xval
     160        19824 :    call MPI_ALLREDUCE(arr_xval,arr_xmax,1,MPI_DOUBLE_PRECISION,MPI_MAX,comm,ierr)
     161        19824 :    xmax=arr_xmax(1)
     162              :  else
     163              : #endif
     164         4226 :    xmax=xval
     165              : #if defined HAVE_MPI
     166              :  end if
     167              : #endif
     168              : 
     169        24050 : end subroutine xmpi_max_dpv
     170              : !!***
     171              : 
     172              : !!****f* ABINIT/xmpi_max_int0d_ip
     173              : !! NAME
     174              : !!  xmpi_max_int0d_ip
     175              : !!
     176              : !! FUNCTION
     177              : !!  Combines values from all processes and distribute
     178              : !!  the result back to all processes.
     179              : !!  Target: scalar integer. In place operation
     180              : !!
     181              : !! INPUTS
     182              : !!  comm= MPI communicator
     183              : !!
     184              : !! OUTPUT
     185              : !!  ierr= exit status, a non-zero value meaning there is an error
     186              : !!
     187              : !! SIDE EFFECTS
     188              : !!  xval=
     189              : !!    in input: the value on the local processor
     190              : !!    in output: the maximum inside the given communicator.
     191              : !!
     192              : !! SOURCE
     193              : 
     194            0 : subroutine xmpi_max_int0d_ip(xval,comm,ierr)
     195              : 
     196              : !Arguments-------------------------
     197              :  integer ,intent(inout) :: xval
     198              :  integer ,intent(in) :: comm
     199              :  integer ,intent(out) :: ierr
     200              : 
     201              : !Local variables-------------------
     202              : #if defined HAVE_MPI
     203              :  integer :: arr_xmax(1),arr_xval(1)
     204              : #endif
     205              : ! *************************************************************************
     206              : 
     207            0 :  ierr=0
     208              : #if defined HAVE_MPI
     209            0 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
     210            0 :    arr_xval(1) = xval
     211            0 :    call MPI_ALLREDUCE(arr_xval,arr_xmax,1,MPI_INTEGER,MPI_MAX,comm,ierr)
     212            0 :    xval = arr_xmax(1)
     213              :  end if
     214              : #endif
     215              : 
     216            0 : end subroutine xmpi_max_int0d_ip
     217              : !!***
     218              : 
     219              : !!****f* ABINIT/xmpi_max_dp0d_ip
     220              : !! NAME
     221              : !!  xmpi_max_dp0d_ip
     222              : !!
     223              : !! FUNCTION
     224              : !!  Combines values from all processes and distribute
     225              : !!  the result back to all processes.
     226              : !!  Target: scalar double precisions. In place operation
     227              : !!
     228              : !! INPUTS
     229              : !!  comm= MPI communicator
     230              : !!
     231              : !! OUTPUT
     232              : !!  ierr= exit status, a non-zero value meaning there is an error
     233              : !!
     234              : !! SIDE EFFECTS
     235              : !!  xval=
     236              : !!    in input: the value on the local processor
     237              : !!    in output: the maximum inside the given communicator.
     238              : !!
     239              : !! SOURCE
     240              : 
     241        33169 : subroutine xmpi_max_dp0d_ip(xval,comm,ierr)
     242              : 
     243              : !Arguments-------------------------
     244              :  real(dp),intent(inout) :: xval
     245              :  integer ,intent(in) :: comm
     246              :  integer ,intent(out) :: ierr
     247              : 
     248              : !Local variables-------------------
     249              : #if defined HAVE_MPI
     250              :  real(dp) :: arr_xmax(1),arr_xval(1)
     251              : #endif
     252              : ! *************************************************************************
     253              : 
     254        33169 :  ierr=0
     255              : #if defined HAVE_MPI
     256        33169 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
     257        32687 :    arr_xval(1) = xval
     258        32687 :    call MPI_ALLREDUCE(arr_xval,arr_xmax,1,MPI_DOUBLE_PRECISION,MPI_MAX,comm,ierr)
     259        32687 :    xval = arr_xmax(1)
     260              :  end if
     261              : #endif
     262              : 
     263        33169 : end subroutine xmpi_max_dp0d_ip
     264              : !!***
     265              : 
     266              : !!****f* ABINIT/xmpi_max_dp1d_ip
     267              : !! NAME
     268              : !!  xmpi_max_dp1d_ip
     269              : !!
     270              : !! SOURCE
     271              : 
     272            0 : subroutine xmpi_max_dp1d_ip(xval, comm, ierr)
     273              : 
     274              : !Arguments-------------------------
     275              :  real(dp),intent(inout) :: xval(:)
     276              :  integer ,intent(in) :: comm
     277              :  integer ,intent(out) :: ierr
     278              : 
     279              : !Local variables-------------------
     280              : #if defined HAVE_MPI
     281            0 :  real(dp) :: arr_xval(size(xval))
     282              : #endif
     283              : ! *************************************************************************
     284              : 
     285            0 :  ierr=0
     286              : #if defined HAVE_MPI
     287            0 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
     288            0 :    arr_xval = xval
     289            0 :    call MPI_ALLREDUCE(arr_xval,xval,size(xval),MPI_DOUBLE_PRECISION,MPI_MAX,comm,ierr)
     290              :  end if
     291              : #endif
     292              : 
     293            0 : end subroutine xmpi_max_dp1d_ip
     294              : !!***
     295              : 
     296              : !!****f* ABINIT/xmpi_max_int1d_ip
     297              : !! NAME
     298              : !!  xmpi_max_int1d_ip
     299              : !!
     300              : !! FUNCTION
     301              : !!  Combines values from all processes and distribute
     302              : !!  the result back to all processes.
     303              : !!  Target: 1d integer vector. In place operation
     304              : !!
     305              : !! INPUTS
     306              : !!  comm= MPI communicator
     307              : !!
     308              : !! SIDE EFFECTS
     309              : !!  xval=
     310              : !!    in input: the value on the local processor
     311              : !!    in output: the maximum inside the given communicator.
     312              : !!
     313              : !! SOURCE
     314              : 
     315            0 : subroutine xmpi_max_int1d_ip(xval, comm, ierr)
     316              : 
     317              : !Arguments-------------------------
     318              :  integer, intent(inout) :: xval(:)
     319              :  integer ,intent(in) :: comm
     320              :  integer ,intent(out) :: ierr
     321              : 
     322              : !Local variables-------------------
     323              : #if defined HAVE_MPI
     324            0 :  integer :: xmax(size(xval))
     325              : #endif
     326              : ! *************************************************************************
     327              : 
     328            0 :  ierr=0
     329              : #if defined HAVE_MPI
     330            0 :  if (comm /= MPI_COMM_SELF .and. comm /= MPI_COMM_NULL) then
     331            0 :    call MPI_ALLREDUCE(xval,xmax,size(xval),MPI_INTEGER,MPI_MAX,comm,ierr)
     332            0 :    xval = xmax
     333              :  end if
     334              : #endif
     335              : 
     336            0 : end subroutine xmpi_max_int1d_ip
     337              : !!***
        

Generated by: LCOV version 2.3-1