forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/performance: Start gathering sharable infrastructure (RobotLoco…
…motion#14505) * tools/performance: Split useful tooling out from cassie_bench Relevant to: RobotLocomotion#14464 Gather the sharable bits of experiment execution scripting and port the cassie benchmark to use it. This is a first pass at factoring out the common stuff from the cassie_benchmark tree, for use by other benchmarks. It hoists the basic techniques for data collection and variance reduction. As this gathers more uses, it can be polished more. Also missing from this patch is any documentation or tooling to help with using the compare.py script from the googlebenchmark package.
- Loading branch information
1 parent
528e338
commit ce36a0f
Showing
8 changed files
with
337 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,6 @@ | ||
#!/bin/bash | ||
# Collect context information for a benchmark experiment. | ||
# TODO(rpoyner-tri) find a robust way of recording source code version | ||
# information. | ||
|
||
set -e -u -o pipefail | ||
|
||
uname -a > ${TEST_UNDECLARED_OUTPUTS_DIR}/kernel.txt || true | ||
|
||
# Fill this in with a platform-specific command to control processor affinity, | ||
# if any. | ||
AFFINITY_COMMAND="" | ||
|
||
case $(uname) in | ||
Linux) | ||
lsb_release -idrc | ||
# Choosing processor #0 is arbitrary. It is up to experimenters | ||
# to ensure it is reliably idle during experiments. | ||
AFFINITY_COMMAND="taskset 0x1" | ||
;; | ||
Darwin) | ||
sw_vers | ||
;; | ||
*) | ||
echo unknown | ||
;; | ||
esac > ${TEST_UNDECLARED_OUTPUTS_DIR}/os.txt | ||
|
||
${TEST_SRCDIR}/drake/tools/workspace/cc/identify_compiler \ | ||
> ${TEST_UNDECLARED_OUTPUTS_DIR}/compiler.txt | ||
|
||
${AFFINITY_COMMAND} \ | ||
${TEST_SRCDIR}/drake/examples/multibody/cassie_benchmark/cassie_bench \ | ||
--benchmark_display_aggregates_only=true \ | ||
--benchmark_repetitions=9 \ | ||
--benchmark_out_format=json \ | ||
--benchmark_out=${TEST_UNDECLARED_OUTPUTS_DIR}/results.json \ | ||
"$@" \ | ||
>& ${TEST_UNDECLARED_OUTPUTS_DIR}/summary.txt | ||
|
||
echo Full results are in: | ||
echo ${TEST_UNDECLARED_OUTPUTS_DIR}/ | ||
${TEST_SRCDIR}/drake/tools/performance/record_results \ | ||
${TEST_SRCDIR}/drake/examples/multibody/cassie_benchmark/cassie_bench \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- python -*- | ||
|
||
load("//tools/lint:lint.bzl", "add_lint_tests") | ||
load("//tools/skylark:py.bzl", "py_binary") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
py_binary( | ||
name = "record_results", | ||
srcs = ["record_results.py"], | ||
data = [ | ||
"//tools/workspace/cc:identify_compiler", | ||
], | ||
) | ||
|
||
add_lint_tests(python_lint_extra_srcs = ["benchmark_tool"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Tools support for performance analysis | ||
|
||
This directory contains tools to help with careful performance measurement and | ||
analysis of Drake programs. | ||
|
||
## Benchmarking tools | ||
|
||
Included here are two tools to help with well-controlled benchmark experiments: | ||
|
||
* `record_results.py` -- run benchmark under bazel, record context and results | ||
* `benchmark_tool` -- outside-bazel tool for experiments and data handling | ||
|
||
A fully worked example that integrates these two tools is available at | ||
`drake/examples/multibody/cassie_benchmark`. Some of the history of attempts to | ||
drive variance out of benchmark results is captured in #13902. | ||
|
||
TODO(rpoyner-tri): explain how to use compare.py from the googlebenchmark | ||
package to compare stored results from different experiments. |
Oops, something went wrong.