Rate This Document
Findability
Accuracy
Completeness
Readability

Source Code Compilation and Build

Obtain the PaddlePaddle source code, configure CMake, and compile and check wheel.

  1. Obtain the PaddlePaddle source code.
    1
    2
    3
    4
    git clone --branch v3.3.1 --depth 1 https://github.com/PaddlePaddle/Paddle.git 
    cd Paddle 
    git submodule sync --recursive 
    git submodule update --init --recursive
    
  2. Create a build directory and configure CMake.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    mkdir -p build-cp311-cuda13
    cd build-cp311-cuda13 
    ulimit -n 4096  
    cmake .. \
      -GNinja \
      -DCMAKE_BUILD_TYPE=Release \
      -DPY_VERSION=3.11 \
      -DPYTHON_EXECUTABLE="$(command -v python3)" \
      -DWITH_GPU=ON \
      -DWITH_ARM=ON \
      -DWITH_TESTING=OFF \
      -DWITH_DISTRIBUTE=OFF \
      -DWITH_NCCL=OFF \
      -DWITH_OPENVINO=OFF \
      -DWITH_CUDNN=ON \
      -DWITH_CUDNN_FRONTEND=OFF \
      -DWITH_TP_CACHE=ON \
      -DTHIRD_PARTY_CACHE_PATH="$(pwd)/third_party_cache" \
      -DCUDA_ARCH_NAME=Ampere \
      -DCMAKE_CUDA_FLAGS="-DEIGEN_DONT_VECTORIZE -UPADDLE_WITH_SLEEF"
    
    Table 1 Key parameters

    Parameter

    Description

    -DPY_VERSION=3.11

    Generate a Python 3.11 ABI wheel.

    -DWITH_GPU=ON

    Build PaddlePaddle for the GPU version.

    -DWITH_ARM=ON

    Enable the Arm architecture for building.

    -DWITH_TESTING=OFF

    Disable the construction of test targets to reduce the construction time and dependency scale.

    -DWITH_DISTRIBUTE=OFF

    Disable the distributed training capability.

    -DWITH_NCCL=OFF

    Disable NCCL. Multi-device communication is not included in the minimum verification path.

    -DWITH_OPENVINO=OFF

    Disable the construction of the OpenVINO backend.

    -DCUDA_ARCH_NAME=Ampere

    Generate CUDA code for the A100/Ampere architecture.

    -DCMAKE_CUDA_FLAGS=...

    Used by the CUDA compilation unit to prevent the NVCC from parsing the Arm NEON header file in AArch64.

  3. Perform the compilation.
    1
    2
    3
    export MAX_JOBS=8 
    export CMAKE_BUILD_PARALLEL_LEVEL=8 
    ninja -j8
    
  4. Check the wheel file after the build is complete.
    1
    ls -lh python/dist/*.whl
    

    The following is an example of the build product.

    1
    paddlepaddle_gpu-3.3.0.dev20260319-cp311-cp311-linux_aarch64.whl