如何在Spyder(Anaconda一般)(Windows 10)中编码时使用我的GPU



我最近按照几个说明尝试在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,并决定按照Stackoverflow中类似问题的其他说明进行操作。我以管理员身份运行Anaconda Prompt,创建了一个名为";tf-gpu";,安装tensorflow、keras和其他具有";pip";。我从Anaconda在这个频道安装了Spyder,运行Spyder和相同的代码。我得到了同样的结果。

到目前为止一切都不起作用,我想利用我的GPU来节省一些时间,而不是使用GoogleColab。如果有人推荐我如何使用Anaconda Spyder的GPU,我会很高兴。

提前谢谢。

您确定具有使用GPU的硬件要求吗?因为它说没有可用的GPU。

最新更新