import torch def verify_cuda(): print("--- CUDA Verification ---") cuda_available = torch.cuda.is_available() print(f"CUDA Available: {cuda_available}") if cuda_available: print(f"CUDA Version: {torch.version.cuda}") device_count = torch.cuda.device_count() print(f"Number of GPUs: {device_count}") for i in range(device_count): print(f"GPU {i}: {torch.cuda.get_device_name(i)}") print(f"Compute Capability: {torch.cuda.get_device_capability(i)}") print(f"Allocated Memory: {torch.cuda.memory_allocated(i) / 1024**3:.2f} GB") print(f"Cached Memory: {torch.cuda.memory_reserved(i) / 1024**3:.2f} GB") else: print("WARNING: CUDA is not available. Please ensure NVIDIA drivers and toolkit are correctly configured.") if __name__ == "__main__": verify_cuda()