Created
November 9, 2024 00:39
-
-
Save devonartis/da35f4e564a74f84bc557a5132b2e1ea to your computer and use it in GitHub Desktop.
Verify GPU is being used on silicone mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from config import PATHS, MODEL_PATH, PREDICTIONS_CSV, ADVERSARIAL_PREDICTIONS_CSV | |
import sys | |
import tensorflow as tf | |
import cv2 | |
import numpy as np | |
import pandas as pd | |
from tqdm import tqdm | |
def verify_setup(): | |
""" | |
Verify that all required packages are properly installed and configured | |
""" | |
print("Python version:", sys.version) | |
print("\nTensorFlow version:", tf.__version__) | |
print("TensorFlow Metal device:", tf.config.list_physical_devices('GPU')) | |
print("\nOpenCV version:", cv2.__version__) | |
print("NumPy version:", np.__version__) | |
print("Pandas version:", pd.__version__) | |
# Test Metal acceleration | |
print("\nTesting Metal acceleration...") | |
with tf.device('/GPU:0'): | |
a = tf.random.normal([1000, 1000]) | |
b = tf.random.normal([1000, 1000]) | |
c = tf.matmul(a, b) | |
print("Matrix multiplication test successful") | |
print("\nAll components verified successfully!") | |
if __name__ == "__main__": | |
verify_setup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment