mirror of
https://github.com/zebrajr/pytorch.git
synced 2026-01-15 12:15:51 +00:00
Reland of benchmark code (#43428)
Summary: Reland of the benchmark code that broke the slow tests because the GPU were running out of memory Pull Request resolved: https://github.com/pytorch/pytorch/pull/43428 Reviewed By: ngimel Differential Revision: D23296136 Pulled By: albanD fbshipit-source-id: 0002ae23dc82f401604e33d0905d6b9eedebc851
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4cfac34075
commit
e08e93f946
48
benchmarks/functional_autograd_benchmark/README.md
Normal file
48
benchmarks/functional_autograd_benchmark/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Benchmarking tool for the autograd API
|
||||
|
||||
This folder contain a set of self-contained scripts that allow to benchmark the autograd with different common models.
|
||||
It is designed to run the benchmark before and after your change and will generate a table to share on the PR.
|
||||
|
||||
To do so, you can use `functional_autograd_benchmark.py` to run the benchmarks before your change (using as output `before.txt`) and after your change (using as output `after.txt`).
|
||||
You can then use `compare.py` to get a markdown table comparing the two runs.
|
||||
|
||||
The default arguments of `functional_autograd_benchmark.py` should be used in general. You can change them though to force a given device or force running even the (very) slow settings.
|
||||
|
||||
### Sample usage
|
||||
|
||||
```bash
|
||||
# Make sure you compile pytorch in release mode and with the same flags before/after
|
||||
export DEBUG=0
|
||||
# When running on CPU, it might be required to limit the number of cores to avoid oversubscription
|
||||
export OMP_NUM_THREADS=10
|
||||
|
||||
# Compile pytorch with the base revision
|
||||
git checkout master
|
||||
python setup.py develop
|
||||
|
||||
# Run the benchmark for the base
|
||||
# This will use the GPU if available.
|
||||
pushd benchmarks/functional_autograd_benchmark
|
||||
python functional_autograd_benchmark.py --output before.txt
|
||||
|
||||
# Compile pytorch with your change
|
||||
popd
|
||||
git checkout your_feature_branch
|
||||
python setup.py develop
|
||||
|
||||
# Run the benchmark for the new version
|
||||
pushd benchmarks/functional_autograd_benchmark
|
||||
python functional_autograd_benchmark.py --output after.txt
|
||||
|
||||
# Get the markdown table that you can paste in your github PR
|
||||
python compare.py
|
||||
|
||||
popd
|
||||
|
||||
```
|
||||
|
||||
### Files in this folder:
|
||||
- `functional_autograd_benchmark.py` is the main entry point to run the benchmark.
|
||||
- `compare.py` is the entry point to run the comparison script that generates a markdown table.
|
||||
- `torchaudio_models.py` and `torchvision_models.py` contains code extracted from torchaudio and torchvision to be able to run the models without having a specific version of these libraries installed.
|
||||
- `ppl_models.py`, `vision_models.py` and `audio_text_models.py` contain all the getter functions used for the benchmark.
|
||||
Reference in New Issue
Block a user