diff options
author | Jan Eilers <jan.eilers@arm.com> | 2020-10-15 18:34:43 +0100 |
---|---|---|
committer | Jan Eilers <jan.eilers@arm.com> | 2020-10-20 13:48:50 +0100 |
commit | 45274909b06a4882ada92899c58ee66194446135 (patch) | |
tree | 61a67ce012ef80fbd5d5f23cc8a22ba39ea2c7f2 /tests/ExecuteNetwork/ExecuteNetworkProgramOptions.hpp | |
parent | 3c24f43ff9afb50898d6a73ccddbc0936f72fdad (diff) | |
download | armnn-45274909b06a4882ada92899c58ee66194446135.tar.gz |
IVGCVSW-5284 Refactor ExecuteNetwork
* Removed boost program options and replaced it with cxxopts
* Unified adding, parsing and validation of program options
into the struct ProgramOptions
* Program options are now parsed directly into ExecuteNetworkParams
which can be passed directly to MainImpl
* Split NetworkExecutionUtils into header and source
* Removed RunTest
* Removed RunCsvTest
* Removed RunClTuning
* Moved MainImpl back to ExecuteNetwork.cpp
* Added additional util functions
The functionality of ExecuteNetwork remains the same. Only
cl tuning runs need to be started separately
and there is no short option for fp16-turbo-mode because -h is
reserved in cxxopts to print help messages
Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Change-Id: Ib9689375c81e1a184c17bb3ea66c3550430bbe09
Diffstat (limited to 'tests/ExecuteNetwork/ExecuteNetworkProgramOptions.hpp')
-rw-r--r-- | tests/ExecuteNetwork/ExecuteNetworkProgramOptions.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.hpp b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.hpp new file mode 100644 index 0000000000..0b43176ab3 --- /dev/null +++ b/tests/ExecuteNetwork/ExecuteNetworkProgramOptions.hpp @@ -0,0 +1,46 @@ +// +// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "ExecuteNetworkParams.hpp" +#include <armnn/IRuntime.hpp> + +/* + * Historically we use the ',' character to separate dimensions in a tensor shape. However, cxxopts will read this + * an an array of values which is fine until we have multiple tensors specified. This lumps the values of all shapes + * together in a single array and we cannot break it up again. We'll change the vector delimiter to a '.'. We do this + * as close as possible to the usage of cxxopts to avoid polluting other possible uses. + */ +#define CXXOPTS_VECTOR_DELIMITER '.' +#include <cxxopts/cxxopts.hpp> + +/// Holds and parses program options for the ExecuteNetwork application +struct ProgramOptions +{ + /// Initializes ProgramOptions by adding options to the underlying cxxopts::options object. + /// (Does not parse any options) + ProgramOptions(); + + /// Runs ParseOptions() on initialization + ProgramOptions(int ac, const char* av[]); + + /// Parses program options from the command line or another source and stores + /// the values in member variables. It also checks the validity of the parsed parameters. + /// Throws a cxxopts exception if parsing fails or an armnn exception if parameters are not valid. + void ParseOptions(int ac, const char* av[]); + + /// Ensures that the parameters for ExecuteNetwork fit together + void ValidateExecuteNetworkParams(); + + /// Ensures that the runtime options are valid + void ValidateRuntimeOptions(); + + cxxopts::Options m_CxxOptions; + cxxopts::ParseResult m_CxxResult; + + ExecuteNetworkParams m_ExNetParams; + armnn::IRuntime::CreationOptions m_RuntimeOptions; +};
\ No newline at end of file |