[英]I don't have an Nvidia GPU and want to run a Tensorflow model on the CPU. Why does it keep asking for some CUDA DLL?
I followed these instructions 我遵循了这些指示
Specifically, I want to run a downloaded Tensorflow model from Github. 具体来说,我想从Github运行下载的Tensorflow模型。 I only have an Intel GPU on my computer, so I want to execute the Tensorflow model on my CPU. 我的计算机上只有一个Intel GPU,因此我想在CPU上执行Tensorflow模型。 As described here on GitHub , it should be possible by setting the use-gpu parameter to false. 如GitHub上所述 ,可以通过将use-gpu参数设置为false来实现。 So I run this command: 所以我运行以下命令:
python test_model.py model=iphone_orig dped_dir=dped/ test_subset=full iteration=all resolution=orig use_gpu=false
However, I get the following error, the last two lines indicate that tensorflow tries to run on the GPU, this is the console window: 但是,我收到以下错误,最后两行表明tensorflow尝试在GPU上运行,这是控制台窗口:
C:\Users\username\Downloads\DPED-master\DPED-master>python test_model.py model=iphone_orig dped_dir=dped/ test_subset=full iteration=all resolution=orig use_gpu=false
Traceback (most recent call last):
File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\platform\self_check.py", line 62, in preload_check
ctypes.WinDLL(build_info.nvcuda_dll_name)
File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\ctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] Das angegebene Modul wurde nicht gefunden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test_model.py", line 5, in <module>
import tensorflow as tf
File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
self_check.preload_check()
File "C:\Users\username\Downloads\WPy64-3720\python-3.7.2.amd64\lib\site-packages\tensorflow\python\platform\self_check.py", line 70, in preload_check
% build_info.nvcuda_dll_name)
ImportError: Could not find 'nvcuda.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Typically it is installed in 'C:\Windows\System32'. If it is not present, ensure that you have a CUDA-capable GPU with the correct driver installed.
You find the relevant test_model.py file here 您可以在此处找到相关的test_model.py文件
I Tried several executions, with and without GPU setting. 我尝试了几种执行方式,无论是否设置了GPU。 What can I do to fix it? 我该如何解决?
there are two module of tensorlfow: 'tensorflow','tensorflow-gpu'
on cpu you need to install tensorlfow with pip install tensorflow
or on conda conda install tensorflow
tensorlfow有两个模块: 'tensorflow','tensorflow-gpu'
在cpu上,您需要使用pip install tensorflow
或conda conda pip install tensorflow
conda install tensorflow
EDIT for second question: 编辑第二个问题:
If a TensorFlow operation is placed on the GPU, then the execution engine must have the GPU implementation of that operation, known as the kernel. 如果将TensorFlow操作放置在GPU上,则执行引擎必须具有该操作的GPU实现,称为内核。
If the kernel is not present, then the placement results in a runtime error. 如果内核不存在,则放置会导致运行时错误。 Also, if the requested GPU device does not exist, then a runtime error is raised. 另外,如果所请求的GPU设备不存在,则会引发运行时错误。
The best way to handle is to allow the operation to be placed on the CPU if requesting the GPU device results in an error. 最好的处理方法是,如果请求GPU设备导致错误,则允许将操作放置在CPU上。
One answer would be to remove all GPU configs and second would be soft placement if GPU is not found as explained above use config.allow_soft_placement = True
一个答案是删除所有GPU配置,第二个答案是软放置,如果如上所述找不到GPU,则使用config.allow_soft_placement = True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.