diff --git a/files/0001-Try-to-load-so.avx2-libs-first-if-they-exist-and-cpu.patch b/files/0001-Try-to-load-so.avx2-libs-first-if-they-exist-and-cpu.patch new file mode 100644 --- /dev/null +++ b/files/0001-Try-to-load-so.avx2-libs-first-if-they-exist-and-cpu.patch @@ -0,0 +1,45 @@ +From 325fb5e5ee95a597b50583846938e3ba97fa78ab Mon Sep 17 00:00:00 2001 +From: Joey Riches +Date: Thu, 22 Jul 2021 02:54:21 +0100 +Subject: [PATCH 1/1] Try to load so.avx2 libs first if they exist and cpu is + supported + +We compile for haswell so we also check for popcnt to exclude bdver4 (Exacavator) + +Not really the most ideal solution but should do the trick. +--- + Python/dynload_shlib.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c +index f271193190..f25c01dce0 100644 +--- a/Python/dynload_shlib.c ++++ b/Python/dynload_shlib.c +@@ -61,6 +61,7 @@ _PyImport_FindSharedFuncptr(const char *prefix, + void *handle; + char funcname[258]; + char pathbuf[260]; ++ char *pathname2; + int dlopenflags=0; + + if (strchr(pathname, '/') == NULL) { +@@ -93,7 +94,15 @@ _PyImport_FindSharedFuncptr(const char *prefix, + + dlopenflags = PyThreadState_GET()->interp->dlopenflags; + +- handle = dlopen(pathname, dlopenflags); ++ pathname2 = malloc(strlen(pathname) + strlen(".avx2") + 1); ++ sprintf(pathname2, "%s%s", pathname, ".avx2"); ++ if (__builtin_cpu_supports("avx2") && ++ __builtin_cpu_supports("popcnt") && // We compile for haswell, add popcnt count to exclude bdver4 (Exacavator) ++ access(pathname2, R_OK) == 0) ++ handle = dlopen(pathname2, dlopenflags); ++ else ++ handle = dlopen(pathname, dlopenflags); ++ free(pathname2); + + if (handle == NULL) { + PyObject *mod_name; +-- +2.32.0 + diff --git a/files/series b/files/series --- a/files/series +++ b/files/series @@ -1 +1,2 @@ 0001-ensurepip-Always-install-pip-setuptools-ignoring-ins.patch +0001-Try-to-load-so.avx2-libs-first-if-they-exist-and-cpu.patch diff --git a/package.yml b/package.yml --- a/package.yml +++ b/package.yml @@ -1,6 +1,6 @@ name : python3 version : 3.9.6 -release : 35 +release : 36 source : - https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz : 397920af33efc5b97f2e0b57e91923512ef89fc5b3c1d21dbfc8c4828ce0108a license : Python-2.0 diff --git a/pspec_x86_64.xml b/pspec_x86_64.xml --- a/pspec_x86_64.xml +++ b/pspec_x86_64.xml @@ -5058,7 +5058,7 @@ programming.devel - python3 + python3 /usr/include/python3.9/Python-ast.h @@ -5231,7 +5231,7 @@ programming.python - python3 + python3 /usr/lib/python3.9/test/Sine-1000Hz-300ms.aif @@ -8536,15 +8536,15 @@ programming.python - python3 + python3 /usr/lib64/python3.9/lib-dynload/_tkinter.cpython-39-x86_64-linux-gnu.so - - 2021-08-08 + + 2021-08-11 3.9.6 Packaging update Joey Riches