Running Benchmarks
Basic Usage
Run a full benchmark sweep:Programmatic Usage
Benchmark Metrics
Training Metrics
- train_time_per_epoch_s: Average time per training epoch in seconds
- final_train_accuracy: Final training accuracy after all epochs
- cpu_utilization_percent: Average CPU usage during training
- peak_memory_mb: Peak memory consumption in megabytes
Inference Metrics
- inference_latency_per_sample_s: Per-sample inference time
- batch_throughput_samples_per_s: Throughput in samples per second
Resource Metrics
- energy_per_epoch_j: Estimated energy consumption per epoch in joules
- peak_memory_mb: Peak memory usage tracked with tracemalloc
Custom Benchmark Configuration
Interpreting Results
CSV Output Format
Benchmark results are saved tobenchmarks/benchmark_results.csv with the following columns:
| Column | Description |
|---|---|
| seed | Random seed for reproducibility |
| layer_sizes | Model architecture (e.g., “16x32x4”) |
| precision_mode | Data type used (float32, float16, int8) |
| batch_size | Batch size used for training |
| epochs | Number of training epochs |
| n_samples | Total training samples |
| train_time_per_epoch_s | Average training time per epoch |
| inference_latency_per_sample_s | Per-sample inference latency |
| batch_throughput_samples_per_s | Inference throughput |
| peak_memory_mb | Peak memory usage |
| cpu_utilization_percent | Average CPU usage |
| final_train_accuracy | Final training accuracy |
| energy_per_epoch_j | Estimated energy per epoch |
Performance Analysis
Compare precision modes:Memory Measurement
Benchmarking usestracemalloc to track peak memory usage:
CPU Utilization
CPU usage is sampled continuously during training usingpsutil:
Energy Estimation
Energy consumption is estimated based on runtime and precision mode:Enabling Profiling
To generate detailed profiling reports during benchmarking:profiling/ directory.
Next Steps
Profiling
Profile model parameters and memory usage
Statistical Analysis
Run repeated benchmarks with confidence intervals