Skip to content

Commit 0c9027b

Browse files
authored
add arch checker class (#1332)
1 parent 0240431 commit 0c9027b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

AI-and-Analytics/version_check.py

+27
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@
1111
modin_found = util.find_spec("modin") is not None
1212
torchccl_found = util.find_spec("oneccl_bindings_for_pytorch") is not None
1313

14+
class arch_checker:
15+
16+
def __init__(self):
17+
cpuinfo_found = util.find_spec("cpuinfo") is not None
18+
if cpuinfo_found == False:
19+
self.arch = 'None'
20+
print("please install py-cpuinfo")
21+
return
22+
from cpuinfo import get_cpu_info
23+
info = get_cpu_info()
24+
flags = info['flags']
25+
arch_list = ['SPR', 'CPX',"ICX|CLX", "SKX", "BDW|CORE|ATOM"]
26+
isa_list = [['amx_bf16', 'amx_int8', 'amx_tile'],['avx512_bf16'],['avx512_vnni'],['avx512'],['avx2']]
27+
index = len(arch_list) - 1
28+
for flag in flags:
29+
for idx, isa_sublist in enumerate(isa_list):
30+
for isa in isa_sublist:
31+
if isa in flag:
32+
if idx < index:
33+
index = idx
34+
self.arch = arch_list[index]
35+
return
36+
1437
if tensorflow_found == True:
1538

1639
import tensorflow as tf
@@ -85,3 +108,7 @@ def get_mkl_enabled_flag():
85108
if torchccl_found == True:
86109
import oneccl_bindings_for_pytorch as torchccl
87110
print("oneCCL Bindings version {}".format(torchccl.__version__))
111+
112+
113+
checker = arch_checker()
114+
print("Arch : ", checker.arch)

0 commit comments

Comments
 (0)