Skip to content

Commit

Permalink
Define KOKKOS_ARCH_NVIDIA_GPU macro when targeting an NVIDIA GPU arch…
Browse files Browse the repository at this point in the history
…itecture
  • Loading branch information
dalg24 committed Mar 2, 2023
1 parent fc4a9ce commit 5d3bcb1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile.kokkos
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA_ARCH), 1)
endif

ifneq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NVIDIA_GPU")

KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)

ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1)
Expand Down
1 change: 1 addition & 0 deletions cmake/KokkosCore_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
#cmakedefine KOKKOS_ARCH_AMPERE86
#cmakedefine KOKKOS_ARCH_HOPPER
#cmakedefine KOKKOS_ARCH_HOPPER90
#cmakedefine KOKKOS_ARCH_NVIDIA_GPU
#cmakedefine KOKKOS_ARCH_AMD_ZEN
#cmakedefine KOKKOS_ARCH_AMD_ZEN2
#cmakedefine KOKKOS_ARCH_AMD_ZEN3
Expand Down
1 change: 1 addition & 0 deletions cmake/kokkos_arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ FUNCTION(CHECK_CUDA_ARCH ARCH FLAG)
IF(CUDA_ARCH_ALREADY_SPECIFIED)
MESSAGE(FATAL_ERROR "Multiple GPU architectures given! Already have ${CUDA_ARCH_ALREADY_SPECIFIED}, but trying to add ${ARCH}. If you are re-running CMake, try clearing the cache and running again.")
ENDIF()
SET(KOKKOS_ARCH_NVIDIA_GPU ON PARENT_SCOPE)
SET(CUDA_ARCH_ALREADY_SPECIFIED ${ARCH} PARENT_SCOPE)
IF (NOT KOKKOS_ENABLE_CUDA AND NOT KOKKOS_ENABLE_OPENMPTARGET AND NOT KOKKOS_ENABLE_SYCL AND NOT KOKKOS_ENABLE_OPENACC)
MESSAGE(WARNING "Given CUDA arch ${ARCH}, but Kokkos_ENABLE_CUDA, Kokkos_ENABLE_OPENACC, and Kokkos_ENABLE_OPENMPTARGET are OFF. Option will be ignored.")
Expand Down

0 comments on commit 5d3bcb1

Please sign in to comment.