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.
tim::component::gpu_roofline< Types > Struct Template Reference

Combines hardware counters and timers and executes the empirical roofline toolkit during application termination to estimate the peak possible performance for the machine. More...

#include "timemory/components/roofline/gpu_roofline.hpp"

+ Collaboration diagram for tim::component::gpu_roofline< Types >:

Public Types

enum class  MODE {
  COUNTERS ,
  ACTIVITY
}
 
using value_type = std::tuple< typename cupti_activity::value_type, typename cupti_counters::value_type >
 
using this_type = gpu_roofline< Types... >
 
using base_type = base< this_type, value_type >
 
using storage_type = typename base_type::storage_type
 
using size_type = std::size_t
 
using counters_type = cupti_counters
 
using activity_type = cupti_activity
 
using device_t = device::gpu
 
using result_type = std::vector< double >
 
using label_type = std::vector< std::string >
 
using count_type = wall_clock
 
using types_tuple = std::tuple< Types... >
 
using ert_data_t = ert::exec_data< count_type >
 
using ert_data_ptr_t = std::shared_ptr< ert_data_t >
 
template<typename Tp >
using ert_config_type = ert::configuration< device_t, Tp, count_type >
 
template<typename Tp >
using ert_counter_type = ert::counter< device_t, Tp, count_type >
 
template<typename Tp >
using ert_executor_type = ert::executor< device_t, Tp, count_type >
 
template<typename Tp >
using ert_callback_type = ert::callback< ert_executor_type< Tp > >
 
using ert_config_t = std::tuple< ert_config_type< Types >... >
 
using ert_counter_t = std::tuple< ert_counter_type< Types >... >
 
using ert_executor_t = std::tuple< ert_executor_type< Types >... >
 
using ert_callback_t = std::tuple< ert_callback_type< Types >... >
 
using strvec_t = std::vector< std::string >
 
using events_callback_t = std::function< strvec_t()>
 
using metrics_callback_t = events_callback_t
 
using activity_value_type = typename cupti_activity::value_type
 
using counters_value_type = typename cupti_counters::value_type
 
using secondary_type = std::unordered_multimap< std::string, value_type >
 

Public Member Functions

 gpu_roofline ()
 
 ~gpu_roofline ()=default
 
 gpu_roofline (const gpu_roofline &rhs)
 
gpu_rooflineoperator= (const gpu_roofline &rhs)
 
 gpu_roofline (gpu_roofline &&) noexcept=default
 
gpu_rooflineoperator= (gpu_roofline &&) noexcept=default
 
result_type get () const
 
void start ()
 
void stop ()
 
this_typeoperator+= (const this_type &rhs)
 
this_typeoperator-= (const this_type &rhs)
 
this_typeoperator+= (const value_type &rhs)
 
secondary_type get_secondary () const
 
string_t get_display () const
 
template<typename Archive >
void save (Archive &ar, const unsigned int) const
 
template<typename Archive >
void load (Archive &ar, const unsigned int)
 

Static Public Member Functions

static events_callback_tget_events_callback ()
 
static metrics_callback_tget_metrics_callback ()
 
static MODEevent_mode ()
 
static void configure (const MODE &_mode, int _device=0)
 
static void configure ()
 
static std::string get_mode_string ()
 
static std::string get_type_string ()
 
static ert_config_tget_finalizer ()
 
static ert_data_ptr_tget_ert_data ()
 
static void global_init ()
 
template<typename Tp , typename FuncT >
static void set_executor_callback (FuncT &&f)
 
static void global_finalize (storage_type *_store)
 
static void thread_init ()
 
static void thread_finalize ()
 
template<typename Archive >
static void extra_serialization (Archive &ar)
 
static int64_t unit ()
 
static std::string label ()
 
static std::string description ()
 
static std::string display_unit ()
 
static value_type record ()
 
static label_type label_array ()
 
static label_type display_unit_array ()
 
template<typename... Args>
static opaque get_opaque (Args &&...)
 

Static Public Attributes

static const short precision = 3
 
static const short width = 8
 

Friends

struct operation::record< this_type >
 
struct operation::start< this_type >
 
struct operation::stop< this_type >
 
struct operation::set_started< this_type >
 
struct operation::set_stopped< this_type >
 
class impl::storage< this_type, trait::uses_value_storage< this_type, value_type >::value >
 
std::ostream & operator<< (std::ostream &os, const this_type &obj)
 

Detailed Description

template<typename... Types>
struct tim::component::gpu_roofline< Types >

Combines hardware counters and timers and executes the empirical roofline toolkit during application termination to estimate the peak possible performance for the machine.

Template Parameters
TypesVariadic list of data types for roofline analysis

Definition at line 70 of file gpu_roofline.hpp.

Member Typedef Documentation

◆ activity_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::activity_type = cupti_activity

Definition at line 82 of file gpu_roofline.hpp.

◆ activity_value_type

Definition at line 580 of file gpu_roofline.hpp.

◆ base_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::base_type = base<this_type, value_type>

Definition at line 77 of file gpu_roofline.hpp.

◆ count_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::count_type = wall_clock

Definition at line 86 of file gpu_roofline.hpp.

◆ counters_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::counters_type = cupti_counters

Definition at line 81 of file gpu_roofline.hpp.

◆ counters_value_type

Definition at line 581 of file gpu_roofline.hpp.

◆ device_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::device_t = device::gpu

Definition at line 83 of file gpu_roofline.hpp.

◆ ert_callback_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::ert_callback_t = std::tuple<ert_callback_type<Types>...>

Definition at line 112 of file gpu_roofline.hpp.

◆ ert_callback_type

template<typename... Types>
template<typename Tp >
using tim::component::gpu_roofline< Types >::ert_callback_type = ert::callback<ert_executor_type<Tp> >

Definition at line 106 of file gpu_roofline.hpp.

◆ ert_config_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::ert_config_t = std::tuple<ert_config_type<Types>...>

Definition at line 109 of file gpu_roofline.hpp.

◆ ert_config_type

template<typename... Types>
template<typename Tp >
using tim::component::gpu_roofline< Types >::ert_config_type = ert::configuration<device_t, Tp, count_type>

Definition at line 100 of file gpu_roofline.hpp.

◆ ert_counter_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::ert_counter_t = std::tuple<ert_counter_type<Types>...>

Definition at line 110 of file gpu_roofline.hpp.

◆ ert_counter_type

template<typename... Types>
template<typename Tp >
using tim::component::gpu_roofline< Types >::ert_counter_type = ert::counter<device_t, Tp, count_type>

Definition at line 102 of file gpu_roofline.hpp.

◆ ert_data_ptr_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::ert_data_ptr_t = std::shared_ptr<ert_data_t>

Definition at line 96 of file gpu_roofline.hpp.

◆ ert_data_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::ert_data_t = ert::exec_data<count_type>

Definition at line 95 of file gpu_roofline.hpp.

◆ ert_executor_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::ert_executor_t = std::tuple<ert_executor_type<Types>...>

Definition at line 111 of file gpu_roofline.hpp.

◆ ert_executor_type

template<typename... Types>
template<typename Tp >
using tim::component::gpu_roofline< Types >::ert_executor_type = ert::executor<device_t, Tp, count_type>

Definition at line 104 of file gpu_roofline.hpp.

◆ events_callback_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::events_callback_t = std::function<strvec_t()>

Definition at line 132 of file gpu_roofline.hpp.

◆ label_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::label_type = std::vector<std::string>

Definition at line 85 of file gpu_roofline.hpp.

◆ metrics_callback_t

Definition at line 133 of file gpu_roofline.hpp.

◆ result_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::result_type = std::vector<double>

Definition at line 84 of file gpu_roofline.hpp.

◆ secondary_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::secondary_type = std::unordered_multimap<std::string, value_type>

Definition at line 582 of file gpu_roofline.hpp.

◆ size_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::size_type = std::size_t

Definition at line 80 of file gpu_roofline.hpp.

◆ storage_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::storage_type = typename base_type::storage_type

Definition at line 78 of file gpu_roofline.hpp.

◆ strvec_t

template<typename... Types>
using tim::component::gpu_roofline< Types >::strvec_t = std::vector<std::string>

Definition at line 131 of file gpu_roofline.hpp.

◆ this_type

template<typename... Types>
using tim::component::gpu_roofline< Types >::this_type = gpu_roofline<Types...>

Definition at line 76 of file gpu_roofline.hpp.

◆ types_tuple

template<typename... Types>
using tim::component::gpu_roofline< Types >::types_tuple = std::tuple<Types...>

Definition at line 87 of file gpu_roofline.hpp.

◆ value_type

Definition at line 74 of file gpu_roofline.hpp.

Member Enumeration Documentation

◆ MODE

template<typename... Types>
enum class tim::component::gpu_roofline::MODE
strong
Enumerator
COUNTERS 
ACTIVITY 

Definition at line 123 of file gpu_roofline.hpp.

124 {
125 COUNTERS,
126 ACTIVITY
127 };

Constructor & Destructor Documentation

◆ gpu_roofline() [1/3]

template<typename... Types>
tim::component::gpu_roofline< Types >::gpu_roofline ( )
inline

◆ ~gpu_roofline()

template<typename... Types>
tim::component::gpu_roofline< Types >::~gpu_roofline ( )
default

◆ gpu_roofline() [2/3]

template<typename... Types>
tim::component::gpu_roofline< Types >::gpu_roofline ( const gpu_roofline< Types > &  rhs)
inline

Definition at line 430 of file gpu_roofline.hpp.

431 : base_type(rhs)
432 , m_data(rhs.m_data)
433 {}
base< this_type, value_type > base_type

◆ gpu_roofline() [3/3]

template<typename... Types>
tim::component::gpu_roofline< Types >::gpu_roofline ( gpu_roofline< Types > &&  )
defaultnoexcept

Member Function Documentation

◆ configure() [1/2]

template<typename... Types>
static void tim::component::gpu_roofline< Types >::configure ( )
inlinestatic

◆ configure() [2/2]

template<typename... Types>
static void tim::component::gpu_roofline< Types >::configure ( const MODE _mode,
int  _device = 0 
)
inlinestatic

Definition at line 180 of file gpu_roofline.hpp.

181 {
182 if(is_configured())
183 return;
184 is_configured() = true;
185
186 event_mode() = _mode;
187
189 {
190 get_labels() = { std::string("runtime") };
191 }
192 else
193 {
194 strvec_t events = { "global_load", "global_store" };
195 strvec_t metrics = { "ldst_executed" };
196#if defined(TIMEMORY_USE_CUDA_HALF)
197 if(is_one_of<cuda::fp16_t, types_tuple>::value)
198 {
199 metrics.push_back("flop_count_hp");
200 }
201#endif
202
203 if(is_one_of<float, types_tuple>::value)
204 {
205 metrics.push_back("flop_count_sp");
206 }
207
208 if(is_one_of<double, types_tuple>::value)
209 {
210 metrics.push_back("flop_count_dp");
211 }
212
213 // integer
214 if(mpl::is_one_of_integral<types_tuple>::value ||
216 {
217 for(const auto* itr :
218 { "ipc", "inst_executed", "inst_integer", "inst_fp_64", "inst_fp_32",
219 "inst_fp_16", "local_load_transactions_per_request",
220 "local_store_transactions_per_request",
221 "shared_load_transactions_per_request",
222 "shared_store_transactions_per_request",
223 "gld_transactions_per_request", "gst_transactions_per_request",
224 "inst_executed_global_reductions", "inst_executed_global_stores",
225 "inst_executed_global_loads", "inst_executed_local_loads",
226 "inst_executed_local_stores", "inst_executed_shared_loads",
227 "inst_executed_shared_stores" })
228 metrics.emplace_back(itr);
229 }
230
231 // add in extra events
232 auto _extra_events = get_events_callback()();
233 for(const auto& itr : _extra_events)
234 events.push_back(itr);
235
236 // add in extra metrics
237 auto _extra_metrics = get_metrics_callback()();
238 for(const auto& itr : _extra_metrics)
239 metrics.push_back(itr);
240
241 auto _get_unique = [](const strvec_t& _vec) {
242 std::set<std::string> _set;
243 for(const auto& itr : _vec)
244 _set.insert(itr);
246 for(const auto& itr : _set)
247 _ret.push_back(itr);
248 return _ret;
249 };
250
251 metrics = _get_unique(metrics);
252 events = _get_unique(events);
253
254 counters_type::configure(_device, events, metrics);
255 get_labels() = counters_type::label_array();
256 }
257 }
const hash_alias_ptr_t hash_value_t std::string *& _ret
Definition: definition.hpp:300
instruction_roofline
Definition: settings.cpp:1748
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
static array_t< string_t > label_array()
std::vector< std::string > strvec_t
static events_callback_t & get_events_callback()
static metrics_callback_t & get_metrics_callback()

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::cupti_counters::configure(), tim::component::gpu_roofline< Types >::event_mode(), tim::component::gpu_roofline< Types >::get_events_callback(), tim::component::gpu_roofline< Types >::get_metrics_callback(), tim::instruction_roofline, and tim::component::cupti_counters::label_array().

◆ description()

template<typename... Types>
static std::string tim::component::gpu_roofline< Types >::description ( )
inlinestatic

Definition at line 390 of file gpu_roofline.hpp.

391 {
392 return "Model used to provide performance relative to the peak possible "
393 "performance on a GPU architecture.";
394 }

◆ display_unit()

◆ display_unit_array()

template<typename... Types>
static label_type tim::component::gpu_roofline< Types >::display_unit_array ( )
inlinestatic

Definition at line 662 of file gpu_roofline.hpp.

663 {
664 const auto& _labels = get_labels();
665 return label_type(_labels.size(), this_type::display_unit());
666 }
std::vector< std::string > label_type
static std::string display_unit()

References tim::component::gpu_roofline< Types >::display_unit().

◆ event_mode()

template<typename... Types>
static MODE & tim::component::gpu_roofline< Types >::event_mode ( )
inlinestatic

Definition at line 152 of file gpu_roofline.hpp.

153 {
154 auto&& _get = [=]() {
155 auto&& aslc = [](std::string str) {
156 for(auto& itr : str)
157 itr = tolower(itr);
158 return str;
159 };
160
161 // check the standard variable
163 if(_env.empty())
164 _env = aslc(settings::roofline_mode());
165 return (_env == "op" || _env == "hw" || _env == "counters")
167 : ((_env == "ai" || _env == "ac" || _env == "activity")
170 };
171
172 static MODE _instance = _get();
173 if(!is_configured())
174 _instance = _get();
175 return _instance;
176 }
roofline_mode
Definition: settings.cpp:1732
gpu_roofline_mode
Definition: settings.cpp:1736

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, tim::gpu_roofline_mode, and tim::roofline_mode.

Referenced by tim::component::gpu_roofline< Types >::configure(), tim::component::gpu_roofline< Types >::display_unit(), tim::component::gpu_roofline< Types >::get(), tim::component::gpu_roofline< Types >::get_display(), tim::component::gpu_roofline< Types >::get_mode_string(), tim::component::gpu_roofline< Types >::get_secondary(), tim::component::gpu_roofline< Types >::global_finalize(), tim::component::gpu_roofline< Types >::global_init(), tim::component::gpu_roofline< Types >::load(), tim::component::gpu_roofline< Types >::operator+=(), tim::component::gpu_roofline< Types >::operator-=(), tim::component::gpu_roofline< Types >::record(), tim::component::gpu_roofline< Types >::save(), tim::component::gpu_roofline< Types >::start(), tim::component::gpu_roofline< Types >::stop(), and tim::component::gpu_roofline< Types >::unit().

◆ extra_serialization()

template<typename... Types>
template<typename Archive >
static void tim::component::gpu_roofline< Types >::extra_serialization ( Archive &  ar)
inlinestatic

Definition at line 358 of file gpu_roofline.hpp.

359 {
360 auto& _ert_data = get_ert_data();
361 if(!_ert_data) // for input
362 _ert_data = std::make_shared<ert_data_t>();
363 ar(cereal::make_nvp("roofline", *_ert_data));
364 }
static ert_data_ptr_t & get_ert_data()

References tim::component::gpu_roofline< Types >::get_ert_data().

◆ get()

template<typename... Types>
result_type tim::component::gpu_roofline< Types >::get ( ) const
inline

Definition at line 450 of file gpu_roofline.hpp.

451 {
452 switch(event_mode())
453 {
454 case MODE::ACTIVITY: return result_type({ m_data.activity->get() });
455 case MODE::COUNTERS: return m_data.counters->get();
456 default: break;
457 }
458 return result_type{};
459 }
std::vector< double > result_type

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

Referenced by tim::component::gpu_roofline< Types >::save().

◆ get_display()

template<typename... Types>
string_t tim::component::gpu_roofline< Types >::get_display ( ) const
inline

Definition at line 635 of file gpu_roofline.hpp.

636 {
637 std::stringstream ss;
639 {
640 return m_data.counters->get_display();
641 }
642 {
643 ss << m_data.activity->get_display();
644 }
645 return ss.str();
646 }

References tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

Referenced by tim::component::gpu_roofline< Types >::save().

◆ get_ert_data()

template<typename... Types>
static ert_data_ptr_t & tim::component::gpu_roofline< Types >::get_ert_data ( )
inlinestatic

Definition at line 291 of file gpu_roofline.hpp.

292 {
293 static ert_data_ptr_t _instance = std::make_shared<ert_data_t>();
294 return _instance;
295 }
std::shared_ptr< ert_data_t > ert_data_ptr_t

Referenced by tim::component::gpu_roofline< Types >::extra_serialization(), and tim::component::gpu_roofline< Types >::global_finalize().

◆ get_events_callback()

template<typename... Types>
static events_callback_t & tim::component::gpu_roofline< Types >::get_events_callback ( )
inlinestatic

Definition at line 137 of file gpu_roofline.hpp.

138 {
139 static events_callback_t _instance = []() { return strvec_t{}; };
140 return _instance;
141 }
std::function< strvec_t()> events_callback_t

Referenced by tim::component::gpu_roofline< Types >::configure().

◆ get_finalizer()

template<typename... Types>
static ert_config_t & tim::component::gpu_roofline< Types >::get_finalizer ( )
inlinestatic

Definition at line 283 of file gpu_roofline.hpp.

284 {
285 static ert_config_t _instance;
286 return _instance;
287 }
std::tuple< ert_config_type< Types >... > ert_config_t

Referenced by tim::component::gpu_roofline< Types >::global_finalize().

◆ get_metrics_callback()

template<typename... Types>
static metrics_callback_t & tim::component::gpu_roofline< Types >::get_metrics_callback ( )
inlinestatic

Definition at line 143 of file gpu_roofline.hpp.

144 {
145 static metrics_callback_t _instance = []() { return strvec_t{}; };
146 return _instance;
147 }
events_callback_t metrics_callback_t

Referenced by tim::component::gpu_roofline< Types >::configure().

◆ get_mode_string()

template<typename... Types>
static std::string tim::component::gpu_roofline< Types >::get_mode_string ( )
inlinestatic

◆ get_opaque()

template<typename... Args>
static opaque tim::component::empty_base::get_opaque ( Args &&  ...)
inlinestaticinherited

Definition at line 72 of file declaration.hpp.

73 {
74 return opaque{};
75 }

◆ get_secondary()

template<typename... Types>
secondary_type tim::component::gpu_roofline< Types >::get_secondary ( ) const
inline

Definition at line 586 of file gpu_roofline.hpp.

587 {
588 secondary_type ret;
589 switch(event_mode())
590 {
591 case MODE::ACTIVITY:
592 {
593 auto&& _tmp = m_data.activity->get_secondary();
594 for(auto&& itr : _tmp)
595 {
596 ret.insert(
597 { itr.first, value_type{ itr.second, counters_value_type{} } });
598 }
599 break;
600 }
601 case MODE::COUNTERS:
602 {
603 auto&& _tmp = m_data.counters->get_secondary();
604 for(auto&& itr : _tmp)
605 {
606 ret.insert(
607 { itr.first, value_type{ activity_value_type{}, itr.second } });
608 }
609 break;
610 }
611 }
612 return ret;
613 }
typename cupti_activity::value_type activity_value_type
std::unordered_multimap< std::string, value_type > secondary_type
typename cupti_counters::value_type counters_value_type
std::tuple< typename cupti_activity::value_type, typename cupti_counters::value_type > value_type

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

◆ get_type_string()

template<typename... Types>
static std::string tim::component::gpu_roofline< Types >::get_type_string ( )
inlinestatic

Definition at line 276 of file gpu_roofline.hpp.

277 {
278 return mpl::apply<std::string>::join('_', demangle(typeid(Types).name())...);
279 }
std::string demangle(const char *_mangled_name, int *_status=nullptr)
Definition: demangle.hpp:47
static string_t join(SepT &&separator, Tuple &&__tup, index_sequence< Idx... >) noexcept
Definition: apply.hpp:408

References tim::demangle(), and tim::mpl::apply< Ret >::join().

Referenced by tim::component::gpu_roofline< Types >::label(), and tim::component::gpu_roofline< Types >::save().

◆ global_finalize()

template<typename... Types>
static void tim::component::gpu_roofline< Types >::global_finalize ( storage_type _store)
inlinestatic

Definition at line 323 of file gpu_roofline.hpp.

324 {
325 // disable the activity/counters before running ERT
327 {
328 operation::fini<activity_type>{}(
329 operation::mode_constant<operation::fini_mode::global>{});
330 }
331 else
332 {
333 operation::fini<counters_type>{}(
334 operation::mode_constant<operation::fini_mode::global>{});
335 }
336
337 // run ERT
338 if(_store && _store->size() > 0)
339 {
340 assert(_store->is_finalizing());
341 // run roofline peak generation
342 auto ert_config = get_finalizer();
343 auto ert_data = get_ert_data();
344 mpl::apply<void>::access<ert_executor_t>(ert_config, ert_data);
345 if(ert_data && (settings::verbose() > 0 || settings::debug()))
346 std::cout << *(ert_data) << std::endl;
347 }
348 }
static ert_config_t & get_finalizer()

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::debug, tim::component::gpu_roofline< Types >::event_mode(), tim::component::gpu_roofline< Types >::get_ert_data(), tim::component::gpu_roofline< Types >::get_finalizer(), tim::component::empty_storage::size(), and tim::verbose.

◆ global_init()

template<typename... Types>
static void tim::component::gpu_roofline< Types >::global_init ( )
inlinestatic

Definition at line 299 of file gpu_roofline.hpp.

300 {
302 {
303 operation::init<activity_type>{}(
304 operation::mode_constant<operation::init_mode::global>{});
305 }
306 else
307 {
308 operation::init<counters_type>{}(
309 operation::mode_constant<operation::init_mode::global>{});
310 }
311 }

References tim::component::gpu_roofline< Types >::ACTIVITY, and tim::component::gpu_roofline< Types >::event_mode().

◆ label()

template<typename... Types>
static std::string tim::component::gpu_roofline< Types >::label ( )
inlinestatic

Definition at line 375 of file gpu_roofline.hpp.

376 {
378 {
379 auto ret = std::string("gpu_roofline_") + get_type_string() + "_" +
381 // erase consecutive underscores
382 while(ret.find("__") != std::string::npos)
383 ret.erase(ret.find("__"), 1);
384 return ret;
385 }
386
387 return std::string("gpu_roofline_") + get_mode_string();
388 }
roofline_type_labels_gpu
Definition: settings.cpp:1746
roofline_type_labels
Definition: settings.cpp:1742
static std::string get_type_string()
static std::string get_mode_string()

References tim::component::gpu_roofline< Types >::get_mode_string(), tim::component::gpu_roofline< Types >::get_type_string(), tim::roofline_type_labels, and tim::roofline_type_labels_gpu.

◆ label_array()

template<typename... Types>
static label_type tim::component::gpu_roofline< Types >::label_array ( )
inlinestatic

Definition at line 658 of file gpu_roofline.hpp.

658{ return this_type::get_labels(); }

◆ load()

template<typename... Types>
template<typename Archive >
void tim::component::gpu_roofline< Types >::load ( Archive &  ar,
const unsigned int   
)
inline

Definition at line 844 of file gpu_roofline.hpp.

845 {
846 std::string _disp;
847 result_type _data;
848 std::vector<std::string> _labels;
849 std::string _mode_str;
850 std::string _type_str;
851
852 ar(cereal::make_nvp("laps", laps), cereal::make_nvp("display", _disp),
853 cereal::make_nvp("mode", _mode_str), cereal::make_nvp("type", _type_str),
854 cereal::make_nvp("labels", _labels));
855
856 if(_mode_str == "counters")
857 {
859 }
860 else if(_mode_str == "activity")
861 {
863 }
864
865 _data.resize(_labels.size());
866
867 ar.setNextName("repr_data");
868 ar.startNode();
869 auto litr = _labels.begin();
870 auto ditr = _data.begin();
871 for(; litr != _labels.end() && ditr != _data.end(); ++litr, ++ditr)
872 ar(cereal::make_nvp(*litr, *ditr));
873 ar.finishNode();
874
875 ar.setNextName("value");
876 ar.startNode();
878 {
879 ar(std::get<0>(value));
880 }
881 else
882 {
883 ar(std::get<1>(value));
884 }
885 ar.finishNode();
886
887 ar.setNextName("accum");
888 ar.startNode();
890 {
891 ar(std::get<0>(accum));
892 }
893 else
894 {
895 ar(std::get<1>(accum));
896 }
897 ar.finishNode();
898 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, tim::component::gpu_roofline< Types >::event_mode(), and tim::component::base< gpu_roofline< Types... >, std::tuple< cupti_activity::value_type, cupti_counters::value_type > >::laps.

◆ operator+=() [1/2]

template<typename... Types>
this_type & tim::component::gpu_roofline< Types >::operator+= ( const this_type rhs)
inline

Definition at line 508 of file gpu_roofline.hpp.

509 {
510 switch(event_mode())
511 {
512 case MODE::ACTIVITY:
513 {
514 *m_data.activity += *rhs.m_data.activity;
515 std::get<0>(accum) = m_data.activity->get_accum();
516 std::get<0>(value) = m_data.activity->get_value();
517 break;
518 }
519 case MODE::COUNTERS:
520 {
521 *m_data.counters += *rhs.m_data.counters;
522 std::get<1>(accum) = m_data.counters->get_accum();
523 std::get<1>(value) = m_data.counters->get_value();
524 break;
525 }
526 }
527 return *this;
528 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

◆ operator+=() [2/2]

template<typename... Types>
this_type & tim::component::gpu_roofline< Types >::operator+= ( const value_type rhs)
inline

Definition at line 556 of file gpu_roofline.hpp.

557 {
558 switch(event_mode())
559 {
560 case MODE::ACTIVITY:
561 {
562 *m_data.activity += std::get<0>(rhs);
563 std::get<0>(accum) = m_data.activity->get_accum();
564 std::get<0>(value) = m_data.activity->get_value();
565 break;
566 }
567 case MODE::COUNTERS:
568 {
569 *m_data.counters += std::get<1>(rhs);
570 std::get<1>(accum) = m_data.counters->get_accum();
571 std::get<1>(value) = m_data.counters->get_value();
572 break;
573 }
574 }
575 return *this;
576 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

◆ operator-=()

template<typename... Types>
this_type & tim::component::gpu_roofline< Types >::operator-= ( const this_type rhs)
inline

Definition at line 532 of file gpu_roofline.hpp.

533 {
534 switch(event_mode())
535 {
536 case MODE::ACTIVITY:
537 {
538 *m_data.activity -= *rhs.m_data.activity;
539 std::get<0>(accum) = m_data.activity->get_accum();
540 std::get<0>(value) = m_data.activity->get_value();
541 break;
542 }
543 case MODE::COUNTERS:
544 {
545 *m_data.counters -= *rhs.m_data.counters;
546 std::get<1>(accum) = m_data.counters->get_accum();
547 std::get<1>(value) = m_data.counters->get_value();
548 break;
549 }
550 }
551 return *this;
552 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

◆ operator=() [1/2]

template<typename... Types>
gpu_roofline & tim::component::gpu_roofline< Types >::operator= ( const gpu_roofline< Types > &  rhs)
inline

Definition at line 435 of file gpu_roofline.hpp.

436 {
437 if(this != &rhs)
438 {
439 base_type::operator=(rhs);
440 m_data = rhs.m_data;
441 }
442 return *this;
443 }

◆ operator=() [2/2]

template<typename... Types>
gpu_roofline & tim::component::gpu_roofline< Types >::operator= ( gpu_roofline< Types > &&  )
defaultnoexcept

◆ record()

template<typename... Types>
static value_type tim::component::gpu_roofline< Types >::record ( )
inlinestatic

◆ save()

template<typename... Types>
template<typename Archive >
void tim::component::gpu_roofline< Types >::save ( Archive &  ar,
const unsigned int   
) const
inline

Definition at line 795 of file gpu_roofline.hpp.

796 {
797 auto _disp = get_display();
798 auto _data = get();
799 auto _labels = get_labels();
800
801 ar(cereal::make_nvp("laps", laps), cereal::make_nvp("display", _disp),
802 cereal::make_nvp("mode", get_mode_string()),
803 cereal::make_nvp("type", get_type_string()),
804 cereal::make_nvp("labels", _labels));
805
806 ar.setNextName("repr_data");
807 ar.startNode();
808 auto litr = _labels.begin();
809 auto ditr = _data.begin();
810 for(; litr != _labels.end() && ditr != _data.end(); ++litr, ++ditr)
811 ar(cereal::make_nvp(*litr, *ditr));
812 ar.finishNode();
813
814 ar.setNextName("value");
815 ar.startNode();
816 ar.makeArray();
818 {
819 ar(std::get<0>(value));
820 }
821 else
822 {
823 ar(std::get<1>(value));
824 }
825 ar.finishNode();
826
827 ar.setNextName("accum");
828 ar.startNode();
829 ar.makeArray();
831 {
832 ar(std::get<0>(accum));
833 }
834 else
835 {
836 ar(std::get<1>(accum));
837 }
838 ar.finishNode();
839 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::event_mode(), tim::component::gpu_roofline< Types >::get(), tim::component::gpu_roofline< Types >::get_display(), tim::component::gpu_roofline< Types >::get_mode_string(), tim::component::gpu_roofline< Types >::get_type_string(), and tim::component::base< gpu_roofline< Types... >, std::tuple< cupti_activity::value_type, cupti_counters::value_type > >::laps.

◆ set_executor_callback()

template<typename... Types>
template<typename Tp , typename FuncT >
static void tim::component::gpu_roofline< Types >::set_executor_callback ( FuncT &&  f)
inlinestatic

Definition at line 316 of file gpu_roofline.hpp.

317 {
318 ert_executor_type<Tp>::get_callback() = std::forward<FuncT>(f);
319 }
static callback_type & get_callback()

References tim::ert::executor< DeviceT, Tp, CounterT >::get_callback().

◆ start()

template<typename... Types>
void tim::component::gpu_roofline< Types >::start ( )
inline

Definition at line 463 of file gpu_roofline.hpp.

464 {
465 switch(event_mode())
466 {
467 case MODE::ACTIVITY:
468 {
469 m_data.activity->start();
470 std::get<0>(value) = m_data.activity->get_value();
471 break;
472 }
473 case MODE::COUNTERS:
474 {
475 m_data.counters->start();
476 std::get<1>(value) = m_data.counters->get_value();
477 break;
478 }
479 }
480 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

◆ stop()

template<typename... Types>
void tim::component::gpu_roofline< Types >::stop ( )
inline

Definition at line 484 of file gpu_roofline.hpp.

485 {
486 using namespace tim::component::operators;
487 switch(event_mode())
488 {
489 case MODE::ACTIVITY:
490 {
491 m_data.activity->stop();
492 std::get<0>(accum) = m_data.activity->get_accum();
493 std::get<0>(value) = m_data.activity->get_value();
494 break;
495 }
496 case MODE::COUNTERS:
497 {
498 m_data.counters->stop();
499 std::get<1>(accum) = m_data.counters->get_accum();
500 std::get<1>(value) = m_data.counters->get_value();
501 break;
502 }
503 }
504 }

References tim::component::gpu_roofline< Types >::ACTIVITY, tim::component::gpu_roofline< Types >::COUNTERS, and tim::component::gpu_roofline< Types >::event_mode().

◆ thread_finalize()

template<typename... Types>
static void tim::component::gpu_roofline< Types >::thread_finalize ( )
inlinestatic

Definition at line 353 of file gpu_roofline.hpp.

353{}

◆ thread_init()

template<typename... Types>
static void tim::component::gpu_roofline< Types >::thread_init ( )
inlinestatic

Definition at line 352 of file gpu_roofline.hpp.

352{}

◆ unit()

Friends And Related Function Documentation

◆ impl::storage< this_type, trait::uses_value_storage< this_type, value_type >::value >

template<typename... Types>
friend class impl::storage< this_type, trait::uses_value_storage< this_type, value_type >::value >
friend

Definition at line 586 of file gpu_roofline.hpp.

◆ operation::record< this_type >

template<typename... Types>
friend struct operation::record< this_type >
friend

Definition at line 1 of file gpu_roofline.hpp.

◆ operation::set_started< this_type >

template<typename... Types>
friend struct operation::set_started< this_type >
friend

Definition at line 1 of file gpu_roofline.hpp.

◆ operation::set_stopped< this_type >

template<typename... Types>
friend struct operation::set_stopped< this_type >
friend

Definition at line 1 of file gpu_roofline.hpp.

◆ operation::start< this_type >

template<typename... Types>
friend struct operation::start< this_type >
friend

Definition at line 1 of file gpu_roofline.hpp.

◆ operation::stop< this_type >

template<typename... Types>
friend struct operation::stop< this_type >
friend

Definition at line 1 of file gpu_roofline.hpp.

◆ operator<<

template<typename... Types>
std::ostream & operator<< ( std::ostream &  os,
const this_type obj 
)
friend

Definition at line 650 of file gpu_roofline.hpp.

651 {
652 os << as_string(obj.get_display());
653 return os;
654 }
const std::string std::ostream * os

Member Data Documentation

◆ precision

template<typename... Types>
const short tim::component::gpu_roofline< Types >::precision = 3
static

Definition at line 118 of file gpu_roofline.hpp.

◆ width

template<typename... Types>
const short tim::component::gpu_roofline< Types >::width = 8
static

Definition at line 119 of file gpu_roofline.hpp.


The documentation for this struct was generated from the following file: