Skip to content

Instantly share code, notes, and snippets.

@lanzani
Last active August 4, 2022 23:16
Show Gist options
  • Save lanzani/fc20b2ccbd741524a50cfd3d1a81416c to your computer and use it in GitHub Desktop.
Save lanzani/fc20b2ccbd741524a50cfd3d1a81416c to your computer and use it in GitHub Desktop.
Check CUDA compatibility with TensorFlow & DLIB.
def test_gpu_support():
"""Check CUDA compatibility with TensorFlow & DLIB.
"""
import os
import dlib
import tensorflow as tf
print("[INFO] TensorFlow: ", tf.__version__)
print("[INFO] DLIB: ", dlib.__version__)
# os.environ['CUDA_VISIBLE_DEVICES'] = ''
if tf.test.gpu_device_name():
print('[INFO] GPU: Found')
else:
print("[INFO] GPU: Not found")
print("[INFO] Testing on GPU...")
print("[INFO] TensorFlow GPU-Support: ",
"available" if tf.test.is_gpu_available() else "NOT available")
# tf.config.list_physical_devices('GPU')
print("[INFO] Dlib GPU-Support: ",
"available" if dlib.DLIB_USE_CUDA else "NOT available")
test_gpu_support()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment