aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/test/test_runtime.py
diff options
context:
space:
mode:
authorÉanna Ó Catháin <eanna.ocathain@arm.com>2020-04-16 08:54:12 +0100
committerÉanna Ó Catháin <eanna.ocathain@arm.com>2020-04-16 08:54:12 +0100
commit59da369d2a66e49eb0f84d596ed7162621c32d06 (patch)
tree0689778226834336c7b667212627ef72bbd6f4e0 /python/pyarmnn/test/test_runtime.py
parent3c9e04563b9fb7d7aadc61834909a9ffc6b1769c (diff)
downloadarmnn-59da369d2a66e49eb0f84d596ed7162621c32d06.tar.gz
MLECO-712 Enable creation of runtime with external profiling support
Change-Id: Ie0af439817eb4ed70e6112b2eb6f4a2c787a6bd0 Signed-off-by: Éanna Ó Catháin <eanna.ocathain@arm.com>
Diffstat (limited to 'python/pyarmnn/test/test_runtime.py')
-rw-r--r--python/pyarmnn/test/test_runtime.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/python/pyarmnn/test/test_runtime.py b/python/pyarmnn/test/test_runtime.py
index 2943be8f16..ff0ad40b55 100644
--- a/python/pyarmnn/test/test_runtime.py
+++ b/python/pyarmnn/test/test_runtime.py
@@ -14,6 +14,7 @@ def random_runtime(shared_data_folder):
network = parser.CreateNetworkFromBinaryFile(os.path.join(shared_data_folder, 'mock_model.tflite'))
preferred_backends = [ann.BackendId('CpuRef')]
options = ann.CreationOptions()
+
runtime = ann.IRuntime(options)
graphs_count = parser.GetSubgraphCount()
@@ -95,7 +96,6 @@ def test_python_disowns_network(random_runtime):
assert not opt_network.thisown
-
def test_load_network(random_runtime):
preferred_backends = random_runtime[0]
network = random_runtime[1]
@@ -108,6 +108,40 @@ def test_load_network(random_runtime):
assert "" == messages
assert net_id == 0
+def test_create_runtime_with_external_profiling_enabled():
+
+ options = ann.CreationOptions()
+
+ options.m_ProfilingOptions.m_FileOnly = True
+ options.m_ProfilingOptions.m_EnableProfiling = True
+ options.m_ProfilingOptions.m_OutgoingCaptureFile = "/tmp/outgoing.txt"
+ options.m_ProfilingOptions.m_IncomingCaptureFile = "/tmp/incoming.txt"
+ options.m_ProfilingOptions.m_TimelineEnabled = True
+ options.m_ProfilingOptions.m_CapturePeriod = 1000
+ options.m_ProfilingOptions.m_FileFormat = "JSON"
+
+ runtime = ann.IRuntime(options)
+
+ assert runtime is not None
+
+def test_create_runtime_with_external_profiling_enabled_invalid_options():
+
+ options = ann.CreationOptions()
+
+ options.m_ProfilingOptions.m_FileOnly = True
+ options.m_ProfilingOptions.m_EnableProfiling = False
+ options.m_ProfilingOptions.m_OutgoingCaptureFile = "/tmp/outgoing.txt"
+ options.m_ProfilingOptions.m_IncomingCaptureFile = "/tmp/incoming.txt"
+ options.m_ProfilingOptions.m_TimelineEnabled = True
+ options.m_ProfilingOptions.m_CapturePeriod = 1000
+ options.m_ProfilingOptions.m_FileFormat = "JSON"
+
+ with pytest.raises(RuntimeError) as err:
+ runtime = ann.IRuntime(options)
+
+ expected_error_message = "It is not possible to enable timeline reporting without profiling being enabled"
+ assert expected_error_message in str(err.value)
+
def test_load_network_properties_provided(random_runtime):
preferred_backends = random_runtime[0]