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

Commit

Permalink
Opperf: Support Python<3.6 (#15487)
Browse files Browse the repository at this point in the history
* support python<3.6

* fix: use kwargs

Co-Authored-By: Lin Yuan <[email protected]>
  • Loading branch information
2 people authored and wkcn committed Jul 10, 2019
1 parent 6b2b927 commit d82c89a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions benchmark/opperf/opperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ def main():
'output file.')

args = parser.parse_args()
logging.info(f"Running MXNet operator benchmarks with the following options: {args}")
assert not os.path.isfile(args.output_file), f"Output file {args.output_file} already exists."
logging.info("Running MXNet operator benchmarks with the following options: {args}".format(args=args))
assert not os.path.isfile(args.output_file),\
"Output file {output_file} already exists.".format(output_file=args.output_file)

# 2. RUN BENCHMARKS
ctx = _parse_mxnet_context(args.ctx)
Expand All @@ -140,7 +141,7 @@ def main():
# 4. Generate list of MXNet operators not covered in benchmarks
ops_not_covered = get_operators_with_no_benchmark(final_benchmark_results.keys())
for idx, op in enumerate(ops_not_covered):
print(f"{idx}. {op}")
print("{idx}. {op}".format(idx=idx, op=op))

return 0

Expand Down
4 changes: 2 additions & 2 deletions benchmark/opperf/utils/benchmark_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def _run_nd_operator_performance_test(op, inputs, run_backward, warmup, runs, kw

# Run Benchmarks
op_benchmark_result = {op.__name__: []}
logging.info(f"Begin Benchmark - {op.__name__}")
logging.info("Begin Benchmark - {name}".format(name=op.__name__))
for idx, kwargs in enumerate(kwargs_list):
_, profiler_output = benchmark_helper_func(op, runs, **kwargs)

# Add inputs used for profiling this operator into result
profiler_output["inputs"] = inputs[idx]
op_benchmark_result[op.__name__].append(profiler_output)
logging.info(f"Complete Benchmark - {op.__name__}")
logging.info("Complete Benchmark - {name}".format(name=op.__name__))
return op_benchmark_result


Expand Down

0 comments on commit d82c89a

Please sign in to comment.