Troubleshoot Profiling of CUDA Programs using nsight Compute

# Add a conf
sudo vim /etc/modprobe.d/debug-cuda-gpu.conf
options nvidia NVreg_RestrictProfilingToAdminUsers=0 

# update and reboot 
sudo update-initramfs -u -k all
reboot

# open nsight compute using sudo 
sudo /usr/local/cuda/bin/ncu-ui

Error before fixing!

Launched process: ncu (pid: 112990)
/usr/local/cuda-12.2/nsight-compute-2023.2.2/target/linux-desktop-glibc_2_11_3-x64/ncu --config-file off --export /home/rajesh/learn/saxpy/a.cu.profile --force-overwrite --set full /home/rajesh/learn/saxpy/axplusy.out
Launch succeeded.
Profiling...
==PROF== Connected to process 113001 (/home/rajesh/learn/saxpy/axplusy.out)

==ERROR== ERR_NVGPUCTRPERM - The user does not have permission to access NVIDIA GPU Performance Counters on the target device 0. For instructions on enabling permissions and to get more information see https://developer.nvidia.com/ERR_NVGPUCTRPERM

==PROF== Disconnected from process 113001

==WARNING== No kernels were profiled.

==WARNING== Profiling kernels launched by child processes requires the --target-processes all option.

Process terminated.
★ 2 min read · Rajesh Pandian M · cuda , debug , compute