ArmNN
 22.08
ExecuteNetworkParams.cpp File Reference

Go to the source code of this file.

Functions

void CheckClTuningParameter (const int &tuningLevel, const std::string &tuningPath, const std::vector< armnn::BackendId > computeDevices)
 

Function Documentation

◆ CheckClTuningParameter()

void CheckClTuningParameter ( const int &  tuningLevel,
const std::string &  tuningPath,
const std::vector< armnn::BackendId computeDevices 
)

Definition at line 14 of file ExecuteNetworkParams.cpp.

References ARMNN_LOG, and ValidatePath().

Referenced by ExecuteNetworkParams::ValidateParams().

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 }
#define ARMNN_LOG(severity)
Definition: Logging.hpp:205
bool ValidatePath(const std::string &file, const bool expectFile)
Verifies if the given string is a valid path.