Series · 11 posts
PyTorch Training Performance on One GPU
DataLoader workers, GPU augmentation, TF32, autocast, channels_last, torch.compile and memory limits, each timed on a Windows RTX 4080 workstation.
The performance checklists everyone copies, measured on one real machine. Several of the famous flags did almost nothing, one well-known setting backfired, and the Windows-specific traps turn out to matter more than the tuning advice written on Linux.
- 1Diagnosing CPU-GPU Bottlenecks in PyTorch TrainingJuly 14, 2026Is Your GPU Actually Busy? Diagnosing CPU-GPU Bottlenecks in PyTorch
Training pipelines stall on data loading more often than on compute. How to prove it with the PyTorch profiler instead of guessing.
- 2PyTorch DataLoader num_workers on Windows, BenchmarkedJuly 24, 2026num_workers on Windows: I Benchmarked the Advice I Gave You Last Week
num_workers measured on a 16-core Windows machine: workers made light pipelines slower, and one overlooked flag mattered more than any count.
- 3GPU Image Augmentation With torchvision v2: 13x FasterJuly 27, 2026I Moved Image Augmentation to the GPU: 13x Faster, With One Catch
Batched GPU augmentation beat the best CPU worker setup 13x, but every image in a batch silently gets the same random crop, jitter and blur.
- 4Does Batch-Level GPU Augmentation Hurt Accuracy? 25 ModelsJuly 29, 2026Does Batch-Level GPU Augmentation Hurt Accuracy? I Trained 25 Models to Find Out
What shared per-batch augmentation parameters cost on CIFAR-10, measured over 25 trained models, and how five seeds nearly gave the wrong answer.
- 5cudnn.benchmark and TF32 Measured on an RTX 4080July 31, 2026The 'Free Speedup' Flags, Measured: One Did Almost Nothing on My GPU
The famous flag bought 3%, the flag nobody mentions was already on, and TF32's numerical error is 340x larger. Timed on an RTX 4080.
- 6PyTorch Autocast Measured: 1.6x Faster, 40% Less MemoryAugust 3, 2026Autocast in Practice: 1.6x Faster, 40% Less Memory, and the 0.35% of Gradients That Vanish
fp16 and bf16 autocast timed on a ResNet18 training step, plus a count of how many real gradients underflow to zero: the reason GradScaler exists.
- 7channels_last in PyTorch: Faster in bf16, 4x Slower in fp16August 4, 2026channels_last: 1.4x Faster in bf16, 4x Slower in fp16, on the Same GPU
The memory-format one-liner worked as documented with bfloat16 and backfired with float16 on the same GPU. Timings, forward/backward split, gotchas.
- 8torch.compile on Windows GPU: Getting It to RunAugust 5, 2026torch.compile on Windows Isn't Supposed to Work. Here's What I Got Anyway
No official Triton wheels for Windows. With a community wheel, a version pin and a MAX_PATH workaround, torch.compile ran, and I timed what it is worth.
- 9Training Past GPU Memory: Windows Sysmem Fallback MeasuredAugust 7, 2026My GPU Stopped Throwing OOM Errors. What It Does Instead Is Worse
ResNet50 batches pushed past 16 GB got a silent 45x slowdown instead of OOM. Real numbers for gradient checkpointing and accumulation.
- 10DataLoader num_workers=4 Made Training 47% Slower on WindowsAugust 26, 2026num_workers=4 Made My Training 47% Slower
On Windows, 4 DataLoader workers made each epoch 47% slower and 8 workers 2.4x slower. The fix is one flag Linux tutorials never mention.
- 11The loss.item() GPU Sync Tax, Measured in Five RegimesSeptember 9, 2026I Went Hunting for the Famous loss.item() Tax and Came Back With Pocket Change
Calling .item() every step across small and big models, sub-ms steps, torch.compile and CUDA graphs. Worst case 7%, and why folklore says more.