Support for Apple Silicon M1

The new Apple Silicon Macs report the following os properties:
os.arch: aarch64
os.family: Mac
os.name: mac os x
os.version: 11.0.1

this yields a javacpp.platform of “macosx-arm64” which causes maven + nd4j-native-platform to try to pull artifacts that don’t exist.

I can override this on the command-line using -Djavacpp.platform=macosx-x86_64 (and then run the app using Rosetta)…

But VSCode still reports the following errors because I’m unable to override javacpp.platform directly in my pom:
Missing artifact org.bytedeco:javacpp:jar:macosx-arm64:1.5.3
Missing artifact org.bytedeco:openblas:jar:macosx-arm64:0.3.9-1-1.5.3
Missing artifact org.nd4j:nd4j-native:jar:macosx-arm64:1.0.0-beta7

It would be great to get prebuilt jars for macosx-arm64 or at least to add a default profile activation which sets the os.arch to x86_64 when running on Apple Silicon so that we don’t get the errors in our IDEs.

This is indeed a serious issue. I expect more and more people picking up the new M1 cpu and struggle with this issue. Is this something that is at least planned?

For anyone interested, I did create a question on StackOverflow. One solution that at least makes it work is to use non M1 jdk and use that in Maven and for executing the code. Performance is not great, I get a lot of OOM that I don’t get on other machines.

Here is the link to the SO question: Apple M1 - Maven Java dependency that is not yet available for macosx-arm64 - Stack Overflow

For future viewers of this thread:
Just want to update this post: we actually do properly support M1 macs now and have for a while now.
Ensure you do the following:

<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>1.0.0-M2.1</version>
</dependency>
<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native</artifactId>
  <version>1.0.0-M2.1</version>
  <classifier>macosx-arm64</classifier>
</dependency>
<dependency>
  <groupId>org.bytedeco</groupId>
  <artifactId>openblas</artifactId>
  <version>0.3.21-1.5.8</version>
  <classifier>macosx-arm64</classifier>
</dependency>

We do not provide support for this in the normal nd4j-native-platform. That is due to the scope of dependencies not all having mac arm versions but the math library does work out of the box.

1 Like