Repository: reframe-hpc/reframe

Issue:
Add a `model` field in `DeviceInfo`
Currently, the `arch` and `type` are not enough: `type` is meant to be a generic string, such as `gpu`, `arch` could be something like `sm_90` and `model` could a be a more precise information on the model, as we do with the CPUs.

Discussion:

Patch:
diff --git a/reframe/core/systems.py b/reframe/core/systems.py
index d51247f8..7c5a785e 100644
--- a/reframe/core/systems.py
+++ b/reframe/core/systems.py
@@ -128,7 +128,7 @@ class DeviceInfo(_ReadOnlyInfo, jsonext.JSONSerializable):
     '''
 
     __slots__ = ()
-    _known_attrs = ('type', 'arch')
+    _known_attrs = ('type', 'arch', 'model')
 
     @property
     def info(self):
diff --git a/reframe/schemas/config.json b/reframe/schemas/config.json
index f4872128..01f3b9e7 100644
--- a/reframe/schemas/config.json
+++ b/reframe/schemas/config.json
@@ -233,6 +233,7 @@
             "properties": {
                 "type": {"type": "string"},
                 "arch": {"type": "string"},
+                "model": {"type": "string"},
                 "num_devices": {"type": "number"}
             }
         },


Test patch:
diff --git a/unittests/resources/config/settings.py b/unittests/resources/config/settings.py
index 9a622e0d..6c0c2fa5 100644
--- a/unittests/resources/config/settings.py
+++ b/unittests/resources/config/settings.py
@@ -117,7 +117,8 @@ site_configuration = {
                     'devices': [
                         {
                             'type': 'gpu',
-                            'arch': 'p100',
+                            'arch': 'sm_60',
+                            'model': 'p100',
                             'num_devices': 1
                         }
                     ]
diff --git a/unittests/test_autodetect.py b/unittests/test_autodetect.py
index cc59007a..bf53f6f8 100644
--- a/unittests/test_autodetect.py
+++ b/unittests/test_autodetect.py
@@ -26,7 +26,8 @@ def temp_topo(tmp_path, monkeypatch):
         json.dump([
             {
                 'type': 'gpu',
-                'arch': 'a100',
+                'arch': 'sm_80',
+                'model': 'a100',
                 'num_devices': 8
             }
         ], fp)
@@ -79,10 +80,14 @@ def test_autotect(default_exec_ctx):
     assert len(part.devices) == 1
     assert part.devices[0].info == {
         'type': 'gpu',
-        'arch': 'a100',
+        'arch': 'sm_80',
+        'model': 'a100',
         'num_devices': 8
     }
     assert part.devices[0].device_type == 'gpu'
+    assert part.devices[0].type == 'gpu'
+    assert part.devices[0].arch == 'sm_80'
+    assert part.devices[0].model == 'a100'
 
     # Test immutability of ProcessorInfo and DeviceInfo
     with pytest.raises(AttributeError):
diff --git a/unittests/test_config.py b/unittests/test_config.py
index ddb7e012..bbefa0e5 100644
--- a/unittests/test_config.py
+++ b/unittests/test_config.py
@@ -474,6 +474,14 @@ def test_system_create(site_config):
     assert partition.processor.num_numa_nodes == 1
     assert partition.processor.num_cores_per_numa_node == 4
 
+    # Check device info
+    assert len(partition.devices) == 1
+    assert partition.devices[0].type == 'gpu'
+    assert partition.devices[0].device_type == 'gpu'
+    assert partition.devices[0].arch == 'sm_60'
+    assert partition.devices[0].model == 'p100'
+    assert partition.devices[0].num_devices == 1
+
     # Select another subconfig and check that the default selection of
     # container runtime is done properly
     site_config.select_subconfig('testsys:login')