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

Win: Alternative to MKL #257

Open
1 task done
ax3l opened this issue Nov 1, 2023 · 5 comments
Open
1 task done

Win: Alternative to MKL #257

ax3l opened this issue Nov 1, 2023 · 5 comments
Labels

Comments

@ax3l
Copy link
Member

ax3l commented Nov 1, 2023

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

Currently, the CF scipy build on Windows unconditionally builds against MKL (for blas & lapack). mkl has a hard dependency on intel-openmp, which means downstream projects that use scipy cannot use llvm-openmp with clang-cl anymore if they pull in scipy (even if only at runtime).

https://conda-forge.org/docs/maintainer/knowledge_base.html#blas
conda-forge/intel_repack-feedstock#59

Is it possible to provide an alternative to depending on MKL for windows builds?

Installed packages

intel-openmp
mkl
scipy
...

Environment info

See link
@ax3l ax3l added the bug label Nov 1, 2023
@h-vetinari
Copy link
Member

h-vetinari commented Nov 1, 2023

Currently, the CF scipy build on Windows unconditionally builds against MKL (for blas & lapack)

That is not true. We build against reference LAPACK, and you can switch it out in your environment as you please. I just tried1

mamba create -n test scipy python=3.12 libblas=*=*blis
mamba create -n test scipy python=3.12 libblas=*=*mkl
mamba create -n test scipy python=3.12 libblas=*=*netlib
mamba create -n test scipy python=3.12 libblas=*=*openblas

and they all resolve without issue.

If you're trying to combine specifically openblas with llvm-openmp, you're going to run into the fact that we have no llvm-openmp builds of openblas on windows, but are stuck with an old libflang that's incompatible:

mamba create -n test scipy python=3.12 libblas=*=*openblas clang llvm-openmp

Looking for: ['scipy', 'python=3.12', 'libblas=[build=*openblas]', 'clang', 'llvm-openmp']

conda-forge/win-64                                          Using cache
conda-forge/noarch                                          Using cache
Could not solve for environment specs
The following packages are incompatible
├─ libblas * *openblas is installable with the potential options
│  ├─ libblas 3.8.0 would require
│  │  └─ openblas 0.3.6 h828a276_2, which does not exist (perhaps a missing channel);
│  ├─ libblas [3.8.0|3.9.0] would require
│  │  ├─ libopenblas [0.3.10 hc8a65f3_0|0.3.12 pthreads_h1662909_0|...|0.3.9 hcfe7411_0], which requires
│  │  │  └─ libflang [<6.0.0.a0 |>=5.0.0,<6.0.0.a0 ] with the potential options
│  │  │     ├─ libflang 5.0.0 would require
│  │  │     │  └─ openmp 5.0.0 , which can be installed;
│  │  │     └─ libflang 5.0.0 would require
│  │  │        └─ vc 14 , which does not exist (perhaps a missing channel);
│  │  └─ openblas >=0.3.6,<0.3.7.0a0 , which requires
│  │     └─ libflang <6.0.0.a0  with the potential options
│  │        ├─ libflang 5.0.0, which can be installed (as previously explained);
│  │        └─ libflang 5.0.0, which cannot be installed (as previously explained);

That work (openblas+llvm-openmp) was waiting for a very long time on conda-forge/conda-forge-pinning-feedstock#1359, which itself needed a stable flang (that we've all been waiting for for even longer).

We now have flang 17, but that's still pretty experimental (and only used here out of necessity). I'm hoping that by flang 18 at the beginning of next year, we'll be able to roll it out as our fortran compiler on windows more generally.

CC @isuruf

Footnotes

  1. python=3.12 is not necessary, but just to force the solver to definitely pick the builds post-meson on windows with clang-cl & flang; python 3.12 support #255

@ax3l
Copy link
Member Author

ax3l commented Nov 3, 2023

Thank you for the guidance!

Do you know what blas/lapack to pick on Windows to avoid incompatibility with llvm-openmp?

@h-vetinari
Copy link
Member

Do you know what blas/lapack to pick on Windows to avoid incompatibility with llvm-openmp?

Neither blis nor netlib conflict

mamba create -n test scipy python=3.12 llvm-openmp libblas=*=*blis      ✅ 
mamba create -n test scipy python=3.12 llvm-openmp libblas=*=*mkl       ❌  # resolves but has both {intel,llvm}-openmp
mamba create -n test scipy python=3.12 llvm-openmp libblas=*=*netlib    ✅ 
mamba create -n test scipy python=3.12 llvm-openmp libblas=*=*openblas  ❌

@ax3l
Copy link
Member Author

ax3l commented Nov 10, 2023

Thank you! I'll give that a try in conda-forge/impactx-feedstock#23 :)

@lucascolley
Copy link
Member

can this be closed @ax3l ?

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

No branches or pull requests

3 participants