Skip to content

Commit

Permalink
Always pass -extended-lambda option to NVCC and force Kokkos_ENABLE_C…
Browse files Browse the repository at this point in the history
…UDA_LAMBDA ON
  • Loading branch information
dalg24 committed May 8, 2023
1 parent d7c06c4 commit 798efc5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
14 changes: 6 additions & 8 deletions Makefile.kokkos
Original file line number Diff line number Diff line change
Expand Up @@ -665,15 +665,13 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
endif
endif

ifeq ($(KOKKOS_INTERNAL_CUDA_USE_LAMBDA), 1)
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA")
KOKKOS_CXXFLAGS += -expt-extended-lambda
endif
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA")
KOKKOS_CXXFLAGS += -extended-lambda
endif

ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA")
endif
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA")
endif

ifeq ($(KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR), 1)
Expand Down
2 changes: 1 addition & 1 deletion cmake/KokkosCore_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#cmakedefine KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
#cmakedefine KOKKOS_ENABLE_CUDA_UVM
#cmakedefine KOKKOS_ENABLE_CUDA_LAMBDA
#cmakedefine KOKKOS_ENABLE_CUDA_LAMBDA // deprecated
#cmakedefine KOKKOS_ENABLE_CUDA_CONSTEXPR
#cmakedefine KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC
#cmakedefine KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE
Expand Down
8 changes: 3 additions & 5 deletions cmake/kokkos_arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,9 @@ ENDIF()
#clear anything that might be in the cache
GLOBAL_SET(KOKKOS_CUDA_OPTIONS)
# Construct the Makefile options
IF (KOKKOS_ENABLE_CUDA_LAMBDA)
IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-expt-extended-lambda")
GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-Wext-lambda-captures-this")
ENDIF()
IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-extended-lambda")
GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-Wext-lambda-captures-this")
ENDIF()

IF (KOKKOS_ENABLE_CUDA_CONSTEXPR)
Expand Down
19 changes: 11 additions & 8 deletions cmake/kokkos_enable_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,7 @@ mark_as_advanced(Kokkos_ENABLE_IMPL_MDSPAN)
mark_as_advanced(Kokkos_ENABLE_MDSPAN_EXTERNAL)
mark_as_advanced(Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN)

IF (Trilinos_ENABLE_Kokkos AND TPL_ENABLE_CUDA)
SET(CUDA_LAMBDA_DEFAULT ON)
ELSEIF (KOKKOS_ENABLE_CUDA)
SET(CUDA_LAMBDA_DEFAULT ON)
ELSE()
SET(CUDA_LAMBDA_DEFAULT OFF)
ENDIF()
KOKKOS_ENABLE_OPTION(CUDA_LAMBDA ${CUDA_LAMBDA_DEFAULT} "Whether to activate experimental lambda features")
KOKKOS_ENABLE_OPTION(CUDA_LAMBDA ON "Whether to allow lambda expressions on the device with NVCC **DEPRECATED**")
IF (Trilinos_ENABLE_Kokkos)
SET(COMPLEX_ALIGN_DEFAULT OFF)
ELSE()
Expand Down Expand Up @@ -168,6 +161,16 @@ IF(Kokkos_ENABLE_CUDA_LDG_INTRINSIC)
MESSAGE(FATAL_ERROR "Kokkos_ENABLE_CUDA_LDG_INTRINSIC has been removed. LDG intrinsics are always enabled.")
ENDIF()
ENDIF()
IF(NOT Kokkos_ENABLE_CUDA_LAMBDA)
IF(KOKKOS_ENABLE_DEPRECATED_CODE_4)
MESSAGE(DEPRECATION "Setting Kokkos_ENABLE_CUDA_LAMBDA is deprecated. Lambda expressions in device code are always enabled. Forcing -DKokkos_ENABLE_CUDA_LAMBDA=ON")
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Kokkos turned Cuda lambda support ON!" FORCE)
set(KOKKOS_ENABLE_CUDA_LAMBDA ON)
ELSE()
MESSAGE(FATAL_ERROR "Kokkos_ENABLE_CUDA_LAMBDA has been removed. Lambda expressions in device code always enabled.")
ENDIF()
ENDIF()


IF(DEFINED Kokkos_ENABLE_IMPL_DESUL_ATOMICS)
MESSAGE(WARNING "Kokkos_ENABLE_IMPL_DESUL_ATOMICS option has been removed. Desul atomics cannot be disabled.")
Expand Down

0 comments on commit 798efc5

Please sign in to comment.