Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make numpy and scipy use pkg-config to find blas/lapack #20157

Closed
kiwifb opened this issue Mar 4, 2016 · 59 comments
Closed

make numpy and scipy use pkg-config to find blas/lapack #20157

kiwifb opened this issue Mar 4, 2016 · 59 comments

Comments

@kiwifb
Copy link
Member

kiwifb commented Mar 4, 2016

Since we want the choice of blas/lapack to be configurable by .pc files we need to have numpy and scipy obey to pkg-config.

This is complicated by the fact that numpy/scipy's build system will look for

  1. mkl
  2. openblas
  3. threaded atlas 3.10.x (tatlas.so)
  4. single thread atlas 3.10.x (satlas.so)
  5. threaded atlas (any versions)
  6. single thread atlas (any versions)
  7. accelerate on OS X
  8. blas/lapack configuration provided by the user
  9. blas/lapack source provided by the user

In that order from (1) to (9). Note that the user's wishes are ignored unless everything else fails. Getting numpy/scipy to obey the user wishes, whatever they are, means using not well documented variables to disable the auto-detections steps 1 to 6.

CC: @jdemeyer

Component: packages: standard

Author: François Bissey

Branch/Commit: af70376

Reviewer: Volker Braun

Issue created by migration from https://trac.sagemath.org/ticket/20157

@kiwifb kiwifb added this to the sage-7.1 milestone Mar 4, 2016
@kiwifb
Copy link
Member Author

kiwifb commented Mar 4, 2016

comment:1

Actually

export {ATLAS,PTATLAS,BLAS,LAPACK,OPENBLAS,MKL}=None

shuts down all detection so there is hope things can be taken done selectively.

@kiwifb

This comment has been minimized.

@kiwifb
Copy link
Member Author

kiwifb commented Mar 4, 2016

comment:2

Setting everything to None except for BLAS and LAPACK and then giving those some values is not enough. I have got something quite ugly.

@kiwifb

This comment has been minimized.

@kiwifb
Copy link
Member Author

kiwifb commented Mar 4, 2016

Branch: u/fbissey/numpy_scipy_pc

@kiwifb
Copy link
Member Author

kiwifb commented Mar 4, 2016

Commit: 3237f38

@kiwifb
Copy link
Member Author

kiwifb commented Mar 4, 2016

Author: François Bissey

@kiwifb
Copy link
Member Author

kiwifb commented Mar 4, 2016

New commits:

3237f38Get numpy and scipy to use pc files

@kiwifb
Copy link
Member Author

kiwifb commented Mar 5, 2016

Work Issues: version bumps

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

158fb8dVersion bump to trigger rebuilds

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2016

Changed commit from 3237f38 to 158fb8d

@kiwifb
Copy link
Member Author

kiwifb commented Mar 5, 2016

Changed work issues from version bumps to none

@vbraun
Copy link
Member

vbraun commented Mar 5, 2016

Reviewer: Volker Braun

@vbraun
Copy link
Member

vbraun commented Mar 6, 2016

comment:10

Full log: http://build.sagedev.org/release/builders/%20%20fast%20Volker%20Desktop%20%28Fedora%2022%20x86_64%29%20incremental/builds/458/steps/compile/logs/stdio

/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/numpy-1.10.4.p1/src/numpy/distutils/system_info.py:1651: UserWarning: 
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
blas_info:
/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/numpy-1.10.4.p1/src/numpy/distutils/system_info.py:635: UserWarning: Specified path  is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
C compiler: cc

creating /tmp/tmpX0K4bQ/tmp
creating /tmp/tmpX0K4bQ/tmp/tmpX0K4bQ
compile options: '-c'
cc: /tmp/tmpX0K4bQ/source.c
cc /tmp/tmpX0K4bQ/tmp/tmpX0K4bQ/source.o -L/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib -lcblas -o /tmp/tmpX0K4bQ/a.out
/usr/bin/ld: warning: libatlas.so.3, needed by /mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib/libcblas.so, not found (try using -rpath or -rpath-link)

It is missing the -latlas for some reason, though it is in the cblas.pc

$ pkg-config --libs cblas
-L/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib -lcblas -latlas 

@kiwifb
Copy link
Member Author

kiwifb commented Mar 6, 2016

comment:11

Can you look at the generated site.cfg file?

@kiwifb
Copy link
Member Author

kiwifb commented Mar 6, 2016

comment:12

I notice poseidon also has a problem but look slightly different.

@vbraun
Copy link
Member

vbraun commented Mar 6, 2016

comment:13
$ cat /mnt/disk/home/buildslave-sage/slave/sage_git/build/local/var/tmp/sage/build/numpy-1.10.4.p1/src/site.cfg
[DEFAULT]
library_dirs = /mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib
include_dirs = /mnt/disk/home/buildslave-sage/slave/sage_git/build/local/include
[blas]
include_dirs = 
library_dirs = /mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib
blas_libs = atlas,f77blas,cblas
[lapack]
library_dirs = /mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib
lapack_libs = lapack,f77blas,cblas,atlas

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 13, 2016

Changed commit from f9658ba to 050dff9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 13, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

050dff9more targeted output

@kiwifb
Copy link
Member Author

kiwifb commented Mar 13, 2016

comment:31

Still no review please.

@kiwifb
Copy link
Member Author

kiwifb commented Mar 14, 2016

Changed commit from 050dff9 to fea3a2a

@kiwifb
Copy link
Member Author

kiwifb commented Mar 14, 2016

Dependencies: 20208

@kiwifb
Copy link
Member Author

kiwifb commented Mar 14, 2016

Changed branch from u/fbissey/numpy_scipy_pc_dbg to u/fbissey/numpy_scipy_pc

@kiwifb
Copy link
Member Author

kiwifb commented Mar 14, 2016

comment:32

Random failures should now be solved by #20208.

@vbraun
Copy link
Member

vbraun commented Mar 14, 2016

Changed dependencies from 20208 to #20208

@kiwifb kiwifb modified the milestones: sage-7.1, sage-7.2 Mar 21, 2016
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 22, 2016

Changed commit from fea3a2a to 38007ae

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 22, 2016

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 22, 2016

Changed commit from 38007ae to b2c95cb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 22, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

20e1893Do not strip out system libs in pkg-config
b2c95cbMerge branch 'keep_system_libraries_in_pkgconf' into numpy_scipy_pc

@kiwifb
Copy link
Member Author

kiwifb commented Mar 22, 2016

comment:37

Clean up and merge #20208 so it does build on poseidon out of the box. Cross fingers.

@kiwifb
Copy link
Member Author

kiwifb commented Mar 22, 2016

comment:38

And poseidon still fails because pkgconf hasn't been rebuild before numpy..... I guess I will have to wait until #20208 is in a beta.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 25, 2016

Changed commit from b2c95cb to 41a7bde

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 25, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

41a7bdeMerge branch 'develop' into numpy_scipy_pc

@kiwifb
Copy link
Member Author

kiwifb commented Mar 25, 2016

comment:40

Rebased on 7.2.beta0 which includes #20208.

@kiwifb
Copy link
Member Author

kiwifb commented Mar 25, 2016

Changed dependencies from #20208 to none

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 28, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

a7869d8Merge branch 'develop' into numpy_scipy_pc
af70376try another strategy to get things going on poseidon

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 28, 2016

Changed commit from 41a7bde to af70376

@kiwifb
Copy link
Member Author

kiwifb commented Mar 29, 2016

comment:42

Finally building on poseidon. Theory: #20208 fixes the case where there is no global pkg-config installed and sage's pkgconf is used and in that case having it not strip default library directories when present in the .pc file. But poseidon still failed, probably because it has a global pkg-config command available and it happens to be pkgconf. Because it is provided by the system #20208 doesn't fix it.

The lapack.conf script is much more robust as a result of the latest commit.

Putting back to positive review.

@vbraun
Copy link
Member

vbraun commented Mar 30, 2016

Changed branch from u/fbissey/numpy_scipy_pc to af70376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants