From 314d400ad84612e7657f5921e58459cb5c5ab7dc Mon Sep 17 00:00:00 2001 From: Katherine Wu Date: Mon, 8 Jan 2018 12:47:30 -0800 Subject: [PATCH] Add a section about running the benchmarks with python. Also renamed so that https://www.tensorflow.org/community/benchmarks and https://www.tensorflow.org/performance/benchmarks have different titles PiperOrigin-RevId: 181203841 --- tensorflow/docs_src/community/benchmarks.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tensorflow/docs_src/community/benchmarks.md b/tensorflow/docs_src/community/benchmarks.md index 3bdbabf4bbc..70c0d3e08e8 100644 --- a/tensorflow/docs_src/community/benchmarks.md +++ b/tensorflow/docs_src/community/benchmarks.md @@ -1,4 +1,4 @@ -# Benchmarks +# Defining and Running Benchmarks This guide contains instructions for defining and running a TensorFlow benchmark. These benchmarks store output in [TestResults](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/util/test_log.proto) format. If these benchmarks are added to TensorFlow github repo, then we will run them daily with our continuous build and display a graph on our dashboard: https://benchmarks-dot-tensorflow-testing.appspot.com/. @@ -52,6 +52,19 @@ Key points to note in the example above: * Benchmark method calls `report_benchmark` to report the metric value. +## Running with Python + +Use the `--benchmarks` flag to run the benchmark with python. A [BenchmarkEntries](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/core/util/test_log.proto) proto will be printed. + +``` +python sample_benchmark.py --benchmarks=SampleBenchmark +``` + +Setting the flag as `--benchmarks=.` or `--benchmarks=all` would work as well. + +(Please ensure that Tensorflow is installed to successfully import the package in the line `import tensorflow as tf`. For installation instructions, see [Installing TensorFlow](https://www.tensorflow.org/install/). This step is not necessary when running with bazel.) + + ## Adding a `bazel` Target We have a special target called `tf_py_logged_benchmark` for benchmarks defined under TensorFlow github repo. `tf_py_logged_benchmark` should wrap around a regular `py_test` target. Running a `tf_py_logged_benchmark` would print a [TestResults](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/util/test_log.proto) proto. Defining a `tf_py_logged_benchmark` also lets us run it with TensorFlow continuous build.