I have a tensor flow object detection project I want to build and read that it would be slow on cpu. Thats when someone told me to use directml because I have an AMD gpu and not a NVIDIA one.
I have created an anaconda environment which I called "directml" and installed tensorflow and directml on it (see the picture). If I now try to run my test application which I found from this tutorial (https://docs.microsoft.com/en-us/windows/ai/directml/gpu-tensorflow-windows):
import tensorflow.compat.v1 as tf tf.enable_eager_execution(tf.ConfigProto(log_device_placement=True)) print(tf.add([1.0, 2.0], [3.0, 4.0]))
I dont get the desired output:
2020-06-15 11:27:18.240065: I tensorflow/core/common_runtime/dml/dml_device_factory.cc:32] DirectML: creating device on adapter 0 (AMD Radeon VII) 2020-06-15 11:27:18.323949: I tensorflow/stream_executor/platform/default/dso_loader.cc:60] Successfully opened dynamic library DirectMLba106a7c621ea741d2159d8708ee581c11918380.dll 2020-06-15 11:27:18.337830: I tensorflow/core/common_runtime/eager/execute.cc:571] Executing op Add in device /job:localhost/replica:0/task:0/device:DML:0 tf.Tensor([4. 6.], shape=(2,), dtype=float32)
But I instead get this:
2021-09-16 17:15:03.700209: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found 2021-09-16 17:15:03.700418: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2021-09-16 17:15:05.192685: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2021-09-16 17:15:05.192902: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303) 2021-09-16 17:15:05.197503: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-N3L36AL 2021-09-16 17:15:05.197857: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-N3L36AL 2021-09-16 17:15:05.198376: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2021-09-16 17:15:05.202832: I tensorflow/core/common_runtime/eager/execute.cc:571] Executing op Add in device /job:localhost/replica:0/task:0/device:CPU:0 tf.Tensor([4. 6.], shape=(2,), dtype=float32)
To me it looks like tensorflow is trying to use cuda and not directml, but I have no idea why that is. My Windows, aswell as my AMD drivers are up to date.
You shouldn’t install tensorflow only tensorflow-directml. Because now python is importing tensorflow not tensorflow-directml. Uninstall tensorflow and it should fix imports.
Answered By – userkk
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0