简体   繁体   中英

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 installed tensorflow-directml (in a conda environment with python 3.6) because my GPU is an 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.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

So tensorflow get the integrated GPU Intel instead the Radeon GPU. If I disable the Intel GPU from the Manage Hardware I receive in the output the correct 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)

I don't want to disable the Intel GPU every time so this is my question. Is it possible to choice which GPU I want to use? Or Is it possible to use both GPUs? Thanks

From Microsoft :

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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