Solution for nvidia-smi problems

nvidia-smi is working from windows
1- you can always call it from windows cmd [DOS Shell]
or power shell or terminal actually it is in Windows/System32
i.e it is in path
2- for whatever reason you like to call from wsl2 here:

/mnt/c/Windows/System32/nvidia-smi.exe

Mon May 31 19:18:31 2021
±----------------------------------------------------------------------------+
| NVIDIA-SMI 470.14 Driver Version: 470.14 CUDA Version: 11.3 |
|-------------------------------±---------------------±---------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce … WDDM | 00000000:01:00.0 Off | N/A |
| N/A 47C P8 3W / N/A | 183MiB / 6144MiB | 0% Default |
| | | N/A |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1784 C+G Insufficient Permissions N/A |
| 0 N/A N/A 3720 C+G …cw5n1h2txyewy\LockApp.exe N/A |
| 0 N/A N/A 8688 C+G …5n1h2txyewy\SearchApp.exe N/A |
| 0 N/A N/A 16804 C+G …ekyb3d8bbwe\YourPhone.exe N/A |
±----------------------------------------------------------------------------+

ok.
try it yourself

look to
/mnt/c/Windows/System32/nvidia-smi.exe --help
or what you think about
/mnt/c/Windows/System32/nvidia-smi.exe -l

/mnt/c/Windows/System32/nvidia-smi.exe -l
is the poorman profiler
it takes a snapshoot every second untill you break it with ctrl+c
you can make it even better by using
-lms, --loop-ms= Probe until Ctrl+C at specified millisecond interval.

for example
–loop-ms= 100
it takes a a snapshoot every 100 milliseconds i.e 10 snapshoot per seconds

BUT USE
/mnt/c/Windows/System32/nvidia-smi.exe --loop-ms= 100 >> result.txt

of course it is better to call it dirctly from command prompt/powershell inside windows
then you can “clean” it using your favourite editor. mine is"ultraedit" using macros
you can make “nicer”

why we need profiler : to monitor GPU usage and memory state
in the windows taskbar it is not accurate to show up your apps
activiity.

i shall back with some examples to compare wsl vs. windows