Bug 1172834 - ATLAS xerbla can't be overidden.
Summary: ATLAS xerbla can't be overidden.
Alias: None
Product: Fedora
Classification: Fedora
Component: numpy
Version: 21
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/numpy/numpy/issues...
Depends On:
Blocks: 1179055
TreeView+ depends on / blocked
Reported: 2014-12-10 21:03 UTC by charles harris
Modified: 2015-01-17 23:57 UTC (History)
11 users (show)

Fixed In Version: numpy-1.8.2-3.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1179055 (view as bug list)
Last Closed: 2015-01-17 23:57:28 UTC
Type: Bug

Attachments (Terms of Use)

Description charles harris 2014-12-10 21:03:55 UTC
Description of problem:
ATLAS xerbla exits on error. Numpy normally overrides that function, but that seems to no longer work in fedora 21.

How reproducible: Always

Steps to Reproduce:

charris@localhost [~]$ python
Python 2.7.8 (default, Nov 10 2014, 08:19:18) 
[GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.linalg.lstsq([[np.nan]]*2, [1]*2)
 ** On entry to DLASCL parameter number  4 had an illegal value
charris@localhost [~]$ 

Expected results:
Raises an error and Python continues.

Additional info:
You might be building ATLAS with -Wl,-Bsymbolic-functions, which will cause the problem.

Comment 1 charles harris 2014-12-10 21:15:15 UTC
The numpy is locally built and linked to libtatlas. I note that Fedora numpy is linked to libsatlas, not sure why.

Comment 2 Frantisek Kluknavsky 2014-12-12 13:31:08 UTC
I can confirm the different behavior of numpy between f20 and f21. Problem does not seem to be in atlas, my mini-example with custom xerbla works fine, with both satlas and tatlas. Compiled with Makefile:
test: main.o routines.o Makefile
        $(CC) -o test main.o routines.o -lm -lgfortran -L/usr/lib64/atlas -ltatlas
%.o: %.c
        $(CC) -Wall -O2 -g -c $< -o $@
%.o: %.f90
        $(F90) -Wall -O2 -g -c $< -o $@

Call dgemm('','n',m,n,k,1.0,a,m,b,k,0.0,c,m) with wrong first parameter kills the process - default xerbla. With
 subroutine xerbla(SRNAME, INFO)
  INTEGER            INFO
  PRINT *, "Hello World!"
 end subroutine xerbla
in routines.f90 it prints the hello message and process continues - successful override.

Maybe something changed in numpy?

I do not know why numpy is linked to serial and not threaded atlas in Fedora. One probable answer might be that threaded atlas is currently broken on architectures with weak cache coherency, or maybe because it can not detect the number of cores at runtime and to get real benefits you need to recompile atlas yourself, or maybe because someone wants to use numpy as a generic library and do his own parallelization. Many problems with threaded atlas for little benefit.

Comment 3 Orion Poplawski 2014-12-13 03:36:07 UTC
This because multiple numpy shared libraries are linked against atlas:

rpm -ql numpy | grep -F .so | while read so; do ldd $so | grep atlas && echo $so; done
        libsatlas.so.3 => /usr/lib64/atlas/libsatlas.so.3 (0x00007fd169763000)
        libsatlas.so.3 => /usr/lib64/atlas/libsatlas.so.3 (0x00007f7135291000)
        libsatlas.so.3 => /usr/lib64/atlas/libsatlas.so.3 (0x00007f67f2df9000)

But the xerbla_ override is not in _dotblas.so and that is getting loading first.

Comment 4 Orion Poplawski 2014-12-13 03:48:27 UTC
I've updated the upstream issue tracker:

Would have been nice to have mentioned that link in the original report.

Comment 5 charles harris 2014-12-20 01:13:23 UTC
PR https://github.com/numpy/numpy/pull/5382 for numpy fixes this, but you will probably need to fix the fedora version of numpy yourself. All that seems to be needed is to move the linalg import in numpy/__init__.py before the import of core. The fix *does not work* if site.cfg is used for the setup instead of being automatically detected as by PR https://github.com/numpy/numpy/pull/5364.

Comment 6 charles harris 2014-12-20 01:22:52 UTC
NVM, still broken, needs work.

Comment 7 charles harris 2014-12-24 19:01:40 UTC
See https://github.com/numpy/numpy/pull/5392. That patch is for 1.9.x, but the same fix is needed for the 1.8.2 that is in Fedora.

Comment 8 marcindulak 2015-01-02 14:23:06 UTC
(In reply to charles harris from comment #7)
> See https://github.com/numpy/numpy/pull/5392. That patch is for 1.9.x, but
> the same fix is needed for the 1.8.2 that is in Fedora.

the problem is present also on RHEL7: numpy-1.7.1-10.el7.x86_64

Comment 9 Fedora Update System 2015-01-13 02:20:23 UTC
numpy-1.8.2-3.fc21 has been submitted as an update for Fedora 21.

Comment 10 lnie 2015-01-13 07:20:42 UTC
numpy-1.8.2-3.fc21 works

Comment 11 Fedora Update System 2015-01-14 07:33:40 UTC
Package numpy-1.8.2-3.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing numpy-1.8.2-3.fc21'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2015-01-17 23:57:28 UTC
numpy-1.8.2-3.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.