Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to choose dml device when use tensorflow-directml-plugin #320

Open
bingoct opened this issue Oct 20, 2022 · 1 comment
Open

how to choose dml device when use tensorflow-directml-plugin #320

bingoct opened this issue Oct 20, 2022 · 1 comment

Comments

@bingoct
Copy link

bingoct commented Oct 20, 2022

Enviroment

software version
win 10 pro 10.0.19044
cpu amd 4650G
amd gpu driver 22.9.2 22.9.2
python 3.8.10
tensorflow-cpu 2.10.0
tensorflow-directml-plugin 0.1.1.dev221004

Desciption

>>> import tensorflow as tf
>>> devices = tf.config.experimental.list_physical_devices()
>>> for device in devices:
...     print(device)
...
PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')

Running the keras mnist demo, it seem still works on cpu.
image

Expectation

i try tf1-directml. it works both on gpu in win10-based and wsl2-based.

software version
wsl2(ubuntu) 20.04LTS
wsl2(kernel) 5.10.60.1
python 3.7.15
tensorflow-directml 1.15.8
>>> devices = tf.config.experimental.list_physical_devices()
>>> for device in devices:
...     print(device)    # gpu.name正是TF的gpu。
...
PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')
PhysicalDevice(name='/physical_device:DML:0', device_type='DML')

Run same code above, it works on gpu.
image

btw, it's really exicted to use directml with integrated-gpu. In this small scale network, there is a significant improvement.

CPU avg Epoch  15s 18ms/step
GPU avg Epoch  9s 186us/sample
@bingoct bingoct closed this as completed Oct 20, 2022
@bingoct bingoct reopened this Oct 20, 2022
@argman
Copy link

argman commented Feb 3, 2023

you can set environment variable DML_VISIBLE_DEVICES as in cuda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants