From 64ed7693fca41a89c354c6ce65efa879e3f0e195 Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Wed, 3 Jun 2026 11:47:27 +0200 Subject: [PATCH 1/5] Adding Kokkos Comm Signed-off-by: Cedric Chevalier --- .../builtin/packages/kokkos_comm/package.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 repos/spack_repo/builtin/packages/kokkos_comm/package.py diff --git a/repos/spack_repo/builtin/packages/kokkos_comm/package.py b/repos/spack_repo/builtin/packages/kokkos_comm/package.py new file mode 100644 index 00000000000..1bd7c9d068b --- /dev/null +++ b/repos/spack_repo/builtin/packages/kokkos_comm/package.py @@ -0,0 +1,42 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack_repo.builtin.build_systems.cmake import CMakePackage + +from spack.package import * + + +class KokkosComm(CMakePackage): + """Kokkos Comm is an experimental performance portable explicit communication interface for the Kokkos ecosystem.""" + + homepage = "https://github.com/kokkos/kokkos-comm" + url = "https://github.com/kokkos/kokkos-comm/archive/refs/tags/v0.1.0.tar.gz" + + maintainers("cedricchevalier19", "dssgabriel", "cwpearson") + + license("Apache-2.0 WITH LLVM-exception", checked_by="cedricchevalier19") + + version("0.1.0", sha256="59f4b953a795adb62f306e0861c7e69ee60c8cd2a6f1bd58eb4623b9ab774d45") + + + depends_on("cxx", type=("build", "link",)) + depends_on("cmake@3.22:3", type="build") + + depends_on("kokkos@4.7:") + + depends_on("mpi") + + def cmake_args(self): + args = [ + self.define("KokkosComm_ENABLE_MPI", True), + ] + + if self.spec.satisfies("^kokkos+rocm") and not ( + self.spec.satisfies("^kokkos %cxx=clang") or self.spec.satisfies("^kokkos %cxx=rocmcc") + ): + args.append(self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)) + else: + args.append(self.define("CMAKE_CXX_COMPILER", self["kokkos"].kokkos_cxx)) + + return args From 454085c554bf4532bce6c39684b948a3aace689f Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Wed, 3 Jun 2026 11:55:53 +0200 Subject: [PATCH 2/5] Kokkos Comm: Add proper dependency to MPI Signed-off-by: Cedric Chevalier --- repos/spack_repo/builtin/packages/kokkos_comm/package.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/repos/spack_repo/builtin/packages/kokkos_comm/package.py b/repos/spack_repo/builtin/packages/kokkos_comm/package.py index 1bd7c9d068b..e6cf4a4aefd 100644 --- a/repos/spack_repo/builtin/packages/kokkos_comm/package.py +++ b/repos/spack_repo/builtin/packages/kokkos_comm/package.py @@ -19,17 +19,20 @@ class KokkosComm(CMakePackage): version("0.1.0", sha256="59f4b953a795adb62f306e0861c7e69ee60c8cd2a6f1bd58eb4623b9ab774d45") + variant("mpi", description="Enable MPI backend", default=True) - depends_on("cxx", type=("build", "link",)) + depends_on("cxx") + depends_on("c", when="+mpi") depends_on("cmake@3.22:3", type="build") depends_on("kokkos@4.7:") - depends_on("mpi") + depends_on("mpi@3:", when="+mpi") def cmake_args(self): args = [ - self.define("KokkosComm_ENABLE_MPI", True), + self.define("KokkosComm_ENABLE_MPI", "mpi"), + self.define("KokkosComm_ENABLE_TESTS", True), ] if self.spec.satisfies("^kokkos+rocm") and not ( From e58fcbccb0795d187d3353b2118fdb3d05fff289 Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Wed, 3 Jun 2026 12:01:36 +0200 Subject: [PATCH 3/5] Kokkos Comm : add NCCL backend Signed-off-by: Cedric Chevalier --- .../builtin/packages/kokkos_comm/package.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/repos/spack_repo/builtin/packages/kokkos_comm/package.py b/repos/spack_repo/builtin/packages/kokkos_comm/package.py index e6cf4a4aefd..163b88f9441 100644 --- a/repos/spack_repo/builtin/packages/kokkos_comm/package.py +++ b/repos/spack_repo/builtin/packages/kokkos_comm/package.py @@ -20,18 +20,27 @@ class KokkosComm(CMakePackage): version("0.1.0", sha256="59f4b953a795adb62f306e0861c7e69ee60c8cd2a6f1bd58eb4623b9ab774d45") variant("mpi", description="Enable MPI backend", default=True) + variant("nccl", description="Enable NCCL backend", default=False) + # Mandatory dependencies depends_on("cxx") depends_on("c", when="+mpi") depends_on("cmake@3.22:3", type="build") depends_on("kokkos@4.7:") + # MPI-backend dependencies depends_on("mpi@3:", when="+mpi") - + + # NCCL-backend dependencies + depends_on("kokkos +cuda", when="+nccl") + depends_on("cuda", when="+nccl") + depends_on("nccl@2.20:", when="+nccl") + def cmake_args(self): args = [ self.define("KokkosComm_ENABLE_MPI", "mpi"), + self.define("KokkosComm_ENABLE_NCCL", "nccl"), self.define("KokkosComm_ENABLE_TESTS", True), ] From 824aa0a322b64d131992885d0b92d5ca4accc78d Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Wed, 3 Jun 2026 12:02:26 +0200 Subject: [PATCH 4/5] Kokkos Comm: Add develop version Signed-off-by: Cedric Chevalier --- repos/spack_repo/builtin/packages/kokkos_comm/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repos/spack_repo/builtin/packages/kokkos_comm/package.py b/repos/spack_repo/builtin/packages/kokkos_comm/package.py index 163b88f9441..7469daae58c 100644 --- a/repos/spack_repo/builtin/packages/kokkos_comm/package.py +++ b/repos/spack_repo/builtin/packages/kokkos_comm/package.py @@ -12,11 +12,13 @@ class KokkosComm(CMakePackage): homepage = "https://github.com/kokkos/kokkos-comm" url = "https://github.com/kokkos/kokkos-comm/archive/refs/tags/v0.1.0.tar.gz" + git = "https://github.com/kokkos/kokkos-comm.git" maintainers("cedricchevalier19", "dssgabriel", "cwpearson") license("Apache-2.0 WITH LLVM-exception", checked_by="cedricchevalier19") + version("develop", branch="develop") version("0.1.0", sha256="59f4b953a795adb62f306e0861c7e69ee60c8cd2a6f1bd58eb4623b9ab774d45") variant("mpi", description="Enable MPI backend", default=True) From e8cd75216cdc83115c1e781e6bd0085b911e77a1 Mon Sep 17 00:00:00 2001 From: Cedric Chevalier Date: Wed, 3 Jun 2026 12:10:45 +0200 Subject: [PATCH 5/5] Kokkos Comm : flag test to be removed Signed-off-by: Cedric Chevalier --- repos/spack_repo/builtin/packages/kokkos_comm/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/spack_repo/builtin/packages/kokkos_comm/package.py b/repos/spack_repo/builtin/packages/kokkos_comm/package.py index 7469daae58c..673253cb31e 100644 --- a/repos/spack_repo/builtin/packages/kokkos_comm/package.py +++ b/repos/spack_repo/builtin/packages/kokkos_comm/package.py @@ -43,7 +43,7 @@ def cmake_args(self): args = [ self.define("KokkosComm_ENABLE_MPI", "mpi"), self.define("KokkosComm_ENABLE_NCCL", "nccl"), - self.define("KokkosComm_ENABLE_TESTS", True), + self.define("KokkosComm_ENABLE_TESTS", True), # To be removed, for test ] if self.spec.satisfies("^kokkos+rocm") and not (