Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
profiler.F90
Go to the documentation of this file.
1! Copyright (c) 2022-2024, 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!
37 use nvtx
38 use roctx
39 use craypat
41 use, intrinsic :: iso_c_binding
42 implicit none
43 private
44
47
48contains
49
51 subroutine profiler_start
52 if ((neko_bcknd_cuda .eq. 1)) then
53#if defined(HAVE_NVTX)
55#endif
56 else
57#ifdef CRAYPAT
58 call craypat_record_start
59#endif
60 end if
61 end subroutine profiler_start
62
64 subroutine profiler_stop
65 if ((neko_bcknd_cuda .eq. 1)) then
66#if defined(HAVE_NVTX)
68#endif
69 else
70#ifdef CRAYPAT
71 call craypat_record_stop
72#endif
73 end if
74 end subroutine profiler_stop
75
77 subroutine profiler_start_region(name, region_id)
78 character(kind=c_char,len=*) :: name
79 integer, optional :: region_id
80
81#ifdef HAVE_NVTX
82 if (present(region_id)) then
83 call nvtxstartrange(name, region_id)
84 else
85 call nvtxstartrange(name)
86 end if
87#elif HAVE_ROCTX
88 call roctxstartrange(name)
89#elif CRAYPAT
90 if (present(region_id)) then
91 call craypat_region_begin(name, region_id)
92 end if
93#endif
94
95#if defined(__FUJITSU) && defined(NEKO_FJPROF)
96 if (present(region_id)) then
97 call fapp_start(trim(name), region_id, 0)
98 end if
99#endif
100
101 if (present(region_id)) then
102 call neko_rt_stats%start_region(name, region_id)
103 end if
104
105 end subroutine profiler_start_region
106
108 subroutine profiler_end_region(name, region_id)
109 character(kind=c_char, len=*), optional :: name
110 integer, optional :: region_id
111
112#ifdef HAVE_NVTX
113 call nvtxrangepop
114#elif HAVE_ROCTX
115 call roctxrangepop
116#elif CRAYPAT
117 if (present(region_id)) then
118 call craypat_region_end(region_id)
119 end if
120#endif
121
122#if defined(__FUJITSU) && defined(NEKO_FJPROF)
123 if (present(name) .and. present(region_id)) then
124 call fapp_stop(trim(name), region_id, 0)
125 end if
126#endif
127
128 if (present(name) .and. present(region_id)) then
129 call neko_rt_stats%end_region(name, region_id)
130 end if
131
132 end subroutine profiler_end_region
133
134end module profiler
Interface to CrayPat F77 API.
Definition craypat.F90:34
Device abstraction, common interface for various accelerators.
Definition device.F90:34
subroutine, public device_profiler_stop()
Stop device profiling.
Definition device.F90:1155
subroutine, public device_profiler_start()
Start device profiling.
Definition device.F90:1146
Build configurations.
integer, parameter neko_bcknd_cuda
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:52
subroutine, public profiler_start_region(name, region_id)
Started a named (name) profiler region.
Definition profiler.F90:78
subroutine, public profiler_end_region(name, region_id)
End the most recently started profiler region.
Definition profiler.F90:109
subroutine, public profiler_stop
Stop profiling.
Definition profiler.F90:65
Interfxace to ROCTX.
Definition roctx.F90:2
Runtime statistics.
type(runtime_stats_t), public neko_rt_stats