-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
How to get spack to use system blas/lapack #2067
Comments
|
There isn't currently a good way to ask"why"... but I'd like to one day improve the concretizer to do that. |
Oh and there is also |
Looking at etc/spack/defaults/packages.yaml unfortunately doesn't help me understand how I should get it to use the system blas/lapack instead. I tried putting all:
providers:
blas: [system]
lapack: [system] in packages.yaml and it still went off and tried to build the openblas! When I run $ ./spack config get packages
packages:
all:
providers:
mpi:
- openmpi
- mpich
blas:
- system
- openblas
lapack:
- system
- openblas
pil:
- py-pillow
paths: {}
modules: &id001 {}
buildable: true
version: &id002 []
compiler: &id003 []
cmake:
paths:
cmake@2.8.12: /soft/apps/packages/cmake-2.8.12/bin/
buildable: false
providers: {}
modules: *id001
version: *id002
compiler: *id003 and yet it ignores the system blas that it seems to know about. |
to expand on @tgamblin answer, you can not specify virtual packages ( As for the original question, there is no way to specify an abstract system blas/lapack, because there is no such package in Spack. Keep in mind that setting up any external package which lives in system folders like |
@BarrySmith I wrapped your code blocks so they would display indentation properly. Hope you don't mind. |
So it sounds to me like you'll either need to create a new Spack package for the blas/lapack you have on your system or choose an existing package that's close enough. Then, your packages:
all:
providers:
blas: [blas-package-name]
lapack: [lapack-package-name]
blas-package-name:
paths:
blas-lapack-name@system: /path/to/blas
version: [system]
buildable: False
lapack-package-name:
paths:
lapack-lapack-name@system: /path/to/blas
version: [system]
buildable: False In the above, replace |
@adamjstewart: I think one of the existing providers would work and @BarrySmith shouldn't have to create a new package:
We don't currently have a package specifically for apple BLAS, but wouldn't this work? packages:
all:
providers:
blas: netlib-lapack
lapack: netlib-lapack
netlib-lapack:
paths:
netlib-lapack@system: /usr
version: [system]
buildable: False If Apple BLAS uses really different library names, we might need to create a stub package for it, but I think you can fool Spack using the interface @alalazo and @davydden implemented for lapack & blas should handle this case (see #1682), assuming the libs are called @BarrySmith: FYI, for packages like blas and lapack that have an API spread out over potentially many obscurely named libraries that differ by implementation, we created an abstract interface that lets you query the DAG within Spack to get the library names. I think we need a name for that but I am not sure what we should call it. How does "polymorphic virtual dependencies" sound? Accurate, but too complicated? @alalazo @davydden? Anyway, @BarrySmith: some explanation of the syntax: The packages:
package1:
providers:
blas: netlib-lapack
lapack: netlib-lapack
package2:
providers:
blas: openblas
lapack: openblas The usage above is probably atypical for a single-user install, so you likely wan to stick with using
spack install xsdk ^netlib-lapack
spack install xsdk ^openblas
spack install xsdk ^mkl
|
@tgamblin good point, On mac-os there is indeed BUT: i would not use them as-is to avoid possible pollution of build environement with other libraries sitting in
IMHO this is a much safer approach. Otherwise Cmake or alike may pick up some other system libraries instead of their Spack counterparts. @citibeth : If we all agree that it is the way to do it, we may want to document this as a recommended way of using system's blas/lapack. |
One last thing: @BarrySmith is having issues because he's trying to put |
This brings up another thing. I like the docs that @citibeth and @adamjstewart made because they lay bare a lot of Spack's rough edges and how to work around them. This is one of them that could be fixed easily. Right now Spack will If an external is in a system search path, we should just not This will eliminate the need for stuff like the |
👍 for this to be fixed and some unit tests added to check that |
@davydden: I probably can't work on it today but i think it's not such a hard PR. You'd need to look at:
|
I believe It's already documented that you should never put system paths inside packages.yaml. As others have noted, this can cause builds to pick up packages other than the ones Spack intended (i.e. it HAS caused me pain in the past). The following is problematic:
Instead, change it to:
This works because @davydden outlines a more correct approach (also documented, I believe): Create a single-package tree made of symlinks into system stuff. Spack works best when all software is found in single-package trees. |
@citibeth: see my comments above. That's a bug, but it's good that the workaround is documented. |
I can't for the life of me get this to work, both linux and mac. I've tried
and many variants, with different directories, replacing system with 3.6.1 and it always fails with
Poking around with the debugger doesn't help, it sure looks like netlib-lapack is in candidates but I cannot determine why it fails. Could someone post an exact packages.yaml that works for them? If I take out the
it does what I expect and downloads netlib-lapack instead of openblas. |
@mplegendre: is this related to the concretization issue #2071 you just fixed today? @BarrySmith: does your version include that fix? If not I'll look at it and try to get it working. |
Yes it seems to resolve the problem. Thanks! I am not closing the issue because I think you should document using system blas/lapack clearly in the ReadTheDocs |
@BarrySmith : Keep in mind that using Apple's blas/lapack directly is not a good idea for packages which need single precision or complex arithmetic. That's why Homebrew-science use VecLibFort for many linear algebra packages. I am adding it to Spack #2080, but I have not tested it as I do not use it anymore. |
@davydden Thanks for the warning. Any good package, like PETSc :-) has work arounds that ./configure turns on for the Apple blas/lapack interface bugs, but I realize other packages might not. I am actually using system blas/lapack on linux for testing things out. |
I tried to add
to my packages.py file as suggested by #571 but after adding it spack still goes off and tries to build openblas (which by the way is not particularly portable and often cannot be build which is why I want to use the system blas/lapack).
Is there a spack option that tells WHY spack is making each decision as to which package to build vs reuse etc?
The text was updated successfully, but these errors were encountered: