imagej / imagej2

Open scientific N-dimensional image processing :microscope: :sparkler:
https://imagej.net/
BSD 2-Clause "Simplified" License
1.2k stars 335 forks source link

Mac Native M1 (arm64) support? #283

Open dstranathan opened 3 years ago

dstranathan commented 3 years ago

What is the status of Mac Native M1 (arm64) CPU support?

psobolewskiPhD commented 3 years ago

I've had success with Fiji, by downloading with no JRE and using a native JRE (e.g. Azul). Works very well, nice speed up ~40% on a CPU computational task. Some plugins that use compiled libs, etc. may need tweaks. For example getting native CLIJ working resulted in an 8-fold speedup over Rosetta. You can see some of my experience in this twitter thread: https://twitter.com/psobolewskiPhD/status/1342494593082920960?s=20

ctrueden commented 1 year ago

@psobolewskiPhD JogAmp 2.4.0 (JOGL, JOCL, JOAL, Gluegen) was released earlier this month, and the release includes builds for mac-arm64. I should have new releases of imagej2 and fiji by the end of the week that include this release. This will be a big step toward ImageJ2 and Fiji supporting Mac M1 more comprehensively.

psobolewskiPhD commented 1 year ago

Cool, @ctrueden I'm happy to help test, though I'm not sure I've used those elements much previously (as I've been using Fiji with native arm64 JRE for a long time now)

ctrueden commented 1 year ago

@psobolewskiPhD I'm guessing that your current Fiji setup cannot use the 3D Viewer plugin. One easy way to test that is to do:

And see what happens.

My hope is that with the new JOGL 2.4.0, this will either begin working automatically, or else maybe with some small tweak somewhere.

psobolewskiPhD commented 1 year ago

@psobolewskiPhD I'm guessing that your current Fiji setup cannot use the 3D Viewer plugin. One easy way to test that is to do:

  • File > Open Samples > T1 Head
  • Image > Type > 8-bit
  • Plugins > 3D Viewer

And see what happens.

Correct:

(Fiji Is Just) ImageJ 2.9.0/1.53t; Java 11.0.11 [64-bit]; Mac OS X 13.1; 170MB of 10840MB (1%)

java.lang.UnsatisfiedLinkError: /private/var/folders/sy/y3_x27j14cxg3_vhycs6cr_h0000gn/T/jogamp_0000/file_cache/jln11471013896064159920/jln8880740635522233983/natives/macosx-universal/libgluegen_rt.dylib: dlopen(/private/var/folders/sy/y3_x27j14cxg3_vhycs6cr_h0000gn/T/jogamp_0000/file_cache/jln11471013896064159920/jln8880740635522233983/natives/macosx-universal/libgluegen_rt.dylib, 0x0001): tried: '/private/var/folders/sy/y3_x27j14cxg3_vhycs6cr_h0000gn/T/jogamp_0000/file_cache/jln11471013896064159920/jln8880740635522233983/natives/macosx-universal/libgluegen_rt.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/sy/y3_x27j14cxg3_vhycs6cr_h0000gn/T/jogamp_0000/file_cache/jln11471013896064159920/jln8880740635522233983/natives/macosx-universal/libgluegen_rt.dylib' (no such file), '/private/var/folders/sy/y3_x27j14cxg3_vhycs6cr_h0000gn/T/jogamp_0000/file_cache/jln11471013896064159920/jln8880740635522233983/natives/macosx-universal/libgluegen_rt.dylib
    at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
    at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
    at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
    at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
    at java.base/java.lang.Runtime.load0(Runtime.java:768)
    at java.base/java.lang.System.load(System.java:1837)
    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:604)
    at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
    at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:107)
    at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:488)
    at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:427)
    at com.jogamp.common.os.Platform$1.run(Platform.java:321)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.jogamp.common.os.Platform.<clinit>(Platform.java:290)
    at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:154)
    at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:83)
    at jogamp.opengl.ThreadingImpl$1.run(ThreadingImpl.java:66)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at jogamp.opengl.ThreadingImpl.<clinit>(ThreadingImpl.java:66)
    at com.jogamp.opengl.Threading.disableSingleThreading(Threading.java:164)
    at org.scijava.java3d.JoglPipeline.initialize(JoglPipeline.java:130)
    at org.scijava.java3d.Pipeline.createPipeline(Pipeline.java:92)
    at org.scijava.java3d.MasterControl.loadLibraries(MasterControl.java:837)
    at org.scijava.java3d.VirtualUniverse.<clinit>(VirtualUniverse.java:274)
    at ij3d.ImageJ3DViewer.run(ImageJ3DViewer.java:60)
    at ij3d.ImageJ_3D_Viewer.run(ImageJ_3D_Viewer.java:37)
    at ij.IJ.runUserPlugIn(IJ.java:237)
    at ij.IJ.runPlugIn(IJ.java:203)
    at ij.Executer.runCommand(Executer.java:152)
    at ij.Executer.run(Executer.java:70)
    at java.base/java.lang.Thread.run(Thread.java:829)

My hope is that with the new JOGL 2.4.0, this will either begin working automatically, or else maybe with some small tweak somewhere.

Sounds good!