-
Notifications
You must be signed in to change notification settings - Fork 77
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
accelerate framework support macOS #362
Comments
put |
Hello @matthagan15 , I tried but it did not work because openblas is still linked. ndarray does rely on blas-src. So the problem is with openblas but not blas-src. This is how cargo.toml looks like: ndarray = {version = "0.15", features=["rayon", "serde","blas"]} [features] default = [] intel-mkl-static = ["ndarray/blas","ndarray-linalg/intel-mkl-static"] openblas-static = ["ndarray/blas", "ndarray-linalg/openblas-static"] openblas-system = ["ndarray/blas", "ndarray-linalg/openblas-system"] Thank, Jianshu |
With the above configuration, accelerate is actually working, but openblas is still linked, see my binary link status after using the openblas-system feature (via otool -L on macOS):
Thanks, Jianshu |
That is the openblas-system feature in ndarray-linalg is still using openblas-src system feature. Any idea why? Thanks, Jianshu |
yes you should not be using openblas. use the feature "blas" on ndarray and use the crate "blas-src" with the feature "accelerate" |
Hello @matthagan15 , But my question how to use accelerate backend to replace openblas, I am using openblas actually. That is to say accelerate is only for blas, but not for openblas, meaning I have no way to get rid of openblas right because I need both blas and openblas feature. Thanks, Jianshu |
I also tried uninstall openblas on my system but has error with the same above configuration: error: linking with error: could not compile indicating that with this configuration, cc/clang is still try to find openblas instead of accelerate. Any idea. Thanks, Jianshu |
Try this:
and then add |
Hello @matthagan15 , Many thanks! the problem is solved!! Greatly appreciated openblas must be uninstalled first and then it is successful: /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0) That is we do not specific any backend but let rust to choose and allow the accelerate in build.rs. Thanks a again, Jianshu |
I'm pretty sure you don't have to uninstall openblas, I still have it installed via home brew, but if it worked for you then good! |
Hello @matthagan15 , I have ran into another case where: ndarray = {version = "0.15", features=["rayon", "serde","blas"]} I want to use the accelerate for lapack-src and blas-src, and as always ndarray and ndarray-linalg are all using the blas-src backend. However, I also need to use lapacke, I have the same build.rs mentioned above. I have the following error when linking (no errors if change back to openblas-src on the M1 Mac): = note: Undefined symbols for architecture arm64: It seems of the the lapacke problem but not others. I tried both clang and gcc as the compiler since lapacke is just a rust wrapper around lapacke(C). Many thanks, Jianshu |
Hello All, I want to bring this up again, I recently ran into the ARM performance library (https://developer.arm.com/Tools%20and%20Software/Arm%20Performance%20Libraries) (or for MacOS: https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/first-macos-release-of-arm-performance-libraries), which is just ARM version of OpenBLAS but is carefully designed only for ARM CPUs. MacOS is such an example but I can imagine there will be more Linux ARM CPUs in the future. I open an issue here: #378 to ask whether ndarray-linalg team will add support for it. It can be even faster as I can imagine. Just to let all you know that we can keep an eye on it, so that we can use it for both M-series MacOS and ARM Linux. Thanks, Jianshu |
Dear ndarray-linalg team,
I am wondering whether the backend can be apple's accelerate framework. How can I setup and compile so that I can use the accelerate framework, which is well designed and optimized on apple devices.
Thanks,
The text was updated successfully, but these errors were encountered: