简体   繁体   English

我没有Nvidia GPU,想在CPU上运行Tensorflow模型。 为什么它总是要求一些CUDA DLL?

[英]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.

相关问题 Tensorflow 导入非常慢,因为它正在寻找“cudart64_110.dll”。 我没有 gpu。有 cpu-only 版本吗? - Tensorflow import is very slow because it's looking for "cudart64_110.dll". I don't have a gpu. Is there a cpu-only version? 安装 Tensorflow 2.0,我有 GPU 但没有启用 CUDA,这是否意味着我只能使用我的 CPU? - Installing Tensorflow 2.0, I have GPU but not CUDA-Enabled, Does that means I can only used my CPU? tensorflow-gpu 2.2 适用于 CUDA 10.2 但需要 cuDNN 7.6.4,它在 NVIDIA 存档中没有 CUDA 10.2 的下载文件 - tensorflow-gpu 2.2 works with CUDA 10.2 but requires cuDNN 7.6.4 which doesn't have a download file in NVIDIA archive for CUDA 10.2 为什么我不能在 CPU 上运行 tensorflow 会话,而一个 GPU 设备的内存已全部分配? - Why can't I run tensorflow session on CPU while one GPU device's memory is all allocated? 我可以在 TensorFlow 上同时运行 AMD GPU 和 NVIDIA GPU 吗? - Can I run an AMD GPU and NVIDIA GPU on TensorFlow together? 如何在 NVIDIA gpu 上运行 tensorflow? - How to run tensorflow on NVIDIA gpu? 为什么我的 JAX + Haiku 代码不能在 GPU 上运行? - Why does my JAX + Haiku code don't run on GPU? easyocr 警告 CUDA 不可用 - 默认为 CPU。 注意:此模块使用 GPU 时速度更快 - easyocr WARNING CUDA not available - defaulting to CPU. Note: This module is much faster with a GPU 已安装 CUDA 10.1 但 Tensorflow 不在 GPU 上运行模拟 - CUDA 10.1 installed but Tensorflow doesn't run simulation on GPU tensorflow gpu 测试通过——但我没有安装 cuDNN - tensorflow gpu tests pass--but I don't have cuDNN installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM