NVTX  v3
NVIDIA Tools Extension Library
nvToolsExtCuda.h
1 /*
2 * Copyright 2009-2020 NVIDIA Corporation. All rights reserved.
3 *
4 * Licensed under the Apache License v2.0 with LLVM Exceptions.
5 * See https://llvm.org/LICENSE.txt for license information.
6 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 */
8 
9 #include "nvToolsExt.h"
10 
11 #include "cuda.h"
12 
13 #ifndef NVTOOLSEXT_CUDA_V3
14 #define NVTOOLSEXT_CUDA_V3
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 /* ========================================================================= */
32 /* ------------------------------------------------------------------------- */
33 /* \cond SHOW_HIDDEN
34 * \brief Used to build a non-colliding value for resource types separated class
35 * \version \NVTX_VERSION_2
36 */
37 #define NVTX_RESOURCE_CLASS_CUDA 4
38 
40 /* ------------------------------------------------------------------------- */
44 {
45  NVTX_RESOURCE_TYPE_CUDA_DEVICE = NVTX_RESOURCE_MAKE_TYPE(CUDA, 1), /* CUdevice */
46  NVTX_RESOURCE_TYPE_CUDA_CONTEXT = NVTX_RESOURCE_MAKE_TYPE(CUDA, 2), /* CUcontext */
47  NVTX_RESOURCE_TYPE_CUDA_STREAM = NVTX_RESOURCE_MAKE_TYPE(CUDA, 3), /* CUstream */
48  NVTX_RESOURCE_TYPE_CUDA_EVENT = NVTX_RESOURCE_MAKE_TYPE(CUDA, 4), /* CUevent */
50 
51 
52 /* ------------------------------------------------------------------------- */
62 NVTX_DECLSPEC void NVTX_API nvtxNameCuDeviceA(CUdevice device, const char* name);
63 NVTX_DECLSPEC void NVTX_API nvtxNameCuDeviceW(CUdevice device, const wchar_t* name);
66 /* ------------------------------------------------------------------------- */
84 NVTX_DECLSPEC void NVTX_API nvtxNameCuContextA(CUcontext context, const char* name);
85 NVTX_DECLSPEC void NVTX_API nvtxNameCuContextW(CUcontext context, const wchar_t* name);
88 /* ------------------------------------------------------------------------- */
98 NVTX_DECLSPEC void NVTX_API nvtxNameCuStreamA(CUstream stream, const char* name);
99 NVTX_DECLSPEC void NVTX_API nvtxNameCuStreamW(CUstream stream, const wchar_t* name);
102 /* ------------------------------------------------------------------------- */
112 NVTX_DECLSPEC void NVTX_API nvtxNameCuEventA(CUevent event, const char* name);
113 NVTX_DECLSPEC void NVTX_API nvtxNameCuEventW(CUevent event, const wchar_t* name); /* END RESOURCE_NAMING */
117 
118 /* ========================================================================= */
119 #ifdef UNICODE
120  #define nvtxNameCuDevice nvtxNameCuDeviceW
121  #define nvtxNameCuContext nvtxNameCuContextW
122  #define nvtxNameCuStream nvtxNameCuStreamW
123  #define nvtxNameCuEvent nvtxNameCuEventW
124 #else
125  #define nvtxNameCuDevice nvtxNameCuDeviceA
126  #define nvtxNameCuContext nvtxNameCuContextA
127  #define nvtxNameCuStream nvtxNameCuStreamA
128  #define nvtxNameCuEvent nvtxNameCuEventA
129 #endif
130 
131 #ifdef __cplusplus
132 }
133 #endif /* __cplusplus */
134 
135 #ifndef NVTX_NO_IMPL
136 #define NVTX_IMPL_GUARD_CUDA /* Ensure other headers cannot included directly */
137 #include "nvtxDetail/nvtxImplCuda_v3.h"
138 #undef NVTX_IMPL_GUARD_CUDA
139 #endif /*NVTX_NO_IMPL*/
140 
141 #endif /* NVTOOLSEXT_CUDA_V3 */
NVTX_DECLSPEC void NVTX_API nvtxNameCuDeviceA(CUdevice device, const char *name)
Annotates a CUDA device.
nvtxResourceCUDAType_t
Resource types for CUDA.
NVTX_DECLSPEC void NVTX_API nvtxNameCuContextA(CUcontext context, const char *name)
Annotates a CUDA context.
NVTX_DECLSPEC void NVTX_API nvtxNameCuStreamA(CUstream stream, const char *name)
Annotates a CUDA stream.
NVTX_DECLSPEC void NVTX_API nvtxNameCuEventA(CUevent event, const char *name)
Annotates a CUDA event.