cuda - ncu permission problem with the error "ERR_NVGPUCTRPERM" - Stack Overflow

I've been trying to profile CUDA program with ncu on wsl2 Ubuntu-20.04 in windows 11Commandncu .

I've been trying to profile CUDA program with ncu on wsl2 Ubuntu-20.04 in windows 11

Command

ncu ./my_cuda_program

Error

==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 

What I Tried

  • Reference:
  1. Make a file named cuda.conf in /etc/modprobe.d directory
  2. Add "options nvidia NVreg_RestrictProfilingToAdminUsers=0" in cuda.conf
  3. Run sudo update-initramfs -u on shell

This doesn't work and it shows same error

Environment

  • windows 11
  • wsl2, ubuntu 20.04
  • NVIDIA Geforce GTX 1660 SUPER

nvidia-smi

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.124.03             Driver Version: 572.60         CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1660 ...    On  |   00000000:01:00.0  On |                  N/A |
| 45%   42C    P0             36W /  125W |    1387MiB /   6144MiB |      1%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A              31      G   /Xwayland                             N/A      |
+-----------------------------------------------------------------------------------------+

ncu --version

NVIDIA (R) Nsight Compute Command Line Profiler
Copyright (c) 2018-2024 NVIDIA Corporation
Version 2025.1.0.0 (build 35237751) (public-release)

I've been trying to profile CUDA program with ncu on wsl2 Ubuntu-20.04 in windows 11

Command

ncu ./my_cuda_program

Error

==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/ERR_NVGPUCTRPERM

What I Tried

  • Reference: https://developer.nvidia/nvidia-development-tools-solutions-err_nvgpuctrperm-permission-issue-performance-counters
  1. Make a file named cuda.conf in /etc/modprobe.d directory
  2. Add "options nvidia NVreg_RestrictProfilingToAdminUsers=0" in cuda.conf
  3. Run sudo update-initramfs -u on shell

This doesn't work and it shows same error

Environment

  • windows 11
  • wsl2, ubuntu 20.04
  • NVIDIA Geforce GTX 1660 SUPER

nvidia-smi

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.124.03             Driver Version: 572.60         CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1660 ...    On  |   00000000:01:00.0  On |                  N/A |
| 45%   42C    P0             36W /  125W |    1387MiB /   6144MiB |      1%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A              31      G   /Xwayland                             N/A      |
+-----------------------------------------------------------------------------------------+

ncu --version

NVIDIA (R) Nsight Compute Command Line Profiler
Copyright (c) 2018-2024 NVIDIA Corporation
Version 2025.1.0.0 (build 35237751) (public-release)
Share Improve this question edited Mar 5 at 1:02 Zois Tasoulas 1,5971 gold badge13 silver badges26 bronze badges asked Mar 3 at 12:31 kdhkdh 1302 silver badges8 bronze badges 4
  • 2 In WSL, the underlying permissions are controlled by the permission setting on the WDDM driver within Windows. Have you checked those? – talonmies Commented Mar 3 at 12:52
  • No, I've never heard of that.. Can you tell me how to check it out? – kdh Commented Mar 3 at 13:00
  • 3 It is discussed right in the link you posted in your question – talonmies Commented Mar 3 at 13:09
  • Thank you talonmies! After set the WDDM driver following the website that I referenced, I solve this problem – kdh Commented Mar 4 at 10:34
Add a comment  | 

1 Answer 1

Reset to default 1

After allowing the performance counter, ncu correctly profiles my program.

If you have same problem, follow this page

  1. Open the NVIDIA Control Panel in your window 11
  2. Check "Enable Developer Settings"
  3. Under 'Developer' > 'Manage GPU Performance Counters', select 'Allow access to the GPU performance counter to all users'

Why do I have to set these settings in "Window", even if I profile CUDA programs in Ubuntu-18.04, WSL2?

Following this page, this page says:

Once a Windows NVIDIA GPU driver is installed on the system, CUDA becomes available within WSL 2. The CUDA driver installed on Windows host will be stubbed inside the WSL 2 as libcuda.so, therefore users must not install any NVIDIA GPU Linux driver within WSL 2.

I think this is the reason why I need to check the driver in Window. The point is I was not in the native linux, I was in the linux with the WSL

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745094334a4610884.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信