如何验证CNTK是否正在使用GPU?我在我的机器上安装了CNTK-2-0-beta7-0-Windows-64bit-GPU-1bit-SGD二进制文件.但是,当我尝试从Python运行它时:
from cntk.device import set_default_device, gpu set_default_device(gpu(0))
我明白了:
--------------------------------------------------------------------------- ValueError Traceback (most recent call last)in () 1 from cntk.device import set_default_device, gpu ----> 2 set_default_device(gpu(0)) C:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py34\lib\site-packages\cntk\device.py in gpu(device_id) 74 :class:`~cntk.device.DeviceDescriptor`: GPU device descriptor 75 ''' ---> 76 return cntk_py.DeviceDescriptor.gpu_device(device_id) 77 78 def use_default_device(): ValueError: Specified GPU device id (0) is invalid.
今天添加更多信息:
这是运行NVidia_smi.exe的结果
C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi.exe Thu Jan 12 20:38:30 2017 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 369.61 Driver Version: 369.61 | |-------------------------------+----------------------+----------------------+ | GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GPU WDDM | 0000:01:00.0 Off | N/A | | N/A 51C P0 2W / N/A | 864MiB / 1024MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+
在Jupyter笔记本中重启内核后,我得到:
import cntk as C if C.device.default().type() == 0: print('running on CPU') else: print('running on GPU') running on CPU
但是今天我能够运行:
from cntk.device import set_default_device, gpu set_default_device(gpu(0)) import cntk as C if C.device.default().type() == 0: print('running on CPU') else: print('running on GPU') running on GPU
GPU应该是GPU机器上的默认设置,还是需要明确设置它?