Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 1d4032d

Browse files
authored
set fixed seed for profiler (#16155)
* set fix seed for profiler * update README with profiler option * fix wording
1 parent 33bd02f commit 1d4032d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

benchmark/opperf/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Output for the above benchmark run, on a CPU machine, would look something like
129129
130130
```
131131

132-
## Usecase 3.1 - Run benchmarks for group of operators with same input
132+
## Usecase 4 - Run benchmarks for group of operators with same input
133133
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.
134134

135135
```
@@ -173,6 +173,22 @@ This utility queries MXNet operator registry to fetch all operators registered w
173173
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.
174174
See `utils/op_registry_utils.py` for more details.
175175

176+
## Use python timer
177+
Optionally, you could use the python time package as the profiler engine to caliberate runtime in each operator.
178+
To use python timer for all operators, use the argument --profiler 'python':
179+
```
180+
python incubator-mxnet/benchmark/opperf/opperf.py --profiler='python'
181+
```
182+
183+
To use python timer for a specific operator, pass the argument profiler to the run_performance_test method:
184+
```
185+
add_res = run_performance_test([nd.add, nd.subtract], run_backward=True, dtype='float32', ctx=mx.cpu(),
186+
inputs=[{"lhs": (1024, 1024),
187+
"rhs": (1024, 1024)}],
188+
warmup=10, runs=25, profiler='python')
189+
```
190+
By default, MXNet profiler is used as the profiler engine.
191+
176192
# TODO
177193

178194
All contributions are welcome. Below is the list of desired features:

benchmark/opperf/utils/benchmark_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929

3030
def _prepare_op_inputs(inputs, run_backward, dtype, ctx):
31+
mx.random.seed(41)
3132
kwargs_list = []
3233
args_list = []
3334

0 commit comments

Comments
 (0)