deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.05k stars 648 forks source link

Running mxnet demo on arm64, unsatisfied link #760

Closed DjToMeK27 closed 3 years ago

DjToMeK27 commented 3 years ago

Hello

I have tried running https://github.com/aws-samples/djl-demo/tree/master/android/mxnet-android demo .

I have a problem on arm64 devices. I tried running it on my Pixel 3a and Samsung Galaxy I have downloaded arm64-v8a_native.zip file an copied it into jniLibs/arm64-v8a

https://i.imgur.com/qSKOrGX.png

but I get an error Native library (android-aarch64/libmxnet.so) not found in resource path (.)

I think the problem is with running com.sun.jna.NativeLibrary.loadLibrary, which trys to load android-aarch64 arhitecture on Android device I tried running x86 and x86_64 and this both works normally on emulator

stu1130 commented 3 years ago

Hi @DjToMeK27 I think 4 common ABIs are x86, x86_64, armeabi-v7a and arm64-v8a. It should have 95% coverage. You don't need android-aarch64/libmxnet.so and just use arm64-v8a for 64 bit arch

DjToMeK27 commented 3 years ago

@stu1130 hello. Yes I have arm64-v8a also added to my project but it does not seem to work. As said I have only problems with this type of ABI, others work ok. Will check if I misses something, but it does look like the library is looking in the wrong directory

frankfliu commented 3 years ago

@DjToMeK27 On Android, DJL relay on android system to set to proper java.library.path. com.sun.jna.Native.load() function underneath is calling System.loadLibrary(), It must be some mismatch at android layer.

stu1130 commented 3 years ago

@stu1130 hello. Yes I have arm64-v8a also added to my project but it does not seem to work.

What error did you get? If it is not found, it should be config problem on android layer as @frankfliu mentioned. If it is UnsatisfiedLink error in native library, it probably due to broken native library. We can try to rebuild it from source

DjToMeK27 commented 3 years ago

@stu1130 As said, native library not found

This is whole message

https://justpaste.it/4gvwt

stu1130 commented 3 years ago

@DjToMeK27 Thanks will try to rebuild libmxnet.so

stu1130 commented 3 years ago

@DjToMeK27 please try again. I re-uploaded the new arm64-v8a libmxnet

DjToMeK27 commented 3 years ago

@stu1130 it works now! Thank you! <3