提交 21035e70 编写于 作者: Z zhangjun

auto detect cpu avx instruction set

上级 8ba5a838
......@@ -330,12 +330,21 @@ class Server(object):
def use_mkl(self, flag):
self.mkl_flag = flag
def check_avx(self):
p = subprocess.Popen(['cat /proc/cpuinfo | grep avx 2>/dev/null'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = p.communicate()
if err == '' and len(out) > 0:
return True
else:
return False
def get_device_version(self):
avx_flag = False
mkl_flag = self.mkl_flag
r = os.system("cat /proc/cpuinfo | grep avx > /dev/null 2>&1")
if r == 0:
avx_support = self.check_avx()
if avx_suppport:
avx_flag = True
self.use_mkl(True)
mkl_flag = self.mkl_flag
if avx_flag:
if mkl_flag:
device_version = "cpu-avx-mkl"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册