linxal icon indicating copy to clipboard operation
linxal copied to clipboard

Allow using system openblas

Open bluss opened this issue 9 years ago • 9 comments

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).

bluss avatar Nov 11 '16 15:11 bluss

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.

bluss avatar Nov 11 '16 15:11 bluss

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.

masonium avatar Nov 13 '16 08:11 masonium

Nice, I'll try it out.

bluss avatar Nov 13 '16 09:11 bluss

Did you have any luck with the 'openblas-system' feature?

masonium avatar Nov 26 '16 09:11 masonium

No, it doesn't have lapacke, it emits linking errors for LAPACKE_cgesdd and many others.

bluss avatar Nov 26 '16 13:11 bluss

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.

rennis250 avatar Aug 04 '17 09:08 rennis250

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.

rennis250 avatar Aug 09 '17 22:08 rennis250

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.

masonium avatar Aug 09 '17 22:08 masonium

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.

masonium avatar Aug 14 '17 08:08 masonium