Comments (3)
Hi,
The scripts use the default TensorFlow behavior, which selects the device with the lowest ID as its default. For DML devices on Windows, the order of device IDs corresponds to the standard adapter enumeration order of the system, where device 0 is usually the GPU that your primary display is plugged into.
Ordinarily you can use tf.device()
to explicitly control placement of operators. For example:
>>> import tensorflow as tf
>>> tf.debugging.set_log_device_placement(True)
>>> tf.enable_eager_execution()
>>>
>>> tf.config.experimental.list_physical_devices('DML')
2020-06-23 13:53:21.494269: I tensorflow/core/common_runtime/dml/dml_device_factory.cc:45] DirectML device enumeration: found 2 compatible adapters.
[PhysicalDevice(name='/physical_device:DML:0', device_type='DML'), PhysicalDevice(name='/physical_device:DML:1', device_type='DML')]
>>> with tf.device('/device:DML:1'):
... a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
... b = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
... c = tf.matmul(a, b)
2020-06-23 13:53:49.610495: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-06-23 13:53:49.631467: I tensorflow/core/common_runtime/dml/dml_device_factory.cc:32] DirectML: creating device on adapter 0 (NVIDIA TITAN V)
2020-06-23 13:53:49.724504: I tensorflow/stream_executor/platform/default/dso_loader.cc:60] Successfully opened dynamic library D:/WindowsAI/build/x64-win-redist-release/install/bin/DirectML.dll
2020-06-23 13:53:49.761930: I tensorflow/core/common_runtime/dml/dml_device_factory.cc:32] DirectML: creating device on adapter 1 (AMD Radeon RX 5700 XT)
2020-06-23 13:53:49.938541: I tensorflow/core/common_runtime/eager/execute.cc:571] Executing op MatMul in device /job:localhost/replica:0/task:0/device:DML:1
>>> print(c)
tf.Tensor(
[[22. 28.]
[49. 64.]], shape=(2, 2), dtype=float32)
However you're right that currently our sample scripts don't have a way to control this on the command line. (They just fall back to the default TF behavior of using the first device ID available.) But thanks for bringing this up - it's clear that we need to add something to allow for better customization of device ID order. We'll work on adding this soon, and we'll be sure to update this issue once a better solution becomes available.
In the meantime, there are a couple of ways you could work around this. One way would be to use Device Manager in Windows to disable the adapters you don't want (in your case, that would be the Intel(R) UHD Graphics 620). This will prevent the device from showing up in TensorFlow (but don't forget to re-enable the device once you're done!) In principle it should also be possible to modify the sample training scripts to explicitly specify a device if you're familiar with TF and don't mind editing the scripts.
Hope this helps!
from tensorflow-directml.
Hi,
thank you very much for your help!
I made a quick test disabling the internal GPU, but this does not work: The enumeration still lists both devices in the same order but the script dos not work any more, it exists silently. I'm going to get some example working with your programing hints.
Best regards,
Christoph
from tensorflow-directml.
@chrbayer We recently released a new pypi package that should sort the devices in order of performance. You can try it out and tell us if it the right device is being selected.
from tensorflow-directml.
Related Issues (20)
- Not able to use my own callbacks HOT 3
- Tensorflow-directml is not making any difference in processing times in GPU vs CPU HOT 1
- AMD APU support? HOT 2
- Cannot assign a device for operation embedding/embeddings/Initializer/random_uniform/ HOT 5
- directml on custom tensoflow build ? HOT 1
- Windows Camera post process(DMFT) with DirectML(Tensorflow) HOT 10
- It's not working on Intel Graphics 5500 HOT 1
- Use c api to load pb models HOT 1
- how to set the default device using cAPI?
- session run crashed when runing on nvidia gpu HOT 1
- Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support. HOT 2
- unbox expects Dml at::Tensor as inputs HOT 1
- Is it not supports the amd gpus without rocm?
- Does directml support multi-GPU training
- TensorFlow-DirectML Does Not Exist HOT 7
- AttributeError: module 'tensorflow' has no attribute 'float32' HOT 1
- CPU instructions notification after installing
- python newer versions support
- tensorflow GPU on WSL2 produces a segmentationfault
- RC astro tool operations not supported in DirectML HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow-directml.