mmottl / gsl-ocaml

OCaml bindings to the GSL (GNU Scientific Library).
Other
36 stars 10 forks source link

alternative blas #19

Closed nilsbecker closed 7 years ago

nilsbecker commented 7 years ago

hi, this is basically the same issue as https://github.com/mmottl/lacaml/issues/29 . i tried editing the _oasis file in my local pinned copy of gsl-ocaml like this:

  if system(macosx)
    #CCLib:        -framework Accelerate
    CCOpt+:      -I/usr/local/opt/openblas/include
    CCLib:       -L/usr/local/opt/openblas/lib -lopenblas -llapack

and in the extra section of myocamlbuild.ml (after oasis generated part) i did this:

              match BaseEnvLight.var_get "system" env with
              | "macosx" -> "--libs-without-cblas"
              | _ -> "--libs"

still, the test binaries in the build directory all link to Accelerate framework. i also tried with the "lib-whithout-cblas" commented out, same effect but additionally linked with the gsl-supplied cblas. nowhere is openblas linked. the same changed worked for the lacaml package to link to openblas instead.

is there a way i can avoid linking to Accelerate? (this seems to be necessary in the special use case of forking-based parallelism)

mmottl commented 7 years ago

You may want to look at the _build/_log file to see which command is still linking with the Accelerate framework.

nilsbecker commented 7 years ago

ok, grep Accelerate _log gives a lot:

/Users/nbecker/.opam/4.04.0+flambda/bin/ocamlfind ocamlmklib -o src/gsl_stubs -framework Accelerate -L/usr/local/Cellar/gsl/2.3/lib -lgsl src/mlgsl_blas.o src/mlgsl_blas_complex.o src/mlgsl_blas_complex_float.o src/mlgsl_blas_float.o src/mlgsl_bspline.o src/mlgsl_cdf.o src/mlgsl_cheb.o src/mlgsl_combi.o src/mlgsl_complex.o src/mlgsl_deriv.o src/mlgsl_eigen.o src/mlgsl_error.o src/mlgsl_fft.o src/mlgsl_fit.o src/mlgsl_fun.o src/mlgsl_histo.o src/mlgsl_ieee.o src/mlgsl_integration.o src/mlgsl_interp.o src/mlgsl_linalg.o src/mlgsl_linalg_complex.o src/mlgsl_math.o src/mlgsl_matrix_complex.o src/mlgsl_matrix_complex_float.o src/mlgsl_matrix_double.o src/mlgsl_matrix_float.o src/mlgsl_min.o src/mlgsl_monte.o src/mlgsl_multifit.o src/mlgsl_multimin.o src/mlgsl_multiroots.o src/mlgsl_odeiv.o src/mlgsl_permut.o src/mlgsl_poly.o src/mlgsl_qrng.o src/mlgsl_randist.o src/mlgsl_rng.o src/mlgsl_roots.o src/mlgsl_sf.o src/mlgsl_sort.o src/mlgsl_stats.o src/mlgsl_sum.o src/mlgsl_vector_double.o src/mlgsl_vector_float.o src/mlgsl_wavelet.o
/Users/nbecker/.opam/4.04.0+flambda/bin/ocamlfind ocamlc -a -dllib -lgsl_stubs -cclib -lgsl_stubs -cclib -framework -cclib Accelerate -cclib -L/usr/local/Cellar/gsl/2.3/lib -cclib -lgsl -cclib -L/usr/local/Cellar/gsl/2.3/lib -cclib -lgsl -I src src/gsl_complex.cmo src/gsl_vector.cmo src/gsl_matrix.cmo src/gsl_vector_complex.cmo src/gsl_matrix_complex.cmo src/gsl_blas.cmo src/gsl_vector_flat.cmo src/gsl_vector_complex_flat.cmo src/gsl_matrix_complex_flat.cmo src/gsl_matrix_flat.cmo src/gsl_blas_flat.cmo src/gsl_vectmat.cmo src/gsl_blas_gen.cmo src/gsl_bspline.cmo src/gsl_cdf.cmo src/gsl_fun.cmo src/gsl_cheb.cmo src/gsl_error.cmo src/gsl_combi.cmo src/gsl_const.cmo src/gsl_deriv.cmo src/gsl_eigen.cmo src/gsl_fft.cmo src/gsl_fit.cmo src/gsl_histo.cmo src/gsl_ieee.cmo src/gsl_integration.cmo src/gsl_interp.cmo src/gsl_permut.cmo src/gsl_linalg.cmo src/gsl_math.cmo src/gsl_min.cmo src/gsl_misc.cmo src/gsl_rng.cmo src/gsl_monte.cmo src/gsl_multifit.cmo src/gsl_multifit_nlin.cmo src/gsl_multimin.cmo src/gsl_multiroot.cmo src/gsl_odeiv.cmo src/gsl_poly.cmo src/gsl_qrng.cmo src/gsl_randist.cmo src/gsl_root.cmo src/gsl_sf.cmo src/gsl_siman.cmo src/gsl_sort.cmo src/gsl_stats.cmo src/gsl_sum.cmo src/gsl_version.cmo src/gsl_wavelet.cmo src/gsl.cmo -o src/gsl.cma
/Users/nbecker/.opam/4.04.0+flambda/bin/ocamlfind ocamlopt -a -cclib -lgsl_stubs -cclib -framework -cclib Accelerate -cclib -L/usr/local/Cellar/gsl/2.3/lib -cclib -lgsl -cclib -L/usr/local/Cellar/gsl/2.3/lib -cclib -lgsl -I src src/gsl_complex.cmx src/gsl_vector.cmx src/gsl_matrix.cmx src/gsl_vector_complex.cmx src/gsl_matrix_complex.cmx src/gsl_blas.cmx src/gsl_vector_flat.cmx src/gsl_vector_complex_flat.cmx src/gsl_matrix_complex_flat.cmx src/gsl_matrix_flat.cmx src/gsl_blas_flat.cmx src/gsl_vectmat.cmx src/gsl_blas_gen.cmx src/gsl_bspline.cmx src/gsl_cdf.cmx src/gsl_fun.cmx src/gsl_cheb.cmx src/gsl_error.cmx src/gsl_combi.cmx src/gsl_const.cmx src/gsl_deriv.cmx src/gsl_eigen.cmx src/gsl_fft.cmx src/gsl_fit.cmx src/gsl_histo.cmx src/gsl_ieee.cmx src/gsl_integration.cmx src/gsl_interp.cmx src/gsl_permut.cmx src/gsl_linalg.cmx src/gsl_math.cmx src/gsl_min.cmx src/gsl_misc.cmx src/gsl_rng.cmx src/gsl_monte.cmx src/gsl_multifit.cmx src/gsl_multifit_nlin.cmx src/gsl_multimin.cmx src/gsl_multiroot.cmx src/gsl_odeiv.cmx src/gsl_poly.cmx src/gsl_qrng.cmx src/gsl_randist.cmx src/gsl_root.cmx src/gsl_sf.cmx src/gsl_siman.cmx src/gsl_sort.cmx src/gsl_stats.cmx src/gsl_sum.cmx src/gsl_version.cmx src/gsl_wavelet.cmx src/gsl.cmx -o src/gsl.cmxa
bqdyn245_127:_build nbecker$

while grep "openblas" _log gives nothing ?! it's as if this had not worked at all. i checked that i did reinstall gsl-ocaml via opam reinstall gsl and that it is pinned to the local directory i am making the changes in.

also, commenting or uncommenting the libs-without-cblas line in myocamlbuild does make a difference in whether the gsl-supplied cblas is linked, so i think the installation of the modified version works in principle.

do i have to do extra steps to get oasis to do its thing before opam installing it?

mmottl commented 7 years ago

Have you regenerated the build files using Oasis? If -framework Accelerate is commented out, it should not be linked with.

nilsbecker commented 7 years ago

maybe this is what i am missing: i have not used oasis, so i don't know what i need to do to do that. (i though the opam install procedure would do that for me)

nilsbecker commented 7 years ago

is it just oasis setup?

mmottl commented 7 years ago

Yes, oasis setup should regenerate the build files. Note that it is broken for lacaml and requires some manual intervention, but should work fine with gsl-ocaml.

nilsbecker commented 7 years ago

yes! success! thanks a lot.

mmottl commented 7 years ago

Good to know.