11

I have installed cuda 7 toolkit with newest driver, and it passed all the tests, it seems that driver is loaded, but every time when I just put my laptop to sleep, and wake it up from sleep, cuda doesn't work anymore, deviceQuery

./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 38
-> no CUDA-capable device is detected
Result = FAIL

2 Answers 2

16

http://forums.fast.ai/t/cuda-lib-not-working-after-suspend-on-ubuntu-16-04/3546/4

You can reload the nvidia kernel module and it will work fine:

sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm

Notice though that this won't work unless all applications using that module are closed.

2
  • 2
    This solved my problem! I'm running with a Quadro K2100M on fedora28. Before trying this, I tried "sudo /usr/bin/nvidia-smi -pm ENABLED; sudo /usr/bin/nvidia-smi -c EXCLUSIVE_PROCESS" without success. I've always had to reboot in the past.
    – Aaron Swan
    Commented Nov 8, 2018 at 20:28
  • Closing all applications using nvidia_uvm by dropping into shell with init 3 or ctrl+Fx plus restarting the display manager has worked consistently for me. sudo systemctl restart display-manager or sudo service gdm restart Related Q&A: askubuntu.com/questions/1128057/… and askubuntu.com/questions/1228423/… I'm running 22.04, X11, GNOME V 42.9, nvidia-driver-535, CUDA Toolkit 12.2
    – smcnally
    Commented Mar 8 at 21:11
6

https://chuanwen.wordpress.com/2015/07/19/run-cuda-on-ubuntu-14-04-2/

What if cuda does not work after laptop wake up from sleep:

Put following 2 lines in your /etc/rc.local:

/usr/bin/nvidia-smi -pm ENABLED
/usr/bin/nvidia-smi -c EXCLUSIVE_PROCESS
3
  • Works like a charm! Thank you! (Mint Mate 18.1 - Nvidia GTX 770)
    – Peterling
    Commented Apr 21, 2017 at 9:45
  • Does this prevent the problem from happening in the future? Setting these manually when cuda stopped functioning did not seem to resolve my issue. Thanks.
    – Aaron Swan
    Commented Nov 8, 2018 at 20:32
  • This worked for me!! (Mint 18.3, Quadro M1200 with 384.130 driver and CUDA 9.0)
    – Florent F
    Commented Jan 13, 2020 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .