Repository navigation
Building the C++ inference library for Blackwell (sm_120) — working configuration and notes #79725
Unanswered
mahmoudshehata74
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The prebuilt Python wheels cover Blackwell through the
cu129/cu130package indexes, but the C++ inference library download table currently tops out at CUDA 12.6:Since Blackwell support arrived in CUDA 12.8, both are compiled for architectures ending at
sm_90, and an RTX 50-series card fails at runtime:For projects linking
libpaddle_inference.sofrom C++, building from source is currently the only option. I did this successfully and wanted to share the configuration in case it saves someone else the trial and error.Working configuration
Paddle v3.3.0, CUDA 13.0, cuDNN 9.16, TensorRT 10.14.1, gcc 13.3, Ubuntu 24.04:
Result — one library covering both Ada and Blackwell:
version.txtreportsCUDA version: 13.0,CUDNN version: v9.16,WITH_TENSORRT: ON,TensorRT version: v10.14.1.48. A predictor created withEnableUseGpu(500, 0)runs and logsGPU Compute Capability: 12.0.Notes that might be useful
WITH_NCCL=OFFis required for a single-GPU build.WITH_DISTRIBUTE=OFFalone does not disable the NCCL header check, and configure fails with:CUDA_ARCH_NAME=Manualmust precedeCUDA_ARCH_BIN, otherwise the arch list is ignored. Worth confirming in the configure output:gcc 13.3 works despite
cmake/flags.cmakewarning that it is "too high, recommended to use GCC 8.2". No compiler errors on this version.-DWITH_FLASHATTN=OFFdoes not exist in v3.3.0 — CMake accepts and silently ignores it. FlashAttention is a hard dependency ofinference_lib_distand adds significant build time compilingsm_80/sm_90kernels. If there is a supported way to skip it for inference-only builds, I would be glad to know.For apt-installed TensorRT,
TENSORRT_ROOT=/usr— headers in/usr/include/x86_64-linux-gnu, libraries in/usr/lib/x86_64-linux-gnu. There is noTensorRT-10.x/directory to point at.Runtime linking:
libiomp5.solives inthird_party/install/mklml/lib, notpaddle/lib. Applications that only addpaddle/libto their rpath will fail to start.Build took roughly 4 hours with
-j4on 16 cores and 32 GB of RAM.An environment issue worth flagging
Not a Paddle problem, but it cost me a full build and may affect others on Ubuntu 22.04+:
systemd-oomdkilledciccmid-compile while 28 GB of RAM and 46 GB of swap were free.ciccreserves a large virtual address space it never touches (20.7 GB virtual, 2.1 GB resident).systemd-oomdkills on PSI memory pressure rather than actual exhaustion, and the default heuristic overcommit mode compounds it. Maskingsystemd-oomd.serviceandsystemd-oomd.socketand settingvm.overcommit_memory=1resolved it. Disabling without masking is not enough — the socket unit restarts the service.Full write-up
I documented the whole process, every obstacle, and performance measurements here:
https://github.com/mahmoudshehata74/paddle-inference-cpp-sm120
Includes build scripts, a preflight environment checker, and benchmark data for PP-OCRv5 on an RTX 5060 (twelve optimisation attempts, of which only one — reducing the number of text lines — made any difference).
Questions
inference_lib_distthe right target for a minimal C++ inference library, or is there something narrower?Happy to supply full configure and build logs if useful.
All reactions