From bf19d0de3a24c2ecc408341512a455bd78cf59a9 Mon Sep 17 00:00:00 2001 From: Gaurav Harsha Date: Mon, 20 Jul 2026 16:34:20 -0400 Subject: [PATCH 1/2] Drop CUDA::cuda_driver link to allow CPU-only launch green-gpu makes no CUDA driver API calls: the only cu* symbols in the source are the inline cuComplex.h helpers (cuCadd/cuCmul/cuCreal/...), which come from a header, not libcuda. Everything else uses the CUDA runtime API, cuBLAS, and cuSolver. Linking CUDA::cuda_driver (libcuda.so.1) therefore added a spurious hard DT_NEEDED on the NVIDIA driver library. Since accel-lib/gpu are static and get absorbed into mbpt.exe when green-gpu is used as a CUSTOM_KERNEL, the resulting mbpt.exe failed to even launch on CPU-only nodes with "libcuda.so.1: cannot open shared object file" -- including for pure CPU runs that never touch the GPU. Dropping the link removes the startup dependency; the shared CUDA runtime loads the driver lazily on the first CUDA call, so one binary starts on both CPU-only and GPU nodes. Co-Authored-By: Claude Opus 4.8 --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f16fbe..82c7c68 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,12 +4,12 @@ add_library(accel-lib cuda_common.cu cuda_check.cpp cublas_routines_prec.cu cu_compute_Pq.cu cugw_qpt.cu cugw_qkpt.cu cuhf_utils.cu cugw_utils.cu cu_symmetry.cu ) set_property(TARGET accel-lib PROPERTY CUDA_ARCHITECTURES ${GPU_ARCHS}) #also check the same parameters in solvers target_include_directories(accel-lib PUBLIC .) -target_link_libraries(accel-lib CUDA::cudart CUDA::cuda_driver CUDA::cublas CUDA::cusolver) +target_link_libraries(accel-lib CUDA::cudart CUDA::cublas CUDA::cusolver) target_link_libraries(accel-lib GREEN::UTILS GREEN::NDARRAY GREEN::GRIDS GREEN::SYMMETRY) add_library(gpu gpu_kernel.cpp hf_gpu_kernel.cpp gw_gpu_kernel.cpp) target_include_directories(gpu PUBLIC .) -target_link_libraries(gpu CUDA::cudart CUDA::cuda_driver CUDA::cublas CUDA::cusolver) +target_link_libraries(gpu CUDA::cudart CUDA::cublas CUDA::cusolver) target_link_libraries(gpu accel-lib) target_link_libraries(gpu GREEN::UTILS GREEN::NDARRAY GREEN::SYMMETRY GREEN::GRIDS GREEN::PARAMS) set_property(TARGET gpu PROPERTY CUDA_ARCHITECTURES ${GPU_ARCHS}) #also check same parameters in accel From 27b64b378139712d9a6c9029c8b9164cc57b73b8 Mon Sep 17 00:00:00 2001 From: Gaurav Harsha Date: Mon, 20 Jul 2026 16:47:18 -0400 Subject: [PATCH 2/2] Use runtime cudaDeviceGetAttribute for memory clock rate The only remaining CUDA driver-API call was cuDeviceGetAttribute with CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE (added for CUDA 13 compatibility after cudaDeviceProp::memoryClockRate was removed). That single call is what forced accel-lib/gpu to link libcuda, defeating the point of dropping CUDA::cuda_driver. NVIDIA's documented CUDA 13 replacement for the removed memoryClockRate field is the runtime API cudaDeviceGetAttribute(cudaDevAttrMemoryClockRate), which returns the same kHz value, is available across CUDA versions, and links only against libcudart. Switch to it so no driver-API symbols remain and the binary needs no libcuda at startup. Co-Authored-By: Claude Opus 4.8 --- src/cuda_check.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cuda_check.cpp b/src/cuda_check.cpp index 8f79d8a..8578beb 100644 --- a/src/cuda_check.cpp +++ b/src/cuda_check.cpp @@ -37,7 +37,7 @@ void check_for_cuda(MPI_Comm global_comm, int global_rank, int &devCount_per_nod std::cout<<"Device Number: " << i << std::endl; std::cout<<" Device name: " << prop.name << std::endl; int memClockKHz = 0; - cuDeviceGetAttribute(&memClockKHz, CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE, i); + cudaDeviceGetAttribute(&memClockKHz, cudaDevAttrMemoryClockRate, i); std::cout<<" Peak Memory Bandwidth (GB/s): "<<2.0*memClockKHz*(prop.memoryBusWidth/8)/1.0e6<