summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2014-12-19 19:47:55 -0700
committerCharles Harris <charlesr.harris@gmail.com>2014-12-24 10:38:42 -0700
commit75666e3abce678b4ddaee1c9f65ea497a234fae0 (patch)
tree477bf39f128d422c92f27dfbf9410d3791f60978 /numpy/core
parent3ef77eea0d9c2cd76bc9b89b04a32f1322f842d5 (diff)
downloadnumpy-75666e3abce678b4ddaee1c9f65ea497a234fae0.tar.gz
BUG: Xerbla doesn't get linked in 1.10-devel.
Add our python_xerbla to the multiarray sources. That function is needed for all modules that link to the ATLAS 3.10 libraries, which are now all located in 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. Closes #5362.
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/bscript4
-rw-r--r--numpy/core/setup.py4
-rw-r--r--numpy/core/src/multiarray/multiarraymodule_onefile.c1
-rw-r--r--numpy/core/src/multiarray/python_xerbla.c51
4 files changed, 58 insertions, 2 deletions
diff --git a/numpy/core/bscript b/numpy/core/bscript
index 5df5a3f8a..0f0f6816a 100644
--- a/numpy/core/bscript
+++ b/numpy/core/bscript
@@ -479,7 +479,9 @@ def pre_build(context):
]
if bld.env.HAS_CBLAS:
- sources.append(pjoin('src', 'multiarray', 'cblasfuncs.c'))
+ sources.extend([pjoin('src', 'multiarray', 'cblasfuncs.c'),
+ pjoin('src', 'multiarray', 'python_xerbla.c'),
+ ])
else:
sources = extension.sources
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index a51eb690b..f178c4032 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -839,7 +839,9 @@ def configuration(parent_package='',top_path=None):
blas_info = get_info('blas_opt', 0)
if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []):
extra_info = blas_info
- multiarray_src.append(join('src', 'multiarray', 'cblasfuncs.c'))
+ multiarray_src.extend([join('src', 'multiarray', 'cblasfuncs.c'),
+ join('src', 'multiarray', 'python_xerbla.c'),
+ ])
else:
extra_info = {}
diff --git a/numpy/core/src/multiarray/multiarraymodule_onefile.c b/numpy/core/src/multiarray/multiarraymodule_onefile.c
index 04fef61ce..7adfdf9da 100644
--- a/numpy/core/src/multiarray/multiarraymodule_onefile.c
+++ b/numpy/core/src/multiarray/multiarraymodule_onefile.c
@@ -56,5 +56,6 @@
#include "multiarraymodule.c"
#if defined(HAVE_CBLAS)
+#include "python_xerbla.c"
#include "cblasfuncs.c"
#endif
diff --git a/numpy/core/src/multiarray/python_xerbla.c b/numpy/core/src/multiarray/python_xerbla.c
new file mode 100644
index 000000000..bdf0b9058
--- /dev/null
+++ b/numpy/core/src/multiarray/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;
+}