42 TEST_CASE(
"TestFileOnlyProfiling")
48 for (
auto const& backend : suitableBackends)
57 ILocalPacketHandlerSharedPtr localPacketHandlerPtr = std::make_shared<TestTimelinePacketHandler>();
81 std::vector<armnn::BackendId> backendsVec {backend};
86 CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success);
89 std::vector<float> inputData(16);
90 std::vector<float> outputData(16);
91 for (
unsigned int i = 0; i < 16; ++i) {
96 TensorInfo inputTensorInfo = runtime.GetInputTensorInfo(netId, 0);
100 {0,
ConstTensor(inputTensorInfo, inputData.data())}
104 {0,
Tensor(runtime.GetOutputTensorInfo(netId, 0), outputData.data())}
108 runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
116 std::cout <<
error.what() << std::endl;
120 std::vector<std::string> expectedOutput;
121 expectedOutput.push_back(
"Entity [0] name = input type = layer");
122 expectedOutput.push_back(
" connection [17] from entity [0] to entity [1]");
123 expectedOutput.push_back(
" child: Entity [26] backendId = " + backend.Get() +
" type = workload");
124 expectedOutput.push_back(
"Entity [1] name = Rsqrt type = layer");
125 expectedOutput.push_back(
" connection [25] from entity [1] to entity [2]");
126 expectedOutput.push_back(
" child: Entity [18] backendId = " + backend.Get() +
" type = workload");
127 expectedOutput.push_back(
"Entity [2] name = output type = layer");
128 expectedOutput.push_back(
" child: Entity [30] backendId = " + backend.Get() +
" type = workload");
129 expectedOutput.push_back(
"Entity [6] processId = [processId] type = network");
130 expectedOutput.push_back(
" child: Entity [0] name = input type = layer");
131 expectedOutput.push_back(
" child: Entity [1] name = Rsqrt type = layer");
132 expectedOutput.push_back(
" child: Entity [2] name = output type = layer");
133 expectedOutput.push_back(
" execution: Entity [34] type = inference");
134 expectedOutput.push_back(
" event: [8] class [start_of_life]");
135 expectedOutput.push_back(
"Entity [18] backendId = " + backend.Get() +
" type = workload");
136 expectedOutput.push_back(
" execution: Entity [47] type = workload_execution");
137 expectedOutput.push_back(
"Entity [26] backendId = " + backend.Get() +
" type = workload");
138 expectedOutput.push_back(
" execution: Entity [39] type = workload_execution");
139 expectedOutput.push_back(
"Entity [30] backendId = " + backend.Get() +
" type = workload");
140 expectedOutput.push_back(
" execution: Entity [55] type = workload_execution");
141 expectedOutput.push_back(
"Entity [34] type = inference");
142 expectedOutput.push_back(
" child: Entity [39] type = workload_execution");
143 expectedOutput.push_back(
" child: Entity [47] type = workload_execution");
144 expectedOutput.push_back(
" child: Entity [55] type = workload_execution");
145 expectedOutput.push_back(
" event: [37] class [start_of_life]");
146 expectedOutput.push_back(
" event: [63] class [end_of_life]");
147 expectedOutput.push_back(
"Entity [39] type = workload_execution");
148 expectedOutput.push_back(
" event: [43] class [start_of_life]");
149 expectedOutput.push_back(
" event: [45] class [end_of_life]");
150 expectedOutput.push_back(
"Entity [47] type = workload_execution");
151 expectedOutput.push_back(
" event: [51] class [start_of_life]");
152 expectedOutput.push_back(
" event: [53] class [end_of_life]");
153 expectedOutput.push_back(
"Entity [55] type = workload_execution");
154 expectedOutput.push_back(
" event: [59] class [start_of_life]");
155 expectedOutput.push_back(
" event: [61] class [end_of_life]");
160 TEST_CASE(
"DumpOutgoingValidFileEndToEnd")
166 for (
auto const& backend : suitableBackends)
171 CHECK(!fs::exists(tempPath));
181 ILocalPacketHandlerSharedPtr localPacketHandlerPtr = std::make_shared<TestTimelinePacketHandler>();
206 std::vector<BackendId> backendsVec{backend};
211 CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success);
214 std::vector<float> inputData(16);
215 std::vector<float> outputData(16);
216 for (
unsigned int i = 0; i < 16; ++i) {
221 TensorInfo inputTensorInfo = runtime.GetInputTensorInfo(netId, 0);
225 {0,
ConstTensor(inputTensorInfo, inputData.data())}
229 {0,
Tensor(runtime.GetOutputTensorInfo(netId, 0), outputData.data())}
233 runtime.EnqueueWorkload(netId, inputTensors, outputTensors);
243 CHECK(fs::file_size(tempPath) > 0);
248 CHECK(fs::remove(tempPath));
std::vector< std::string > GetModelDescription(const TimelineModel &model)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
std::string m_OutgoingCaptureFile
Path to a file in which outgoing timeline profiling messages will be stored.
std::vector< arm::pipe::ILocalPacketHandlerSharedPtr > m_LocalPacketHandlers
const std::vector< arm::pipe::ProfilingException > & GetErrors() const
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
std::vector< BackendId > GetSuitableBackendRegistered()
Returns a vector of CpuRef, CpuAcc or GpuAcc backends if they where registered.
std::string m_IncomingCaptureFile
Path to a file in which incoming timeline profiling messages will be stored.
bool m_EnableProfiling
Indicates whether external profiling is enabled or not.
bool m_FileOnly
Enable profiling output to file only.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
bool CompareOutput(std::vector< std::string > output, std::vector< std::string > expectedOutput)
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
ProfilingOptions ConvertExternalProfilingOptions(const armnn::IRuntime::CreationOptions::ExternalProfilingOptions &options)
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
void SetConstant(const bool IsConstant=true)
Marks the data corresponding to this tensor info as constant.
uint32_t m_CapturePeriod
The duration at which captured profiling messages will be flushed.
bool m_TimelineEnabled
Indicates whether external timeline profiling is enabled or not.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
fs::path NamedTempFile(const char *fileName)
Returns a path to a file in the system temporary folder. If the file existed it will be deleted...
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
ExternalProfilingOptions m_ProfilingOptions
arm::pipe::IProfilingService & GetProfilingService(armnn::RuntimeImpl *runtime)