Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Orion Poplawski | e045c2963d | |
Orion Poplawski | ea4c7b3a8d | |
Orion Poplawski | d511cd7c32 | |
Orion Poplawski | d88427056a | |
Orion Poplawski | d3472b22ff | |
Orion Poplawski | 3fe06b86b4 | |
Tomas Tomecek | a29fb063e7 |
|
@ -0,0 +1,127 @@
|
|||
From f0b2dd7d5151878f2b4b3ea20ff551b27243f27d Mon Sep 17 00:00:00 2001
|
||||
From: Charles Harris <charlesr.harris@gmail.com>
|
||||
Date: Wed, 24 Dec 2014 11:26:13 -0700
|
||||
Subject: [PATCH] BUG: Xerbla doesn't get linked in 1.9 on Fedora 21.
|
||||
|
||||
Add our python_xerbla to the blasdot sources. That function is
|
||||
needed for all modules that link to the ATLAS 3.10 libraries, which
|
||||
in Fedora 21 are located in just two files: libsatlas and libtatlas.
|
||||
|
||||
Also make the test for xerbla linkage work better. If xerbla is not
|
||||
linked the test will be skipped with a message.
|
||||
---
|
||||
numpy/core/blasdot/python_xerbla.c | 51 ++++++++++++++++++++++++++++++++++++++
|
||||
numpy/core/setup.py | 3 ++-
|
||||
numpy/linalg/tests/test_linalg.py | 9 ++++---
|
||||
3 files changed, 59 insertions(+), 4 deletions(-)
|
||||
create mode 100644 numpy/core/blasdot/python_xerbla.c
|
||||
|
||||
diff --git a/numpy/core/blasdot/python_xerbla.c b/numpy/core/blasdot/python_xerbla.c
|
||||
new file mode 100644
|
||||
index 0000000..bdf0b90
|
||||
--- /dev/null
|
||||
+++ b/numpy/core/blasdot/python_xerbla.c
|
||||
@@ -0,0 +1,51 @@
|
||||
+#include "Python.h"
|
||||
+
|
||||
+/*
|
||||
+ * From f2c.h, this should be safe unless fortran is set to use 64
|
||||
+ * bit integers. We don't seem to have any good way to detect that.
|
||||
+ */
|
||||
+typedef int integer;
|
||||
+
|
||||
+/*
|
||||
+ From the original manpage:
|
||||
+ --------------------------
|
||||
+ XERBLA is an error handler for the LAPACK routines.
|
||||
+ It is called by an LAPACK routine if an input parameter has an invalid value.
|
||||
+ A message is printed and execution stops.
|
||||
+
|
||||
+ Instead of printing a message and stopping the execution, a
|
||||
+ ValueError is raised with the message.
|
||||
+
|
||||
+ Parameters:
|
||||
+ -----------
|
||||
+ srname: Subroutine name to use in error message, maximum six characters.
|
||||
+ Spaces at the end are skipped.
|
||||
+ info: Number of the invalid parameter.
|
||||
+*/
|
||||
+
|
||||
+int xerbla_(char *srname, integer *info)
|
||||
+{
|
||||
+ static const char format[] = "On entry to %.*s" \
|
||||
+ " parameter number %d had an illegal value";
|
||||
+ char buf[sizeof(format) + 6 + 4]; /* 6 for name, 4 for param. num. */
|
||||
+
|
||||
+ int len = 0; /* length of subroutine name*/
|
||||
+#ifdef WITH_THREAD
|
||||
+ PyGILState_STATE save;
|
||||
+#endif
|
||||
+
|
||||
+ while( len<6 && srname[len]!='\0' )
|
||||
+ len++;
|
||||
+ while( len && srname[len-1]==' ' )
|
||||
+ len--;
|
||||
+#ifdef WITH_THREAD
|
||||
+ save = PyGILState_Ensure();
|
||||
+#endif
|
||||
+ PyOS_snprintf(buf, sizeof(buf), format, len, srname, *info);
|
||||
+ PyErr_SetString(PyExc_ValueError, buf);
|
||||
+#ifdef WITH_THREAD
|
||||
+ PyGILState_Release(save);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
|
||||
index 1cd1ee1..baaee20 100644
|
||||
--- a/numpy/core/setup.py
|
||||
+++ b/numpy/core/setup.py
|
||||
@@ -954,12 +954,13 @@ def get_dotblas_sources(ext, build_dir):
|
||||
if blas_info:
|
||||
if ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', []):
|
||||
return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient.
|
||||
- return ext.depends[:2]
|
||||
+ return ext.depends[:3]
|
||||
return None # no extension module will be built
|
||||
|
||||
config.add_extension('_dotblas',
|
||||
sources = [get_dotblas_sources],
|
||||
depends = [join('blasdot', '_dotblas.c'),
|
||||
+ join('blasdot', 'python_xerbla.c'),
|
||||
join('blasdot', 'apple_sgemv_patch.c'),
|
||||
join('blasdot', 'cblas.h'),
|
||||
],
|
||||
diff --git a/numpy/linalg/tests/test_linalg.py b/numpy/linalg/tests/test_linalg.py
|
||||
index 8edf36a..dec98db 100644
|
||||
--- a/numpy/linalg/tests/test_linalg.py
|
||||
+++ b/numpy/linalg/tests/test_linalg.py
|
||||
@@ -1108,6 +1108,8 @@ def test_xerbla_override():
|
||||
# and may, or may not, abort the process depending on the LAPACK package.
|
||||
from nose import SkipTest
|
||||
|
||||
+ XERBLA_OK = 255
|
||||
+
|
||||
try:
|
||||
pid = os.fork()
|
||||
except (OSError, AttributeError):
|
||||
@@ -1137,15 +1139,16 @@ def test_xerbla_override():
|
||||
a, a, 0, 0)
|
||||
except ValueError as e:
|
||||
if "DORGQR parameter number 5" in str(e):
|
||||
- # success
|
||||
- os._exit(os.EX_OK)
|
||||
+ # success, reuse error code to mark success as
|
||||
+ # FORTRAN STOP returns as success.
|
||||
+ os._exit(XERBLA_OK)
|
||||
|
||||
# Did not abort, but our xerbla was not linked in.
|
||||
os._exit(os.EX_CONFIG)
|
||||
else:
|
||||
# parent
|
||||
pid, status = os.wait()
|
||||
- if os.WEXITSTATUS(status) != os.EX_OK or os.WIFSIGNALED(status):
|
||||
+ if os.WEXITSTATUS(status) != XERBLA_OK:
|
||||
raise SkipTest('Numpy xerbla not linked in.')
|
||||
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
|
||||
index 7a38bed..5bd3a90 100644
|
||||
--- a/numpy/distutils/misc_util.py
|
||||
+++ b/numpy/distutils/misc_util.py
|
||||
@@ -605,11 +605,29 @@ def get_shared_lib_extension(is_python_ext=False):
|
||||
Linux, but not on OS X.
|
||||
|
||||
"""
|
||||
- so_ext = distutils.sysconfig.get_config_var('SO') or ''
|
||||
- # fix long extension for Python >=3.2, see PEP 3149.
|
||||
- if (not is_python_ext) and 'SOABI' in distutils.sysconfig.get_config_vars():
|
||||
- # Does nothing unless SOABI config var exists
|
||||
- so_ext = so_ext.replace('.' + distutils.sysconfig.get_config_var('SOABI'), '', 1)
|
||||
+ confvars = distutils.sysconfig.get_config_vars()
|
||||
+ # SO is deprecated in 3.3.1, use EXT_SUFFIX instead
|
||||
+ so_ext = confvars.get('EXT_SUFFIX', None)
|
||||
+ if so_ext is None:
|
||||
+ so_ext = confvars.get('SO', '')
|
||||
+
|
||||
+ if not is_python_ext:
|
||||
+ # hardcode known values, config vars (including SHLIB_SUFFIX) are
|
||||
+ # unreliable (see #3182)
|
||||
+ # darwin, windows and debug linux are wrong in 3.3.1 and older
|
||||
+ if (sys.platform.startswith('linux') or
|
||||
+ sys.platform.startswith('gnukfreebsd')):
|
||||
+ so_ext = '.so'
|
||||
+ elif sys.platform.startswith('darwin'):
|
||||
+ so_ext = '.dylib'
|
||||
+ elif sys.platform.startswith('win'):
|
||||
+ so_ext = '.dll'
|
||||
+ else:
|
||||
+ # fall back to config vars for unknown platforms
|
||||
+ # fix long extension for Python >=3.2, see PEP 3149.
|
||||
+ if 'SOABI' in confvars:
|
||||
+ # Does nothing unless SOABI config var exists
|
||||
+ so_ext = so_ext.replace('.' + confvars.get('SOABI'), '', 1)
|
||||
|
||||
return so_ext
|
||||
|
||||
diff --git a/numpy/distutils/tests/test_misc_util.py b/numpy/distutils/tests/test_misc_util.py
|
||||
index 448800b..0f870d3 100644
|
||||
--- a/numpy/distutils/tests/test_misc_util.py
|
||||
+++ b/numpy/distutils/tests/test_misc_util.py
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from numpy.testing import *
|
||||
-from numpy.distutils.misc_util import appendpath, minrelpath, gpaths, rel_path
|
||||
+from numpy.distutils.misc_util import appendpath, minrelpath, \
|
||||
+ gpaths, get_shared_lib_extension
|
||||
from os.path import join, sep, dirname
|
||||
|
||||
ajoin = lambda *paths: join(*((sep,)+paths))
|
||||
@@ -53,6 +54,21 @@ class TestGpaths(TestCase):
|
||||
f = gpaths('system_info.py', local_path)
|
||||
assert_(join(local_path,'system_info.py')==f[0],`f`)
|
||||
|
||||
+class TestSharedExtension(TestCase):
|
||||
+
|
||||
+ def test_get_shared_lib_extension(self):
|
||||
+ import sys
|
||||
+ ext = get_shared_lib_extension(is_python_ext=False)
|
||||
+ if sys.platform.startswith('linux'):
|
||||
+ assert_equal(ext, '.so')
|
||||
+ elif sys.platform.startswith('gnukfreebsd'):
|
||||
+ assert_equal(ext, '.so')
|
||||
+ elif sys.platform.startswith('darwin'):
|
||||
+ assert_equal(ext, '.dylib')
|
||||
+ elif sys.platform.startswith('win'):
|
||||
+ assert_equal(ext, '.dll')
|
||||
+ # just check for no crash
|
||||
+ assert_(get_shared_lib_extension(is_python_ext=True))
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_module_suite()
|
|
@ -0,0 +1,85 @@
|
|||
diff -up numpy-1.8.2/numpy/core/blasdot/python_xerbla.c.xerbla numpy-1.8.2/numpy/core/blasdot/python_xerbla.c
|
||||
--- numpy-1.8.2/numpy/core/blasdot/python_xerbla.c.xerbla 2015-01-12 11:04:43.981867493 -0700
|
||||
+++ numpy-1.8.2/numpy/core/blasdot/python_xerbla.c 2015-01-12 11:04:43.980867500 -0700
|
||||
@@ -0,0 +1,51 @@
|
||||
+#include "Python.h"
|
||||
+
|
||||
+/*
|
||||
+ * From f2c.h, this should be safe unless fortran is set to use 64
|
||||
+ * bit integers. We don't seem to have any good way to detect that.
|
||||
+ */
|
||||
+typedef int integer;
|
||||
+
|
||||
+/*
|
||||
+ From the original manpage:
|
||||
+ --------------------------
|
||||
+ XERBLA is an error handler for the LAPACK routines.
|
||||
+ It is called by an LAPACK routine if an input parameter has an invalid value.
|
||||
+ A message is printed and execution stops.
|
||||
+
|
||||
+ Instead of printing a message and stopping the execution, a
|
||||
+ ValueError is raised with the message.
|
||||
+
|
||||
+ Parameters:
|
||||
+ -----------
|
||||
+ srname: Subroutine name to use in error message, maximum six characters.
|
||||
+ Spaces at the end are skipped.
|
||||
+ info: Number of the invalid parameter.
|
||||
+*/
|
||||
+
|
||||
+int xerbla_(char *srname, integer *info)
|
||||
+{
|
||||
+ static const char format[] = "On entry to %.*s" \
|
||||
+ " parameter number %d had an illegal value";
|
||||
+ char buf[sizeof(format) + 6 + 4]; /* 6 for name, 4 for param. num. */
|
||||
+
|
||||
+ int len = 0; /* length of subroutine name*/
|
||||
+#ifdef WITH_THREAD
|
||||
+ PyGILState_STATE save;
|
||||
+#endif
|
||||
+
|
||||
+ while( len<6 && srname[len]!='\0' )
|
||||
+ len++;
|
||||
+ while( len && srname[len-1]==' ' )
|
||||
+ len--;
|
||||
+#ifdef WITH_THREAD
|
||||
+ save = PyGILState_Ensure();
|
||||
+#endif
|
||||
+ PyOS_snprintf(buf, sizeof(buf), format, len, srname, *info);
|
||||
+ PyErr_SetString(PyExc_ValueError, buf);
|
||||
+#ifdef WITH_THREAD
|
||||
+ PyGILState_Release(save);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff -up numpy-1.8.2/numpy/core/setup.py.xerbla numpy-1.8.2/numpy/core/setup.py
|
||||
--- numpy-1.8.2/numpy/core/setup.py.xerbla 2015-01-12 11:04:43.978867512 -0700
|
||||
+++ numpy-1.8.2/numpy/core/setup.py 2015-01-12 15:35:42.593240782 -0700
|
||||
@@ -947,12 +947,13 @@ def configuration(parent_package='',top_
|
||||
if blas_info:
|
||||
if ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', []):
|
||||
return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient.
|
||||
- return ext.depends[:1]
|
||||
+ return ext.depends[:2]
|
||||
return None # no extension module will be built
|
||||
|
||||
config.add_extension('_dotblas',
|
||||
sources = [get_dotblas_sources],
|
||||
depends = [join('blasdot', '_dotblas.c'),
|
||||
+ join('blasdot', 'python_xerbla.c'),
|
||||
join('blasdot', 'cblas.h'),
|
||||
],
|
||||
include_dirs = ['blasdot'],
|
||||
diff -up numpy-1.8.2/numpy/linalg/tests/test_linalg.py.xerbla numpy-1.8.2/numpy/linalg/tests/test_linalg.py
|
||||
--- numpy-1.8.2/numpy/linalg/tests/test_linalg.py.xerbla 2014-08-05 12:04:19.000000000 -0600
|
||||
+++ numpy-1.8.2/numpy/linalg/tests/test_linalg.py 2015-01-12 11:04:43.981867493 -0700
|
||||
@@ -1108,6 +1108,8 @@ def test_xerbla_override():
|
||||
# and may, or may not, abort the process depending on the LAPACK package.
|
||||
from nose import SkipTest
|
||||
|
||||
+ XERBLA_OK = 255
|
||||
+
|
||||
try:
|
||||
pid = os.fork()
|
||||
except (OSError, AttributeError):
|
36
numpy.spec
36
numpy.spec
|
@ -9,7 +9,7 @@
|
|||
|
||||
Name: numpy
|
||||
Version: 1.8.2
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Epoch: 1
|
||||
Summary: A fast multidimensional array facility for Python
|
||||
|
||||
|
@ -18,8 +18,10 @@ Group: Development/Languages
|
|||
License: BSD and Python
|
||||
URL: http://www.numpy.org/
|
||||
Source0: http://downloads.sourceforge.net/numpy/%{name}-%{version}%{?relc}.tar.gz
|
||||
|
||||
Patch0: numpy-1.8.1.ppc64le.patch
|
||||
# Upstream patch to fix xerbla linkage
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1172834
|
||||
Patch1: numpy-xerbla.patch
|
||||
|
||||
BuildRequires: python2-devel lapack-devel python-setuptools gcc-gfortran atlas-devel python-nose
|
||||
Requires: python-nose
|
||||
|
@ -85,8 +87,8 @@ This package includes a version of f2py that works properly with NumPy.
|
|||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?relc}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1 -b .xerbla
|
||||
|
||||
# workaround for rhbz#849713
|
||||
# http://mail.scipy.org/pipermail/numpy-discussion/2012-July/063530.html
|
||||
|
@ -237,6 +239,9 @@ popd &> /dev/null
|
|||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 12 2015 Orion Poplawski <orion@nwra.com> - 1:1.8.2-2
|
||||
- Backport upstream patch to fix xerbla linkage (bug #1172834)
|
||||
|
||||
* Sun Aug 10 2014 Orion Poplawski <orion@nwra.com> - 1:1.8.2-1
|
||||
- Update to 1.8.2
|
||||
|
||||
|
@ -267,29 +272,8 @@ popd &> /dev/null
|
|||
* Wed Oct 30 2013 Orion Poplawski <orion@nwra.com> - 1:1.8.0-1
|
||||
- Update to 1.8.0 final
|
||||
|
||||
* Mon Oct 14 2013 Orion Poplawski <orion@nwra.com> - 1:1.8.0-0.7.rc2
|
||||
- Update to 1.8.0rc2
|
||||
- Create clean site.cfg
|
||||
- Use serial atlas
|
||||
|
||||
* Mon Sep 23 2013 Orion Poplawski <orion@nwra.com> - 1:1.8.0-0.6.b2
|
||||
- Add [atlas] to site.cfg for new atlas library names
|
||||
|
||||
* Sun Sep 22 2013 Orion Poplawski <orion@nwra.com> - 1:1.8.0-0.5.b2
|
||||
- Update site.cfg for new atlas library names
|
||||
|
||||
* Sat Sep 21 2013 David Tardon <dtardon@redhat.com> - 1:1.8.0-0.4.b2
|
||||
- rebuild for atlas 3.10
|
||||
|
||||
* Tue Sep 10 2013 Jon Ciesla <limburgher@gmail.com> - 1:1.8.0-0.3.b2
|
||||
- Fix libdir path in site.cfg, BZ 1006242.
|
||||
|
||||
* Sun Sep 8 2013 Orion Poplawski <orion@nwra.com> - 1:1.8.0-0.2.b2
|
||||
- Update to 1.8.0b2
|
||||
|
||||
* Wed Sep 4 2013 Orion Poplawski <orion@nwra.com> - 1:1.8.0-0.1.b1
|
||||
- Update to 1.8.0b1
|
||||
- Drop f2py patch applied upstream
|
||||
* Mon Oct 14 2013 Tomas Tomecek <ttomecek@redhat.com> - 1:1.7.1-6
|
||||
- fix name of shared library extensions (rhbz#1018783)
|
||||
|
||||
* Tue Aug 27 2013 Jon Ciesla <limburgher@gmail.com> - 1:1.7.1-5
|
||||
- URL Fix, BZ 1001337
|
||||
|
|
Loading…
Reference in New Issue