From 4951b8c62905ffec880bf304b00aac5cffc6c9ac Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Thu, 3 Oct 2019 10:04:30 -0700 Subject: IVGCVSW-3948 Adds External Profiling cmdline to ExecuteNetwork Change-Id: If172bcb64e8202abbde4b8a6cee14f672bc259cd Signed-off-by: Jim Flynn --- include/armnn/IRuntime.hpp | 2 ++ tests/ExecuteNetwork/ExecuteNetwork.cpp | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp index 68965cffa5..8003fd9514 100644 --- a/include/armnn/IRuntime.hpp +++ b/include/armnn/IRuntime.hpp @@ -73,6 +73,8 @@ public: bool m_FileOnly; uint32_t m_CapturePeriod; }; + + ExternalProfilingOptions m_ProfilingOptions; }; static IRuntime* CreateRaw(const CreationOptions& options); diff --git a/tests/ExecuteNetwork/ExecuteNetwork.cpp b/tests/ExecuteNetwork/ExecuteNetwork.cpp index d97a19928c..2309a8b0eb 100644 --- a/tests/ExecuteNetwork/ExecuteNetwork.cpp +++ b/tests/ExecuteNetwork/ExecuteNetwork.cpp @@ -30,6 +30,11 @@ int main(int argc, const char* argv[]) std::string dynamicBackendsPath; std::string outputTensorFiles; + // external profiling parameters + std::string outgoingCaptureFile; + std::string incomingCaptureFile; + uint32_t counterCapturePeriod; + double thresholdTime = 0.0; size_t subgraphId = 0; @@ -95,7 +100,17 @@ int main(int argc, const char* argv[]) "inference time is greater than the threshold time, the test will fail. By default, no threshold " "time is used.") ("print-intermediate-layers,p", po::bool_switch()->default_value(false), - "If this option is enabled, the output of every graph layer will be printed."); + "If this option is enabled, the output of every graph layer will be printed.") + ("enable-external-profiling,a", po::bool_switch()->default_value(false), + "If enabled external profiling will be switched on") + ("outgoing-capture-file,j", po::value(&outgoingCaptureFile), + "If specified the outgoing external profiling packets will be captured in this binary file") + ("incoming-capture-file,k", po::value(&incomingCaptureFile), + "If specified the incoming external profiling packets will be captured in this binary file") + ("file-only-external-profiling,g", po::bool_switch()->default_value(false), + "If enabled then the 'file-only' test mode of external profiling will be enabled") + ("counter-capture-period,u", po::value(&counterCapturePeriod)->default_value(150u), + "If profiling is enabled in 'file-only' mode this is the capture period that will be used in the test"); } catch (const std::exception& e) { @@ -138,6 +153,8 @@ int main(int argc, const char* argv[]) bool enableFp16TurboMode = vm["fp16-turbo-mode"].as(); bool quantizeInput = vm["quantize-input"].as(); bool printIntermediate = vm["print-intermediate-layers"].as(); + bool enableExternalProfiling = vm["enable-external-profiling"].as(); + bool fileOnlyExternalProfiling = vm["file-only-external-profiling"].as(); // Check whether we have to load test cases from a file. if (CheckOption(vm, "test-cases")) @@ -163,6 +180,11 @@ int main(int argc, const char* argv[]) // Create runtime armnn::IRuntime::CreationOptions options; options.m_EnableGpuProfiling = enableProfiling; + options.m_ProfilingOptions.m_EnableProfiling = enableExternalProfiling; + options.m_ProfilingOptions.m_IncomingCaptureFile = incomingCaptureFile; + options.m_ProfilingOptions.m_OutgoingCaptureFile = outgoingCaptureFile; + options.m_ProfilingOptions.m_FileOnly = fileOnlyExternalProfiling; + options.m_ProfilingOptions.m_CapturePeriod = counterCapturePeriod; std::shared_ptr runtime(armnn::IRuntime::Create(options)); -- cgit v1.2.1