How to kill running processes on GPUs for a specific program (e.g. python) in terminal? For example two processes are running with python in the top picture and kill them to see the bottom picture in nvidia-smi
You can grep
"python" in the nvidia-smi
and then pass the PID
to
the kill -9
command, e.g.
sudo kill -9 $( nvidia-smi | grep 'python' | sed -n 's/|\s*[0-9]*\s*\([0-9]*\)\s*.*/\1/p' | sed '/^$/d')