2015-12-21 18 views
1

已经有在tensorflow一些功能来创建可以在行动中可以看出,例如in the adjust contrast op benchmark基准。然而,如果我在我的机器上运行这个,我只是得到一个空输出:如何在tensorflow中为自定义内核创建/运行基准测试?

[email protected]:~/tensorflow$ bazel run //tensorflow/core:kernels_adjust_contrast_op_benchmark_test --test_output=all --cache_test_results=no -- --benchmarks=1000 
INFO: Found 1 target... 
Target //tensorflow/core:kernels_adjust_contrast_op_benchmark_test up-to-date: 
    bazel-bin/tensorflow/core/kernels_adjust_contrast_op_benchmark_test 
INFO: Elapsed time: 10.736s, Critical Path: 8.71s. 

INFO: Running command line: bazel-bin/tensorflow/core/kernels_adjust_contrast_op_benchmark_test '--benchmarks=1000'. 
Running main() from test_main.cc 
Benchmark Time(ns) Iterations 
-------------------------------- 

我的调用是否错误?

+0

你能尝试传递命令行标志'--benchmarks = all'而不是'--benchmarks = 1000'吗? – mrry

+0

@ mrry工作,谢谢! – panmari

回答

2

要调用的基准,运行以下命令(通过--benchmarks=all作为最终参数):

$ bazel run -c opt //tensorflow/core:kernels_adjust_contrast_op_benchmark_test \ 
     --test_output=all --cache_test_results=no -- --benchmarks=all 

要运行GPU基准测试,你必须通过--config=cudabazel并追加_gpu到了测试目标的名称。例如:

$ bazel run -c opt --config=cuda \ 
    //tensorflow/core:kernels_adjust_contrast_op_benchmark_test_gpu \ 
    --test_output=all --cache_test_results=no -- --benchmarks=all 
+0

供将来参考:已更改,构建规则现在需要'_gpu'后缀来运行gpu基准。见文档在https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/BUILD#L12 – panmari

+0

谢谢!我更新了答案,指出了这一点。 – mrry

+0

当你在这里,你也可以添加适当的优化标志:--config opt --config = cuda – panmari

相关问题