#49·nvitop

[BUG] Cannot gather infomation of the `/XWayland` process in WSLg

Author: XuehaiPanCreated Dec 11, 2022Updated Jun 17, 2023
Labelsbugupstreamapicli / tui

Required prerequisites

  • I have read the documentation https://nvitop.readthedocs.io.
  • I have searched the Issue Tracker that this hasn't already been reported. (comment there if it has.)
  • I have tried the latest version of nvitop in an new isolated virtual environment.

What version of nvitop are you using?

0.11.0

Operating system and version

Windows 10 build 10.0.19045.0

NVIDIA driver version

526.98

NVIDIA-SMI

Sat Dec 10 20:36:09 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.60.02    Driver Version: 526.98       CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| 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 ...  On   | 00000000:09:00.0  On |                  N/A |
|  0%   56C    P3    34W / 240W |   2880MiB /  8192MiB |      7%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

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

Python environment

bash
$ python3 -m pip freeze | python3 -c 'import sys; print(sys.version, sys.platform); print("".join(filter(lambda s: any(word in s.lower() for word in ("nvi", "cuda", "nvml", "gpu")), sys.stdin)))'
3.10.8 (main, Oct 11 2022, 11:35:05) [GCC 11.2.0] linux
nvidia-ml-py==11.515.75
nvitop==0.11.0

Problem description

The XWayland process in WSLg uses the NVIDIA GPU in the WSL instance. However, WSL does not expose the process in the /proc directory. So the psutil fails to gather process information by reading the files under /proc/23.

Steps to Reproduce

Command lines:

powershell
$ wsl.exe --shutdown
$ wsl.exe --update
$ wsl.exe
user@WSL $ nvitop

Traceback

No response

Logs

$ nvitop -1
Sat Dec 10 12:35:33 2022
╒═════════════════════════════════════════════════════════════════════════════╕
│ NVITOP 0.11.0        Driver Version: 526.98       CUDA Driver Version: 12.0 │
├───────────────────────────────┬──────────────────────┬──────────────────────┤
│ GPU  Name        Persistence-M│ Bus-Id        Disp.A │ Volatile Uncorr. ECC │
│ Fan  Temp  Perf  Pwr:Usage/Cap│         Memory-Usage │ GPU-Util  Compute M. │
╞═══════════════════════════════╪══════════════════════╪══════════════════════╪════════════════════╕
│   0  GeForce RTX 3070    On   │ 00000000:09:00.0  On │                  N/A │ MEM: ███▏ 34.7%    │
│  0%   55C    P3    30W / 240W │    2844MiB / 8192MiB │     49%      Default │ UTL: ████▍ 49%     │
╘═══════════════════════════════╧══════════════════════╧══════════════════════╧════════════════════╛
[ CPU: █▌ 3.1%                                                ]  ( Load Average:  0.08  0.02  0.01 )
[ MEM: ██▎ 4.5%                                               ]  [ SWP: ▏ 0.0%                     ]

╒══════════════════════════════════════════════════════════════════════════════════════════════════╕
│ Processes:                                                       PanXuehai@BIGAI-PanXuehai (WSL) │
│ GPU     PID      USER  GPU-MEM %SM  %CPU  %MEM  TIME  COMMAND                                    │
╞══════════════════════════════════════════════════════════════════════════════════════════════════╡
│   0      23 G     N/A WDDM:N/A N/A   N/A   N/A   N/A  No Such Process                            │
╘══════════════════════════════════════════════════════════════════════════════════════════════════╛

Screenshot:

image

Expected behavior

Show the process information rather than N/A and No Such Process.

Additional context

I have raised an issue in microsoft/wslg#919.

  • microsoft/wslg#919