未验证 提交 832c3894 编写于 作者: T tianshuo78520a 提交者: GitHub

fix m1 not found leaf7_features (#34309)

上级 e0da9666
...@@ -92,15 +92,14 @@ def avx_supported(): ...@@ -92,15 +92,14 @@ def avx_supported():
'Can not get the AVX flag from machdep.cpu.features.\n' 'Can not get the AVX flag from machdep.cpu.features.\n'
'The original error is: %s\n' % cpt.get_exception_message(e)) 'The original error is: %s\n' % cpt.get_exception_message(e))
if not has_avx: if not has_avx:
try: import subprocess
has_avx = os.popen( pipe = subprocess.Popen(
'sysctl machdep.cpu.leaf7_features | grep -i avx').read( 'sysctl machdep.cpu.leaf7_features | grep -i avx',
) != '' shell=True,
except Exception as e: stdout=subprocess.PIPE,
sys.stderr.write( stderr=subprocess.PIPE)
'Can not get the AVX flag from machdep.cpu.leaf7_features.\n' _ = pipe.communicate()
'The original error is: %s\n' % has_avx = True if pipe.returncode == 0 else False
cpt.get_exception_message(e))
return has_avx return has_avx
elif sysstr == 'windows': elif sysstr == 'windows':
import ctypes import ctypes
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册