Close everything properly
This commit is contained in:
parent
8689d62f02
commit
b9cccbf9ae
1 changed files with 18 additions and 11 deletions
|
|
@ -12,7 +12,11 @@ http://software.intel.com/sites/default/files/m/a/b/3/4/d/41604-319433-012a.pdf
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys, os, subprocess
|
import sys
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import contextlib
|
||||||
|
|
||||||
|
|
||||||
def detect_avx_support(option='detect'):
|
def detect_avx_support(option='detect'):
|
||||||
'''Detect AVX support'''
|
'''Detect AVX support'''
|
||||||
|
|
@ -36,6 +40,7 @@ def detect_unix_like():
|
||||||
except IOError:
|
except IOError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
with contextlib.closing(info):
|
||||||
for line in info:
|
for line in info:
|
||||||
if line.lstrip().startswith('flags'):
|
if line.lstrip().startswith('flags'):
|
||||||
features = line.split()
|
features = line.split()
|
||||||
|
|
@ -50,6 +55,8 @@ def detect_osx_like():
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
with info:
|
||||||
features = info.stdout.read().decode('UTF8')
|
features = info.stdout.read().decode('UTF8')
|
||||||
features = features.split()
|
features = features.split()
|
||||||
return 'AVX1.0' in features and 'OSXSAVE' in features and 'XSAVE' in features
|
return 'AVX1.0' in features and 'OSXSAVE' in features and 'XSAVE' in features
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue