|
|
06a3fb7 |
From 74191d2b2652122be5cf3610a073060cb039fa23 Mon Sep 17 00:00:00 2001
|
|
|
06a3fb7 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
06a3fb7 |
Date: Fri, 23 Sep 2016 21:25:19 -0400
|
|
|
06a3fb7 |
Subject: [PATCH] setup.py: gracefuly handle cpuinfo failure
|
|
|
06a3fb7 |
|
|
|
06a3fb7 |
When comping on aarch64, setup.py fails with:
|
|
|
06a3fb7 |
Exception: py-cpuinfo currently only works on X86 and some ARM CPUs.
|
|
|
06a3fb7 |
Assume that the CPU does not support SSE2 or AVX in importing cpuinfo fails
|
|
|
06a3fb7 |
and continue.
|
|
|
06a3fb7 |
---
|
|
|
06a3fb7 |
setup.py | 13 +++++++++----
|
|
|
06a3fb7 |
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
|
06a3fb7 |
|
|
|
06a3fb7 |
diff --git a/setup.py b/setup.py
|
|
|
06a3fb7 |
index 6b64a571c3..b0dc5bf12a 100755
|
|
|
06a3fb7 |
--- a/setup.py
|
|
|
06a3fb7 |
+++ b/setup.py
|
|
|
06a3fb7 |
@@ -32,8 +32,13 @@ import distutils.spawn
|
|
|
06a3fb7 |
from setuptools.command.build_ext import build_ext
|
|
|
06a3fb7 |
|
|
|
06a3fb7 |
# For guessing the capabilities of the CPU for C-Blosc
|
|
|
06a3fb7 |
-import cpuinfo
|
|
|
06a3fb7 |
-cpu_info = cpuinfo.get_cpu_info()
|
|
|
06a3fb7 |
+try:
|
|
|
06a3fb7 |
+ import cpuinfo
|
|
|
06a3fb7 |
+ cpu_info = cpuinfo.get_cpu_info()
|
|
|
06a3fb7 |
+ cpu_flags = cpu_info['flags']
|
|
|
06a3fb7 |
+except Exception as e:
|
|
|
06a3fb7 |
+ print('cpuinfo failed, assuming no CPU features:', e)
|
|
|
06a3fb7 |
+ cpu_flags = []
|
|
|
06a3fb7 |
|
|
|
06a3fb7 |
# The name for the pkg-config utility
|
|
|
06a3fb7 |
PKG_CONFIG = 'pkg-config'
|
|
|
06a3fb7 |
@@ -812,7 +817,7 @@ if 'BLOSC' not in optional_libs:
|
|
|
06a3fb7 |
os.remove(fd.name)
|
|
|
06a3fb7 |
|
|
|
06a3fb7 |
# SSE2
|
|
|
06a3fb7 |
- if 'sse2' in cpu_info['flags']:
|
|
|
06a3fb7 |
+ if 'sse2' in cpu_flags:
|
|
|
06a3fb7 |
print('SSE2 detected')
|
|
|
06a3fb7 |
CFLAGS.append('-DSHUFFLE_SSE2_ENABLED')
|
|
|
06a3fb7 |
if os.name == 'nt':
|
|
|
06a3fb7 |
@@ -826,7 +831,7 @@ if 'BLOSC' not in optional_libs:
|
|
|
06a3fb7 |
if 'sse2' in f]
|
|
|
06a3fb7 |
# AVX2
|
|
|
06a3fb7 |
# Detection code for AVX2 only works for gcc/clang, not for MSVC yet
|
|
|
06a3fb7 |
- if ('avx2' in cpu_info['flags'] and
|
|
|
06a3fb7 |
+ if ('avx2' in cpu_flags and
|
|
|
06a3fb7 |
compiler_has_flags(compiler, ["-mavx2"])):
|
|
|
06a3fb7 |
print('AVX2 detected')
|
|
|
06a3fb7 |
CFLAGS.append('-DSHUFFLE_AVX2_ENABLED')
|
|
|
06a3fb7 |
--
|
|
|
06a3fb7 |
2.9.0
|
|
|
06a3fb7 |
|