简体   繁体   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. 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. I installed tensorflow-directml (in a conda environment with python 3.6) because my GPU is an AMD Radeon GPU.我安装了 tensorflow-directml(在带有 python 3.6 的 conda 环境中),因为我的 GPU 是 AMD Radeon GPU。 With this simple code有了这个简单的代码

import tensorflow as tf
tf.test.is_gpu_available()

I receive this ouput我收到这个输出

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.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: 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 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

So tensorflow get the integrated GPU Intel instead the Radeon GPU.所以 tensorflow 得到集成的 GPU Intel 而不是 Radeon GPU。 If I disable the Intel GPU from the Manage Hardware I receive in the output the correct GPU如果我从管理硬件中禁用英特尔 GPU 我在 output 中收到正确的 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.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: creating device on adapter 0 (Radeon (TM) 530) 2021-05-14 10:47:09.626567: I tensorflow/core/common_runtime/dml/dml_device_cache.cc:185] DirectML:在适配器 0 上创建设备(Radeon (TM) 530)

I don't want to disable the Intel GPU every time so this is my question.我不想每次都禁用英特尔 GPU 所以这是我的问题。 Is it possible to choice which GPU I want to use?是否可以选择我想使用哪个 GPU? Or Is it possible to use both GPUs?或者是否可以同时使用两个 GPU? Thanks谢谢

From Microsoft :来自微软

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