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

How to compile a mxnet.so on an aarch64 machine? #2221

Open
befallenStar opened this issue Dec 13, 2022 · 12 comments
Open

How to compile a mxnet.so on an aarch64 machine? #2221

befallenStar opened this issue Dec 13, 2022 · 12 comments
Labels
enhancement New feature or request

Comments

@befallenStar
Copy link

I want to use paddleocr on an aarch64 machine, and it would search and use libmxnet.so and libpaddle.so. But after I searched on the official page, I can only find x64 version, which doesn't match my requirement..I try to compile an aarch64 version but it failed when I ran the project.
So, I want to know if there is an existing aarch64 version, or maybe a full manscript for compiling.

@befallenStar befallenStar added the enhancement New feature or request label Dec 13, 2022
@frankfliu
Copy link
Contributor

frankfliu commented Dec 13, 2022

We don't officially support MXNet for aarch64, here is some instructions how to install MXNet manually:

  1. Download armpl library: https://developer.arm.com/downloads/-/arm-performance-libraries
  2. Download MXNet: https://repo.mxnet.io/dist/python/cpu/mxnet-1.9.1-py3-none-manylinux2014_aarch64.whl
  3. Install armpl and MXNet
  4. Set LD_LIBRARY_PATH to point to both armpl and MXNet installation path
  5. Set MXNET_LIBRARY_PATH to libmxnet.so file location

Here is example command for ubuntu20.4:

export LD_LIBRARY_PATH=/opt/arm/armpl_22.1_gcc-10.2/lib:/usr/local/lib64:/home/ubuntu/source/venv/lib/python3.8/site-packages/mxnet/:/usr/local/lib64
export MXNET_LIBRARY_PATH=/home/ubuntu/source/venv/lib/python3.8/site-packages/mxnet/

@frankfliu
Copy link
Contributor

@befallenStar Since you are using paddle, can you use PyTorch instead of MXNet?

We have aarch64 support PyTorch, you don't really need MXNet.

@befallenStar
Copy link
Author

@befallenStar Since you are using paddle, can you use PyTorch instead of MXNet?

We have aarch64 support PyTorch, you don't really need MXNet.

Thank you for your advice and instructions. I'll try if it works. Maybe in the future the aarch64-version mxnet can be included in the repo.

@edyang
Copy link

edyang commented Feb 23, 2023

Maybe in the future the aarch64-version mxnet can be included in the repo.

@scarfkim77
Copy link

scarfkim77 commented Jun 4, 2023

@befallenStar Since you are using paddle, can you use PyTorch instead of MXNet?

We have aarch64 support PyTorch, you don't really need MXNet.

Hi Frank @frankfliu ,

Do you currently support TensorFlow for aarch64?

I am trying to load a model in TensorFlow engine, but got an error: Failed to load TensorFlow native library, /Users/scarfkim77/.djl.ai/tensorflow/2.10.1-cpu-osx-aarch64/libjnitensorflow.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')).

Is there any way to solve it? Thank you very much!

@xiangyubo
Copy link

@befallenStar Since you are using paddle, can you use PyTorch instead of MXNet?

We have aarch64 support PyTorch, you don't really need MXNet.

Hi frankfliu @frankfliu,
Is there any examples about using paddle and pytorch engine on arrch64 machine? I need to use paddle to run a model serving on an aarch64 Linux server. I only see pytorch on Android

@frankfliu
Copy link
Contributor

We currently don't have aarch64 paddle native binaries. You have to build aarch64 JNI from source:

  1. get paddlepaddle aarch64 binary from paddlepaddle
  2. on aarch64 machine and run gradlew :engines:paddlepaddle:paddlepaddle-native:compileJNI to build JNI
  3. manually copy jni and libpaddle.so file into DJL cached folder

@xiangyubo
Copy link

We currently don't have aarch64 paddle native binaries. You have to build aarch64 JNI from source:

  1. get paddlepaddle aarch64 binary from paddlepaddle
  2. on aarch64 machine and run gradlew :engines:paddlepaddle:paddlepaddle-native:compileJNI to build JNI
  3. manually copy jni and libpaddle.so file into DJL cached folder

When I use version 0.15.0, it depends on pytorch something, running on a Hybrid engines mode. So I worry about when I need aarch64 paddle, arrch64 pytorch required. But I checked paddlepaddle-engine:jar:0.22.1, it seems that paddle engine does not depend on pytorch. Is that true?

@frankfliu
Copy link
Contributor

You can use Paddle alone, you don't really need PyTorch.

The only limitation is that you cannot use NDArray operations, you have to do pre/post process using pure java functions.

PyTorch has aarch64 support, so use PyTorch should not have any restrictions.

@xiangyubo
Copy link

You can use Paddle alone, you don't really need PyTorch.

The only limitation is that you cannot use NDArray operations, you have to do pre/post process using pure java functions.

PyTorch has aarch64 support, so use PyTorch should not have any restrictions.

can you give me an example about pure java functions dealing with pre or post NDArray

@GuoQuanhao
Copy link

@frankfliu can you give me an example about pure java functions dealing with pre or post NDArray

@zachgk
Copy link
Contributor

zachgk commented Feb 6, 2024

@xiangyubo @GuoQuanhao He is referring to the NDArray creation and manipulation operations like these that you can find in the NDArray or NDArrays class. These are often used during model pre-processing and post-processing (but can of course be used elsewhere too). But if you don't need them, there is no need for PyTorch

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

No branches or pull requests

7 participants