简体   繁体   中英

How to reset GPU on keras / tensorflow hang?

Sometimes I have to kill my python application which use GPU with Keras or Tensorflow and after that I can't run them anymore. This is probably because GPU is still used by something.

How to free GPU by force without machine reboot?


I tried the following shell script

$ cat ~/bin/nvidia-reset
#!/bin/sh

sudo rmmod nvidia_uvm

sudo rmmod nvidia_drm

sudo rmmod nvidia_modeset

sudo rmmod nvidia

sudo nvidia-smi

But often it is unable to do the job saying nvidia_uvm is busy.

尝试这个:

keras.backend.clear_session()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM