Skip to content

Commit

Permalink
set fixed seed for profiler (apache#16155)
Browse files Browse the repository at this point in the history
* set fix seed for profiler

* update README with profiler option

* fix wording
  • Loading branch information
apeforest authored and drivanov committed Sep 26, 2019
1 parent 7db4ad8 commit ef2bb96
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion benchmark/opperf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Output for the above benchmark run, on a CPU machine, would look something like
```

## Usecase 3.1 - Run benchmarks for group of operators with same input
## Usecase 4 - Run benchmarks for group of operators with same input
For example, you want to run benchmarks for `nd.add`, `nd.sub` operator in MXNet, with the same set of inputs. You just run the following python script.

```
Expand Down Expand Up @@ -173,6 +173,22 @@ This utility queries MXNet operator registry to fetch all operators registered w
However, fully automated tests are enabled only for simpler operators such as - broadcast operators, element_wise operators etc... For the purpose of readability and giving more control to the users, complex operators such as convolution (2D, 3D), Pooling, Recurrent are not fully automated but expressed as default rules.
See `utils/op_registry_utils.py` for more details.

## Use python timer
Optionally, you could use the python time package as the profiler engine to caliberate runtime in each operator.
To use python timer for all operators, use the argument --profiler 'python':
```
python incubator-mxnet/benchmark/opperf/opperf.py --profiler='python'
```

To use python timer for a specific operator, pass the argument profiler to the run_performance_test method:
```
add_res = run_performance_test([nd.add, nd.subtract], run_backward=True, dtype='float32', ctx=mx.cpu(),
inputs=[{"lhs": (1024, 1024),
"rhs": (1024, 1024)}],
warmup=10, runs=25, profiler='python')
```
By default, MXNet profiler is used as the profiler engine.

# TODO

All contributions are welcome. Below is the list of desired features:
Expand Down
1 change: 1 addition & 0 deletions benchmark/opperf/utils/benchmark_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@


def _prepare_op_inputs(inputs, run_backward, dtype, ctx):
mx.random.seed(41)
kwargs_list = []
args_list = []

Expand Down

0 comments on commit ef2bb96

Please sign in to comment.