NVIDIA® Nsight™ Application Development Environment for Heterogeneous Platforms, Visual Studio Edition 5.2 User Guide
Send Feedback
With NVIDIA Nsight, it is possible to attach the Visual Studio debugger to a free-running CUDA application. This feature requires some one-time setup and setting additional environment variables when you launch programs that you wish to debug. The required steps are outlined below.
This setting is required to allow the Nsight Monitor to attach to free-running CUDA applications. It only needs to be configured one time after installing NVIDIA Nsight.
To make a process CUDA-attachable, you must set the environment variable NSIGHT_CUDA_DEBUGGER=1
. The strict requirement is that the environment variable must be set before the application calls cuInit()
. If the application uses the CUDA Runtime API, the environment variable must be set before the first CUDA Runtime API call is made.
Since environment variables are typically inherited by child processes, setting NSIGHT_CUDA_DEBUGGER=1
in a parent process that launches child processes will usually make the child processes CUDA-debuggable as well. Launcher processes and cluster nodes can benefit from this.
Setting It is not recommended that you set |
This will open the Attach to Process dialog box.
Note that this field is blank by default; you will have to manually select your machine name the first time this dialog is opened.
NSIGHT_CUDA_DEBUGGER
environment variable is not set in that process. To end, choose Debug > Stop Debugging. Note that this will terminate the application.
The following dialog is shown when an attachable process hits a GPU exception. A GPU exception can be an MMU fault, inline breakpoint (asm("brkpt;");
in CUDA C), or other abnormal condition.
For safety reasons, the dialog will not be shown if any desktop GPUs are currently debugging in hardware mode, and the GPU will automatically resume. While detailed GPU inspection requires an attached Visual Studio instance, the dialog displays the faulting device name, CUcontext
, kernel (mangled name), and the reason for the exception:
The following options are available:
Canceling or closing this new dialog returns to the original dialog. The dialog automatically closes and reports the exception when the CUDA debugger attaches.
NVIDIA® Nsight™ Application Development Environment for Heterogeneous Platforms, Visual Studio Edition User Guide Rev. 5.2.161206 ©2009-2016. NVIDIA Corporation. All Rights Reserved.