Skip to content

Instantly share code, notes, and snippets.

@ggmartins
Last active August 29, 2022 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggmartins/bf55c0fc6f98fdeca88ddeabd04cfab5 to your computer and use it in GitHub Desktop.
Save ggmartins/bf55c0fc6f98fdeca88ddeabd04cfab5 to your computer and use it in GitHub Desktop.
tensorflow gpu check
#!/usr/bin/env python
import tensorflow as tf
print(tf.__version__)
if tf.test.gpu_device_name():
print('Default GPU Device:{}'.format(tf.test.gpu_device_name()))
else:
print("Please install GPU version of TF")
@ggmartins
Copy link
Author

cuda_version=10.2
export CUDA_HOME=/usr/local/cuda-${cuda_version}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64

@ggmartins
Copy link
Author

for tf2.4.1,
export LD_LIBRARY_PATH=/usr/local/cuda-11.3/targets/x86_64-linux/lib/:/usr/local/cuda-10.2/targets/x86_64-linux/lib/

@ggmartins
Copy link
Author

ggmartins commented Aug 29, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment