mirror of
https://github.com/wolfpld/tracy.git
synced 2026-09-01 07:58:31 +00:00
Refine tracy cuda documentation
This commit is contained in:
@@ -1694,13 +1694,17 @@ Similar to Vulkan and OpenGL, you also need to periodically collect the OpenCL e
|
||||
|
||||
\subsubsection{CUDA}
|
||||
|
||||
CUDA support is enabled by including the \texttt{public/tracy/TracyCUDA.hpp} header file. Tracing CUDA requires the creation of a Tracy CUDA context using the macro \texttt{TracyCUDAContext()}, which returns an instance of a \texttt{TracyCUDACtx} object. This context must be used when profiling CUDA events. Cleanup is handled using the \texttt{TracyCUDAContextDestroy(ctx)} macro. To assign a custom name to the context, use the \texttt{TracyCUDAContextName(ctx, name, size)} macro.
|
||||
CUDA support is enabled by including the \texttt{public/tracy/TracyCUDA.hpp} header file. To use it, the NVIDIA CUPTI library is required. This library comes with the NVIDIA CUDA Toolkit and is located at \texttt{CUDA\_INSTALLATION\_PATH/extras/CUPTI}.
|
||||
|
||||
To begin profiling CUDA events, call the \texttt{TracyCUDAStartProfiling(ctx)} macro. This initiates the profiling of CUDA events, and GPU zones for key CUDA activities will be created automatically.
|
||||
Tracing CUDA requires the creation of a Tracy CUDA context using the macro \texttt{TracyCUDAContext()}, which returns an instance of a \texttt{TracyCUDACtx} object. TracyCUDA allows only a single \texttt{TracyCUDACtx} object at any given time. Subsequent calls to \texttt{TracyCUDAContext()} will return the same reference-counted object. There is no need for clients to instantiate multiple \texttt{TracyCUDACtx} objects, as a single context is capable of instrumenting all CUDA contexts and streams. This context must be used when profiling CUDA events.
|
||||
|
||||
The \texttt{TracyCUDACollect(ctx)} macro flushes CUDA activities and collects the associated events, resulting in the creation of GPU zones. This step is optional, as the collector thread is enabled by default.
|
||||
Cleanup is handled using the \texttt{TracyCUDAContextDestroy(ctx)} macro. To assign a custom name to the context, use the \texttt{TracyCUDAContextName(ctx, name, size)} macro.
|
||||
|
||||
To stop profiling, call the \texttt{TracyCUDAStopProfiling(ctx)} macro. This terminates the profiling of CUDA events.
|
||||
To begin instrumentation of all CUDA API calls, use the \texttt{TracyCUDAStartProfiling(ctx)} macro. This initiates the profiling of CUDA events, including relevant GPU activity such as kernel execution, memory transfers, and synchronization. This instrumentation is automatic and requires no code annotation\footnote{CUDA does not provide an API to retrieve timestamps associated with events. Therefore, the typical GPU instrumentation design of Tracy cannot be applied.}.
|
||||
|
||||
Unlike other GPU backends in Tracy, there is no need to call \texttt{TracyCUDACollect(ctx)} periodically, since a background collector thread is enabled by default. This behavior can be disabled by defining \texttt{TRACY\_CUDA\_ENABLE\_COLLECTOR\_THREAD} as \texttt{0} prior to including \texttt{TracyCUDA.hpp}.
|
||||
|
||||
To stop profiling, call the \texttt{TracyCUDAStopProfiling(ctx)} macro.
|
||||
|
||||
\subsubsection{Multiple zones in one scope}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user