我的系统有GPU。
当我在其上运行Tensorflow时,TF会自动检测到GPU,并在GPU上启动线程运行。
我该如何更改这一设置?
即如何在没有GPU的情况下运行Tensorflow?
我的系统有GPU。
当我在其上运行Tensorflow时,TF会自动检测到GPU,并在GPU上启动线程运行。
我该如何更改这一设置?
即如何在没有GPU的情况下运行Tensorflow?
它应该可以正常工作。主要是禁用了CUDA设备,因此代码会寻找其他源(CPU)
来运行代码。
import os
import tensorflow as tf
#os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" #If the line below doesn't work, uncomment this line (make sure to comment the line below); it should help.
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
#Your Code Here