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

Build OpenBlas and mkl for ios (x86_64 and aarch64) #515

Merged
merged 7 commits into from
Feb 4, 2018

Conversation

johanvos
Copy link
Contributor

With this PR, I can build the jars required for iOS deployment:

mvn -DskipTests -Dmaven.javadoc.skip=true -Djavacpp.platform=ios-x86_64 -Djavacpp.cppbuild.skip=true install
mvn -DskipTests -Dmaven.javadoc.skip=true -Djavacpp.platform=ios-arm64 -Djavacpp.cppbuild.skip=true install

@saudet
Copy link
Member

saudet commented Jan 30, 2018

As noted in pull #444 we might want to create new presets for "netlib" to be able to use implementations like Accelerate that have separate libraries for BLAS and LAPACK, but then again since Accelerate doesn't implement LAPACKE it might not matter as much:
https://stackoverflow.com/questions/38548113/lapacke-on-accelerate-framework

So, BLAS-only like on Android, that looks good enough for now. Let's make Accelerate optional though and give users the option of actually using OpenBLAS if they so choose. Did you encounter any problems building LAPACK-less OpenBLAS for iOS?

@johanvos
Copy link
Contributor Author

It didn't run out of the box but I can't remember if the issues would be easy to solve or not.
However, since accelerate is available as a Framework on iOS, it sounds like the path of least resistance.

@saudet
Copy link
Member

saudet commented Jan 30, 2018 via email

@johanvos
Copy link
Contributor Author

  • added basic step to at least kick off the build of openblas
  • removed mkl

@saudet
Copy link
Member

saudet commented Jan 31, 2018

Ok, I've made some changes to JavaCPP (bytedeco/javacpp@944f6b1) and this PR (16ae078) so it actually builds and bundles OpenBLAS now. That seems to work for me here. You'll find libopenblas.a in the JAR file, but you can ignore it (until if you find that Accelerate is buggy). It should still be able to link with Accelerate too.

Now this doesn't include LAPACKE, so the Java wrappers that this generates won't work with ND4J. The trick is to run a mvn install for another platform after the ones for iOS, say "macosx-x86_64", so that the Java wrappers get overwritten by something that does map LAPACKE. This way, after that, we can build ND4J. At runtime, LAPACK functionality just won't be available on iOS (or Android).

@saudet saudet mentioned this pull request Feb 2, 2018
@saudet
Copy link
Member

saudet commented Feb 3, 2018

Ok, I spent a bit more time fixing the builds and now it should work. With the latest commit above, can you try to run exactly these commands inside the openblas subdirectory and let me know if everything appears to work properly for you as well?

mvn -U clean
mvn install -Djavacpp.platform=ios-arm
mvn install -Djavacpp.platform=ios-arm64
mvn install -Djavacpp.platform=ios-x86
mvn install -Djavacpp.platform=ios-x86_64
mvn install -Djavacpp.platform=macosx-x86_64

@saudet
Copy link
Member

saudet commented Feb 4, 2018

Well, Travis CI seems to be happy with it, so let's get this merged and it will start deploying artifacts automatically! Let me know if you encounter any issues with them. Thanks

@saudet saudet merged commit 53e9326 into bytedeco:master Feb 4, 2018
@saudet
Copy link
Member

saudet commented Feb 7, 2018

Fixed final linking issues in commit aec0265. It should actually work now :)

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

Successfully merging this pull request may close these issues.

2 participants