Stream: machine-learning

Topic: Installing tensorflow with GPU support


view this post on Zulip David John Gagne (Feb 08 2024 at 23:46):

If you are installing the latest version of tensorflow (2.15) on casper or derecho and want GPU support, I recommend using the following command, which will install both tensorflow and the cuda toolkit and cudnn compiled with that version of tensorflow:

pip install tensorflow[and-cuda]

Once you are on a GPU node, run the following command to verify that the GPUs can be detected:

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

If you want to use keras 3 with the latest version of tensorflow, you will need to run pip install keras separately since tensorflow is still installing keras 2. That should change whenever tensorflow 2.16 comes out.

The latest version of tensorflow also has fixed the numpy versioning issue, so you should no longer need to pin your numpy to less than 1.24.


Last updated: May 16 2025 at 17:14 UTC