2

I use the CUDA toolkit to perform some computations on my Nvidia GPUs on Windows 7 SP1 x64 Ultimate. How to kill all processes that use a given GPU? (killing all processes at once)

  • 1
    It can be done in Linux but see no way to do it in Windows, but is a good question. – Moab Dec 3 at 21:35
  • @Moab even taskkill can't do it? – LPChip Dec 4 at 7:36
1

This PowerShell command worked for me:

kill -9 $(nvidia-smi | sed -n 's/|\s*[0-9]*\s*\([0-9]*\)\d*.*/\1/p' | sort | uniq | sed '/^$/d')
New contributor
Adil Advani is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    You should add that this is a powershell command, also I have neither nvidia-smi nor sed commands so I don't know what else is required to run this. – LPChip Dec 4 at 7:40
  • 1
    You're right! forgot to mention powershell command :( – Adil Advani Dec 4 at 19:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.