2015-12-21 56 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

相關問題