From b4b3ac91990eb5deaffca2300319f2ddf7aa0886 Mon Sep 17 00:00:00 2001 From: Kevin May Date: Fri, 21 May 2021 16:42:21 +0100 Subject: IVGCVSW-6009 Integrate threadpool into ExNet * Remove concurrent flag from ExecuteNetwork as it is possible to deduce if SimultaneousIterations > 1 * Add void RunAsync() * Refactor some unit tests Change-Id: I7021d4821b0e460470908294cbd9462850e8b361 Signed-off-by: Keith Davis Signed-off-by: Kevin May --- .../ExecuteNetwork/ExecuteNetworkProgramOptions.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp') diff --git a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp index 042087e4f4..1f57f85252 100644 --- a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp +++ b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp @@ -195,7 +195,8 @@ ProgramOptions::ProgramOptions() : m_CxxOptions{"ExecuteNetwork", cxxopts::value(m_RuntimeOptions.m_DynamicBackendsPath)) ("n,concurrent", - "If this option is enabled inferences will be executed in parallel asynchronously.", + "This option is for Arm NN internal asynchronous testing purposes. " + "By default it is set to true if thread-pool-size or simultaneous-iterations are greater than 1", cxxopts::value(m_ExNetParams.m_Concurrent)->default_value("false")->implicit_value("true")) ("d,input-tensor-data", @@ -284,9 +285,15 @@ ProgramOptions::ProgramOptions() : m_CxxOptions{"ExecuteNetwork", "This option is depreciated please use tflite-executor instead", cxxopts::value(m_ExNetParams.m_EnableDelegate)->default_value("false")->implicit_value("true")) - ("simultaneous-iterations", - "Number of simultaneous iterations to async-run the network for, default is set to 1", - cxxopts::value(m_ExNetParams.m_SimultaneousIterations)->default_value("1")); + ("simultaneous-iterations", + "Number of simultaneous iterations to async-run the network for, default is set to 1 (disabled). " + "When thread-pool-size is set the Arm NN thread pool is used. Otherwise std::launch::async is used.", + cxxopts::value(m_ExNetParams.m_SimultaneousIterations)->default_value("1")) + + ("thread-pool-size", + "Number of Arm NN threads to use when running the network asynchronously via the Arm NN thread pool. " + "The default is set to 1", + cxxopts::value(m_ExNetParams.m_ThreadPoolSize)->default_value("1")); m_CxxOptions.add_options("c) Optimization") ("bf16-turbo-mode", @@ -453,7 +460,11 @@ void ProgramOptions::ParseOptions(int ac, const char* av[]) "please use tflite-executor instead."); } - + // Set concurrent to true if the user expects to run inferences asynchronously + if (m_ExNetParams.m_SimultaneousIterations > 1) + { + m_ExNetParams.m_Concurrent = true; + } // Parse input tensor shape from the string we got from the command-line. std::vector inputTensorShapesVector = -- cgit v1.2.1