Comments (10)
If I remember correctly, the GSL-provided BLAS/LAPACK libraries will be overridden by the OCaml GSL-bindings. gsl-ocaml
links with the Accelerate framework by default. You can call otool -L
on your executables to see whether they link with the Accelerate framework.
from gsl-ocaml.
ok, i get:
hmtree.native:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/opt/gsl/lib/libgsl.19.dylib (compatibility version 22.0.0, current version 22.0.0)
/usr/local/opt/gsl/lib/libgslcblas.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
which i find confusing since it links with accelerate but also shows the gsl-provided cblas if i'm not mistaken. in that program, also lacaml was used if that matters. maybe lacaml actually links accelerate and gsl-ocaml the cblas?
from gsl-ocaml.
Lacaml
should only link with the Accelerate
framework. I guess on Mac OS X it might be necessary to supply gsl-config --libs-without-cblas
within the gsl-ocaml
myocamlbuild.ml
file. If you want, you can try it out by editing that file and replacing the --libs
flag with the mentioned one. Maybe it makes a difference or not. You may need to run an example to find out.
from gsl-ocaml.
ok thanks, will try tomorrow.
from gsl-ocaml.
ok, i tried: i now have this in my local opam-pinned copy of gsl-ocaml:
(*let ic = Unix.open_process_in "gsl-config --cflags --libs" in*)
let ic = Unix.open_process_in "gsl-config --cflags --libs-without-cblas" in
i reinstalled the pinned version with opam. now the same program as before, with otool -L gives
hmtree.native:
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/usr/local/opt/gsl/lib/libgsl.19.dylib (compatibility version 22.0.0, current version 22.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
so the cblas is gone. i have not tried if this program runs yet.
i have tried a toplevel with gsl loaded. calls to Gsl_blas (gemm) work, although in the open files for that process, nothing regarding accelerate was shown. but also the gsl-provided cblas was not shown anymore, so it seems to work to not link that.
so i think your suggestion works. i would think this should then be fixed in the opam package?
from gsl-ocaml.
The more important question is, does the change actually improve performance. If the Accelerate BLAS overrides the GSL-provided one anyway, the change won't be necessary. Maybe you can try out matrix multiplication as a test, which should likely show a significant performance difference.
from gsl-ocaml.
hmm it may be that cblas is linked but not used. i tried again with a minimal program which just uses gsl as its only package, and with the original opam-installed gsl. indeed cblas is linked, but so is accelerate, which is here not a byproduct of using lacaml.
probably performance testing would be the only way to decide.
from gsl-ocaml.
ok. it does seem to matter. i made a program that LU-inverts a 400x400 matrix 100 times. with the standard opam installation of gsl-ocaml this takes 5.9s to run. after pinning gsl-ocaml with the myocamlbuild change above, the same (recompiled) program does not link cblas anymore and runs in 3.0s
(in each case i reran a few times to be sure)
from gsl-ocaml.
for reference:
let a = Gsl.Matrix.create 400 400 in
let () = Gsl.Matrix.set_id a in
let () = Gsl.Matrix.set a 123 223 123. in
for i = 1 to 100 do
ignore @@ Gsl.Linalg.invert_LU (`M a);
done;
from gsl-ocaml.
Ok, thanks for testing this. I've made a new release that will avoid linking with the "slow" library on Mac OS X, the reasonable assumption being that users will always want to use the Accelerate Framework on this platform.
from gsl-ocaml.
Related Issues (20)
- Build fails with gsl 2.1 HOT 6
- Building failure @ FreeBSD HOT 2
- opam installation incompatible with calmp4 HOT 3
- checking api changes upstream HOT 1
- feature request: multidim Gaussian HOT 1
- feature request: sparse matrices HOT 1
- installation via opam fails for 1.19.2 and 1.19.3 HOT 5
- alternative blas HOT 8
- Compilation of gsl fails with OPAMBUILDDOC HOT 3
- installation with homebrew openblas on os x HOT 6
- Initialize the error handler HOT 3
- symbol import error with 1.21 HOT 2
- debugging inside ocaml callback functions HOT 5
- gsl header in non-standard location HOT 4
- Error building on Raspi HOT 7
- missing dependency? HOT 2
- build problems on macos HOT 6
- opam install fails on ocaml 5.0.0~beta2 and macos HOT 2
- Asking for a new release. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gsl-ocaml.