nvidia-exec icon indicating copy to clipboard operation
nvidia-exec copied to clipboard

Running script as subprocess fails to start GPU

Open MrJake222 opened this issue 3 years ago • 0 comments

In my example I use Konsole (terminal emulator for KDE Plasma enviroment), from it's docs:

-e command
    Execute command instead of the normal shell.

Steps to reproduce:

  1. Run konsole -e 'nvx start glxgears'
  2. Observe it fail to start GPU.

nvx.lock used to count active processes fails to see it's the first process using GPU because of there being 2 processes with the substring of nvx start:

$ cat /tmp/nvx.lock 
norbert     6072  0.0  0.7 1050556 124436 pts/5  Sl+  17:39   0:00 konsole -e nvx start glxgears
norbert     6085  0.0  0.0  10216  4416 pts/6    Ss+  17:39   0:00 /bin/bash /usr/bin/nvx start glxgears

This is bad. Even a file open with the same name could break the script.

$ nvx psx
norbert     6398  0.2  0.0  10040  4324 pts/4    S+   17:46   0:00 nano nvx start

Why script uses error-prone ps_nvx instead of ps_nvidia which at a glance seems much better approach? Maybe I'm missing something.

I'd like to contribute if possible, because this script is exactly what I want and writing another would be a waste of time & resources.

edit1: Why not use something as simple as lspci | grep -i nvidia?

MrJake222 avatar Oct 24 '22 15:10 MrJake222