The output of nvidia-smi shows the list of PIDs which are running on the GPU:
Thu May 10 09:05:07 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.111 Driver Version: 384.111 |
|-------------------------------+----------------------+----------------------+
| 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 GTX 108... Off | 00000000:0A:00.0 Off | N/A |
| 61% 74C P2 195W / 250W | 5409MiB / 11172MiB | 100% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 5973 C ...master_JPG/build/tools/program_pytho.bin 4862MiB |
| 0 46324 C python 537MiB |
+-----------------------------------------------------------------------------+
How do I show the usernames associated with each process?
This shows the username of an individual PID:
ps -u -p $pid