Skip to content

fix(nccl): cudart as build dependency - #261

Open
dssgabriel wants to merge 4 commits into
kokkos:developfrom
dssgabriel:fix/nccl-cudart-build-dep
Open

fix(nccl): cudart as build dependency#261
dssgabriel wants to merge 4 commits into
kokkos:developfrom
dssgabriel:fix/nccl-cudart-build-dep

Conversation

@dssgabriel

Copy link
Copy Markdown
Collaborator

Description

This PR makes the CUDA runtime an explicit dependency when building Kokkos Comm with the NCCL backend enabled. The NCCL backend includes CUDA runtime headers and uses CUDA runtime types/functions directly, so the build and installed CMake package needs to expose that dependency instead of relying on it indirectly through Kokkos or NCCL.

Changes

  • Affected areas: build, nccl, tests, docs
  • Breaking change(s)? no

List:

  • Require CUDAToolkit when KokkosComm_ENABLE_NCCL=ON.
  • Link the NCCL backend interface against CUDA::cudart.
  • Propagate the CUDA runtime dependency through the installed KokkosCommConfig.cmake.
  • Ensure direct NCCL test targets link against CUDA::cudart.
  • Document the CUDA Toolkit runtime requirement for the NCCL backend.
  • Replace direct cuda.h inclusion with cuda_runtime.h.
  • Build the MPI CUDA smoke test as a .cu source with CUDA language support.
  • Use CUDA_RUNTIME_LIBRARY Shared for the MPICH CUDA smoke-test workaround.

Checklist

  • Tests are up-to-date
  • Documentation is up-to-date

Signed-off-by: Gabriel Dos Santos <gabriel.dossantos@cea.fr>
Signed-off-by: Gabriel Dos Santos <gabriel.dossantos@cea.fr>
Kokkos Comm only depends on the CUDA runtime API, not the driver API
(even in tests).

Signed-off-by: Gabriel Dos Santos <gabriel.dossantos@cea.fr>
The MPI CUDA smoke test contains CUDA device kernels and uses CUDA
runtime APIs directly, but it was checked in as a .cpp file and added to
an MPI-only test target. That only worked in environments where the C++
compiler happened to be a CUDA-aware wrapper such as `nvcc_wrapper`.

In a normal CMake configuration, the test is compiled as plain C++. The
host compiler does not understand CUDA kernel launch syntax or CUDA
compiler flags such as `--cudart`, so the target cannot be built
correctly.

- Renamed the source to `.cu` and enable the CUDA language only for this
test when `Kokkos_ENABLE_CUDA` is set.
- Link the target against `CUDA::cudart` explicitly
- Use CMake's `CUDA_RUNTIME_LIBRARY` target property to request shared
cudart for the MPICH workaround.

Signed-off-by: Gabriel Dos Santos <gabriel.dossantos@cea.fr>
@dssgabriel dssgabriel self-assigned this Jul 4, 2026
@dssgabriel dssgabriel added A-unit-tests Area: KokkosComm unit tests A-nccl Area: KokkosComm NCCL backend implementation T-build Topic: something related to the build system C-bug-fix Category: a bug fix labels Jul 4, 2026
@cwpearson cwpearson added the SNL-CI-APPROVAL Required to run SNL CI on non-SNL contributions label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-nccl Area: KokkosComm NCCL backend implementation A-unit-tests Area: KokkosComm unit tests C-bug-fix Category: a bug fix SNL-CI-APPROVAL Required to run SNL CI on non-SNL contributions T-build Topic: something related to the build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicitly require CUDA runtime when NCCL backend is enabled

2 participants