Skip to content

Commit ce9fa76

Browse files
rbbergertpadioleau
andauthored
kokkos: allow other LLVM-based compilers for ROCm (spack#3792)
* kokkos: allow other LLVM-based compilers for ROCm Instead of always forcing hipcc, allow kokkos to be compiled directly with either llvm or llvm-amdgpu (rocmcc). * [@spackbot] updating style on behalf of rbberger * Update package.py Co-authored-by: Thomas Padioleau <thomas.padioleau@cea.fr> * Update package.py Co-authored-by: Thomas Padioleau <thomas.padioleau@cea.fr> * [@spackbot] updating style on behalf of rbberger --------- Co-authored-by: rbberger <rbberger@users.noreply.github.com> Co-authored-by: Thomas Padioleau <thomas.padioleau@cea.fr>
1 parent 0209287 commit ce9fa76

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

repos/spack_repo/builtin/packages/kokkos/package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def cmake_args(self):
464464
options.append(self.define("CMAKE_CXX_COMPILER", self.kokkos_cxx))
465465
elif "+rocm" in self.spec:
466466
if "+cmake_lang" in self.spec:
467-
if self.spec.satisfies("%cxx=clang"):
467+
if self.spec.satisfies("%cxx=clang") or self.spec.satisfies("%cxx=rocmcc"):
468468
options.append(self.define("CMAKE_HIP_COMPILER", self.compiler.cxx))
469469
else:
470470
options.append(
@@ -480,7 +480,7 @@ def cmake_args(self):
480480
)
481481
)
482482
options.append(self.define("CMAKE_HIP_EXTENSIONS", False))
483-
else:
483+
elif not (self.spec.satisfies("%cxx=clang") or self.spec.satisfies("%cxx=rocmcc")):
484484
options.append(self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc))
485485
options.append(self.define("Kokkos_ENABLE_ROCTHRUST", True))
486486

repos/spack_repo/builtin/packages/kokkos_fft/package.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def cmake_args(self):
7575
self.define("KokkosFFT_ENABLE_ONEMKL", self.spec.satisfies("device_backend=onemkl")),
7676
]
7777

78-
if self.spec.satisfies("^kokkos+rocm"):
78+
if self.spec.satisfies("^kokkos+rocm") and not (
79+
self.spec.satisfies("^kokkos %cxx=clang") or self.spec.satisfies("^kokkos %cxx=rocmcc")
80+
):
7981
args.append(self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc))
8082
else:
8183
args.append(self.define("CMAKE_CXX_COMPILER", self["kokkos"].kokkos_cxx))

repos/spack_repo/builtin/packages/kokkos_kernels/package.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ def cmake_args(self):
223223
]
224224

225225
options.append(self.define("Kokkos_ROOT", spec["kokkos"].prefix))
226-
if spec.satisfies("^kokkos+rocm"):
226+
if spec.satisfies("^kokkos+rocm") and not (
227+
spec.satisfies("^kokkos %cxx=clang") or spec.satisfies("^kokkos %cxx=rocmcc")
228+
):
227229
options.append(self.define("CMAKE_CXX_COMPILER", spec["hip"].hipcc))
228230
else:
229231
options.append(self.define("CMAKE_CXX_COMPILER", self["kokkos"].kokkos_cxx))

0 commit comments

Comments
 (0)