Small collection of PyTorch scripts for testing and observing GPU performance on a local CUDA-capable machine.
- matrix.py, A simple benchmark that multiplies two 20000x20000 random matrices, once on CPU and once on GPU (cuda), timing each and printing the results for comparison.
- main.py, Trains a resnet50 model (adapted for 100 classes) on the CIFAR100 dataset while showing a live terminal dashboard (built with curses) of CPU usage, RAM usage, elapsed training time, and GPU utilization/memory/temperature (via pynvml/NVML). Training runs for 50 epochs with an Adam optimizer and cross-entropy loss, logging batch loss every 50 batches.
- Python 3.12
- A CUDA-capable GPU (for main.py's GPU device selection and matrix.py's GPU benchmark)
- Dependencies (managed via uv, see pyproject.toml): torch, torchvision, torchaudio, tensorflow, psutil, pynvml, nvidia-ml-py3
Run the CIFAR100 training with live system/GPU monitor:
Run the CPU vs GPU matrix multiplication benchmark:
Note: main.py downloads the CIFAR100 dataset into a local data/ directory on first run.