繁体   English   中英

Choiche GPU tensorflow-directml 或多 GPU

[英]Choiche GPU tensorflow-directml or multi-gpu

I'm training a model with tensorflow on a Windows PC, but the training is low so I'm trying to configure tensorflow to use a 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] 您的 CPU 支持此 TensorFlow 二进制文件未编译使用的指令: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 设备枚举:找到 2 个兼容的适配器。 2021-05-14 11:02:30.984834: I tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] DirectML:在适配器 0(Radeon (TM) 530)上创建设备 2021-05-14 11:02:31.150992 : I tensorflow/stream_executor/platform/default/dso_loader.cc:99] 成功打开动态库 Kernel32.dll 2021-05-14 11:02:31.174716: I tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] Direct : 在适配器 1 (Intel(R) UHD Graphics 620) 上创建设备 True

所以 tensorflow 得到集成的 GPU Intel 而不是 Radeon GPU。 如果我从管理硬件中禁用英特尔 GPU 我在 output 中收到正确的 GPU

2021-05-14 10:47:09.171568: I tensorflow/core/platform/cpu_feature_guard.cc:142] 您的 CPU 支持此 TensorFlow 二进制文件未编译使用的指令: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 设备枚举:找到 1 个兼容的适配器。 2021-05-14 10:47:09.626567: I tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] DirectML:在适配器 0 上创建设备(Radeon (TM) 530)

我不想每次都禁用英特尔 GPU 所以这是我的问题。 是否可以选择我想使用哪个 GPU? 或者是否可以同时使用两个 GPU? 谢谢

来自微软

gpu_config = tf.GPUOptions()
gpu_config.visible_device_list = "1"

session = tf.Session(config=tf.ConfigProto(gpu_options=gpu_config))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM