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::openmp::callback_connector< Components, Api > Struct Template Reference

#include "timemory/components/ompt/tool.hpp"

+ Collaboration diagram for tim::openmp::callback_connector< Components, Api >:

Public Types

using api_type = Api
 
using type = Components
 
using result_type = std::shared_ptr< type >
 
using array_type = std::deque< result_type >
 
using map_type = std::unordered_map< size_t, array_type >
 
using handle_type = component::ompt_handle< api_type >
 

Public Member Functions

template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::begin_callback >::value, int > = 0>
 callback_connector (T, Args... args)
 
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::end_callback >::value, int > = 0>
 callback_connector (T, Args... args)
 
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::store_callback >::value, int > = 0>
 callback_connector (T, Args... args)
 
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
 callback_connector (T, ompt_scope_endpoint_t endp, Args... args)
 
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
 callback_connector (T, ompt_work_t workv, ompt_scope_endpoint_t endp, Args... args)
 
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
 callback_connector (T, ompt_sync_region_t syncv, ompt_scope_endpoint_t endp, Args... args)
 
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
 callback_connector (T, ompt_target_t targv, ompt_scope_endpoint_t endp, Args... args)
 

Static Public Member Functions

static bool is_enabled ()
 

Protected Member Functions

template<typename T , typename Arg , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
void generic_endpoint_connector (T, Arg arg, ompt_scope_endpoint_t endp, Args... args)
 

Detailed Description

template<typename Components, typename Api>
struct tim::openmp::callback_connector< Components, Api >

Definition at line 646 of file tool.hpp.

Member Typedef Documentation

◆ api_type

template<typename Components , typename Api >
using tim::openmp::callback_connector< Components, Api >::api_type = Api

Definition at line 648 of file tool.hpp.

◆ array_type

template<typename Components , typename Api >
using tim::openmp::callback_connector< Components, Api >::array_type = std::deque<result_type>

Definition at line 651 of file tool.hpp.

◆ handle_type

template<typename Components , typename Api >
using tim::openmp::callback_connector< Components, Api >::handle_type = component::ompt_handle<api_type>

Definition at line 653 of file tool.hpp.

◆ map_type

template<typename Components , typename Api >
using tim::openmp::callback_connector< Components, Api >::map_type = std::unordered_map<size_t, array_type>

Definition at line 652 of file tool.hpp.

◆ result_type

template<typename Components , typename Api >
using tim::openmp::callback_connector< Components, Api >::result_type = std::shared_ptr<type>

Definition at line 650 of file tool.hpp.

◆ type

template<typename Components , typename Api >
using tim::openmp::callback_connector< Components, Api >::type = Components

Definition at line 649 of file tool.hpp.

Constructor & Destructor Documentation

◆ callback_connector() [1/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::store_callback >::value, int > >
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
Args...  args 
)

Definition at line 734 of file tool.hpp.

735{
736 if(!is_enabled())
737 return;
738
739 context_handler<api_type> ctx(args...);
740 user_context_callback(ctx, ctx.m_key, args...);
741
742 // don't provide empty entries
743 if(ctx.empty())
744 return;
745
746 user_context_callback<type>(ctx, T{}, std::forward<Args>(args)...);
747}

References tim::openmp::context_handler< Api >::empty(), and tim::openmp::context_handler< Api >::m_key.

◆ callback_connector() [2/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::end_callback >::value, int > = 0>
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
Args...  args 
)

◆ callback_connector() [3/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::store_callback >::value, int > = 0>
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
Args...  args 
)

◆ callback_connector() [4/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > >
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
ompt_scope_endpoint_t  endp,
Args...  args 
)

Definition at line 794 of file tool.hpp.

796{
797 if(!is_enabled())
798 return;
799
800 context_handler<api_type> ctx(endp, args...);
801 user_context_callback(ctx, ctx.m_key, endp, args...);
802
803 // don't provide empty entries
804 if(ctx.empty())
805 return;
806
807 user_context_callback<type>(ctx, T{}, endp, std::forward<Args>(args)...);
808}

References tim::openmp::context_handler< Api >::empty(), and tim::openmp::context_handler< Api >::m_key.

◆ callback_connector() [5/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
ompt_work_t  workv,
ompt_scope_endpoint_t  endp,
Args...  args 
)
inline

Definition at line 690 of file tool.hpp.

691 {
692 if(!is_enabled())
693 return;
694 generic_endpoint_connector(T{}, workv, endp, args...);
695 }
void generic_endpoint_connector(T, Arg arg, ompt_scope_endpoint_t endp, Args... args)
Definition: tool.hpp:816

References tim::openmp::callback_connector< Components, Api >::generic_endpoint_connector(), and tim::openmp::callback_connector< Components, Api >::is_enabled().

◆ callback_connector() [6/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
ompt_sync_region_t  syncv,
ompt_scope_endpoint_t  endp,
Args...  args 
)
inline

◆ callback_connector() [7/7]

template<typename Components , typename Api >
template<typename T , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > = 0>
tim::openmp::callback_connector< Components, Api >::callback_connector ( ,
ompt_target_t  targv,
ompt_scope_endpoint_t  endp,
Args...  args 
)
inline

Member Function Documentation

◆ generic_endpoint_connector()

template<typename Components , typename Api >
template<typename T , typename Arg , typename... Args, enable_if_t< std::is_same< T, mode::endpoint_callback >::value, int > >
void tim::openmp::callback_connector< Components, Api >::generic_endpoint_connector ( ,
Arg  arg,
ompt_scope_endpoint_t  endp,
Args...  args 
)
protected

Definition at line 816 of file tool.hpp.

818{
819 context_handler<api_type> ctx(arg, endp, args...);
820 user_context_callback(ctx, ctx.m_key, arg, endp, args...);
821
822 // don't provide empty entries
823 if(ctx.empty())
824 return;
825
826 user_context_callback<type>(ctx, T{}, std::forward<Arg>(arg), endp,
827 std::forward<Args>(args)...);
828}

References tim::openmp::context_handler< Api >::empty(), and tim::openmp::context_handler< Api >::m_key.

Referenced by tim::openmp::callback_connector< Components, Api >::callback_connector().

◆ is_enabled()

template<typename Components , typename Api >
static bool tim::openmp::callback_connector< Components, Api >::is_enabled ( )
inlinestatic

Definition at line 655 of file tool.hpp.

656 {
657 if(!manager::instance() ||
658 (manager::instance() && manager::instance()->is_finalizing()))
659 {
662 return false;
663 }
664
665 DEBUG_PRINT_HERE("[timemory-ompt]> %s :: handle enabled = %s",
666 demangle<type>().c_str(),
668
670 }
static pointer_t instance()
Get a shared pointer to the instance for the current thread.
static bool get(enable_if_t< is_available< U >::value &&get_value< U >(), int >=0)
GET specialization if component is available.
static bool set(bool val, enable_if_t< is_available< U >::value &&get_value< U >(), int >=0)
SET specialization if component is available.
#define DEBUG_PRINT_HERE(...)
Definition: macros.hpp:168

References DEBUG_PRINT_HERE, tim::manager::instance(), and tim::trait::runtime_enabled< T >::set().

Referenced by tim::openmp::callback_connector< Components, Api >::callback_connector().


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