diff options
| author | Raghuveer Devulapalli <raghuveer.devulapalli@intel.com> | 2021-07-21 11:11:15 -0700 |
|---|---|---|
| committer | Raghuveer Devulapalli <raghuveer.devulapalli@intel.com> | 2021-08-24 08:54:52 -0700 |
| commit | 984ddd428394aa35b26ad452506cdd68a6e8e222 (patch) | |
| tree | e01f3c880056fe2bb3533ae002c40562f459efdc /numpy | |
| parent | 84ced527f53a0a2e0b937ece69c56fd57fd391d1 (diff) | |
| download | numpy-984ddd428394aa35b26ad452506cdd68a6e8e222.tar.gz | |
MAINT: Enable SVML for linux only
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/setup.py | 13 | ||||
| -rw-r--r-- | numpy/core/src/umath/simd.inc.src | 12 |
2 files changed, 18 insertions, 7 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index f9a264e83..0a1d6c8c3 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -63,6 +63,14 @@ class CallOnceOnly: out = copy.deepcopy(pickle.loads(self._check_complex)) return out +def can_link_svml(): + """SVML library is supported only on x86_64 architecture and currently + only on linux + """ + machine = platform.machine() + system = platform.system() + return "x86_64" in machine and system == "Linux" + def pythonlib_dir(): """return path where libpython* is.""" if sys.platform == 'win32': @@ -455,6 +463,9 @@ def configuration(parent_package='',top_path=None): # Inline check inline = config_cmd.check_inline() + if can_link_svml(): + moredefs.append(('NPY_CAN_LINK_SVML', 1)) + # Use relaxed stride checking if NPY_RELAXED_STRIDES_CHECKING: moredefs.append(('NPY_RELAXED_STRIDES_CHECKING', 1)) @@ -953,7 +964,7 @@ def configuration(parent_package='',top_path=None): ] svml_objs = [] - if "x86" in platform.machine(): + if can_link_svml(): for svmlsrc in os.listdir("numpy/core/src/umath/svml"): if svmlsrc.endswith(".s"): svml_objs.append(join('src', 'umath', 'svml', svmlsrc)) diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src index 552e584d0..bca6af360 100644 --- a/numpy/core/src/umath/simd.inc.src +++ b/numpy/core/src/umath/simd.inc.src @@ -129,7 +129,7 @@ run_binary_avx512f_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_in * #func = tanh, exp2, log2, log10, expm1, log1p, cbrt, tan, asin, acos, atan, sinh, cosh, asinh, acosh, atanh# */ -#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS +#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && defined NPY_CAN_LINK_SVML static NPY_INLINE NPY_GCC_TARGET_AVX512_SKX void AVX512_SKX_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps); #endif @@ -137,7 +137,7 @@ AVX512_SKX_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const static NPY_INLINE int run_unary_avx512_skx_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { -#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS +#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && defined NPY_CAN_LINK_SVML if (IS_UNARY_SMALL_STEPS_AND_NOMEMOVERLAP) { AVX512_SKX_@func@_@TYPE@(args, dimensions, steps); return 1; @@ -155,7 +155,7 @@ run_unary_avx512_skx_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_ * #func = sin, cos# */ -#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS +#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && defined NPY_CAN_LINK_SVML static NPY_INLINE NPY_GCC_TARGET_AVX512_SKX void AVX512_SKX_@func@_DOUBLE(char **args, npy_intp const *dimensions, npy_intp const *steps); #endif @@ -163,7 +163,7 @@ AVX512_SKX_@func@_DOUBLE(char **args, npy_intp const *dimensions, npy_intp const static NPY_INLINE int run_unary_avx512_skx_@func@_DOUBLE(char **args, npy_intp const *dimensions, npy_intp const *steps) { -#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS +#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && defined NPY_CAN_LINK_SVML if (IS_UNARY_SMALL_STEPS_AND_NOMEMOVERLAP) { AVX512_SKX_@func@_DOUBLE(args, dimensions, steps); return 1; @@ -1207,7 +1207,7 @@ NPY_FINLINE NPY_GCC_OPT_3 NPY_GCC_TARGET_@ISA@ @vtype@d * #default_val = 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0# */ -#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS +#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && defined NPY_CAN_LINK_SVML static NPY_INLINE NPY_GCC_TARGET_AVX512_SKX void AVX512_SKX_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { @@ -1274,7 +1274,7 @@ AVX512_SKX_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const * #func = sin, cos# */ -#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS +#if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && defined NPY_CAN_LINK_SVML static NPY_INLINE NPY_GCC_TARGET_AVX512_SKX void AVX512_SKX_@func@_DOUBLE(char **args, npy_intp const *dimensions, npy_intp const *steps) { |
