LCOV - code coverage report
Current view: | top level - physics/rrtmgp/ext/rte-kernels - mo_rte_util_array.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 11 | 22 | 50.0 %
Date: | 2024-12-17 22:39:59 |  | Functions: | 2 | 4 | 50.0 %

              Line data    Source code
           1             : ! This code is part of Radiative Transfer for Energetics (RTE)
           2             : !
           3             : ! Contacts: Robert Pincus and Eli Mlawer
           4             : ! email:  rrtmgp@aer.com
           5             : !
           6             : ! Copyright 2015-  Atmospheric and Environmental Research,
           7             : !    Regents of the University of Colorado,
           8             : !    Trustees of Columbia University in the City of New York
           9             : ! All right reserved.
          10             : !
          11             : ! Use and duplication is permitted under the terms of the
          12             : !    BSD 3-clause license, see http://opensource.org/licenses/BSD-3-Clause
          13             : ! -------------------------------------------------------------------------------------------------
          14             : module mo_rte_util_array
          15             :   use mo_rte_kind,      only: wp, wl
          16             :   implicit none
          17             :   !>
          18             :   !> Efficiently set arrays to zero
          19             :   !>
          20             :   interface zero_array
          21             :     module procedure zero_array_1D, zero_array_2D, zero_array_3D, zero_array_4D
          22             :   end interface
          23             :   public :: zero_array
          24             : contains
          25             :  !-------------------------------------------------------------------------------------------------
          26             :   ! Initializing arrays to 0
          27             :   !-------------------------------------------------------------------------------------------------
          28           0 :   subroutine zero_array_1D(ni, array) bind(C, name="zero_array_1D")
          29             :     integer,                 intent(in ) :: ni
          30             :     real(wp), dimension(ni), intent(out) :: array
          31             :     ! -----------------------
          32             :     integer :: i
          33             :     ! -----------------------
          34             :     !$acc parallel loop copyout(array)
          35             :     !$omp target teams distribute parallel do simd map(from:array)
          36           0 :     do i = 1, ni
          37           0 :       array(i) = 0.0_wp
          38             :     end do
          39           0 :   end subroutine zero_array_1D
          40             :   ! ----------------------------------------------------------
          41     4930859 :   subroutine zero_array_2D(ni, nj, array) bind(C, name="zero_array_2D")
          42             :     integer,                     intent(in ) :: ni, nj
          43             :     real(wp), dimension(ni, nj), intent(out) :: array
          44             :     ! -----------------------
          45             :     integer :: i,j
          46             :     ! -----------------------
          47             :     !$acc parallel loop collapse(2) copyout(array)
          48             :     !$omp target teams distribute parallel do simd collapse(2) map(from:array)
          49   535842382 :     do j = 1, nj
          50  8740518682 :       do i = 1, ni
          51  8735587823 :         array(i,j) = 0.0_wp
          52             :       end do
          53             :     end do
          54     4930859 :   end subroutine zero_array_2D
          55             :   ! ----------------------------------------------------------
          56     1524662 :   subroutine zero_array_3D(ni, nj, nk, array) bind(C, name="zero_array_3D")
          57             :     integer,                         intent(in ) :: ni, nj, nk
          58             :     real(wp), dimension(ni, nj, nk), intent(out) :: array
          59             :     ! -----------------------
          60             :     integer :: i,j,k
          61             :     ! -----------------------
          62             :     !$acc parallel loop collapse(3) copyout(array)
          63             :     !$omp target teams distribute parallel do simd collapse(3) map(from:array)
          64   184224982 :     do k = 1, nk
          65 17358055062 :       do j = 1, nj
          66 >28159*10^7 :         do i = 1, ni
          67 >28141*10^7 :           array(i,j,k) = 0.0_wp
          68             :         end do
          69             :       end do
          70             :     end do
          71     1524662 :   end subroutine zero_array_3D
          72             :   ! ----------------------------------------------------------
          73           0 :   subroutine zero_array_4D(ni, nj, nk, nl, array) bind(C, name="zero_array_4D")
          74             :     integer,                             intent(in ) :: ni, nj, nk, nl
          75             :     real(wp), dimension(ni, nj, nk, nl), intent(out) :: array
          76             :     ! -----------------------
          77             :     integer :: i,j,k,l
          78             :     ! -----------------------
          79             :     !$acc parallel loop collapse(4) copyout(array)
          80             :     !$omp target teams distribute parallel do simd collapse(4) map(from:array)
          81           0 :     do l = 1, nl
          82           0 :       do k = 1, nk
          83           0 :         do j = 1, nj
          84           0 :           do i = 1, ni
          85           0 :             array(i,j,k,l) = 0.0_wp
          86             :           end do
          87             :         end do
          88             :       end do
          89             :     end do
          90           0 :   end subroutine zero_array_4D
          91             : end module mo_rte_util_array

Generated by: LCOV version 1.14