Using a GPU with DFC on WSL2

Hi. I am running through how to compile an existing tensorflow model (effencientNet-S with fine tuning). I am able to install DFC on WSL2 and I can perform the parsing successfully using the CPU.

However I can’t get it to recognize the GPU.

I can use the GPU for tensorflow in other python projects just fine. However it appears that for the DFC wheel it installs a version of tensorflow that won’t recognise the GPU.

For example if I pip install tensorflow[and-cuda] I get version 2.18 and it recognises the GPU fine.

I then install the DFC wheel it installs tensorflow 2.12 over the top and I loose GPU.

Any ideas?

Hey @benwjackson

Welcome to the Hailo Community!

I understand your GPU recognition issue, and I believe I can identify the root cause. The problem stems from version compatibility between TensorFlow and the Hailo DFC wheel installation.

When you install the Hailo DFC wheel, it automatically downgrades TensorFlow to version 2.12, which lacks the more robust GPU support features found in TensorFlow 2.18+. This downgrade occurs because the Hailo environment has specific dependency requirements that tie it to TensorFlow 2.12.

1. Environment Isolation

Create separate environments for Hailo DFC and GPU operations:

  • Use virtual environments or Docker containers
  • Keep Hailo DFC (TensorFlow 2.12) in one environment
  • Maintain GPU-compatible TensorFlow (2.18) in another environment

2. Manual TensorFlow Upgrade

After installing DFC, you can attempt to manually upgrade TensorFlow:

pip install tensorflow[and-cuda]==2.18

After:

  1. Deleting my previous python virtual environment
  2. creating a new python virtual environment
  3. installing the DFC wheel
  4. upgrading tensorflow using: pip install tensorflow[and-cuda]==2.18
  5. downgrading numpy to version 1.23.3
  6. Installing Cuda 11.8

It still does not work and I get the error:

Traceback (most recent call last):
File “/home/ben/dev/hailo_compiler/hailo_compile.py”, line 39, in
runner = ClientRunner(hw_arch=chosen_hw_arch)
File “/home/ben/dev/hailo_compiler/.venv/lib/python3.10/site-packages/hailo_sdk_client/runner/client_runner.py”, line 130, in init
HSimWrapper().load()
File “/home/ben/dev/hailo_compiler/.venv/lib/python3.10/site-packages/hailo_sdk_common/paths_manager/SimWrapper.py”, line 15, in load
self._load()
File “/home/ben/dev/hailo_compiler/.venv/lib/python3.10/site-packages/hailo_sdk_common/paths_manager/SimWrapper.py”, line 19, in _load
self._hsim = tf.load_op_library(hsim_path)
File “/home/ben/dev/hailo_compiler/.venv/lib/python3.10/site-packages/tensorflow/python/framework/load_library.py”, line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/ben/dev/hailo_compiler/.venv/lib/python3.10/site-packages/hailo_sdk_client/emulator/emulator/lib/HSim.so: undefined symbol: _ZN10tensorflow15OpKernelContext21CtxFailureWithWarningEPKciRKN3tsl6StatusE

Is the DFC even compatible with Tensorflow 2.18? Why do I have to do this complicated version danve with EVERY AI project…