pytorch/benchmarks/fastrnns
Mikhail Zolotukhin d11603de38 [TensorExpr] Benchmarks: set number of profiling runs to 2 for PE. (#44112)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44112

Test Plan: Imported from OSS

Reviewed By: bertmaher

Differential Revision: D23500904

Pulled By: ZolotukhinM

fbshipit-source-id: d0dd54752b7ea5ae11f33e865c96d2d61e98d573
2020-09-03 11:29:35 -07:00
..
__init__.py
bench.py Respect canFuseOn{CPU,GPU} in TE fuser (#43967) 2020-09-02 18:00:25 -07:00
cells.py
custom_lstms.py
factory.py Add fastrnns benchmark to CI and upload data to scribe (#42030) 2020-08-06 10:30:27 -07:00
fuser.py [TensorExpr] Benchmarks: set number of profiling runs to 2 for PE. (#44112) 2020-09-03 11:29:35 -07:00
profile.py Remove (most) Python 2 support from Python code (#35615) 2020-04-22 09:23:14 -07:00
README.md
runner.py
scratch.py
test.py
test_bench.py Respect canFuseOn{CPU,GPU} in TE fuser (#43967) 2020-09-02 18:00:25 -07:00

Fast RNN benchmarks

Benchmarks for TorchScript models

For most stable results, do the following:

  • Set CPU Governor to performance mode (as opposed to energy save)
  • Turn off turbo for all CPUs (assuming Intel CPUs)
  • Shield cpus via cset shield when running benchmarks.

Some of these scripts accept command line args but most of them do not because I was lazy. They will probably be added sometime in the future, but the default sizes are pretty reasonable.

Test fastrnns (fwd + bwd) correctness

Test the fastrnns benchmarking scripts with the following: python -m fastrnns.test or run the test independently: python -m fastrnns.test --rnns jit

Run benchmarks

python -m fastrnns.bench

should give a good comparison, or you can specify the type of model to run

python -m fastrnns.bench --rnns cudnn aten jit --group rnns

Run model profiling, calls nvprof

python -m fastrnns.profile

should generate nvprof file for all models somewhere. you can also specify the models to generate nvprof files separately:

python -m fastrnns.profile --rnns aten jit

Caveats

Use Linux for the most accurate timing. A lot of these tests only run on CUDA.