Skip to content

Instantly share code, notes, and snippets.

@H4niz
Created August 10, 2025 13:59
Show Gist options
  • Save H4niz/534bbaf55bf53c0d21a8edef8e50847b to your computer and use it in GitHub Desktop.
Save H4niz/534bbaf55bf53c0d21a8edef8e50847b to your computer and use it in GitHub Desktop.
pyttest
python3 -c "
import torch
print('=== PyTorch GPU Test ===')
print(f'PyTorch version: {torch.__version__}')
print(f'CUDA available: {torch.cuda.is_available()}')
if torch.cuda.is_available():
print(f'CUDA version: {torch.version.cuda}')
print(f'Device count: {torch.cuda.device_count()}')
print(f'Current device: {torch.cuda.current_device()}')
print(f'Device name: {torch.cuda.get_device_name()}')
print(f'Device capability: {torch.cuda.get_device_capability()}')
# Test basic operations
print('\\n=== Testing GPU Computation ===')
x = torch.randn(1000, 1000, device='cuda')
y = torch.randn(1000, 1000, device='cuda')
import time
start = time.time()
z = torch.mm(x, y)
torch.cuda.synchronize()
end = time.time()
print(f'Matrix multiplication (1000x1000): {end-start:.4f}s')
print('✅ GPU computation successful!')
else:
print('❌ CUDA not available')
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment