MCPcopy Create free account
hub / github.com/ARM-software/armnn / CheckClTuningParameter

Function CheckClTuningParameter

tests/ExecuteNetwork/ExecuteNetworkParams.cpp:14–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#include <armnnUtils/Filesystem.hpp>
13
14void CheckClTuningParameter(const int& tuningLevel,
15 const std::string& tuningPath,
16 const std::vector<armnn::BackendId> computeDevices)
17{
18 if (!tuningPath.empty())
19 {
20 if (tuningLevel == 0)
21 {
22 ARMNN_LOG(info) << "Using cl tuning file: " << tuningPath << "\n";
23 if (!ValidatePath(tuningPath, true))
24 {
25 throw armnn::InvalidArgumentException("The tuning path is not valid");
26 }
27 }
28 else if ((1 <= tuningLevel) && (tuningLevel <= 3))
29 {
30 ARMNN_LOG(info) << "Starting execution to generate a cl tuning file: " << tuningPath << "\n"
31 << "Tuning level in use: " << tuningLevel << "\n";
32 }
33 else if ((0 < tuningLevel) || (tuningLevel > 3))
34 {
35 throw armnn::InvalidArgumentException(fmt::format("The tuning level {} is not valid.",
36 tuningLevel));
37 }
38
39 // Ensure that a GpuAcc is enabled. Otherwise no tuning data are used or genereted
40 // Only warn if it's not enabled
41 auto it = std::find(computeDevices.begin(), computeDevices.end(), "GpuAcc");
42 if (it == computeDevices.end())
43 {
44 ARMNN_LOG(warning) << "To use Cl Tuning the compute device GpuAcc needs to be active.";
45 }
46 }
47}
48
49void ExecuteNetworkParams::ValidateParams()
50{

Callers 1

ValidateParamsMethod · 0.85

Calls 7

ValidatePathFunction · 0.85
formatEnum · 0.85
findFunction · 0.85
emptyMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected