# Why can't TensorFlow find a GPU on Cheaha?

**URL:** <https://ask.cyberinfrastructure.org/t/why-cant-tensorflow-find-a-gpu-on-cheaha/2507>\
**Category:** University of Alabama at Birmingham\
**Tags:** gpu, tensorflow\
**Created:** [September 15, 2022, 9:44pm UTC](https://ask.cyberinfrastructure.org/t/why-cant-tensorflow-find-a-gpu-on-cheaha/2507 "2022-09-15T21:44:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wwarr](https://ask.cyberinfrastructure.org/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@wwarr](https://ask.cyberinfrastructure.org/u/wwarr)\
**Post date:** [September 15, 2022, 9:44pm UTC](https://ask.cyberinfrastructure.org/t/why-cant-tensorflow-find-a-gpu-on-cheaha/2507/1 "2022-09-15T21:44:26Z")

</div>

I’m using TensorFlow on Cheaha, and my code isn’t using the GPU or I can’t locate the GPU or I’m receiving an error about missing GPUs. Why is this occurring and what can I do about it?

---

<div class="post-metadata">

**Author:** ![wwarr](https://ask.cyberinfrastructure.org/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@wwarr](https://ask.cyberinfrastructure.org/u/wwarr)\
**Post date:** [September 16, 2022, 4:36pm UTC](https://ask.cyberinfrastructure.org/t/why-cant-tensorflow-find-a-gpu-on-cheaha/2507/2 "2022-09-16T16:36:11Z")

</div>

When using Tensorflow on Cheaha, if you see an error like `Not creating XLA devices, tf_xla_enable_xla_devices not set` or are unable to find the GPU via the Tensorflow API, check the following.

1. Ensure you are correctly requesting [GPUs](https://docs.rc.uab.edu/cheaha/slurm/gpu/) with the SLURM flag `--gres=gpu:1`. Change `1` to the appropriate number of GPUs needed.

2. Ensure you are loading the appropriate CUDA toolkit using e.g. `module load cuda11.2/toolkit/11.2.2`. You can check which modules are available using `module avail toolkit` at the terminal. Be sure you are loading the correct module. To check which module is required for your version of Tensorflow, see the toolkit requirements chart here [https://www.tensorflow.org/install/source#gpu](https://www.tensorflow.org/install/source#gpu).
