Repository navigation
samples/nvcuda: support Linux arm64 cross-compilation - #7420
Merged
Merged
Conversation
qixuancao
force-pushed
the
fix/issue-7162
branch
2 times, most recently
from
November 6, 2026 11:30
94b0ddc to
a84c448
Compare
qixuancao
marked this pull request as ready for review
November 6, 2026 11:30
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Enable cross-compiling samples/nvcuda/example_app_nvcuda for Linux arm64 (aarch64) using the NVIDIA CUDA SBSA cross-compilation toolkit: - Install cuda-toolkit and cuda-cross-sbsa in the Linux CI workflow for apps-arm64 and apps-vcpkg-arm64 jobs. - Update m4/cuda.m4 to select the target CUDA directory (targets/sbsa-linux or targets/aarch64-linux) when cross-compiling for arm64/aarch64, check that libcudart links for the target architecture, and verify nvcc works with -ccbin $CXX. - Update samples/nvcuda/Makefile to pass -ccbin $(CXX) to nvcc and use the target-specific CUDA include and library directories when targeting arm64/aarch64. Refs: BOINC#7162 Assisted-by: Antigravity:Gemini-4-Argon
qixuancao
force-pushed
the
fix/issue-7162
branch
from
November 6, 2026 12:16
a84c448 to
d5ff887
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently, the
samples/nvcudasample application (example_app_nvcuda) is only built in Linux CI for nativex86_64(appsandapps-vcpkg), and is not cross-compiled for Linuxarm64(apps-arm64andapps-vcpkg-arm64).Change
Enable cross-compilation of
samples/nvcuda/example_app_nvcudafor Linuxarm64(aarch64) using the NVIDIA CUDA SBSA cross-compilation toolkit:.github/workflows/linux.yml:cuda-toolkit-${{ env.CUDA_VERSION_MM }}) forapps-arm64andapps-vcpkg-arm64in addition toappsandapps-vcpkgso/usr/local/cuda/bin/nvccand host build tools are available.Install CUDA for apps-arm64 and apps-vcpkg-arm64step that installscuda-repo-cross-sbsa-$distro_name-${{ env.CUDA_VERSION_MM }}-local_${{ env.CUDA_VERSION_MMP }}-1_all.debandcuda-cross-sbsa-${{ env.CUDA_VERSION_MM }}(which populates/usr/local/cuda/targets/sbsa-linux/{include,lib}).m4/cuda.m4&samples/Makefile.am:$cuda_root/targets/sbsa-linux(or$cuda_root/targets/aarch64-linux) as the target CUDA directory when$host_cpuisaarch64orarm64, and chooselib64orlibaccordingly.-lcudartlinks (AC_CHECK_LIB([cudart], [cudaMalloc], ...)) in addition to checkingcuda_runtime.h, determineCUDA_CCBIN(falling back to${CUDA_CCBIN##* }ifCXXcontains a compiler wrapper such asccache), substituteCUDA_CCBINviaAC_SUBST, and export it insamples/Makefile.am.samples/nvcuda/Makefile:arm64/aarch64cross-compilation viaRELEASE_ARCH,TARGET_ARCH, oraarch64inCXX, and setCUDA_INCLUDE_PATHandCUDA_LIB_PATHto$(CUDA_INSTALL_PATH)/targets/sbsa-linux/{include,lib}(ortargets/aarch64-linux).-ccbin "$(CUDA_CCBIN)"(defaultingCUDA_CCBIN ?= $(CXX)for standalone invokes) and the target include/library directories to$(CUDA_NVCC)when compilingcuda_kernel.cu.cuda.o: cuda.cpprule so GNU Make's built-in.cpp.orule does not pass$(TARGET_ARCH)as a compiler flag ifTARGET_ARCHis set in the environment.Testing
samples/nvcuda/example_app_nvcudaon Linuxx86_64targetingaarch64-linux-gnu(./configure --host=aarch64-linux ...withCXX=aarch64-linux-gnu-g++and CUDA 13.3 +cuda-cross-sbsa-13-3):configuredetects CUDA 13.3,cuda_runtime.h,-lcudart, andnvcc -ccbin aarch64-linux-gnu-g++.samples/nvcuda/example_app_nvcudais built as anELF 64-bit LSB pie executable, ARM aarch64linked againstlibcudart.so.13.samples/nvcuda/example_app_nvcudanatively on Linuxx86_64with CUDA 13.3 and verified the resultingx86-64ELF executable.Fixes #7162
Summary by cubic
Enables cross-compiling
samples/nvcuda/example_app_nvcudafor Linux arm64 (aarch64) using the NVIDIA CUDA SBSA cross-compilation toolkit.cuda-toolkitandcuda-cross-sbsain the Linux CI workflow for theapps-arm64andapps-vcpkg-arm64jobs.m4/cuda.m4to selecttargets/sbsa-linux(ortargets/aarch64-linux) CUDA directories when cross-compiling for arm64, verifies-lcudartlinks for the target, and checksnvccworks with-ccbin $CXX.CUDA_CCBINfromsamples/Makefile.amso the sample Makefile picks up the host compiler.samples/nvcuda/Makefileto pass-ccbin "$(CUDA_CCBIN)"tonvccand use target-specific CUDA include and library paths for arm64.Fixes #7162
Written for commit d5ff887. Summary will update on new commits.