Crosscompilation for arm64

I’m looking for a way to compile (install) pytorch for arm64 platform and as of now I’m not interesting of optimized (GPU-like) version of pytorch, it’s good enough to have CPU version able to run on ARM device. Please can you advice how can I either compile or install such a version of pytorch?
In my case I do not have CUDA available on device but instead I have OpenCL 1.2 FP.

I think you can just compile with NO_CUDA=1. Could you try it and see if there is any error?

I would love too, but is there install dependencies ? Since my platfrom ti’s kind of minimal on packages …

Yes, you would need numpy pyyaml mkl setuptools cmake cffi

Is it mkl library for arm architecture? Isn’t Intel lib?

Right, you can skip that. Sorry I just copied + pasted from Github install page without checking. :slight_smile:

I’m wondering to know if there’s a way to cross compile Pytorch on Allwinner platform (AArch64 processor). Leads are greatly appreciated.

Also @Peter_Peter, I presume that you’ve compiled or installed pytorch on arm64 by now. Could you please post the steps you have followed for the same?


@NikhilKanda this is the script I used to compile on AGX Xavier which is an ARM64 platform:

Hi @smth. Thanks for the info, but I hope that is not cross compilation. Correct me if I’m wrong

oh, sorry yes this is not cross-compilation.

I dont think all parts of our build system are even ready for cross-compilation

Can you give me any information about cross compilation of pytorch …

I haven’t tried this, but the following tutorial looks relevant:

met the same problem, need to cross compile libtorch for arm64 in x86-64 platform, is there any resources about this?

To build libtorch you can follow these instructions:

Personally, I only use CMake for cross-compiling and add a -DCMAKE_TOOLCHAIN_FILE=<path to your cmake toolchain> argument

If you have problems with binaries like mkrename mkdisp mkalias or addSuffix, you will have to compile sleef with your x86_64 compiler and then add for libtorch the cmake argument : -DNATIVE_BUILD_DIR=<path to native sleef build>.

full build step cross compile on arm64