timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
types.hpp
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2020, The Regents of the University of California,
4// through Lawrence Berkeley National Laboratory (subject to receipt of any
5// required approvals from the U.S. Dept. of Energy). All rights reserved.
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in all
15// copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23// SOFTWARE.
24
25/** \file types.hpp
26 * \headerfile types.hpp "timemory/types.hpp"
27 * Provides collection types
28 *
29 */
30
31#pragma once
32
33#include "timemory/api.hpp"
37#include "timemory/enum.h"
51
52#include <tuple>
53
54//--------------------------------------------------------------------------------------//
55//
56// clang-format off
57//
58//--------------------------------------------------------------------------------------//
59//
60#if !defined(TIMEMORY_COMPONENT_TYPES)
61# define TIMEMORY_COMPONENT_TYPES \
62 component::allinea_map, \
63 component::caliper_marker, \
64 component::caliper_config, \
65 component::caliper_loop_marker, \
66 component::cpu_clock, \
67 component::cpu_roofline_dp_flops, \
68 component::cpu_roofline_flops, \
69 component::cpu_roofline_sp_flops, \
70 component::cpu_util, \
71 component::craypat_counters, \
72 component::craypat_flush_buffer, \
73 component::craypat_heap_stats, \
74 component::craypat_record, \
75 component::craypat_region, \
76 component::cuda_event, \
77 component::cuda_profiler, \
78 component::cupti_activity, \
79 component::cupti_counters, \
80 component::cupti_pcsampling, \
81 component::current_peak_rss, \
82 component::data_tracker_integer, \
83 component::data_tracker_unsigned, \
84 component::data_tracker_floating, \
85 component::gperftools_cpu_profiler, \
86 component::gperftools_heap_profiler, \
87 component::gpu_roofline_dp_flops, \
88 component::gpu_roofline_flops, \
89 component::gpu_roofline_hp_flops, \
90 component::gpu_roofline_sp_flops, \
91 component::hip_event, \
92 component::kernel_mode_time, \
93 component::likwid_marker, \
94 component::likwid_nvmarker, \
95 component::malloc_gotcha, \
96 component::memory_allocations, \
97 component::monotonic_clock, \
98 component::monotonic_raw_clock, \
99 component::network_stats, \
100 component::num_io_in, \
101 component::num_io_out, \
102 component::num_major_page_faults, \
103 component::num_minor_page_faults, \
104 component::nvtx_marker, \
105 component::ompt_native_handle, \
106 component::page_rss, \
107 component::papi_array_t, \
108 component::papi_vector, \
109 component::peak_rss, \
110 component::perfetto_trace, \
111 component::printer, \
112 component::priority_context_switch, \
113 component::process_cpu_clock, \
114 component::process_cpu_util, \
115 component::read_bytes, \
116 component::read_char, \
117 component::roctx_marker, \
118 component::system_clock, \
119 component::tau_marker, \
120 component::thread_cpu_clock, \
121 component::thread_cpu_util, \
122 component::timestamp, \
123 component::trip_count, \
124 component::user_clock, \
125 component::user_global_bundle, \
126 component::user_mode_time, \
127 component::virtual_memory, \
128 component::voluntary_context_switch, \
129 component::vtune_event, \
130 component::vtune_frame, \
131 component::vtune_profiler, \
132 component::wall_clock, \
133 component::written_bytes, \
134 component::written_char
135#endif
136//
137//--------------------------------------------------------------------------------------//
138//
139// clang-format on
140//
141//--------------------------------------------------------------------------------------//
142//
143#if !defined(TIMEMORY_MINIMAL_TUPLE_TYPES)
144# define TIMEMORY_MINIMAL_TUPLE_TYPES \
145 component::wall_clock, component::cpu_clock, component::cpu_util, \
146 component::peak_rss, component::user_global_bundle
147#endif
148//
149//--------------------------------------------------------------------------------------//
150//
151#if !defined(TIMEMORY_FULL_TUPLE_TYPES)
152# define TIMEMORY_FULL_TUPLE_TYPES \
153 component::wall_clock, component::system_clock, component::user_clock, \
154 component::cpu_util, component::peak_rss, component::user_global_bundle
155#endif
156//
157//--------------------------------------------------------------------------------------//
158//
159#if !defined(TIMEMORY_MINIMAL_LIST_TYPES)
160# define TIMEMORY_MINIMAL_LIST_TYPES \
161 component::papi_vector*, component::cuda_event*, component::nvtx_marker*, \
162 component::cupti_activity*, component::cupti_counters*, \
163 component::cpu_roofline_flops*, component::gpu_roofline_flops*
164#endif
165//
166//--------------------------------------------------------------------------------------//
167//
168#if !defined(TIMEMORY_FULL_LIST_TYPES)
169# define TIMEMORY_FULL_LIST_TYPES \
170 component::caliper*, component::tau_marker*, component::papi_vector*, \
171 component::cuda_event*, component::nvtx_marker*, component::cupti_activity*, \
172 component::cupti_counters*, component::cpu_roofline_flops*, \
173 component::gpu_roofline_flops*
174#endif
175
176namespace tim
177{
178//
179#if defined(DEBUG) && !defined(TIMEMORY_IGNORE_NATIVE_SIZE_MISMATCH)
180//
181static_assert((TIMEMORY_NATIVE_COMPONENTS_END -
183 std::tuple_size<std::tuple<TIMEMORY_COMPONENT_TYPES>>::value,
184 "Error! Number of components defined in macro TIMEMORY_COMPONENT_TYPES "
185 "does not equal the enumeration value of TIMEMORY_NATIVE_COMPONENTS_END "
186 "minus TIMEMORY_NATIVE_COMPONENT_INTERNAL_SIZE. It is likely that one of "
187 "these was updated and the other was not");
188//
189#endif
190//
191//--------------------------------------------------------------------------------------//
192//
193// using complete_types_t = type_list<TIMEMORY_COMPONENT_TYPES>;
194//
195//--------------------------------------------------------------------------------------//
196//
197// using complete_tuple_t = std::tuple<TIMEMORY_COMPONENT_TYPES>;
198// using complete_component_list_t = component_list<TIMEMORY_COMPONENT_TYPES>;
199// using complete_component_tuple_t = component_tuple<TIMEMORY_COMPONENT_TYPES>;
200// using complete_auto_list_t = auto_list<TIMEMORY_COMPONENT_TYPES>;
201// using complete_auto_tuple_t = auto_tuple<TIMEMORY_COMPONENT_TYPES>;
202//
203//--------------------------------------------------------------------------------------//
204//
205template <typename Tp>
207//
208template <size_t... Idx>
209struct complete_types<std::index_sequence<Idx...>>
210{
211 using type =
214};
215//
216//--------------------------------------------------------------------------------------//
217//
218template <typename Tp>
220//
221template <size_t... Idx>
222struct available_types<std::index_sequence<Idx...>>
223{
224 using type =
228};
229//
230//--------------------------------------------------------------------------------------//
231//
234//
237//
238//--------------------------------------------------------------------------------------//
239//
245//
246//--------------------------------------------------------------------------------------//
247//
253//
254//--------------------------------------------------------------------------------------//
255//
256// backwards-compatibility
257//
260//
261//--------------------------------------------------------------------------------------//
262//
267//
268//--------------------------------------------------------------------------------------//
269//
270} // namespace tim
271//
272//--------------------------------------------------------------------------------------//
273//
274#if !defined(TIMEMORY_LIBRARY_TYPE)
275# define TIMEMORY_LIBRARY_TYPE tim::available_component_list_t
276#endif
277//
278//--------------------------------------------------------------------------------------//
279//
280#if !defined(TIMEMORY_BUNDLE_TYPE)
281# define TIMEMORY_BUNDLE_TYPE tim::global_bundle_t
282#endif
283//
284//--------------------------------------------------------------------------------------//
285//
286#if !defined(TIMEMORY_OMPT_BUNDLE_TYPE)
287# define TIMEMORY_OMPT_BUNDLE_TYPE tim::ompt_bundle_t
288#endif
289//
290//--------------------------------------------------------------------------------------//
291//
292#if !defined(TIMEMORY_MPIP_BUNDLE_TYPE)
293# define TIMEMORY_MPIP_BUNDLE_TYPE tim::mpip_bundle_t
294#endif
295//
296//--------------------------------------------------------------------------------------//
297//
This is a variadic component wrapper where all components are allocated on the stack and cannot be di...
Declare the config types.
Declare the containers types.
#define TIMEMORY_NATIVE_COMPONENT_INTERNAL_SIZE
\macro TIMEMORY_NATIVE_COMPONENT_INTERNAL_SIZE
Definition: enum.h:654
#define TIMEMORY_NATIVE_COMPONENTS_END
Definition: enum.h:151
STL namespace.
impl::filter_false< trait::is_available, T > available_t
Definition: available.hpp:324
impl::filter_true< concepts::is_placeholder, T > non_placeholder_t
Definition: available.hpp:313
Definition: kokkosp.cpp:39
convert_t< complete_types_t, component_list<> > complete_component_list_t
Definition: types.hpp:241
convert_t< complete_types_t, std::tuple<> > complete_tuple_t
Definition: types.hpp:240
convert_t< available_types_t, auto_list<> > available_auto_list_t
Definition: types.hpp:251
typename available_types< std::make_index_sequence< TIMEMORY_COMPONENTS_END > >::type available_types_t
Definition: types.hpp:236
convert_t< complete_types_t, component_tuple<> > complete_component_tuple_t
Definition: types.hpp:242
complete_component_list_t complete_list_t
Definition: types.hpp:258
typename complete_types< std::make_index_sequence< TIMEMORY_COMPONENTS_END > >::type complete_types_t
Definition: types.hpp:233
convert_t< available_types_t, auto_tuple<> > available_auto_tuple_t
Definition: types.hpp:252
convert_t< available_types_t, std::tuple<> > available_tuple_t
Definition: types.hpp:248
convert_t< complete_types_t, auto_tuple<> > complete_auto_tuple_t
Definition: types.hpp:244
convert_t< available_types_t, component_tuple<> > available_component_tuple_t
Definition: types.hpp:250
convert_t< complete_types_t, auto_list<> > complete_auto_list_t
Definition: types.hpp:243
convert_t< available_types_t, component_list<> > available_component_list_t
Definition: types.hpp:249
typename impl::convert< T, U >::type convert_t
Definition: types.hpp:855
std::integer_sequence< size_t, Idx... > index_sequence
Alias template index_sequence.
Definition: types.hpp:178
available_component_list_t available_list_t
Definition: types.hpp:259
lightweight tuple-alternative for meta-programming logic
Definition: types.hpp:233
Declare the operations types.
Declare the storage types.