Skip to content
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

missing openblas error #54

Closed
mars0i opened this issue Jul 2, 2017 · 5 comments
Closed

missing openblas error #54

mars0i opened this issue Jul 2, 2017 · 5 comments

Comments

@mars0i
Copy link
Contributor

mars0i commented Jul 2, 2017

It looks like building the current version of Owl requires that openblas be installed, specifically under /usr/local/opt/openblas:

$ make
ocaml setup.ml -build
Start compiling Owl ...
Finished, 1 target (0 cached) in 00:00:01.
+ /Users/marshall/.opam/4.04.2/bin/ocamlfind ocamlmklib -o lib/owl_stubs -L/usr/local/opt/openblas/lib -L/usr/local/lib/gcc/7 -framework Accelerate -lopenblas -lgfortran lib/owl_dense_common_c.o lib/owl_dense_common_vec_cmp.o lib/owl_dense_common_vec_map.o lib/owl_dense_common_vec_fold.o lib/owl_dense_common_vec_combine.o lib/owl_cblas_generated_stub.o lib/owl_lapacke_generated_stub.o
ld: warning: directory not found for option '-L/usr/local/opt/openblas/lib'
ld: library not found for -lopenblas
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Command exited with code 2.
Compilation unsuccessful after building 15 targets (0 cached) in 00:00:25.
E: Failure("Command ''/Users/marshall/.opam/4.04.2/bin/ocamlbuild' lib/libowl_stubs.a lib/dllowl_stubs.so lib/owl.cma lib/owl.cmxa lib/owl.a lib/owl.cmxs perftest/perf_common.cma perftest/perf_common.cmxa perftest/perf_common.a perftest/perf_common.cmxs perftest/perf_dense_real.native perftest/perf_sparse_real.native perftest/perf_sparse_complex.native perftest/perf_dense_ndarray.native perftest/perf_dense_matrix.native perftest/perf_sparse_ndarray.native perftest/perf_sparse_matrix.native perftest/perf_specific_fun.native examples/test_neural.native -use-ocamlfind -tag debug' terminated with error code 10")
make: *** [all] Error 1

Building and installing openblas got me past this error (there doesn't seem to be a pre-built version for MacOS), but it looks like you have to install openblas using make PREFIX=/usr/local/opt/openblas install in order for the Owl build scripts to find it. (I thought PREFIX=/usr/local/opt would put openblas in the right place, but that's incorrect.)

If this is all as expected, then it would be useful to have this information in the README.

Thanks again-

@ryanrhymes
Copy link
Member

ryanrhymes commented Jul 2, 2017

Sorry about this inconvenience, I am redesigning the Linalg module at the moment. The new release will include full interface to CBLAS and LAPACKE so I have chosen OpenBLAS as the underlying library (in fact anything with compatible interface should work).

You can install openblas using brew install homebrew/science/openblas and this should solve the problem. Or you can use opam to install conf-openblas to resolve the dependency issue. In the next release, I will include conf-openblas in the oasis file, but I will also update the readme, thanks for pointing it out.

However, I recommend to download the openblas source from its repo and install from the source code. It gives way better performance than using brew. Based on my current experiment, Owl is able to achieve the same performance as Julia (actually often a bit faster :)

@mars0i
Copy link
Contributor Author

mars0i commented Jul 2, 2017

Thanks Liang. No problem. I'm trying some variations on plotting functions. I'll come back with questions (or possibly a PR) once I have had a chance to experiment and think about whether any additions/changes would make sense.

I didn't know that trick for homebrew. Thanks. I had tried using brew to install openblas using only the string "openblas", but this didn't seem to be in the database. I didn't know about specifying a path. I'll have to learn more about homebrew.

I had tried installing lacaml with opam, and that installed conf-openblas, but that didn't get rid of the error. Maybe the location of the files is different from what myocamlbuild.ml assumes? (I don't understand how this file is constructed.)

Anyway, I have openblas installed from source now (whew--that takes a long time to build) and have been able to build and install Owl.

Very nice about performance! Thanks.

@nilsbecker
Copy link
Contributor

fwiw, i have had good experiences with openblas on mac. specifically, the accelerate framework on mac also provides lapack, but for me this gave errors when combining it with parmap for fork-based parallelization. forking is apparently not supported in accelerate.
with openblas this works much better, and the performance is not worse than accelerate. plus, it's cross platform.

@mars0i
Copy link
Contributor Author

mars0i commented Jul 4, 2017

I did a simple speed comparison before and after installing openBLAS and recompiling and installing Owl, and my little application was two to 2-1/2 times faster.

@ryanrhymes
Copy link
Member

Indeed, for most linear algebra and math operations, Owl should be at least as fast as julia (given the right openblas is linked to). But there is still a lot of space to further optimise owl's other operations (julia is very well designed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants