gpu-optimization-patterns
Installation
SKILL.md
GPU Optimization Patterns
Expert patterns for memory management, torch.compile, profiling, quantization, and kernel optimization.
Pattern 1: GPU Memory Profiling and Budgeting
Profile and track GPU memory usage with explicit memory math.
import torch
def memory_report(label: str = ""):
allocated = torch.cuda.memory_allocated() / 1e9
reserved = torch.cuda.memory_reserved() / 1e9
print(f"[{label}] Allocated: {allocated:.2f} GB | Reserved: {reserved:.2f} GB")