TABLE OF CONTENTS


ABINIT/m_nvtx_data [ Modules ]

[ Top ] [ Modules ]

NAME

  m_nvtx_data

FUNCTION

  Small module to define data used to profile and trace abinit with nvtx library (Nvidia nsys).

COPYRIGHT

  Copyright (C) 2000-2021 ABINIT group (MT)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

SOURCE

 17 #if defined HAVE_CONFIG_H
 18 #include "config.h"
 19 #endif
 20 
 21 module m_nvtx_data
 22 
 23 #if defined(HAVE_GPU_CUDA) && defined(HAVE_GPU_NVTX_V3)
 24   use m_nvtx, only : nvtxStartRange, nvtxEndRange
 25 #endif
 26 
 27   implicit none
 28 
 29   logical :: nvtx_activated = .false.
 30 
 31   integer, parameter :: NUMBER_OF_NVTX_REGIONS = 27
 32   character(len=32), dimension(NUMBER_OF_NVTX_REGIONS) :: nvtx_names
 33   integer          , dimension(NUMBER_OF_NVTX_REGIONS) :: nvtx_ids
 34 
 35   integer, parameter :: NVTX_MAIN_COMPUTATION = 1
 36   integer, parameter :: NVTX_SCF = 2
 37   integer, parameter :: NVTX_VTORHO = 3
 38   integer, parameter :: NVTX_VTOWFK = 4
 39   integer, parameter :: NVTX_LOBPCG1 = 5
 40   integer, parameter :: NVTX_LOBPCG2 = 6
 41   integer, parameter :: NVTX_CHEBFI1 = 7
 42   integer, parameter :: NVTX_CHEBFI2 = 8
 43   integer, parameter :: NVTX_ORTHO_WF = 9
 44   integer, parameter :: NVTX_GETGHC = 10
 45   integer, parameter :: NVTX_CHEBFI2_RR = 11 ! Rayleigh Ritz
 46   integer, parameter :: NVTX_CHEBFI2_RRQ = 12 ! Rayleigh Ritz Quotient
 47   integer, parameter :: NVTX_CHEBFI2_CORE = 13 ! core
 48   integer, parameter :: NVTX_CHEBFI2_NONLOP = 14
 49   integer, parameter :: NVTX_CTOCPRJ = 15
 50   integer, parameter :: NVTX_SCF_FOURWF = 16
 51   integer, parameter :: NVTX_MKRHO = 17
 52   integer, parameter :: NVTX_INVOVL = 18
 53   integer, parameter :: NVTX_INVOVL_NONLOP1 = 19
 54   integer, parameter :: NVTX_INVOVL_NONLOP2 = 20
 55   integer, parameter :: NVTX_INVOVL_INNER = 21
 56   integer, parameter :: NVTX_INVOVL_INNER_APPLY_BLOCK = 22
 57   integer, parameter :: NVTX_INVOVL_INNER_GEMM = 23
 58   integer, parameter :: NVTX_SUB_SPC_DIAGO = 24
 59   integer, parameter :: NVTX_CHEBFI2_NEXT_ORDER = 25
 60   integer, parameter :: NVTX_CHEBFI2_SWAP_BUF = 26
 61   integer, parameter :: NVTX_CHEBFI2_GET_AX_BX = 27
 62 
 63 contains
 64 
 65   !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 66   !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 67   subroutine nvtx_init(activate)
 68 
 69     implicit none
 70 
 71     ! dummy variables
 72     logical :: activate
 73 
 74     nvtx_activated = activate
 75 
 76     nvtx_names = [character(len=32) :: &
 77          & "MAIN_COMPUTATION", &
 78          & "SCF", &
 79          & "VTORHO", &
 80          & "VTOWFK", &
 81          & "LOBPCG1", &
 82          & "LOBPCG2", &
 83          & "CHEBFI1", &
 84          & "CHEBFI2", &
 85          & "ORTHO_WF", &
 86          & "GETGHC", &
 87          & "CHEBFI2_RR", &
 88          & "CHEBFI2_RRQ", &
 89          & "CHEBFI2_CORE", &
 90          & "CHEBFI2_NONLOP", &
 91          & "CTOCPRJ", &
 92          & "SCF_FOURWF", &
 93          & "MKRHO", &
 94          & "INVOVL", &
 95          & "INVOVL_NONLOP1", &
 96          & "INVOVL_NONLOP2", &
 97          & "INVOVL_INNER", &
 98          & "INVOVL_INNER_APPLY_BLOCK", &
 99          & "INVOVL_INNER_GEMM", &
100          & "SUB_SPC_DIAGO", &
101          & "CHEBFI2_NEXT_ORDER", &
102          & "CHEBFI2_SWAP_BUF", &
103          & "CHEBFI2_GET_AX_BX" &
104          ]
105 
106     nvtx_ids(1) = NVTX_MAIN_COMPUTATION
107     nvtx_ids(2) = NVTX_SCF
108     nvtx_ids(3) = NVTX_VTORHO
109     nvtx_ids(4) = NVTX_VTOWFK
110     nvtx_ids(5) = NVTX_LOBPCG1
111     nvtx_ids(6) = NVTX_LOBPCG2
112     nvtx_ids(7) = NVTX_CHEBFI1
113     nvtx_ids(8) = NVTX_CHEBFI2
114     nvtx_ids(9) = NVTX_ORTHO_WF
115     nvtx_ids(10) = NVTX_GETGHC
116     nvtx_ids(11)= NVTX_CHEBFI2_RR
117     nvtx_ids(12)= NVTX_CHEBFI2_RRQ
118     nvtx_ids(13)= NVTX_CHEBFI2_CORE
119     nvtx_ids(14)= NVTX_CHEBFI2_NONLOP
120     nvtx_ids(15)= NVTX_CTOCPRJ
121     nvtx_ids(16)= NVTX_SCF_FOURWF
122     nvtx_ids(17)= NVTX_MKRHO
123     nvtx_ids(18)= NVTX_INVOVL
124     nvtx_ids(19)= NVTX_INVOVL_NONLOP1
125     nvtx_ids(20)= NVTX_INVOVL_NONLOP2
126     nvtx_ids(21)= NVTX_INVOVL_INNER
127     nvtx_ids(22)= NVTX_INVOVL_INNER_APPLY_BLOCK
128     nvtx_ids(23)= NVTX_INVOVL_INNER_GEMM
129     nvtx_ids(24)= NVTX_SUB_SPC_DIAGO
130     nvtx_ids(25)= NVTX_CHEBFI2_NEXT_ORDER
131     nvtx_ids(26)= NVTX_CHEBFI2_SWAP_BUF
132     nvtx_ids(27)= NVTX_CHEBFI2_GET_AX_BX
133 
134   end subroutine nvtx_init
135 
136 #if defined(HAVE_GPU_CUDA) && defined(HAVE_GPU_NVTX_V3)
137   !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
138   !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
139   subroutine abi_nvtx_start_range(id)
140 
141     implicit none
142 
143     ! dummy variables
144     integer :: id
145 
146     if (nvtx_activated) then
147        if (id .le. NUMBER_OF_NVTX_REGIONS) then
148           call nvtxStartRange(nvtx_names(id),id)
149        end if
150     end if
151 
152   end subroutine abi_nvtx_start_range
153 
154   !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
155   !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
156   subroutine abi_nvtx_end_range()
157 
158     implicit none
159 
160     if (nvtx_activated) then
161        call nvtxEndRange()
162     end if
163 
164   end subroutine abi_nvtx_end_range
165 
166 #endif
167 
168 end module m_nvtx_data