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

fix m1 not found leaf7_features (#34309)

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