我正在Windows PC上使用TensorFlow训练模型,但训练速度很慢,所以我试图将TensorFlow配置为使用GPU。我安装了tensorflow-directml
(在Python 3.6的Conda环境中),因为我的GPU是AMD Radeon GPU。用这个简单的代码
import tensorflow as tf
tf.test.is_gpu_available()
我收到这个输出
2021-05-14 11:02:30.113880: I
tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports
instructions that this TensorFlow binary was not compiled to use: AVX2
2021-05-14 11:02:30.121580: I
tensorflow/stream_executor/platform/default/dso_loader.cc:99]
Successfully opened dynamic library
C:\Users\v.rocca\anaconda3\envs\tfradeon\lib\site-packages\tensorflow_core\python/directml.adbd007a01a52364381a1c71ebb6fa1b2389c88d.dll
2021-05-14 11:02:30.765470: I
tensorflow/core/common_runtime/dml/dml_device_cache.cc:249] DirectML
device enumeration: found 2 compatible adapters. 2021-05-14
11:02:30.984834: I
tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] DirectML:
creating device on adapter 0 (Radeon (TM) 530) 2021-05-14
11:02:31.150992: I
tensorflow/stream_executor/platform/default/dso_loader.cc:99]
Successfully opened dynamic library Kernel32.dll 2021-05-14
11:02:31.174716: I
tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] DirectML:
creating device on adapter 1 (Intel(R) UHD Graphics 620) True
所以tensorflow得到了集成的GPU英特尔而不是Radeon GPU。如果我从管理硬件中禁用英特尔GPU,我会在输出中收到正确的GPU
2021-05-14 10:47:09.171568: I
tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports
instructions that this TensorFlow binary was not compiled to use: AVX2
2021-05-14 10:47:09.176828: I
tensorflow/stream_executor/platform/default/dso_loader.cc:99]
Successfully opened dynamic library
C:\Users\v.rocca\anaconda3\envs\tfradeon\lib\site-packages\tensorflow_core\python/directml.adbd007a01a52364381a1c71ebb6fa1b2389c88d.dll
2021-05-14 10:47:09.421265: I
tensorflow/core/common_runtime/dml/dml_device_cache.cc:249] DirectML
device enumeration: found 1 compatible adapters. 2021-05-14
10:47:09.626567: I
tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] DirectML:
creating device on adapter 0 (Radeon (TM) 530)
我不想每次都禁用英特尔GPU,所以这是我的问题。可以选择我想使用的GPU吗?是否可以同时使用两个GPU?谢谢
1条答案
按热度按时间q7solyqu1#
Microsoft: