簡體   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