cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
profiling.hpp File Reference

wrappers for the CUDA profiler API functions, and convenience RAII classes for profiler-output-marked time range and points. More...

#include "../api/types.hpp"
#include "../api/error.hpp"
#include "../api/current_context.hpp"
#include "../api/stream.hpp"
#include "../api/event.hpp"
#include "../api/device.hpp"
#include "../api/multi_wrapper_impls/context.hpp"
#include <cudaProfiler.h>
#include <nvToolsExt.h>
#include <nvToolsExtCuda.h>
#include <mutex>
#include <cstdint>
#include <string>
#include <thread>
Include dependency graph for profiling.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cuda::profiling::color_t
 An RGB colorspace color value, with potential transparency, which may be used to color elements in timelines or other graphical displays of profiling information. More...
 
class  cuda::profiling::scoped_range_marker
 A RAII/CADRe class whose scope of existence is reflected as a range in the profiler. More...
 
class  cuda::profiling::scope
 A class to instantiate in the part of your application which does any work you intend to use the CUDA profiler to profile. More...
 

Namespaces

 cuda
 Definitions and functionality wrapping CUDA APIs.
 
 cuda::profiling
 Interaction with NVIDIA's profiler, particularly tagging, marking and indications of entities it will pick up and register/display.
 
 cuda::profiling::range
 definitions related to profiled ranges and the range_t class
 
 cuda::profiling::mark
 definitions related to marking individual time points in the profiler timeline
 

Macros

#define CUDA_API_WRAPPERS_PROFILING_HPP_
 
#define profile_this_scope()   ::cuda::profiling::scope cuda_profiling_scope_{};
 

Typedefs

using cuda::profiling::range::handle_t = nvtxRangeId_t
 The raw handle of a CUDA profiling range.
 

Enumerations

enum  cuda::profiling::range::type_t {
  unspecified,
  kernel,
  pci_express_transfer
}
 Types of profiled ranges we recognize. More...
 

Functions

template<typename CharT >
void cuda::profiling::mark::point (const CharT *description, color_t color=color_t::Black())
 Mark a single point on the profiler timeline, giving it also a color and some descriptive text.
 
template<typename CharT >
range::handle_t cuda::profiling::mark::range_start (const CharT *description, range::type_t type=range::type_t::unspecified, color_t color=color_t::LightRed())
 Mark the beginning of a range on the profiler timeline, giving it also a color and some descriptive text. More...
 
void cuda::profiling::mark::range_end (range::handle_t range_handle)
 Mark the end of a range, using the handle obtained when previously marking its beginning. More...
 
void cuda::profiling::start ()
 Start CUDA profiling for the current process.
 
void cuda::profiling::stop ()
 Stop CUDA profiling for the current process.
 
template<typename CharT >
void cuda::profiling::name (const ::std::thread &host_thread, const CharT *name)
 Have the profiler refer to a given host thread, using a specified string identifier (rather than its numeric ID). More...
 
template<typename CharT >
void cuda::profiling::name_this_thread (const CharT *name)
 Have the profiler refer to the current thread using a specified string identifier (rather than its numeric ID). More...
 
template<typename CharT >
void cuda::profiling::name (const stream_t &stream, const CharT *name)
 Have the profile assign a name to a certain stream.
 
template<typename CharT >
void cuda::profiling::name (const event_t &event, const CharT *name)
 Have the profile assign a name to a certain event.
 
template<typename CharT >
void cuda::profiling::name (const device_t &device, const CharT *name)
 Have the profile assign a name to a certain CUDA device.
 

Detailed Description

wrappers for the CUDA profiler API functions, and convenience RAII classes for profiler-output-marked time range and points.