在 Spyder(一般为 Anaconda)(Windows 10)中编码时如何使用我的 GPU?
Posted
技术标签:
【中文标题】在 Spyder(一般为 Anaconda)(Windows 10)中编码时如何使用我的 GPU?【英文标题】:How to use my GPU when coding in Spyder (Anaconda in general) (Windows 10)? 【发布时间】:2021-04-06 19:22:45 【问题描述】:我最近尝试按照几条说明在 Windows 10 中使用我的 GPU。最初,我按照 Tensorflow (Tensorflow.org) 的说明进行操作。我基于我的显卡安装了 python 3.9.1、cuDNN 11.1、CUDA 11.1.1、NVIDIA GPU 驱动程序,并创建了新路径。之后在 Anaconda(1.10) 中创建了一个名为“Tensorflow”的通道,在该通道中运行的 Spyder(4.1.5) 中导入了 tensorflow,但是当尝试测试是否有可用的 GPU 时,得到“0”结果(下面提供的代码)。实际上我不确定我之前安装的是否以及如何使用。
In [1]: import tensorflow as tf
2020-12-30 10:48:46.263644: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
In [2]: print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
2020-12-30 10:48:46.263644: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2020-12-30 10:48:54.941741: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2020-12-30 10:48:54.945949: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2020-12-30 10:48:46.263644: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2020-12-30 10:48:54.941741: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2020-12-30 10:48:54.945949: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2020-12-30 10:48:56.212215: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.56GHz coreCount: 16 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2020-12-30 10:48:56.215245: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2020-12-30 10:48:56.288545: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2020-12-30 10:48:56.289169: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
Num GPUs Available: 0
2020-12-30 10:48:46.263644: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2020-12-30 10:48:54.941741: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2020-12-30 10:48:54.945949: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2020-12-30 10:48:56.212215: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.56GHz coreCount: 16 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2020-12-30 10:48:56.215245: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2020-12-30 10:48:56.288545: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2020-12-30 10:48:56.289169: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2020-12-30 10:48:56.326345: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2020-12-30 10:48:56.336977: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2020-12-30 10:48:56.338808: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-12-30 10:48:56.359937: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2020-12-30 10:48:56.363748: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2020-12-30 10:48:56.364357: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1757] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
In [3]:
因此,我认为我仍在使用 CPU,并决定按照 *** 中类似问题的其他说明进行操作。我以管理员身份运行 Anaconda Prompt,创建了一个名为“tf-gpu”的新频道,使用“pip”安装了 tensorflow、keras 和其他软件包。我从 Anaconda 在这个频道中安装了 Spyder,运行 Spyder 和相同的代码。我得到了同样的结果。
到目前为止没有任何效果,我想利用我的 GPU 来节省一些时间,而不是使用 GoogleColab。如果有任何关于如何使用 Anaconda Spyder 使用我的 GPU 的建议,我会很高兴。
提前谢谢你。
【问题讨论】:
你有什么 GPU? @dedObed 我的设备中有两个 GPU:Intel(R) UHD Graphics 630 和 NVIDIA GeForce GTX 1650。在这种情况下我想使用后者。 【参考方案1】:您确定您有使用 GPU 的硬件要求吗? 因为它说没有可用的 GPU。
【讨论】:
我的设备中有两个 GPU:Intel(R) UHD Graphics 630 和 NVIDIA GeForce GTX 1650。我想在 Spyder Anaconda 中使用后者。 好吧,您的 NVIDIA 未列出 here 所以,您的设备可能无法使用 CUDA。 根据这个论坛 (forums.developer.nvidia.com/t/cuda-enabled-geforce-1650/81010),自 2008 年左右以来,NVIDIA 生产的每一个 GPU 都启用了 CUDA。因此,GeForce GTX 1650 支持 CUDA。 你安装了哪个驱动? 我下载了适用于 GeForce GTX 16 系列(笔记本电脑)的 NVIDIA 驱动程序 (nvidia.com/Download/index.aspx#),产品 GeForce GTX 1650,输入 Game Ready 驱动程序,适用于 Windows 10 64 位以上是关于在 Spyder(一般为 Anaconda)(Windows 10)中编码时如何使用我的 GPU?的主要内容,如果未能解决你的问题,请参考以下文章