NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
nvToolsExtCudaRt.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2009-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Licensed under the Apache License v2.0 with LLVM Exceptions.
18 * See https://nvidia.github.io/NVTX/LICENSE.txt for license information.
19 */
20
21#if defined(NVTX_AS_SYSTEM_HEADER)
22#if defined(__clang__)
23#pragma clang system_header
24#elif defined(__GNUC__) || defined(__NVCOMPILER)
25#pragma GCC system_header
26#elif defined(_MSC_VER)
27#pragma system_header
28#endif
29#endif
30
31#include "nvToolsExt.h"
32
33#include "cuda.h"
34#include "driver_types.h"
35
36#ifndef NVTOOLSEXT_CUDART_V3
37#define NVTOOLSEXT_CUDART_V3
38
39#ifdef __cplusplus
40extern "C" {
41#endif /* __cplusplus */
42
43/* ========================================================================= */
55/* ------------------------------------------------------------------------- */
56/* \cond SHOW_HIDDEN
57* \brief Used to build a non-colliding value for resource types separated class
58* \version NVTX_VERSION_2
59*/
60#define NVTX_RESOURCE_CLASS_CUDART 5
63/* ------------------------------------------------------------------------- */
67{
68 NVTX_RESOURCE_TYPE_CUDART_DEVICE = NVTX_RESOURCE_MAKE_TYPE(CUDART, 0), /* int device */
69 NVTX_RESOURCE_TYPE_CUDART_STREAM = NVTX_RESOURCE_MAKE_TYPE(CUDART, 1), /* cudaStream_t */
70 NVTX_RESOURCE_TYPE_CUDART_EVENT = NVTX_RESOURCE_MAKE_TYPE(CUDART, 2) /* cudaEvent_t */
72
73
74/* ------------------------------------------------------------------------- */
84NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceA(int device, const char* name);
85NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceW(int device, const wchar_t* name);
88/* ------------------------------------------------------------------------- */
98NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamA(cudaStream_t stream, const char* name);
99NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamW(cudaStream_t stream, const wchar_t* name);
102/* ------------------------------------------------------------------------- */
112NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventA(cudaEvent_t event, const char* name);
113NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventW(cudaEvent_t event, const wchar_t* name);
/* END RESOURCE_NAMING */
117
118/* ========================================================================= */
119#ifdef UNICODE
120 #define nvtxNameCudaDevice nvtxNameCudaDeviceW
121 #define nvtxNameCudaStream nvtxNameCudaStreamW
122 #define nvtxNameCudaEvent nvtxNameCudaEventW
123#else
124 #define nvtxNameCudaDevice nvtxNameCudaDeviceA
125 #define nvtxNameCudaStream nvtxNameCudaStreamA
126 #define nvtxNameCudaEvent nvtxNameCudaEventA
127#endif
128
129#ifdef __cplusplus
130}
131#endif /* __cplusplus */
132
133#ifndef NVTX_NO_IMPL
134#define NVTX_IMPL_GUARD_CUDART /* Ensure other headers cannot be included directly */
135#include "nvtxDetail/nvtxImplCudaRt_v3.h"
136#undef NVTX_IMPL_GUARD_CUDART
137#endif /*NVTX_NO_IMPL*/
138
139#endif /* NVTOOLSEXT_CUDART_V3 */
nvtxResourceCUDARTType_t
Resource types for CUDART.
NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceA(int device, const char *name)
Annotates a CUDA device.
NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamA(cudaStream_t stream, const char *name)
Annotates a CUDA stream.
NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventA(cudaEvent_t event, const char *name)
Annotates a CUDA event.