-
Notifications
You must be signed in to change notification settings - Fork 12
Expose MKL linkage, fixes segfaults with lapack
crate.
#11
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
Expose MKL linkage, fixes segfaults with lapack
crate.
#11
Conversation
Hello, Thank you for looking into this. In general, the strategy is to not try to forward any src crate's features but instead let the end user take care of it. So in your case, I would do as follows: lapack = "0.20"
lapack-src = { version = "0.11", features = ["intel-mkl"] }
intel-mkl-src = { version = "0.8", features = ["mkl-static-lp64-seq"] } But I agree it should ideally work out of the box. I would propose we keep only this line: intel-mkl = ["intel-mkl-static-lp64-seq"] And explain in the readme that if something else is needed, the user should not activate Alternatively, we keep |
Hi, thanks for getting back to me. Correct me if I'm misunderstanding, but if we make the
I think it's definitely okay to say the only way to link intel-mkl via lapack-src is in the lp64 parallel variant. It just has to be clearly documented. Do you want me to go ahead and change that? Also I have no idea why the mac-os tests are failing, I don' t think I did anything to those :D |
In my example, I was assuming Yes, the parallel one is perhaps a better default choice. With a good description of what to do if something else is needed. If you rebase on main, that error should be gone. |
Hey, sorry if I'm being obtuse here. I've made a simplified proposal that I think does what you want. If not, let me know. I've now made it that |
Hi @IvanUkhov, just checking in if I can do anything to help this PR move on. |
Hi, I have another question: I saw you changed the edition to 2024, I was wondering if it would be okay to revert to 2021. I had a similar request on one of my own crates, since the 2024 edition will require relatively recent compilers to build. Some people are still stuck on older compilers, but 2021 seems to generally work. |
Can you please rebase on main? The diff is a bit confusing. |
For my understanding, let me try to talk through the issue so you can correct me where I am wrong. Let us, for instance, take https://github.com/blas-lapack-rs/lapack/blob/main/src/lapack-sys.rs#L7055 It uses https://github.com/blas-lapack-rs/lapack-sys/blob/main/src/lapack.rs#L3705 In turn, https://doc.rust-lang.org/core/ffi/type.c_int.html The documentation tells us that it is always 32 bits (ignoring “esoteric systems”). From this, we conclude that whatever we compile and try to invoke has to have ints of 32 bits. In particular, for the MKL to play well with the rest of the ecosystem, it has to be compiled with LP64. Hence, technically, we do not want the user to enable ILP64. Is the above an adequate description? |
Yes, this is exactly my understanding. For 'lapack-src' to play nice with lapack, only the LP64 interface should be exposed. |
I think I now understand how one should be thinking about this. If you insist on having more than one option, we will have to expose all four that are compatible, and each one should be fairly treated. So let us remove
As mentioned earlier, ideally, we would want to just have Let us also please remove the paragraphs you added to the readme and lib.rs and simply add these four options to the list in those two spaces. You can also bump the version number, as it is mentioned there. I will do the same for I will maybe open an issue in |
Yes, I'd very much like to have more than one option and I agree with everything you said. I'll take care of it in the coming days. |
Thank you and sorry that it took so long! |
Thank you as well and no worries at all. |
Hi, I've tried using the
lapack
andlapack-src
crates like this and ran into segmentation faults and/or runtime parameter errors from the LAPACK backend. It didn't take too long to figure out that this was caused by theintel-mkl-src
crate linking theILP64
version (long and int are 64-bit) of MKL, whereas thelapack
crate exposes theLP64
interface (long is 64 bit, int is 32 bit). So usinglapack
andlapack-src
like thiswill produce segfaults and lapack runtime errors. So I made two changes
Changes
LP64
version linked when theintel-mkl
feature is selected, so that this works together with thelapack
crate more out of the box. This is a breaking change, but I do think it's justified for the out-of-the-box compatibility with thelapack
crate.intel-mkl-*-*-*
to allow a user to select the desired linkage.