linxal
linxal copied to clipboard
Allow using system openblas
Compiling openblas takes a long time, and what's worse, with changing cargo, rustc versions and various crates there's a chance you have to repeat it a lot. You could offer the option to use system openblas (the openblas-src crate supports it).
I don't have the best answer for how to enable picking blas backend and so on, or to do it in a composable way.
I've added openblas-system and netlib-system features, which enable the 'system' feature of the corresponding -src crate. Using the 'system' feature doesn't seem to work on my system, though, so I can't really tell if it's right.
Nice, I'll try it out.
Did you have any luck with the 'openblas-system' feature?
No, it doesn't have lapacke, it emits linking errors for LAPACKE_cgesdd and many others.
It works on Mac without trouble. OpenBLAS is installed from Homebrew. I can do some snooping to figure out why it works here, but I may need some leads.
I also tried on Ubuntu and there it does not work.
It also works on Fedora. You just need to make sure to install the static version of libgfortran. Otherwise, nothing else needs to be done. I'm beginning to suspect that the linking errors only happen on Ubuntu. I will try to test on a Windows machine at some point.
Thanks for your work on this. I do run Ubuntu on main dev machine. I might try a couple of other distros on VMs to test this further as well.
On my ubuntu machine, the package installation of libatlas3-base create a libcblas.so.3 object, but not a libcblas.so link. Once I create it manually, the netlib-system target worked. I get the same errors as @bluss when trying to use openblas-system. It seems that the command line doesn't even try to link to liblapacke. I can get test runs to work by using a version of openblas-src that adds the following lines:
println!("cargo:rustc-link-lib={}=tmglib", kind);
println!("cargo:rustc-link-lib={}=lapacke", kind);
after the similar line linking openblas. I don't know if this is a global fix, since it might break other distros that don't require these libraries.