fix nnlib/device.py for some notebooks

This commit is contained in:
iperov 2019-02-25 21:34:47 +04:00
parent ac5ac75645
commit 7db469a1da

View file

@ -260,7 +260,12 @@ class device:
force_plaidML = os.environ.get("force_plaidML", "0") == "1" force_plaidML = os.environ.get("force_plaidML", "0") == "1"
has_nvml = False has_nvml = False
has_nvml_cap = False has_nvml_cap = False
has_nvidia_device = os.environ.get("force_has_nvidia_device", "0") == "1"
#use force_has_nvidia_device=1 if
#- your NVIDIA cannot be seen by OpenCL
#- CUDA build of DFL
has_nvidia_device = os.environ.get("force_has_nvidia_device", "0") == "1"
plaidML_devices = [] plaidML_devices = []
# Using plaidML OpenCL backend to determine system devices and has_nvidia_device # Using plaidML OpenCL backend to determine system devices and has_nvidia_device
@ -309,8 +314,8 @@ if device.backend is None:
device.backend = None device.backend = None
has_nvml = False has_nvml = False
if device.backend is None or force_plaidML: if not has_nvidia_device and (device.backend is None or force_plaidML):
#tensorflow backend was failed or forcing plaidML, trying to use plaidML backend #tensorflow backend was failed without has_nvidia_device , or forcing plaidML, trying to use plaidML backend
if plaidML_devices_count == 0: if plaidML_devices_count == 0:
print ("plaidML: No capable OpenCL devices found. Falling back to tensorflow backend.") print ("plaidML: No capable OpenCL devices found. Falling back to tensorflow backend.")
device.backend = None device.backend = None