-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Recipes which depend on blas and lapack #80
Comments
No experience here I'm afraid. @msarahan any advice? |
I have some experience with this. Was going to submit OpenBLAS with NumPy, SciPy, and scikit-learn support. Also can add cvxopt support, but will wait for things like FFTW ( #106 ) to go into feedstocks first. Can add numexpr to the mix, but haven't written this one yet. @abergeron and I wrote the OpenBLAS recipe in conda recipes. Though I don't think I like the way I did things in that version and am contemplating how to rewrite it after discussions with @mcg1969. He has some good insight after the solver overhaul and the public release of mkl. In general and am open to some discussion about improving this scheme going forward. The main idea is one should use a feature to select the underlying BLAS/LAPACK. This is how While features could be used for lots of different things, the main use case seems to be select an implementation of a common API like BLAS/LAPACK. Though I think this could be coded a little more explicitly when choosing feature names. For instance, I kind of like the idea of all BLAS features being named Any thoughts on this? |
@jakirkham I like the proposal - though I would say that as a community guideline we should direct people towards using either MKL or OpenBLAS - since most people are not dogmatic about what BLAS they use, they just want it to be fast! I've actually struggled against this before because often recipes only require setting a key/path to the chosen BLAS library but the rest of the recipe is the same. All the more reason (IMHO) that features should be passed through to scripts in some way, perhaps as ENV variables? Would make it easier to maintain one recipe and just switch on certain feature options - not that this repo has any control over that! |
@patricksnape - we can change the recipe behaviour based on external env vars if we need to...
|
Nice proposal @pelson. Is there already a spec on how we add and select these different features? Like a yaml file we add them to or something? If not, we should definitely work on one before we start adding this stuff (my opinion at least 😄). |
@pelson Awesome. This is the kind of stuff that would make a killer little blog post somewhere - really useful information, thanks. These kind of 'best practises' would be great to compile in the Wiki or somewhere similar. |
Hey guys, assuming that we acquire a license for |
These are all great questions. Probably the first step would be to talk to people at Continuum and see how they handle this problem. After that we may need to talk with someone at Intel to understand the licensing constraints in this situation. |
Yes, you'd need to install it with the license key on the CI machines. I don't think you can bundle it outside of their installer (this would probably defeat their licensing software, if it would work at all). I don't know how permissible it is to install something like that in a docker image - or even if it's possible to do their activation process in an unattended way. This is really a question for Intel. FWIW, with docker, you could install MKL in one image, and then create linked images with docker-compose so that you don't need the overhead of MKL for every build. Packages that link against MKL don't need to be different other than providing a way of adding mkl as a dependency. This is the default in Anaconda, but it would be nicer to make a set of features for BLAS, and then choose one. This would give mutual exclusivity, which might be what you want. These schemes are not completely supported in conda right now, though. I think the ideal would be some jinja2 placeholder for blas, and which blas gets used is a matter of configuration. |
Also, something I didn't express clearly: the hard issue here is installation of MKL on the build side of the story. Redistribution of runtimes is permissible (please check the license yourself, but I'm pretty sure this is the case.) |
I also wanted to know that if we should compile with the same |
Basically, let's stick with Ideally though I would like to have us use something like OpenBLAS. This is already what Once we have that we can discuss the implications for features and feedstocks going forward. |
The problem here is that features really don't provide mutual exclusivity by themselves. In theory you can install the We need the key-value functionality for features that we discussed in another thread, or my metapackage solution we discussed elsewhere. Consider this second option for a moment. We would create a set of metapackages with the name "python_blas". One version of this package would be built for each blas variant: Then any package that needs to link to BLAS directly builds different variants for each BLAS type, and includes the corresponding version of the This approach utilizes the natural mutual exclusivity offered by package names to ensure that only one BLAS is being used in a given Python dependency chain. |
Sorry to derail this a bit. I have heard you bring this up before, @mcg1969, but I'm having trouble understanding why one would want to do this. What is the use case here? Are there some cases you have encountered where this is helpful? |
I'm thinking of cases like, say, Python & R in the same environment. Why require them both to link to the same BLAS? I mean, sure, it would be convenient, but it puts more burden on the builders and the users. If it happens to be convenient to use MKL by default with Python and OpenBLAS by default with R, well, why not? The argument is more clear with C runtime libraries. It's not easy to ensure that every program you're using in an environment links to the same C runtime. But obviously we need to make sure that every Python package does. |
Permissible yes, allowed with some/many open source licenses, no. Refer to the Intel EULA for details but from what I recall the last time the NumPy developers talked about distributing MKL linked NumPy binaries the sticky points were:
|
I am concerned about performance issues here, but would need to think a bit more to come up with a reasonable example. Though, as @jjhelmus mentions, licensing is a concern. I do regularly interact with GPL programs that need a BLAS and NumPy. IANAL, but I feel like having MKL around is a murky area. Especially as there would be linkage through to the GPL'd library.
Doesn't this case become a slippery slope? How are we sure that some C/C++ library isn't later getting used by some Python library with C/C++ bindings? It seems like it would be very hard to avoid this interface between other C runtimes from ever showing up. |
I'm not going to address the licensing concerns. We would have these same packaging & dependency issues with BLAS or C runtimes no matter what the licenses are.
Performance issues certainly matter, but convenience does too. We can't necessarily control who is building every package we would like to use. So as long as things don't break to run the two BLAS versions in separate processes, we should not be preventing conda from installing them into the same environment.
Well, if dependencies aren't set correctly, there's nothing we can do. What we want here is the ability to get those dependency relationships right, and hopefully we can instruct people to do so, or find ways to automate those determinations in conda build. But the ship has sailed on multiple C runtimes. We simply cannot synchronize on a single C runtime within conda environments involving mixed platforms like Python, R, lua, node, etc. |
In fact, the C runtime problem is really the controlling example here. We don't have a choice but to get that one right, and if it helps us solve the BLAS problem too, even better. |
Hey guys, I went ahead and tried to compile {% set version = "2.0.3" %}
package:
name: bob.math
version: {{ version }}
source:
fn: bob.math-{{ version }}.zip
url: https://pypi.python.org/packages/source/b/bob.math/bob.math-{{ version }}.zip
md5: 0f010af6ce20fe6614570edff94e593f
build:
number: 3
skip: true # [win]
script: python -B setup.py install --single-version-externally-managed --record record.txt
script_env:
- LD_LIBRARY_PATH
- LIBRARY_PATH
- MIC_LD_LIBRARY_PATH
- NLSPATH
- CPATH
requirements:
build:
- python
- setuptools
- bob.core
- boost
- cmake
- numpy x.x
- pkg-config
run:
- python
- bob.core
- boost
- numpy x.x
test:
requires:
- nose
imports:
- bob
- bob.math
commands:
- nosetests -sv bob.math
about:
home: http://github.com/bioidiap/bob.math
license: Modified BSD License (3-clause)
summary: LAPACK and BLAS interfaces for Bob
extra:
recipe-maintainers:
- 183amir I installed build:
script_env:
- LD_LIBRARY_PATH
- LIBRARY_PATH
- MIC_LD_LIBRARY_PATH
- NLSPATH
- CPATH I guess having a package like |
So we have a way to do BLAS now and it works ok. Details can be found in this hackpad. There is certainly room for growth, but it will probably involve an enhancement proposal (once that framework is ironed out). |
Closing, but feel free to discuss more as appropriate. |
I have a recipe that I am looking to submit that has compiled extensions which links to blas and lapack. Does anyone have experience building package which depend on these or have any suggestions on how get these to build in a portable manner? I'm only looking to support Linux and OS X with the package which hopefully makes the process a bit easier.
The text was updated successfully, but these errors were encountered: