NVTX  v3
NVIDIA Tools Extension Library
nvToolsExtCudaRt.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 #include "driver_types.h"
13 
14 #ifndef NVTOOLSEXT_CUDART_V3
15 #define NVTOOLSEXT_CUDART_V3
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
20 
21 /* ========================================================================= */
33 /* ------------------------------------------------------------------------- */
34 /* \cond SHOW_HIDDEN
35 * \brief Used to build a non-colliding value for resource types separated class
36 * \version \NVTX_VERSION_2
37 */
38 #define NVTX_RESOURCE_CLASS_CUDART 5
39 
41 /* ------------------------------------------------------------------------- */
45 {
46  NVTX_RESOURCE_TYPE_CUDART_DEVICE = NVTX_RESOURCE_MAKE_TYPE(CUDART, 0), /* int device */
47  NVTX_RESOURCE_TYPE_CUDART_STREAM = NVTX_RESOURCE_MAKE_TYPE(CUDART, 1), /* cudaStream_t */
48  NVTX_RESOURCE_TYPE_CUDART_EVENT = NVTX_RESOURCE_MAKE_TYPE(CUDART, 2), /* cudaEvent_t */
50 
51 
52 /* ------------------------------------------------------------------------- */
62 NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceA(int device, const char* name);
63 NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceW(int device, const wchar_t* name);
66 /* ------------------------------------------------------------------------- */
76 NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamA(cudaStream_t stream, const char* name);
77 NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamW(cudaStream_t stream, const wchar_t* name);
80 /* ------------------------------------------------------------------------- */
90 NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventA(cudaEvent_t event, const char* name);
91 NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventW(cudaEvent_t event, const wchar_t* name); /* END RESOURCE_NAMING */
95 
96 /* ========================================================================= */
97 #ifdef UNICODE
98  #define nvtxNameCudaDevice nvtxNameCudaDeviceW
99  #define nvtxNameCudaStream nvtxNameCudaStreamW
100  #define nvtxNameCudaEvent nvtxNameCudaEventW
101 #else
102  #define nvtxNameCudaDevice nvtxNameCudaDeviceA
103  #define nvtxNameCudaStream nvtxNameCudaStreamA
104  #define nvtxNameCudaEvent nvtxNameCudaEventA
105 #endif
106 
107 #ifdef __cplusplus
108 }
109 #endif /* __cplusplus */
110 
111 #ifndef NVTX_NO_IMPL
112 #define NVTX_IMPL_GUARD_CUDART /* Ensure other headers cannot included directly */
113 #include "nvtxDetail/nvtxImplCudaRt_v3.h"
114 #undef NVTX_IMPL_GUARD_CUDART
115 #endif /*NVTX_NO_IMPL*/
116 
117 #endif /* NVTOOLSEXT_CUDART_V3 */
NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceA(int device, const char *name)
Annotates a CUDA device.
NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventA(cudaEvent_t event, const char *name)
Annotates a CUDA event.
nvtxResourceCUDARTType_t
Resource types for CUDART.
NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamA(cudaStream_t stream, const char *name)
Annotates a CUDA stream.