Neko  0.8.1
A portable framework for high-order spectral element flow simulations
profiler.F90
Go to the documentation of this file.
1 ! Copyright (c) 2022, The Neko Authors
2 ! All rights reserved.
3 !
4 ! Redistribution and use in source and binary forms, with or without
5 ! modification, are permitted provided that the following conditions
6 ! are met:
7 !
8 ! * Redistributions of source code must retain the above copyright
9 ! notice, this list of conditions and the following disclaimer.
10 !
11 ! * Redistributions in binary form must reproduce the above
12 ! copyright notice, this list of conditions and the following
13 ! disclaimer in the documentation and/or other materials provided
14 ! with the distribution.
15 !
16 ! * Neither the name of the authors nor the names of its
17 ! contributors may be used to endorse or promote products derived
18 ! from this software without specific prior written permission.
19 !
20 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 ! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 ! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 ! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 ! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 ! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 ! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 ! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 ! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 ! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 ! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 ! POSSIBILITY OF SUCH DAMAGE.
32 !
34 module profiler
35  use neko_config
37  use nvtx
38  use roctx
39  use craypat
40  implicit none
41  private
42 
45 
46 contains
47 
49  subroutine profiler_start
50  if ((neko_bcknd_cuda .eq. 1)) then
51 #if defined(HAVE_NVTX)
53 #endif
54  else
55 #ifdef CRAYPAT
56  call craypat_record_start
57 #endif
58  end if
59  end subroutine profiler_start
60 
62  subroutine profiler_stop
63  if ((neko_bcknd_cuda .eq. 1)) then
64 #if defined(HAVE_NVTX)
66 #endif
67  else
68 #ifdef CRAYPAT
69  call craypat_record_stop
70 #endif
71  end if
72  end subroutine profiler_stop
73 
75  subroutine profiler_start_region(name, region_id)
76  character(kind=c_char,len=*) :: name
77  integer, optional :: region_id
78 
79 #ifdef HAVE_NVTX
80  if (present(region_id)) then
81  call nvtxstartrange(name, region_id)
82  else
83  call nvtxstartrange(name)
84  end if
85 #elif HAVE_ROCTX
86  call roctxstartrange(name)
87 #elif CRAYPAT
88  ! call craypat_region_begin(name)
89 #endif
90 
91  end subroutine profiler_start_region
92 
95 
96 #ifdef HAVE_NVTX
97  call nvtxrangepop
98 #elif HAVE_ROCTX
99  call roctxrangepop
100 #elif CRAYPAT
101  ! call craypat_region_end
102 #endif
103 
104  end subroutine profiler_end_region
105 
106 end module profiler
Interface to CrayPat F77 API.
Definition: craypat.F90:2
Device abstraction, common interface for various accelerators.
Definition: device.F90:34
subroutine, public device_profiler_stop()
Stop device profiling.
Definition: device.F90:1133
subroutine, public device_profiler_start()
Start device profiling.
Definition: device.F90:1124
Build configurations.
Definition: neko_config.f90:34
integer, parameter neko_bcknd_cuda
Definition: neko_config.f90:41
Interface to NVTX Based on https://github.com/maxcuda/NVTX_example.
Definition: nvtx.F90:3
Profiling interface.
Definition: profiler.F90:34
subroutine, public profiler_start
Start profiling.
Definition: profiler.F90:50
subroutine, public profiler_end_region
End the most recently started profiler region.
Definition: profiler.F90:95
subroutine, public profiler_start_region(name, region_id)
Started a named (name) profiler region.
Definition: profiler.F90:76
subroutine, public profiler_stop
Stop profiling.
Definition: profiler.F90:63
Interfxace to ROCTX.
Definition: roctx.F90:2