Supply CUDA math libs via CUDAToolkit imported targets - #100
Open
joshkamm wants to merge 1 commit into
Open
Conversation
pixi-build-cmake >=0.3.12 (via rattler-build 0.62's strict env isolation) no longer forwards CPATH from the developer's shell into the build, so nvc++ lost the NVHPC module's math_libs include path and every GPU translation unit failed on #include <cublas_v2.h> (#98). Make the build self-sufficient instead of relying on ambient CPATH: - find_package(CUDAToolkit) when USE_ACC, and link CUDA::cublas / CUDA::cusolver PUBLIC on SlaterGPU so io, sgpu.exe, and downstream consumers inherit both headers and libraries transitively - Replace the removed FindCUDA module and hand-rolled NVHPC math_libs library paths in examples/ with CUDA::cudart - Replace deprecated find_package(CUDA) in SlaterGPUConfig.cmake.in with find_dependency(CUDAToolkit) gated on the USE_ACC build setting (#93) Verified with a cold pixi build pinned to backend 0.3.14 (sanitized env): CUDAToolkit 12.9.41 is discovered from the NVHPC layout via PATH alone and all previously failing cuBLAS/cuSolver TUs compile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #98. Closes #93.
Problem
pixi-build-cmake 0.3.12+ absorbed rattler-build 0.62.0's strict build-environment isolation: the build no longer inherits the developer's shell env (PATH stays on the forwarding allowlist;
CPATHdoes not).nvc++is still found, but the NVHPC module'smath_libs/includeno longer reaches it, so everyUSE_ACCtranslation unit fails on#include <cublas_v2.h>. The group was shielded by the<=0.3.8backend cap until #97 bumped it to<=0.4.2(2026-07-01) — which is why builds "the same as before" suddenly broke. Full evidence trail in #98 (comment).Fix
Make the build supply the CUDA math libraries itself instead of relying on ambient
CPATH:find_package(CUDAToolkit REQUIRED)underUSE_ACC(top-level)target_link_libraries(SlaterGPU PUBLIC CUDA::cublas CUDA::cusolver)— PUBLIC becauseinclude/cuda_util.hincludes the cuBLAS/cuSolver headers whenUSE_ACC, so dependents (io,sgpu.exe, downstream consumers like ZEST) need the headers and libraries too; they now inherit both transitivelyFindCUDAmodule,enable_language(CUDA), and the hand-rolled${CUDA_TOOLKIT_ROOT_DIR}/../../math_libs/lib64/libcublas.sopaths (FindCUDAToolkit understands the NVHPC layout natively); keepCUDA::cudartSlaterGPUConfig.cmake.in: replace the deprecatedfind_package(CUDA QUIET)/enable_language(CUDA)block (the CMP0146 warning from Replace deprecated FindCUDA module with find_package(CUDAToolkit) in Config.cmake.in #93) withfind_dependency(CUDAToolkit REQUIRED)gated on the exportedUSE_ACCsettingVerification
Cold pixi build (fresh cache, wiped
.pixi) pinned to backend==0.3.14(sanitized env) on Perlmutter, NVHPC 25.5:CPATH)cublas_v2.herror count: 0)integrals.cpp(OpenACC kernel names truncated for long source paths, causing duplicate device functions (NVVM_ERROR_COMPILATION) #99), which this login node hits regardless of this change — so the finalsgpu.exelink is not exercised locally. CI's GPU runner (NVHPC 25.1) should exercise the full link path on this PR.Notes for review
CMakeLists.txt(from Fix CI after broken from new cmake release #50) referencedCUDART_LIBRARYerrors produced by the oldFindCUDA/find_librarycode in examples/, which this PR removes — the warning may now be obsolete, but I left it for a separate decision (the monthly latest-pixi CI run can re-evaluate it).SlaterGPUTargets.cmakenow carriesCUDA::cublas/CUDA::cusolverin the interface, resolved by the Config file'sfind_dependency(CUDAToolkit). Their lock hashes will need the usual bump after merge.🤖 Generated with Claude Code