aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColm Donelan <colm.donelan@arm.com>2024-05-07 11:51:26 +0100
committerColm Donelan <colm.donelan@arm.com>2024-05-07 12:36:02 +0000
commitf5fa0dbb9a1b2918f3e391bb7a7c895f23fcbf65 (patch)
tree6958fcdb7aaa634d8e1f60b2ea28cbc8346782ab
parent794119d07960d61c2d32aa4d94447912fe5fefba (diff)
downloadarmnn-f5fa0dbb9a1b2918f3e391bb7a7c895f23fcbf65.tar.gz
IVGCVSW-8350 Enable serialize-to-armnn only when ARMNN_SERIALIZER is on.
Signed-off-by: Colm Donelan <colm.donelan@arm.com> Change-Id: I8f036370aa87f8aa54316996aafc5baed18ecc2c
-rw-r--r--tests/ExecuteNetwork/ArmNNExecutor.cpp10
-rw-r--r--tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp4
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/ExecuteNetwork/ArmNNExecutor.cpp b/tests/ExecuteNetwork/ArmNNExecutor.cpp
index 2bbb9f9a8d..23f5f8ee25 100644
--- a/tests/ExecuteNetwork/ArmNNExecutor.cpp
+++ b/tests/ExecuteNetwork/ArmNNExecutor.cpp
@@ -9,11 +9,13 @@
#include <AsyncExecutionCallback.hpp>
#include <armnn/IAsyncExecutionCallback.hpp>
+#if defined(ARMNN_SERIALIZER)
#include <armnnSerializer/ISerializer.hpp>
-
+#endif
using namespace armnn;
using namespace std::chrono;
+#if defined(ARMNN_SERIALIZER)
/**
* Given a reference to an INetwork and a target directory, serialize the network to a file
* called "<timestamp>_network.armnn"
@@ -121,6 +123,7 @@ std::string SerializeNetworkToDotFile(const armnn::IOptimizedNetwork& optimizedN
fileStream.close();
return fileName;
}
+#endif
ArmNNExecutor::ArmNNExecutor(const ExecuteNetworkParams& params, armnn::IRuntime::CreationOptions runtimeOptions)
: m_Params(params)
@@ -139,6 +142,7 @@ ArmNNExecutor::ArmNNExecutor(const ExecuteNetworkParams& params, armnn::IRuntime
// If the user has asked for detailed data write out the .armnn amd .dot files.
if (params.m_SerializeToArmNN)
{
+#if defined(ARMNN_SERIALIZER)
// .armnn first.
// This could throw multiple exceptions if the directory cannot be created or the file cannot be written.
std::string targetDirectory(armnnUtils::Filesystem::CreateDirectory("/ArmNNSerializeNetwork"));
@@ -150,8 +154,10 @@ ArmNNExecutor::ArmNNExecutor(const ExecuteNetworkParams& params, armnn::IRuntime
fileName =
SerializeNetworkToDotFile(*optNet, targetDirectory);
ARMNN_LOG(info) << "The optimized network has been serialized to:" << fileName;
+#else
+ ARMNN_LOG(info) << "Arm NN has not been built with ARMNN_SERIALIZER enabled.";
+#endif
}
-
m_IOInfo = GetIOInfo(optNet.get());
armnn::ProfilingDetailsMethod profilingDetailsMethod = ProfilingDetailsMethod::Undefined;
diff --git a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
index ba994b0da8..2eb68713c6 100644
--- a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
+++ b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.cpp
@@ -352,10 +352,10 @@ ProgramOptions::ProgramOptions() : m_CxxOptions{"ExecuteNetwork",
" the tflite ref model.",
cxxopts::value<bool>(m_ExNetParams.m_CompareWithTflite)->default_value("false")
->implicit_value("true"))
-
("serialize-to-armnn",
"Serialize the loaded network to an .armnn file. This option will also serialize the optimized network"
- " in dot format. This option only works with the TfLite parser. An inference will NOT be executed.",
+ " in dot format. This option only works with both the TfLite parser and the Arm NN serializer"
+ " enabled in the build. An inference will NOT be executed.",
cxxopts::value<bool>(m_ExNetParams.m_SerializeToArmNN)->default_value("false")
->implicit_value("true"));