- added support for all ipr cluster cpus

work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3958]
This commit is contained in:
Guillaume Raffy 2024-11-18 23:04:29 +01:00
parent 862a3911f0
commit 628ac7352a
5 changed files with 76 additions and 9 deletions

View File

@ -1,6 +1,6 @@
from datetime import datetime
from .core import IAutoParam, BenchParam, BenchParamType
from .main import __version__ as iprbench_version
from .version import __version__ as iprbench_version
import socket
import subprocess
import re
@ -76,13 +76,36 @@ class CpuModel(IAutoParam):
cpu_model_name: the name of a cpu as seen in /proc/cpuinfo (eg 'Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz')
return: a compact identifier of the cpu model without spaces (eg 'intel_core_i5_8350u' (the frequency is implicit, as this model only operates at 1.7 Ghz))
"""
cpu_model_id = None
match = re.match(r'Intel\(R\) Core\(TM\) i(?P<major_id>[357])-(?P<minor_id>[0-9]+[U]) CPU @ [0-9]+\.[0-9]+GHz', cpu_model_name)
if match:
cpu_model_id = f'intel_core_i{match["major_id"]}_{match["minor_id"].lower()}'
else:
assert False, f'unhandled cpu model name: "{cpu_model_name}"'
return cpu_model_id
return f'intel_core_i{match["major_id"]}_{match["minor_id"].lower()}'
# eg "Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz"
match = re.match(r'Intel\(R\) Xeon\(R\) Gold +(?P<xeon_id>[^ ]+) +CPU +@ [0-9]+\.[0-9]+GHz', cpu_model_name)
if match:
return f'intel_xeon_gold_{match["xeon_id"].lower()}'
# eg "Intel(R) Xeon(R) CPU X5650 @ 2.67GHz"
# eg 'Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz': 'intel_xeon_e5-2660',
# eg 'Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz': 'intel_xeon_e5-2660v2'
# eg'Intel(R) Xeon(R) CPU E5-2660 v4 @ 2.00GHz': 'intel_xeon_e5-2660v4'
match = re.match(r'Intel\(R\) Xeon\(R\) CPU +(?P<xeon_id>[^ ]+) +(?P<version>(?:[^@ ]+ +|))@ [0-9]+\.[0-9]+GHz', cpu_model_name)
if match:
cpu_id = f'intel_xeon_{match["xeon_id"].lower()}'
version = match['version']
m2 = re.match(r'^v(?P<version_number>[0-9]+) ', version)
if m2:
cpu_id += f'v{m2["version_number"]}'
return cpu_id
# eg "AMD EPYC 7282 16-Core Processor"
match = re.match(r'AMD EPYC (?P<epyc_model_id>[0-9a-z]+) (?P<num_cores>[0-9]+)-Core Processor', cpu_model_name)
if match:
return f'amd_epyc_{match["epyc_model_id"].lower()}'
assert False, f'unhandled cpu model name: "{cpu_model_name}"'
return None
def get_value(self) -> BenchParamType:
# completed_process = subprocess.run('grep "^model name +:" /proc/cpuinfo | head -1 | sed "s/model name *: //"', shell=True, check=True, capture_output=True)

View File

@ -1,5 +1,3 @@
__version__ = '0.0.2'
from .core import BenchmarkId, IBenchmark, ResultsDbFactory
from .benchmarks.hibench import HiBench
from .benchmarks.mamul1 import MaMul1

1
iprbench/version.py Normal file
View File

@ -0,0 +1 @@
__version__ = '0.0.3'

View File

@ -35,7 +35,7 @@ Repository = "https://github.com/g-raffy/starbench"
packages = ["iprbench", "iprbench.benchmarks", "iprbench.resultsdb"]
[tool.setuptools.dynamic]
version = {attr = "iprbench.main.__version__"}
version = {attr = "iprbench.version.__version__"}
[tool.setuptools.package-data]
iprbench = ["resources/**/*"]

45
test/test_cpu.py Normal file
View File

@ -0,0 +1,45 @@
"""test all benchmarks
"""
import unittest
import logging
from pathlib import Path
from iprbench.autoparams import CpuModel
class CpuTestCase(unittest.TestCase):
results_root_dir: Path
def setUp(self) -> None: # pylint: disable=useless-parent-delegation
return super().setUp()
def test_cpu(self):
# amd_epyc_7282
# amd_epyc_7282
# intel_xeon_x5550
# intel_xeon_x5650
# intel_xeon_e5-2660
# intel_xeon_e5-2660v2
# intel_xeon_e5-2660v4
# intel_xeon_gold_5220
# intel_xeon_gold_6140
# intel_xeon_gold_6154
# intel_xeon_gold_6226r
# intel_xeon_gold_6248r
ipr_cpus_id = {
r'Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz': 'intel_core_i5_8350u',
r'Intel(R) Xeon(R) CPU X5650 @ 2.67GHz': 'intel_xeon_x5650',
r'Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz': 'intel_xeon_e5-2660',
r'Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz': 'intel_xeon_e5-2660v2',
r'Intel(R) Xeon(R) CPU E5-2660 v4 @ 2.00GHz': 'intel_xeon_e5-2660v4',
r'Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz': 'intel_xeon_gold_6248r',
r'AMD EPYC 7282 16-Core Processor': 'amd_epyc_7282',
r'AMD EPYC 7452 32-Core Processor': 'amd_epyc_7452',
}
for cpuinfo_id, short_id in ipr_cpus_id.items():
self.assertEqual(CpuModel.model_name_to_cpu_model_id(cpuinfo_id), short_id)
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
unittest.main()