23
23
from .logger import logger
24
24
25
25
26
- def get_numa_cpus_conf () -> Dict :
26
+ def get_numa_cpus_conf () -> Dict [ int , str ] :
27
27
try :
28
- _ , numa_cpus_map , _ = read_output_from_command (
29
- "lscpu | grep NUMA | grep CPU | awk '{ print $4 }'" , shell = True
30
- )
31
- return {i : cpus for i , cpus in enumerate (numa_cpus_map .split ("\n " ))}
28
+ _ , lscpu_text , _ = read_output_from_command ("lscpu" )
29
+ return {
30
+ i : numa_cpus
31
+ for i , numa_cpus in enumerate (
32
+ map (
33
+ lambda x : x .split (" " )[- 1 ],
34
+ filter (
35
+ lambda line : "NUMA" in line and "CPU(s)" in line ,
36
+ lscpu_text .split ("\n " ),
37
+ ),
38
+ )
39
+ )
40
+ }
32
41
except FileNotFoundError :
33
42
logger .warning ("Unable to get numa cpus configuration via lscpu" )
34
43
return dict ()
@@ -54,26 +63,25 @@ def get_software_info() -> Dict:
54
63
55
64
56
65
def get_oneapi_devices () -> pd .DataFrame :
57
- # # Removed until dpctl bug is fixed
58
- # # (lost devices in subprocesses)
59
- # try:
60
- # import dpctl
61
- # devices = dpctl.get_devices()
62
- # devices = {
63
- # device.filter_string: {
64
- # "name": device.name,
65
- # "vendor": device.vendor,
66
- # "type": str(device.device_type).split(".")[1],
67
- # "driver version": device.driver_version,
68
- # "memory size[GB]": device.global_mem_size / 2**30,
69
- # }
70
- # for device in devices
71
- # }
72
- # return pd.DataFrame(devices).T
73
- # except (ImportError, ModuleNotFoundError):
74
- # logger.warning("dpctl can not be imported")
75
- # # 'type' is left for device type selection only
76
- return pd .DataFrame ({"type" : list ()})
66
+ try :
67
+ import dpctl
68
+
69
+ devices = dpctl .get_devices ()
70
+ devices = {
71
+ device .filter_string : {
72
+ "name" : device .name ,
73
+ "vendor" : device .vendor ,
74
+ "type" : str (device .device_type ).split ("." )[1 ],
75
+ "driver version" : device .driver_version ,
76
+ "memory size[GB]" : device .global_mem_size / 2 ** 30 ,
77
+ }
78
+ for device in devices
79
+ }
80
+ return pd .DataFrame (devices ).T
81
+ except (ImportError , ModuleNotFoundError ):
82
+ logger .warning ("dpctl can not be imported" )
83
+ # 'type' is left for device type selection only
84
+ return pd .DataFrame ({"type" : list ()})
77
85
78
86
79
87
def get_higher_isa (cpu_flags : str ) -> str :
0 commit comments