Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpu-test

Small collection of PyTorch scripts for testing and observing GPU performance on a local CUDA-capable machine.

What's here

  • 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.

Requirements

  • 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

Usage

Run the CIFAR100 training with live system/GPU monitor:

uv run main.py

Run the CPU vs GPU matrix multiplication benchmark:

uv run matrix.py

Note: main.py downloads the CIFAR100 dataset into a local data/ directory on first run.

About

PyTorch scripts to benchmark CPU vs GPU matrix multiplication and monitor CPU/GPU stats during a live CIFAR100 training run

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages