如何使用 NVidia GPU 使 tensorflow-gpu v2 在 Windows 上运行 [英] How to get tensorflow-gpu v2 working on Windows with NVidia GPU

查看:125
本文介绍了如何使用 NVidia GPU 使 tensorflow-gpu v2 在 Windows 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tensorflow-gpu 2.x Python 包在带有 NVidia GPU 的 Windows 上运行的步骤是什么?

What are the steps to get tensorflow-gpu 2.x Python package working on Windows with an NVidia GPU?

即我怎样才能摆脱找不到'cudart64_101.dll'然后找不到'cudnn64_7.dll'?

I.e. how can I get rid of Could not find 'cudart64_101.dll' and then Could not find 'cudnn64_7.dll'?

推荐答案

步骤

  • 根据您看到的错误消息需要特定版本,不是最新版本!
  • https://www.nvidia.com/Download/index.aspx

    pip uninstall tensorflow
    pip install tensorflow-gpu
    

    3.测试

    首先下面的测试会失败,注意丢失文件的版本,例如找不到'cudart64_101.dll'

    import tensorflow
    
    tensorflow.test.is_built_with_gpu_support() # Test install of pip package, should output True
    tensorflow.test.is_gpu_available() # Should output True
    tensorflow.test.gpu_device_name() # Should output something like /device:GPU:0
    

    4.下载并安装 CUDA Toolkit 10.1 本地设置

    • 您需要的版本是未找到的版本,例如cudart64_101.dll -->版本 10.1.
    • 您需要取消选择组件,因为安装程序包含较旧的驱动程序,在网络安装程序中这不起作用
    • 4. Download and install CUDA Toolkit 10.1 local setup

      • The version you need is the one not found e.g. cudart64_101.dll --> version 10.1.
      • You will need to unselect components because setup contains an older driver, in network setup this doesn't work right
      • https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal

        选择自定义设置并:

        • 取消选择 CUDA/Visual Studio 集成
        • 取消选择驱动程序组件
        • Unselect CUDA / Visual Studio Integration
        • Unselect Driver components
        • 没有其他版本的 CUDA
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;
        C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;
        

        6.再次测试

        • 重新启动您的 IDE 以接收新的环境变量(包括 PATH)
        • 会失败,注意丢失文件的版本,例如找不到'cudnn64_7.dll'

          Will fail, pay attention to version of missing file e.g. Could not find 'cudnn64_7.dll'

          • 您需要的版本是未找到的版本,例如cudnn64_7.dll -->用于 CUDA 10.1 的 7.x 版本(或您需要的 CUDA 版本)
          • The version you need is the one not found e.g. cudnn64_7.dll --> version 7.x for CUDA 10.1 (or the version of CUDA you needed)

          https://developer.nvidia.com/rdp/cudnn-archive

          • cuda 文件夹的内容解压并复制到:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\(或您下载的版本和安装)
          • 如果您有任何冲突,请跳过重复的文件
          • Unzip and copy content of cuda folder into: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\ (or the version you downloaded and installed)
          • If you have any conflicts, skip duplicate files
          • 这次应该可以使用,假设您下载了正确的版本

          这篇关于如何使用 NVidia GPU 使 tensorflow-gpu v2 在 Windows 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆