Skip to content

Commit

Permalink
test(model): Update CPU topology tests to use integer instead of floa…
Browse files Browse the repository at this point in the history
…t for frequencies
  • Loading branch information
gfieni committed Oct 4, 2023
1 parent 8204f5f commit 506f36d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/unit/model/test_cpu_topology.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, INRIA
# Copyright (c) 2023, Inria
# Copyright (c) 2023, University of Lille
# All rights reserved.
#
Expand Down Expand Up @@ -35,31 +35,31 @@ def test_cpu_topology_amd_epyc_7351():
Test the CPUTopology class with an AMD EPYC 7351 CPU configuration.
https://www.amd.com/en/support/cpu/amd-epyc/amd-epyc-7001-series/amd-epyc-7351
"""
cpu_topology = CPUTopology(155, 100.0, 12, 24, 29)
assert cpu_topology.get_min_frequency() == 1200.0
assert cpu_topology.get_base_frequency() == 2400.0
assert cpu_topology.get_max_frequency() == 2900.0
assert cpu_topology.get_supported_frequencies() == [ratio * 100.0 for ratio in range(12, 29 + 1)]
cpu_topology = CPUTopology(155, 100, 12, 24, 29)
assert cpu_topology.get_min_frequency() == 1200
assert cpu_topology.get_base_frequency() == 2400
assert cpu_topology.get_max_frequency() == 2900
assert cpu_topology.get_supported_frequencies() == [ratio * 100 for ratio in range(12, 29 + 1)]


def test_cpu_topology_intel_xeon_gold_5220():
"""
Test the CPUTopology class with an Intel Xeon Gold 5220 CPU configuration.
https://www.intel.com/content/www/us/en/products/sku/193388/intel-xeon-gold-5220-processor-24-75m-cache-2-20-ghz/
"""
cpu_topology = CPUTopology(125, 100.0, 10, 22, 39)
assert cpu_topology.get_min_frequency() == 1000.0
assert cpu_topology.get_base_frequency() == 2200.0
assert cpu_topology.get_max_frequency() == 3900.0
assert cpu_topology.get_supported_frequencies() == [ratio * 100.0 for ratio in range(10, 39 + 1)]
cpu_topology = CPUTopology(125, 100, 10, 22, 39)
assert cpu_topology.get_min_frequency() == 1000
assert cpu_topology.get_base_frequency() == 2200
assert cpu_topology.get_max_frequency() == 3900
assert cpu_topology.get_supported_frequencies() == [ratio * 100 for ratio in range(10, 39 + 1)]


def test_cpu_topology_with_133mhz_base_clock():
"""
Test the CPUTopology class with a base clock of 133MHz.
"""
cpu_topology = CPUTopology(0, 133.0, 10, 20, 30)
assert cpu_topology.get_min_frequency() == 1330.0
assert cpu_topology.get_base_frequency() == 2660.0
assert cpu_topology.get_max_frequency() == 3990.0
assert cpu_topology.get_supported_frequencies() == [ratio * 133.0 for ratio in range(10, 30 + 1)]
cpu_topology = CPUTopology(0, 133, 10, 20, 30)
assert cpu_topology.get_min_frequency() == 1330
assert cpu_topology.get_base_frequency() == 2660
assert cpu_topology.get_max_frequency() == 3990
assert cpu_topology.get_supported_frequencies() == [ratio * 133 for ratio in range(10, 30 + 1)]

0 comments on commit 506f36d

Please sign in to comment.