jetson orin nane 编译 paddle
参考:https://github.com/paddlepaddle/paddle/issues/74126
一、下载与编译
git clone https://github.com/PaddlePaddle/Paddle.git
cd Paddlemkdir -p build && cd ./buildcmake .. -DPY_VERSION=3.10 \-DWITH_MKL=OFF \-DWITH_TESTING=OFF \-DCMAKE_BUILD_TYPE=Release \-DON_INFER=ON \-DWITH_PYTHON=ON \-DWITH_XBYAK=OFF \-DWITH_NV_JETSON=ON \-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \-DWITH_NCCL=OFF \-DWITH_RCCL=OFF \-DWITH_DISTRIBUTE=OFF \-DWITH_GPU=ON \-DWITH_TENSORRT=ON \-DWITH_ARM=ON \-DCMAKE_CXX_FLAGS="-Wno-error=class-memaccess"ulimit -n 65535 && make TARGET=ARMV8 -j3pip install python/dist/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_aarch64.whl
二、报错处理
1、backends::gpu::ChangeThreadNum(dev_ctx, &threads, 256);
解决
176 int64_t output_size = out->numel();
177 uint32_t blocks = NumBlocks(output_size);
178 uint32_t threads = kNumCUDAThreads;
179 #ifdef WITH_NV_JETSON
180 backends::gpu::ChangeThreadNum(dev_ctx, &threads, 256);
181 #endif26 static constexpr int kNumCUDAThreads = 512;27 static constexpr int kNumMaximumNumBlocks = 4096;28 static constexpr int kROISize = 4;180 backends::gpu::ChangeThreadNum(dev_ctx, (int*)(&threads), 256);
2、sh: 1: patchelf: not found
[100%] Packing whl packages------>>>
fatal: Not a valid object name 2>/dev/null
sh: 1: patchelf: not found
Traceback (most recent call last):
File "/mnt/ssd2/Paddle/build/python/setup.py", line 1312, in <module>
raise Exception("patch libpaddle.%s failed, command: %s" % (ext_name, command))
Exception: patch libpaddle..so failed, command: patchelf --set-rpath '$ORIGIN/../../nvidia/cuda_runtime/lib:$ORIGIN/../../nvidia/cuda_nvrtc/lib:$ORIGIN/../../nvidia/cublas/lib:$ORIGIN/../../nvidia/cudnn/lib:$ORIGIN/../../nvidia/curand/lib:$ORIGIN/../../nvidia/cusparse/lib:$ORIGIN/../../nvidia/nvjitlink/lib:$ORIGIN/../../nvidia/cuda_cupti/lib:$ORIGIN/../../nvidia/cuda_runtime/lib:$ORIGIN/../../nvidia/cufft/lib:$ORIGIN/../../nvidia/cufft/lib:$ORIGIN/../../nvidia/cusolver/lib:$ORIGIN/../../nvidia/nccl/lib:$ORIGIN/../../nvidia/nvtx/lib:$ORIGIN/../libs/' /home/nvidia/ssd2/Paddle/build/python/paddle/base/libpaddle.so
make[2]: *** [python/CMakeFiles/paddle_copy.dir/build.make:73: python/build/.timestamp_wheel] Error 1
make[1]: *** [CMakeFiles/Makefile2:40696: python/CMakeFiles/paddle_copy.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
解决
sudo apt install patchelf
3、RuntimeError: Missing build dependency: httpx
[100%] Built target inference_lib_dist
Traceback (most recent call last):
File "/mnt/ssd2/Paddle/build/python/setup.py", line 1610, in <module>
check_build_dependency()
File "/mnt/ssd2/Paddle/build/python/setup.py", line 1565, in check_build_dependency
raise RuntimeError(missing_modules.format(dependency=dependency))
RuntimeError: Missing build dependency: httpx
Please run 'pip install -r python/requirements.txt' to make sure you have all the dependencies installed.
make[2]: *** [python/CMakeFiles/paddle_copy.dir/build.make:73: python/build/.timestamp_wheel] Error 1
make[1]: *** [CMakeFiles/Makefile2:40696: python/CMakeFiles/paddle_copy.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
解决
python3 -m venv paddle_env
source paddle_env/bin/activate
pip install -r ../python/requirements.txt
4、[100%] Built target inference_lib_dist
解决
# You are in the Paddle/build directory.
cd python
python setup.py bdist_wheel# Now you find out that there are still missing libraries time after time after each launch.
# Here is the installation of all the libs that I was missing
pip install pyyaml
pip install pybind11-stubgen
pip install wheel
# You can probably install those packages and run make again