Skip to content

Commit

Permalink
remove redundant machine definitions
Browse files Browse the repository at this point in the history
Additionally, we temporarily as a shim set self.num_of_cores based on the physical cores times the number
of virtual cores per core
  • Loading branch information
schroeding committed Dec 8, 2024
1 parent 2047bfe commit 1cb6c3c
Showing 1 changed file with 5 additions and 96 deletions.
101 changes: 5 additions & 96 deletions benchexec/test_core_assignment_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def machine(self):
"""Create the necessary parameters of get_cpu_distribution for a specific machine."""

layer_definition, _virtual_cores_per_core = self.machine_definition
assert layer_definition[0] * _virtual_cores_per_core == self.num_of_cores
assert _virtual_cores_per_core == self.num_of_hyperthreading_siblings
self.num_of_cores = layer_definition[0] * _virtual_cores_per_core

layers = []

Expand All @@ -126,11 +125,8 @@ def machine(self):
# v again, it shouldn't matter in the end, but let's keep consistent with the current implementation to keep the
# tests consistent: hyperthreading "cores" get the id of their real core
if _i == 0:
_hyperthread_siblings = math.trunc(
self.num_of_cores / layer_definition[_i]
)
layer_number = layer_number * _hyperthread_siblings
layer_number -= layer_number % _hyperthread_siblings
layer_number = layer_number * _virtual_cores_per_core
layer_number -= layer_number % _virtual_cores_per_core
# ^ we can probably get rid of this piece of code in the end, TODO
_layer[layer_number] = _layer.get(layer_number, [])
_layer[layer_number].append(cpu_nr)
Expand All @@ -144,7 +140,8 @@ def machine(self):
return (layers,)

def mainAssertValid(self, coreLimit, expectedResult, maxThreads=None):
_, _virtual_cores_per_core = self.machine_definition
_layer_definition, _virtual_cores_per_core = self.machine_definition
self.num_of_cores = _layer_definition[0] * _virtual_cores_per_core
self.coreLimit = coreLimit
if expectedResult:
if maxThreads:
Expand Down Expand Up @@ -181,9 +178,6 @@ def _test_nCoresPerRun(self, coreLimit, expected_assignment, max_threads=None):
@expect_assignment(8, [list(range(8))])
@expect_invalid([(2, 5), (5, 2), (3, 3)])
class TestCpuCoresPerRun_singleCPU(TestCpuCoresPerRun):
num_of_packages = 1
num_of_cores = 8
num_of_hyperthreading_siblings = 1
use_hyperthreading = False
machine_definition = ([8, 1], 1)

Expand All @@ -195,9 +189,6 @@ class TestCpuCoresPerRun_singleCPU(TestCpuCoresPerRun):
@expect_assignment(8, [list(range(0, 16, 2))])
@expect_invalid([(2, 5), (5, 2), (3, 3)])
class TestCpuCoresPerRun_singleCPU_HT(TestCpuCoresPerRun):
num_of_packages = 1
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([8, 1], 2)

Expand Down Expand Up @@ -305,9 +296,6 @@ class TestCpuCoresPerRun_singleCPU_HT(TestCpuCoresPerRun):
)
@expect_invalid([(2, 17), (17, 2), (4, 9), (9, 4), (8, 5), (5, 8)])
class TestCpuCoresPerRun_dualCPU_HT(TestCpuCoresPerRun):
num_of_packages = 2
num_of_cores = 32
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([16, 2], 2)

Expand Down Expand Up @@ -337,9 +325,6 @@ def test_dualCPU_HT(self):
@expect_assignment(8, [[0, 1, 2, 3, 4, 5, 6, 7]])
@expect_invalid([(6, 2)])
class TestCpuCoresPerRun_threeCPU(TestCpuCoresPerRun):
num_of_packages = 3
num_of_cores = 15
num_of_hyperthreading_siblings = 1
use_hyperthreading = False
machine_definition = ([15, 3], 1)

Expand Down Expand Up @@ -401,9 +386,6 @@ class TestCpuCoresPerRun_threeCPU(TestCpuCoresPerRun):
)
@expect_invalid([(11, 2)])
class TestCpuCoresPerRun_threeCPU_HT(TestCpuCoresPerRun):
num_of_packages = 3
num_of_cores = 30
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([15, 3], 2)

Expand Down Expand Up @@ -464,9 +446,6 @@ def test_threeCPU_HT_noncontiguousId(self):
]
)
class TestCpuCoresPerRun_quadCPU_HT(TestCpuCoresPerRun):
num_of_packages = 4
num_of_cores = 64
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([32, 4], 2)

Expand Down Expand Up @@ -502,9 +481,6 @@ def test_quadCPU_HT(self):
@expect_assignment(4, [[0, 2, 4, 6]])
@expect_invalid([(1, 5), (2, 3), (3, 2), (4, 2), (8, 1)])
class TestCpuCoresPerRun_singleCPU_no_ht(TestCpuCoresPerRun):
num_of_packages = 1
num_of_cores = 8
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([4, 1], 2)

Expand All @@ -518,9 +494,6 @@ class TestCpuCoresPerRun_singleCPU_no_ht(TestCpuCoresPerRun):
[(1, 9), (1, 10), (2, 5), (2, 6), (3, 3), (3, 4), (4, 3), (4, 4), (8, 2), (8, 3)]
)
class TestCpuCoresPerRun_dualCPU_no_ht(TestCpuCoresPerRun):
num_of_packages = 2
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([8, 2], 2)

Expand All @@ -532,9 +505,6 @@ class TestCpuCoresPerRun_dualCPU_no_ht(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 2, 4, 6, 8, 10, 12, 14]])
@expect_invalid([(1, 10), (2, 4), (3, 4), (4, 2), (8, 2)])
class TestCpuCoresPerRun_threeCPU_no_ht(TestCpuCoresPerRun):
num_of_packages = 3
num_of_cores = 18
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([9, 3], 2)

Expand Down Expand Up @@ -575,9 +545,6 @@ class TestCpuCoresPerRun_threeCPU_no_ht(TestCpuCoresPerRun):
@expect_invalid([(1, 17), (2, 9), (3, 5), (4, 5), (8, 3)])
@expect_invalid([(5, 3), (6, 3)])
class TestCpuCoresPerRun_quadCPU_no_ht(TestCpuCoresPerRun):
num_of_packages = 4
num_of_cores = 32
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([16, 4], 2)

Expand All @@ -594,11 +561,6 @@ def test_quadCPU_no_ht_valid(self):
@expect_assignment(8, [[0, 2, 4, 6, 8, 10, 12, 14]])
@expect_invalid([(2, 5), (5, 2), (3, 3)])
class Test_Topology_P1_NUMA2_L8_C16_F(TestCpuCoresPerRun):
num_of_packages = 1
num_of_NUMAs = 2
num_of_L3_regions = 8
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([8, 8, 2, 1], 2)

Expand Down Expand Up @@ -636,11 +598,6 @@ class Test_Topology_P1_NUMA2_L8_C16_F(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14, 15]])
@expect_invalid([(2, 9), (4, 5), (3, 5)])
class Test_Topology_P1_NUMA2_L8_C16_T(TestCpuCoresPerRun):
num_of_packages = 1
num_of_NUMAs = 2
num_of_L3_regions = 8
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([8, 8, 2, 1], 2)

Expand All @@ -651,11 +608,6 @@ class Test_Topology_P1_NUMA2_L8_C16_T(TestCpuCoresPerRun):
@expect_assignment(4, [[0, 2, 4, 6]])
@expect_invalid([(2, 4), (3, 2), (4, 2)])
class Test_Topology_P1_NUMA3_L6_C12_F(TestCpuCoresPerRun):
num_of_packages = 1
num_of_NUMAs = 3
num_of_L3_regions = 6
num_of_cores = 12
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([6, 6, 3, 1], 2)
""" x P
Expand All @@ -676,11 +628,6 @@ class Test_Topology_P1_NUMA3_L6_C12_F(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 1, 2, 3, 4, 5, 6, 7]])
@expect_invalid([(2, 7), (3, 4), (4, 4), (5, 2)])
class Test_Topology_P1_NUMA3_L6_C12_T(TestCpuCoresPerRun):
num_of_packages = 1
num_of_NUMAs = 3
num_of_L3_regions = 6
num_of_cores = 12
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([6, 6, 3, 1], 2)
""" x P
Expand All @@ -700,11 +647,6 @@ class Test_Topology_P1_NUMA3_L6_C12_T(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 2, 4, 6, 8, 10, 12, 14]])
@expect_invalid([(2, 5), (3, 3), (4, 3), (8, 2)])
class Test_Topology_P2_NUMA4_L8_C16_F(TestCpuCoresPerRun):
num_of_packages = 2
num_of_NUMAs = 4
num_of_L3_regions = 8
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([8, 8, 4, 2], 2)

Expand All @@ -728,11 +670,6 @@ class Test_Topology_P2_NUMA4_L8_C16_F(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14, 15]])
@expect_invalid([(2, 9), (3, 5), (4, 5), (8, 3)])
class Test_Topology_P2_NUMA4_L8_C16_T(TestCpuCoresPerRun):
num_of_packages = 2
num_of_NUMAs = 4
num_of_L3_regions = 8
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([8, 8, 4, 2], 2)

Expand All @@ -744,12 +681,6 @@ class Test_Topology_P2_NUMA4_L8_C16_T(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 2, 4, 6, 8, 10, 12, 14]])
@expect_invalid([(2, 5), (3, 3), (4, 3), (8, 2)])
class Test_Topology_P1_G2_NUMA4_L8_C16_F(TestCpuCoresPerRun):
num_of_packages = 1
num_of_groups = 2
num_of_NUMAs = 4
num_of_L3_regions = 8
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = False
machine_definition = ([8, 8, 4, 2, 1], 2)

Expand All @@ -773,12 +704,6 @@ class Test_Topology_P1_G2_NUMA4_L8_C16_F(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14, 15]])
@expect_invalid([(2, 9), (3, 5), (4, 5), (8, 3)])
class Test_Topology_P1_G2_NUMA4_L8_C16_T(TestCpuCoresPerRun):
num_of_packages = 1
num_of_groups = 2
num_of_NUMAs = 4
num_of_L3_regions = 8
num_of_cores = 16
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([8, 8, 4, 2, 1], 2)

Expand All @@ -789,11 +714,6 @@ class Test_Topology_P1_G2_NUMA4_L8_C16_T(TestCpuCoresPerRun):
@expect_assignment(4, [[0, 3, 6, 9]])
@expect_invalid([(2, 3), (3, 2), (4, 2), (8, 3)])
class Test_Topology_P1_NUMA2_L4_C12_F3(TestCpuCoresPerRun):
num_of_packages = 1
num_of_NUMAs = 2
num_of_L3_regions = 4
num_of_cores = 12
num_of_hyperthreading_siblings = 3
use_hyperthreading = False
machine_definition = ([4, 4, 2, 1], 3)

Expand All @@ -805,11 +725,6 @@ class Test_Topology_P1_NUMA2_L4_C12_F3(TestCpuCoresPerRun):
@expect_assignment(8, [[0, 1, 2, 3, 4, 5, 6, 7]])
@expect_invalid([(2, 5), (3, 5), (4, 3), (8, 2)])
class Test_Topology_P1_NUMA2_L4_C12_T3(TestCpuCoresPerRun):
num_of_packages = 1
num_of_NUMAs = 2
num_of_L3_regions = 4
num_of_cores = 12
num_of_hyperthreading_siblings = 3
use_hyperthreading = True
machine_definition = ([4, 4, 2, 1], 3)

Expand Down Expand Up @@ -894,12 +809,6 @@ class Test_Topology_P1_NUMA2_L4_C12_T3(TestCpuCoresPerRun):
)
# fmt: on
class Test_Topology_P2_G2_NUMA8_L16_C256_T(TestCpuCoresPerRun):
num_of_packages = 2
num_of_groups = 2
num_of_NUMAs = 8
num_of_L3_regions = 16
num_of_cores = 256
num_of_hyperthreading_siblings = 2
use_hyperthreading = True
machine_definition = ([128, 16, 8, 2, 2], 2)

Expand Down

0 comments on commit 1cb6c3c

Please sign in to comment.