pytorch libtorch_cpu编译

 

下载源码

安装依赖

pip install astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

编译

ARM架构

cmake -G "Unix Makefiles" -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ -DBUILD_SHARED_LIBS=ON -DUSE_NCCL=OFF -DUSE_CUDA=OFF -DUSE_QNNPACK=OFF -DBUILD_CAFFE2=OFF -DUSE_IDEEP=OFF -DBUILD_PYTHON=OFF -DBUILD_BINARY=OFF -DBUILD_SHARED_LIBS:BOOL=ON  -DCMAKE_BUILD_TYPE:STRING=Release -DDNNL_ENABLE_JIT_PROFILING=OFF -DSLEEF_OPTIMIZE_SSE=OFF -DPYTHON_EXECUTABLE:PATH="/usr/bin/python3" -DCMAKE_INSTALL_PREFIX:PATH=../pytorch-install ../
cmake --build . --target install