mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-04 10:10:08 +01:00
added test for optimal throughput assignment and invalid asmbench import files
This commit is contained in:
@@ -115,6 +115,16 @@ class TestDBInterface(unittest.TestCase):
|
|||||||
for _, e in entries.items():
|
for _, e in entries.items():
|
||||||
self.assertIsNotNone(e['throughput'])
|
self.assertIsNotNone(e['throughput'])
|
||||||
self.assertIsNotNone(e['latency'])
|
self.assertIsNotNone(e['latency'])
|
||||||
|
# remove empty line => no import since broken format
|
||||||
|
del input_data[3]
|
||||||
|
entries = dbi._get_asmbench_output(input_data, 'aarch64')
|
||||||
|
self.assertEqual(len(entries), 0)
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
dbi.import_benchmark_output(
|
||||||
|
'csx', 'invalid_bench_type', self._find_file('asmbench_import_x86.dat')
|
||||||
|
)
|
||||||
|
with self.assertRaises(AssertionError):
|
||||||
|
dbi.import_benchmark_output('csx', 'ibench', 'invalid_file')
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Helper functions
|
# Helper functions
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Unit tests for Semantic Analysis
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
from copy import deepcopy
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
|
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
@@ -106,6 +107,26 @@ class TestSemanticTools(unittest.TestCase):
|
|||||||
self.assertIsInstance(instruction_form['port_pressure'], list)
|
self.assertIsInstance(instruction_form['port_pressure'], list)
|
||||||
self.assertEqual(len(instruction_form['port_pressure']), port_num)
|
self.assertEqual(len(instruction_form['port_pressure']), port_num)
|
||||||
|
|
||||||
|
def test_optimal_throughput_assignment(self):
|
||||||
|
# x86
|
||||||
|
kernel_fixed = deepcopy(self.kernel_x86)
|
||||||
|
self.semantics_csx.add_semantics(kernel_fixed)
|
||||||
|
kernel_optimal = deepcopy(kernel_fixed)
|
||||||
|
self.semantics_csx.assign_optimal_throughput(kernel_optimal)
|
||||||
|
tp_fixed = self.semantics_csx.get_throughput_sum(kernel_fixed)
|
||||||
|
tp_optimal = self.semantics_csx.get_throughput_sum(kernel_optimal)
|
||||||
|
self.assertNotEqual(tp_fixed, tp_optimal)
|
||||||
|
self.assertTrue(max(tp_optimal) <= max(tp_fixed))
|
||||||
|
# arm
|
||||||
|
kernel_fixed = deepcopy(self.kernel_AArch64)
|
||||||
|
self.semantics_tx2.add_semantics(kernel_fixed)
|
||||||
|
kernel_optimal = deepcopy(kernel_fixed)
|
||||||
|
self.semantics_tx2.assign_optimal_throughput(kernel_optimal)
|
||||||
|
tp_fixed = self.semantics_tx2.get_throughput_sum(kernel_fixed)
|
||||||
|
tp_optimal = self.semantics_tx2.get_throughput_sum(kernel_optimal)
|
||||||
|
self.assertNotEqual(tp_fixed, tp_optimal)
|
||||||
|
self.assertTrue(max(tp_optimal) <= max(tp_fixed))
|
||||||
|
|
||||||
def test_kernelDG_x86(self):
|
def test_kernelDG_x86(self):
|
||||||
#
|
#
|
||||||
# 4
|
# 4
|
||||||
|
|||||||
Reference in New Issue
Block a user