Update Kokkos library in LAMMPS to v4.5.0

This commit is contained in:
Stan Moore
2024-12-13 09:23:03 -07:00
parent a78aee5731
commit 7f68aeb6d5
617 changed files with 21499 additions and 17255 deletions

View File

@ -1,7 +1,101 @@
# CHANGELOG # CHANGELOG
## 4.5.00
[Full Changelog](https://github.com/kokkos/kokkos/compare/4.4.01...4.5.00)
### Features
* SYCL backend graduated to production ready
* Introduce new `SequentialHostInit` view allocation property [\#7229](https://github.com/kokkos/kokkos/pull/7229) (backported in 4.4.01)
* Support building with Run-Time Type Information (RTTI) disabled
* Add new `KOKKOS_RELOCATABLE_FUNCTION` function annotation macro [\#5993](https://github.com/kokkos/kokkos/pull/5993)
### Backend and Architecture Enhancements
#### CUDA
* Adding occupancy tuning for CUDA architectures [\#6788](https://github.com/kokkos/kokkos/pull/6788)
* By default disable `cudaMallocAsync` (i.e., revert the change made in version 4.2) [\#7353](https://github.com/kokkos/kokkos/pull/7353)
#### HIP
* Add support for AMD Phoenix APUs with Radeon 740M/760M/780M/880M/890M [\#7162](https://github.com/kokkos/kokkos/pull/7162)
* Update maximum waves per CU values for consumer card [\#7347](https://github.com/kokkos/kokkos/pull/7347)
* Check that Kokkos is running on the architecture it was compiled for [\#7379](https://github.com/kokkos/kokkos/pull/7379)
* Add opt-in option to use `hipMallocAsync` instead of `hipMalloc` [\#7324](https://github.com/kokkos/kokkos/pull/7324)
* Introduce new architecture option `AMD_GFX942_APU` for MI300A [\#7462](https://github.com/kokkos/kokkos/pull/7462)
#### SYCL
* Move the `SYCL` backend out of the `Experimental` namespace [\#7171](https://github.com/kokkos/kokkos/pull/7171)
* Introduce `KOKKOS_ENABLE_SYCL_RELOCATABLE_DEVICE_CODE` as CMake option [\#5993](https://github.com/kokkos/kokkos/pull/5993)
#### OpenACC
* Add support for building with the Clacc compiler [\#7198](https://github.com/kokkos/kokkos/pull/7198)
* Workaround NVHPC collapse clause bug for `MDRangePolicy` [\#7425](https://github.com/kokkos/kokkos/pull/7425)
#### HPX
* Implement `Experimental::partition_space` to produce truly independent execution spaces [\#7287](https://github.com/kokkos/kokkos/pull/7287)
#### Threads
* Fix compilation for `parallel_reduce` `MDRange` with `Dynamic` scheduling [\#7478](https://github.com/kokkos/kokkos/pull/7478)
* Fix race conditions on ARM architectures [\#7498](https://github.com/kokkos/kokkos/pull/7498)
#### OpenMP
* Fix run time behavior when compiling with `-fvisibility-hidden` [\#7284](https://github.com/kokkos/kokkos/pull/7284) (backported in 4.4.01)
* Fix linking with Cray Clang compiler [\#7341](https://github.com/kokkos/kokkos/pull/7341)
#### Serial
* Allow `Kokkos_ENABLE_ATOMICS_BYPASS` to skip mutexes to remediate performance regression in 4.4 [\#7369](https://github.com/kokkos/kokkos/pull/7369)
### General Enhancements
* Improve `View` initialization/destruction for non-scalar trivial and trivially-destructible types [\#7219](https://github.com/kokkos/kokkos/pull/7219) [\#7225](https://github.com/kokkos/kokkos/pull/7225)
* Add getters for default tile sizes used in `MDRangePolicy` [\#6839](https://github.com/kokkos/kokkos/pull/6839)
* Improve performance of `Kokkos::sort` when `std::sort` is used [\#7264](https://github.com/kokkos/kokkos/pull/7264)
* Add range-based for loop support for `Array<T, N>` [\#7293](https://github.com/kokkos/kokkos/pull/7293)
* Allow functors as reducers for nested team parallel reduce [\#6921](https://github.com/kokkos/kokkos/pull/6921)
* Avoid making copies of string rvalue reference arguments to `view_alloc()` [\#7364](https://github.com/kokkos/kokkos/pull/7364)
* Add `atomic_{mod,xor,nand,lshift,rshift}` [\#7458](https://github.com/kokkos/kokkos/pull/7458)
* Allow using `SequentialHostInit` with `Kokkos::DualView` [\#7456](https://github.com/kokkos/kokkos/pull/7456)
* Add `Graph::instantiate()` [\#7240](https://github.com/kokkos/kokkos/pull/7240)
* Allow an arbitrary execution space instance to be used in `Kokkos::Graph::submit()` [\#7249](https://github.com/kokkos/kokkos/pull/7249)
* Enable compile-time diagnostic of illegal reduction target for graphs [\#7460](https://github.com/kokkos/kokkos/pull/7460)
### Build System Changes
* Make sure backend-specific options such as `IMPL_CUDA_MALLOC_ASYNC` only show when that backend is actually enabled [\#7228](https://github.com/kokkos/kokkos/pull/7228)
* Major refactoring removing `TriBITS` paths [\#6164](https://github.com/kokkos/kokkos/pull/6164)
* Add support for SpacemiT K60 (RISC-V) [\#7160](https://github.com/kokkos/kokkos/pull/7160)
### Deprecations
* Deprecate Tasking interface [\#7393](https://github.com/kokkos/kokkos/pull/7393)
* Deprecate `atomic_query_version`, `atomic_assign`, `atomic_compare_exchange_strong`, `atomic_{inc, dec}rement` [\#7458](https://github.com/kokkos/kokkos/pull/7458)
* Deprecate `{OpenMP,HPX}::is_asynchronous()` [\#7322](https://github.com/kokkos/kokkos/pull/7322)
### Bug Fixes
* Fix undefined behavior in `BinSort` when sorting within bins on host [\#7223](https://github.com/kokkos/kokkos/pull/7223)
* Using CUDA limits to set extents for blocks, grids [\#7235](https://github.com/kokkos/kokkos/pull/7235)
* Fix `deep_copy (serial_exec, dst, src)` with multiple host backends [\#7245](https://github.com/kokkos/kokkos/pull/7245)
* Skip `RangePolicy` bounds conversion checks if roundtrip convertibility is not provided [\#7172](https://github.com/kokkos/kokkos/pull/7172)
* Allow extracting host and device views from `DualView` with `const` value type [\#7242](https://github.com/kokkos/kokkos/pull/7242)
* Fix `TeamPolicy` array reduction for CUDA and HIP [\#6296](https://github.com/kokkos/kokkos/pull/6296)
* Fix implicit copy assignment operators in few AVX2 masks being deleted [\#7296](https://github.com/kokkos/kokkos/pull/7296)
* Fix configuring without architecture flags for SYCL [\#7303](https://github.com/kokkos/kokkos/pull/7303)
* Set an initial value index during join of `MinLoc`, `MaxLoc` or `MinMaxLoc` [\#7330](https://github.com/kokkos/kokkos/pull/7330)
* Fix storage lifetime of driver for global launch of graph nodes for CUDA and HIP [\#7365](https://github.com/kokkos/kokkos/pull/7365)
* Make `value_type` for `RandomAccessIterator` non-`const` [\#7485](https://github.com/kokkos/kokkos/pull/7485)
## [4.4.01](https://github.com/kokkos/kokkos/tree/4.4.01) ## [4.4.01](https://github.com/kokkos/kokkos/tree/4.4.01)
[Full Changelog](https://github.com/kokkos/kokkos/compare/4.0.00...4.4.01) [Full Changelog](https://github.com/kokkos/kokkos/compare/4.4.00...4.4.01)
### Features: ### Features:
* Introduce new SequentialHostInit view allocation property [\#7229](https://github.com/kokkos/kokkos/pull/7229) * Introduce new SequentialHostInit view allocation property [\#7229](https://github.com/kokkos/kokkos/pull/7229)
@ -13,7 +107,7 @@
### Bug Fixes ### Bug Fixes
* OpenMP: Fix issue related to the visibility of an internal symbol with shared libraries that affected `ScatterView` in particular [\#7284](https://github.com/kokkos/kokkos/pull/7284) * OpenMP: Fix issue related to the visibility of an internal symbol with shared libraries that affected `ScatterView` in particular [\#7284](https://github.com/kokkos/kokkos/pull/7284)
* Fix implicit copy assignment operators in few AVX2 masks being deleted [#7296](https://github.com/kokkos/kokkos/pull/7296) * Fix implicit copy assignment operators in few AVX2 masks being deleted [\#7296](https://github.com/kokkos/kokkos/pull/7296)
## [4.4.00](https://github.com/kokkos/kokkos/tree/4.4.00) ## [4.4.00](https://github.com/kokkos/kokkos/tree/4.4.00)
[Full Changelog](https://github.com/kokkos/kokkos/compare/4.3.01...4.4.00) [Full Changelog](https://github.com/kokkos/kokkos/compare/4.3.01...4.4.00)
@ -57,6 +151,7 @@
* SIMD: Allow flexible vector width for 32 bit types [\#6802](https://github.com/kokkos/kokkos/pull/6802) * SIMD: Allow flexible vector width for 32 bit types [\#6802](https://github.com/kokkos/kokkos/pull/6802)
* Updates for `Kokkos::Array`: add `kokkos_swap(Array<T, N>)` specialization [\#6943](https://github.com/kokkos/kokkos/pull/6943), add `Kokkos::to_array` [\#6375](https://github.com/kokkos/kokkos/pull/6375), make `Kokkos::Array` equality-comparable [\#7148](https://github.com/kokkos/kokkos/pull/7148) * Updates for `Kokkos::Array`: add `kokkos_swap(Array<T, N>)` specialization [\#6943](https://github.com/kokkos/kokkos/pull/6943), add `Kokkos::to_array` [\#6375](https://github.com/kokkos/kokkos/pull/6375), make `Kokkos::Array` equality-comparable [\#7148](https://github.com/kokkos/kokkos/pull/7148)
* Structured binding support for `Kokkos::complex` [\#7040](https://github.com/kokkos/kokkos/pull/7040) * Structured binding support for `Kokkos::complex` [\#7040](https://github.com/kokkos/kokkos/pull/7040)
* Introduce `KOKKOS_DEDUCTION_GUIDE` macro to allow for portable user-defined deduction guides [\#6954](https://github.com/kokkos/kokkos/pull/6954)
### Build System Changes ### Build System Changes
* Do not require OpenMP support for languages other than CXX [\#6965](https://github.com/kokkos/kokkos/pull/6965) * Do not require OpenMP support for languages other than CXX [\#6965](https://github.com/kokkos/kokkos/pull/6965)
@ -1388,7 +1483,7 @@
**Closed issues:** **Closed issues:**
- Silent error (Validate storage level arg to set_scratch_size) [\#3097](https://github.com/kokkos/kokkos/issues/3097) - Silent error (Validate storage level arg to set_scratch_size) [\#3097](https://github.com/kokkos/kokkos/issues/3097)
- Remove KOKKKOS\_ENABLE\_PROFILING Option [\#3095](https://github.com/kokkos/kokkos/issues/3095) - Remove KOKKOS\_ENABLE\_PROFILING Option [\#3095](https://github.com/kokkos/kokkos/issues/3095)
- Cuda 11 -\> allow C++17 [\#3083](https://github.com/kokkos/kokkos/issues/3083) - Cuda 11 -\> allow C++17 [\#3083](https://github.com/kokkos/kokkos/issues/3083)
- In source build failure not explained [\#3081](https://github.com/kokkos/kokkos/issues/3081) - In source build failure not explained [\#3081](https://github.com/kokkos/kokkos/issues/3081)
- Allow naming of Views for initialization kernel [\#3070](https://github.com/kokkos/kokkos/issues/3070) - Allow naming of Views for initialization kernel [\#3070](https://github.com/kokkos/kokkos/issues/3070)

View File

@ -2,11 +2,10 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
# Disable in-source builds to prevent source tree corruption. # Disable in-source builds to prevent source tree corruption.
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." ) message(
endif() FATAL_ERROR
"FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt."
if (COMMAND TRIBITS_PACKAGE) )
TRIBITS_PACKAGE(Kokkos)
endif() endif()
# We want to determine if options are given with the wrong case # We want to determine if options are given with the wrong case
@ -15,72 +14,66 @@ endif()
# form a list of all the given variables. If it begins with any # form a list of all the given variables. If it begins with any
# case of KoKkOS, we add it to the list. # case of KoKkOS, we add it to the list.
GET_CMAKE_PROPERTY(_variableNames VARIABLES) get_cmake_property(_variableNames VARIABLES)
SET(KOKKOS_GIVEN_VARIABLES) set(KOKKOS_GIVEN_VARIABLES)
FOREACH (var ${_variableNames}) foreach(var ${_variableNames})
STRING(TOUPPER ${var} UC_VAR) string(TOUPPER ${var} UC_VAR)
STRING(FIND ${UC_VAR} KOKKOS IDX) string(FIND ${UC_VAR} KOKKOS IDX)
IF (${IDX} EQUAL 0) if(${IDX} EQUAL 0)
LIST(APPEND KOKKOS_GIVEN_VARIABLES ${var}) list(APPEND KOKKOS_GIVEN_VARIABLES ${var})
ENDIF() endif()
ENDFOREACH() endforeach()
# Basic initialization (Used in KOKKOS_SETTINGS) # Basic initialization (Used in KOKKOS_SETTINGS)
SET(Kokkos_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(Kokkos_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(KOKKOS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(KOKKOS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(KOKKOS_SRC_PATH ${Kokkos_SOURCE_DIR}) set(KOKKOS_SRC_PATH ${Kokkos_SOURCE_DIR})
SET(KOKKOS_PATH ${Kokkos_SOURCE_DIR}) set(KOKKOS_PATH ${Kokkos_SOURCE_DIR})
SET(KOKKOS_TOP_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(KOKKOS_TOP_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(PACKAGE_NAME Kokkos)
set(PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# Is this a build as part of Trilinos?
IF(COMMAND TRIBITS_PACKAGE_DECL)
SET(KOKKOS_HAS_TRILINOS ON)
ELSE()
SET(KOKKOS_HAS_TRILINOS OFF)
SET(PACKAGE_NAME Kokkos)
SET(PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
ENDIF()
# Is this build a subdirectory of another project # Is this build a subdirectory of another project
GET_DIRECTORY_PROPERTY(HAS_PARENT PARENT_DIRECTORY) get_directory_property(HAS_PARENT PARENT_DIRECTORY)
include(${KOKKOS_SRC_PATH}/cmake/kokkos_functions.cmake)
include(${KOKKOS_SRC_PATH}/cmake/kokkos_pick_cxx_std.cmake)
INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_functions.cmake) set(KOKKOS_ENABLED_OPTIONS) #exported in config file
INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_pick_cxx_std.cmake) set(KOKKOS_ENABLED_DEVICES) #exported in config file
set(KOKKOS_ENABLED_TPLS) #exported in config file
SET(KOKKOS_ENABLED_OPTIONS) #exported in config file set(KOKKOS_ENABLED_ARCH_LIST) #exported in config file
SET(KOKKOS_ENABLED_DEVICES) #exported in config file
SET(KOKKOS_ENABLED_TPLS) #exported in config file
SET(KOKKOS_ENABLED_ARCH_LIST) #exported in config file
#These are helper flags used for sanity checks during config #These are helper flags used for sanity checks during config
#Certain features should depend on other features being configured first #Certain features should depend on other features being configured first
SET(KOKKOS_CFG_DAG_NONE On) #sentinel to indicate no dependencies set(KOKKOS_CFG_DAG_NONE On) #sentinel to indicate no dependencies
SET(KOKKOS_CFG_DAG_DEVICES_DONE Off) set(KOKKOS_CFG_DAG_DEVICES_DONE Off)
SET(KOKKOS_CFG_DAG_OPTIONS_DONE Off) set(KOKKOS_CFG_DAG_OPTIONS_DONE Off)
SET(KOKKOS_CFG_DAG_ARCH_DONE Off) set(KOKKOS_CFG_DAG_ARCH_DONE Off)
SET(KOKKOS_CFG_DAG_CXX_STD_DONE Off) set(KOKKOS_CFG_DAG_CXX_STD_DONE Off)
SET(KOKKOS_CFG_DAG_COMPILER_ID_DONE Off) set(KOKKOS_CFG_DAG_COMPILER_ID_DONE Off)
FUNCTION(KOKKOS_CFG_DEPENDS SUCCESSOR PRECURSOR) function(KOKKOS_CFG_DEPENDS SUCCESSOR PRECURSOR)
SET(PRE_FLAG KOKKOS_CFG_DAG_${PRECURSOR}) set(PRE_FLAG KOKKOS_CFG_DAG_${PRECURSOR})
SET(POST_FLAG KOKKOS_CFG_DAG_${SUCCESSOR}) set(POST_FLAG KOKKOS_CFG_DAG_${SUCCESSOR})
IF (NOT ${PRE_FLAG}) if(NOT ${PRE_FLAG})
MESSAGE(FATAL_ERROR "Bad CMake refactor: feature ${SUCCESSOR} cannot be configured until ${PRECURSOR} is configured") message(
ENDIF() FATAL_ERROR "Bad CMake refactor: feature ${SUCCESSOR} cannot be configured until ${PRECURSOR} is configured"
GLOBAL_SET(${POST_FLAG} On) )
ENDFUNCTION() endif()
global_set(${POST_FLAG} On)
endfunction()
list(APPEND CMAKE_MODULE_PATH cmake/Modules)
LIST(APPEND CMAKE_MODULE_PATH cmake/Modules)
IF(NOT KOKKOS_HAS_TRILINOS)
set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# What language are we compiling Kokkos as # What language are we compiling Kokkos as
# downstream dependencies need to match this! # downstream dependencies need to match this!
SET(KOKKOS_COMPILE_LANGUAGE CXX) set(KOKKOS_COMPILE_LANGUAGE CXX)
# use lower case here since we didn't parse options yet # use lower case here since we didn't parse options yet
IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_CUDA) if(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_CUDA)
# Without this as a language for the package we would get a C++ compiler enabled. # Without this as a language for the package we would get a C++ compiler enabled.
# but we still need a C++ compiler even if we build all our cpp files as CUDA only # but we still need a C++ compiler even if we build all our cpp files as CUDA only
@ -88,70 +81,75 @@ IF(NOT KOKKOS_HAS_TRILINOS)
# This is just the rather odd way CMake does this, since CUDA doesn't imply C++ even # This is just the rather odd way CMake does this, since CUDA doesn't imply C++ even
# though it is a C++ extension ... (but I guess it didn't use to be back in CUDA 4 or 5 # though it is a C++ extension ... (but I guess it didn't use to be back in CUDA 4 or 5
# days. # days.
SET(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX) set(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX)
SET(KOKKOS_COMPILE_LANGUAGE CUDA) set(KOKKOS_COMPILE_LANGUAGE CUDA)
ENDIF() endif()
# use lower case here since we haven't parsed options yet # use lower case here since we haven't parsed options yet
IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_HIP) if(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_HIP)
# Without this as a language for the package we would get a C++ compiler enabled. # Without this as a language for the package we would get a C++ compiler enabled.
# but we still need a C++ compiler even if we build all our cpp files as HIP only # but we still need a C++ compiler even if we build all our cpp files as HIP only
# because otherwise the C++ features don't work etc. # because otherwise the C++ features don't work etc.
SET(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX) set(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX)
SET(KOKKOS_COMPILE_LANGUAGE HIP) set(KOKKOS_COMPILE_LANGUAGE HIP)
ENDIF() endif()
IF (Spack_WORKAROUND) if(Spack_WORKAROUND)
IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) if(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
MESSAGE(FATAL_ERROR "Can't currently use Kokkos_ENABLE_COMPILER_AS_CMAKE_LANGUAGE in a spack installation!") message(FATAL_ERROR "Can't currently use Kokkos_ENABLE_COMPILER_AS_CMAKE_LANGUAGE in a spack installation!")
ENDIF() endif()
#if we are explicitly using Spack for development, #if we are explicitly using Spack for development,
#nuke the Spack compiler #nuke the Spack compiler
SET(SPACK_CXX $ENV{SPACK_CXX}) set(SPACK_CXX $ENV{SPACK_CXX})
IF(SPACK_CXX) if(SPACK_CXX)
SET(CMAKE_CXX_COMPILER ${SPACK_CXX} CACHE STRING "the C++ compiler" FORCE) set(CMAKE_CXX_COMPILER ${SPACK_CXX} CACHE STRING "the C++ compiler" FORCE)
SET(ENV{CXX} ${SPACK_CXX}) set(ENV{CXX} ${SPACK_CXX})
ENDIF() endif()
ENDIF() endif()
# Always call the project command to define Kokkos_ variables # Always call the project command to define Kokkos_ variables
# and to make sure that C++ is an enabled language # and to make sure that C++ is an enabled language
PROJECT(Kokkos ${KOKKOS_COMPILE_LANGUAGE} ${KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE}) project(Kokkos ${KOKKOS_COMPILE_LANGUAGE} ${KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE})
IF(NOT HAS_PARENT) if(NOT HAS_PARENT)
IF (NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
SET(DEFAULT_BUILD_TYPE "RelWithDebInfo") set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
MESSAGE(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
SET(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}"
"Choose the type of build, options are: Debug, Release, RelWithDebInfo and MinSizeRel." CACHE STRING "Choose the type of build, options are: Debug, Release, RelWithDebInfo and MinSizeRel." FORCE
FORCE) )
ENDIF() endif()
ENDIF() endif()
ELSE()
SET(KOKKOS_COMPILE_LANGUAGE CXX)
ENDIF()
IF (NOT CMAKE_SIZEOF_VOID_P)
STRING(FIND ${CMAKE_CXX_COMPILER} nvcc_wrapper FIND_IDX)
IF (NOT FIND_IDX STREQUAL -1)
MESSAGE(FATAL_ERROR "Kokkos did not configure correctly and failed to validate compiler. The most likely cause is CUDA linkage using nvcc_wrapper. Please ensure your CUDA environment is correctly configured.")
ELSE()
MESSAGE(FATAL_ERROR "Kokkos did not configure correctly and failed to validate compiler. The most likely cause is linkage errors during CMake compiler validation. Please consult the CMake error log shown below for the exact error during compiler validation")
ENDIF()
ELSEIF (NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
MESSAGE(WARNING "32-bit builds are experimental and not officially supported.")
SET(KOKKOS_IMPL_32BIT ON)
ELSE()
MESSAGE(FATAL_ERROR "Kokkos assumes a 64-bit build, i.e., 8-byte pointers, but found ${CMAKE_SIZEOF_VOID_P}-byte pointers instead;")
ENDIF()
ENDIF()
if(NOT CMAKE_SIZEOF_VOID_P)
string(FIND ${CMAKE_CXX_COMPILER} nvcc_wrapper FIND_IDX)
if(NOT FIND_IDX STREQUAL -1)
message(
FATAL_ERROR
"Kokkos did not configure correctly and failed to validate compiler. The most likely cause is CUDA linkage using nvcc_wrapper. Please ensure your CUDA environment is correctly configured."
)
else()
message(
FATAL_ERROR
"Kokkos did not configure correctly and failed to validate compiler. The most likely cause is linkage errors during CMake compiler validation. Please consult the CMake error log shown below for the exact error during compiler validation"
)
endif()
elseif(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
message(WARNING "32-bit builds are experimental and not officially supported.")
set(KOKKOS_IMPL_32BIT ON)
else()
message(
FATAL_ERROR
"Kokkos assumes a 64-bit build, i.e., 8-byte pointers, but found ${CMAKE_SIZEOF_VOID_P}-byte pointers instead;"
)
endif()
endif()
set(Kokkos_VERSION_MAJOR 4) set(Kokkos_VERSION_MAJOR 4)
set(Kokkos_VERSION_MINOR 4) set(Kokkos_VERSION_MINOR 5)
set(Kokkos_VERSION_PATCH 1) set(Kokkos_VERSION_PATCH 0)
set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}")
message(STATUS "Kokkos version: ${Kokkos_VERSION}") message(STATUS "Kokkos version: ${Kokkos_VERSION}")
math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}")
@ -164,58 +162,54 @@ math(EXPR KOKKOS_VERSION_PATCH "${KOKKOS_VERSION} % 100")
# Load either the real TriBITS or a TriBITS wrapper # Load either the real TriBITS or a TriBITS wrapper
# for certain utility functions that are universal (like GLOBAL_SET) # for certain utility functions that are universal (like GLOBAL_SET)
INCLUDE(${KOKKOS_SRC_PATH}/cmake/fake_tribits.cmake) include(${KOKKOS_SRC_PATH}/cmake/fake_tribits.cmake)
IF (Kokkos_ENABLE_CUDA) if(Kokkos_ENABLE_CUDA)
# If we are building CUDA, we have tricked CMake because we declare a CXX project # If we are building CUDA, we have tricked CMake because we declare a CXX project
# If the default C++ standard for a given compiler matches the requested # If the default C++ standard for a given compiler matches the requested
# standard, then CMake just omits the -std flag in later versions of CMake # standard, then CMake just omits the -std flag in later versions of CMake
# This breaks CUDA compilation (CUDA compiler can have a different default # This breaks CUDA compilation (CUDA compiler can have a different default
# -std then the underlying host compiler by itself). Setting this variable # -std then the underlying host compiler by itself). Setting this variable
# forces CMake to always add the -std flag even if it thinks it doesn't need it # forces CMake to always add the -std flag even if it thinks it doesn't need it
GLOBAL_SET(CMAKE_CXX_STANDARD_DEFAULT 98) global_set(CMAKE_CXX_STANDARD_DEFAULT 98)
ENDIF() endif()
# These are the variables we will append to as we go # These are the variables we will append to as we go
# I really wish these were regular variables # I really wish these were regular variables
# but scoping issues can make it difficult # but scoping issues can make it difficult
GLOBAL_SET(KOKKOS_COMPILE_OPTIONS) global_set(KOKKOS_COMPILE_OPTIONS)
GLOBAL_SET(KOKKOS_LINK_OPTIONS) global_set(KOKKOS_LINK_OPTIONS)
GLOBAL_SET(KOKKOS_AMDGPU_OPTIONS) global_set(KOKKOS_AMDGPU_OPTIONS)
GLOBAL_SET(KOKKOS_CUDA_OPTIONS) global_set(KOKKOS_CUDA_OPTIONS)
GLOBAL_SET(KOKKOS_CUDAFE_OPTIONS) global_set(KOKKOS_CUDAFE_OPTIONS)
GLOBAL_SET(KOKKOS_XCOMPILER_OPTIONS) global_set(KOKKOS_XCOMPILER_OPTIONS)
# We need to append text here for making sure TPLs # We need to append text here for making sure TPLs
# we import are available for an installed Kokkos # we import are available for an installed Kokkos
GLOBAL_SET(KOKKOS_TPL_EXPORTS) global_set(KOKKOS_TPL_EXPORTS)
# KOKKOS_DEPENDENCE is used by kokkos_launch_compiler # KOKKOS_DEPENDENCE is used by kokkos_launch_compiler
GLOBAL_SET(KOKKOS_COMPILE_DEFINITIONS KOKKOS_DEPENDENCE) global_set(KOKKOS_COMPILE_DEFINITIONS KOKKOS_DEPENDENCE)
# MSVC never goes through kokkos_launch_compiler # MSVC never goes through kokkos_launch_compiler
IF(NOT MSVC) if(NOT MSVC)
GLOBAL_APPEND(KOKKOS_LINK_OPTIONS -DKOKKOS_DEPENDENCE) global_append(KOKKOS_LINK_OPTIONS -DKOKKOS_DEPENDENCE)
ENDIF() endif()
IF(Kokkos_ENABLE_TESTS AND NOT KOKKOS_HAS_TRILINOS) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/kokkos_configure_trilinos.cmake)
if(Kokkos_ENABLE_TESTS)
find_package(GTest QUIET) find_package(GTest QUIET)
ENDIF() endif()
# Include a set of Kokkos-specific wrapper functions that # Include a set of Kokkos-specific wrapper functions that
# will either call raw CMake or TriBITS # will either call raw CMake or TriBITS
# These are functions like KOKKOS_INCLUDE_DIRECTORIES # These are functions like KOKKOS_INCLUDE_DIRECTORIES
INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_tribits.cmake) include(${KOKKOS_SRC_PATH}/cmake/kokkos_tribits.cmake)
# Check the environment and set certain variables # Check the environment and set certain variables
# to allow platform-specific checks # to allow platform-specific checks
INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_check_env.cmake) include(${KOKKOS_SRC_PATH}/cmake/kokkos_check_env.cmake)
IF(NOT KOKKOS_HAS_TRILINOS) include(${KOKKOS_SRC_PATH}/cmake/build_env_info.cmake)
# This does not work in Trilinos and we simply don't care
# to fix it for Trilinos
# Gather information about the runtime environment
INCLUDE(${KOKKOS_SRC_PATH}/cmake/build_env_info.cmake)
check_git_setup() check_git_setup()
ENDIF()
# The build environment setup goes in the following steps # The build environment setup goes in the following steps
# 1) Check all the enable options. This includes checking Kokkos_DEVICES # 1) Check all the enable options. This includes checking Kokkos_DEVICES
@ -223,102 +217,54 @@ ENDIF()
# 3) Check the CXX standard and select important CXX flags # 3) Check the CXX standard and select important CXX flags
# 4) Check for any third-party libraries (TPLs) like hwloc # 4) Check for any third-party libraries (TPLs) like hwloc
# 5) Check if optimizing for a particular architecture and add arch-specific flags # 5) Check if optimizing for a particular architecture and add arch-specific flags
KOKKOS_SETUP_BUILD_ENVIRONMENT() kokkos_setup_build_environment()
# Finish off the build # Finish off the build
# 6) Recurse into subdirectories and configure individual libraries # 6) Recurse into subdirectories and configure individual libraries
# 7) Export and install targets # 7) Export and install targets
OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
SET(KOKKOS_COMPONENT_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms kokkossimd) set(KOKKOS_COMPONENT_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms kokkossimd)
SET_PROPERTY(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_COMPONENT_LIBRARIES}) set_property(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_COMPONENT_LIBRARIES})
IF (KOKKOS_HAS_TRILINOS) if(HAS_PARENT)
SET(TRILINOS_INCDIR ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) set(KOKKOS_HEADER_DIR "include/kokkos")
SET(KOKKOS_HEADER_DIR ${TRILINOS_INCDIR}) set(KOKKOS_IS_SUBDIRECTORY TRUE)
SET(KOKKOS_IS_SUBDIRECTORY TRUE) else()
ELSEIF(HAS_PARENT) set(KOKKOS_HEADER_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
SET(KOKKOS_HEADER_DIR "include/kokkos") set(KOKKOS_IS_SUBDIRECTORY FALSE)
SET(KOKKOS_IS_SUBDIRECTORY TRUE) endif()
ELSE()
SET(KOKKOS_HEADER_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
SET(KOKKOS_IS_SUBDIRECTORY FALSE)
ENDIF()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# A) Forward declare the package so that certain options are also defined for # A) Forward declare the package so that certain options are also defined for
# subpackages # subpackages
## This restores the old behavior of ProjectCompilerPostConfig.cmake
# We must do this before KOKKOS_PACKAGE_DECL
IF (KOKKOS_HAS_TRILINOS)
# Overwrite the old flags at the top-level
# Because Tribits doesn't use lists, it uses spaces for the list of CXX flags
# we have to match the annoying behavior, also we have to preserve quotes
# which needs another workaround.
SET(KOKKOS_COMPILE_OPTIONS_TMP)
IF (KOKKOS_ENABLE_HIP)
LIST(APPEND KOKKOS_COMPILE_OPTIONS ${KOKKOS_AMDGPU_OPTIONS})
ENDIF()
FOREACH(OPTION ${KOKKOS_COMPILE_OPTIONS})
STRING(FIND "${OPTION}" " " OPTION_HAS_WHITESPACE)
IF(OPTION_HAS_WHITESPACE EQUAL -1)
LIST(APPEND KOKKOS_COMPILE_OPTIONS_TMP "${OPTION}")
ELSE()
LIST(APPEND KOKKOS_COMPILE_OPTIONS_TMP "\"${OPTION}\"")
ENDIF()
ENDFOREACH()
STRING(REPLACE ";" " " KOKKOSCORE_COMPILE_OPTIONS "${KOKKOS_COMPILE_OPTIONS_TMP}")
LIST(APPEND KOKKOS_ALL_COMPILE_OPTIONS ${KOKKOS_COMPILE_OPTIONS})
IF (KOKKOS_ENABLE_CUDA)
LIST(APPEND KOKKOS_ALL_COMPILE_OPTIONS ${KOKKOS_CUDA_OPTIONS})
ENDIF()
FOREACH(XCOMP_FLAG ${KOKKOS_XCOMPILER_OPTIONS})
SET(KOKKOSCORE_XCOMPILER_OPTIONS "${KOKKOSCORE_XCOMPILER_OPTIONS} -Xcompiler ${XCOMP_FLAG}")
LIST(APPEND KOKKOS_ALL_COMPILE_OPTIONS -Xcompiler ${XCOMP_FLAG})
ENDFOREACH()
IF (KOKKOS_ENABLE_CUDA)
STRING(REPLACE ";" " " KOKKOSCORE_CUDA_OPTIONS "${KOKKOS_CUDA_OPTIONS}")
FOREACH(CUDAFE_FLAG ${KOKKOS_CUDAFE_OPTIONS})
SET(KOKKOSCORE_CUDAFE_OPTIONS "${KOKKOSCORE_CUDAFE_OPTIONS} -Xcudafe ${CUDAFE_FLAG}")
LIST(APPEND KOKKOS_ALL_COMPILE_OPTIONS -Xcudafe ${CUDAFE_FLAG})
ENDFOREACH()
ENDIF()
#These flags get set up in KOKKOS_PACKAGE_DECL, which means they
#must be configured before KOKKOS_PACKAGE_DECL
SET(KOKKOS_ALL_COMPILE_OPTIONS
$<$<COMPILE_LANGUAGE:CXX>:${KOKKOS_ALL_COMPILE_OPTIONS}>)
ENDIF()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# D) Process the subpackages (subdirectories) for Kokkos # D) Process the subpackages (subdirectories) for Kokkos
# #
KOKKOS_PROCESS_SUBPACKAGES() kokkos_process_subpackages()
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# E) If Kokkos itself is enabled, process the Kokkos package # E) If Kokkos itself is enabled, process the Kokkos package
# #
KOKKOS_PACKAGE_POSTPROCESS() kokkos_configure_core()
KOKKOS_CONFIGURE_CORE()
IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING) if(NOT Kokkos_INSTALL_TESTING)
ADD_LIBRARY(kokkos INTERFACE) add_library(kokkos INTERFACE)
#Make sure in-tree projects can reference this as Kokkos:: #Make sure in-tree projects can reference this as Kokkos::
#to match the installed target names #to match the installed target names
ADD_LIBRARY(Kokkos::kokkos ALIAS kokkos) add_library(Kokkos::kokkos ALIAS kokkos)
# all_libs target is required for TriBITS-compliance # all_libs target is required for TriBITS-compliance
ADD_LIBRARY(Kokkos::all_libs ALIAS kokkos) add_library(Kokkos::all_libs ALIAS kokkos)
TARGET_LINK_LIBRARIES(kokkos INTERFACE ${KOKKOS_COMPONENT_LIBRARIES}) target_link_libraries(kokkos INTERFACE ${KOKKOS_COMPONENT_LIBRARIES})
KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(kokkos) kokkos_internal_add_library_install(kokkos)
ENDIF() endif()
INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_install.cmake) include(${KOKKOS_SRC_PATH}/cmake/kokkos_install.cmake)
# nvcc_wrapper is Kokkos' wrapper for NVIDIA's NVCC CUDA compiler. # nvcc_wrapper is Kokkos' wrapper for NVIDIA's NVCC CUDA compiler.
# Kokkos needs nvcc_wrapper in order to build. Other libraries and # Kokkos needs nvcc_wrapper in order to build. Other libraries and
@ -327,16 +273,15 @@ INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_install.cmake)
# as relative to ${CMAKE_INSTALL_PATH}. # as relative to ${CMAKE_INSTALL_PATH}.
# KOKKOS_INSTALL_ADDITIONAL_FILES will install nvcc wrapper and other generated # KOKKOS_INSTALL_ADDITIONAL_FILES will install nvcc wrapper and other generated
# files # files
KOKKOS_INSTALL_ADDITIONAL_FILES() kokkos_install_additional_files()
# Finally - if we are a subproject - make sure the enabled devices are visible # Finally - if we are a subproject - make sure the enabled devices are visible
IF (HAS_PARENT) if(HAS_PARENT)
FOREACH(DEV Kokkos_ENABLED_DEVICES) foreach(DEV Kokkos_ENABLED_DEVICES)
#I would much rather not make these cache variables or global properties, but I can't #I would much rather not make these cache variables or global properties, but I can't
#make any guarantees on whether PARENT_SCOPE is good enough to make #make any guarantees on whether PARENT_SCOPE is good enough to make
#these variables visible where I need them #these variables visible where I need them
SET(Kokkos_ENABLE_${DEV} ON PARENT_SCOPE) set(Kokkos_ENABLE_${DEV} ON PARENT_SCOPE)
SET_PROPERTY(GLOBAL PROPERTY Kokkos_ENABLE_${DEV} ON) set_property(GLOBAL PROPERTY Kokkos_ENABLE_${DEV} ON)
ENDFOREACH() endforeach()
ENDIF() endif()

View File

@ -7,6 +7,8 @@ We actively welcome pull requests.
3. If you've changed APIs, update the documentation. 3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes. 4. Ensure the test suite passes.
Before sending your patch for review, please try to ensure that it is formatted properly. We use clang-format version 16 for this.
## Issues ## Issues
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.

View File

@ -1,73 +0,0 @@
Developers of Kokkos (those who commit modifications to Kokkos)
must maintain the snapshot of Kokkos in the Trilinos repository.
This file contains instructions for how to
snapshot Kokkos from github.com/kokkos to Trilinos.
------------------------------------------------------------------------
*** EVERYTHING GOES RIGHT WORKFLOW ***
1) Given a 'git clone' of Kokkos and of Trilinos repositories.
1.1) Let ${KOKKOS} be the absolute path to the Kokkos clone.
This path *must* terminate with the directory name 'kokkos';
e.g., ${HOME}/kokkos .
1.2) Let ${TRILINOS} be the absolute path to the Trilinos directory.
2) Given that the Kokkos build & test is clean and
changes are committed to the Kokkos clone.
3) Snapshot the current commit in the Kokkos clone into the Trilinos clone.
This overwrites ${TRILINOS}/packages/kokkos with the content of ${KOKKOS}:
${KOKKOS}/scripts/snapshot.py --verbose ${KOKKOS} ${TRILINOS}/packages
4) Verify the snapshot commit happened as expected
cd ${TRILINOS}/packages/kokkos
git log -1 --name-only
5) Modify, build, and test Trilinos with the Kokkos snapshot.
6) Given that that the Trilinos build & test is clean and
changes are committed to the Trilinos clone.
7) Attempt push to the Kokkos repository.
If push fails then you must 'remove the Kokkos snapshot'
from your Trilinos clone.
See below.
8) Attempt to push to the Trilinos repository.
If updating for a failed push requires you to change Kokkos you must
'remove the Kokkos snapshot' from your Trilinos clone.
See below.
------------------------------------------------------------------------
*** WHEN SOMETHING GOES WRONG AND YOU MUST ***
*** REMOVE THE KOKKOS SNAPSHOT FROM YOUR TRILINOS CLONE ***
1) Query the Trilinos clone commit log.
git log --oneline
2) Note the <SHA1> of the commit to the Trillinos clone
immediately BEFORE the Kokkos snapshot commit.
Copy this <SHA1> for use in the next command.
3) IF more than one outstanding commit then you can remove just the
Kokkos snapshot commit with 'git rebase -i'. Edit the rebase file.
Remove or comment out the Kokkos snapshot commit entry.
git rebase -i <SHA1>
4) IF the Kokkos snapshot commit is the one and only
outstanding commit then remove just than commit.
git reset --hard HEAD~1
------------------------------------------------------------------------
*** REGARDING 'snapshot.py' TOOL ***
The 'snapshot.py' tool is developed and maintained by the
Center for Computing Research (CCR)
Software Engineering, Maintenance, and Support (SEMS) team.
Contact Brent Perschbacher <bmpersc@sandia.gov> for questions>
------------------------------------------------------------------------

View File

@ -11,8 +11,8 @@ CXXFLAGS += $(SHFLAGS)
endif endif
KOKKOS_VERSION_MAJOR = 4 KOKKOS_VERSION_MAJOR = 4
KOKKOS_VERSION_MINOR = 4 KOKKOS_VERSION_MINOR = 5
KOKKOS_VERSION_PATCH = 1 KOKKOS_VERSION_PATCH = 0
KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc)
# Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial
@ -40,16 +40,19 @@ KOKKOS_TRIBITS ?= "no"
KOKKOS_STANDALONE_CMAKE ?= "no" KOKKOS_STANDALONE_CMAKE ?= "no"
# Default settings specific options. # Default settings specific options.
# Options: force_uvm,use_ldg,rdc,enable_lambda,enable_constexpr,disable_malloc_async # Options: force_uvm,use_ldg,rdc,enable_lambda,enable_constexpr,enable_malloc_async
KOKKOS_CUDA_OPTIONS ?= "disable_malloc_async" KOKKOS_CUDA_OPTIONS ?= ""
# Options: rdc # Options: rdc,enable_malloc_async
KOKKOS_HIP_OPTIONS ?= "" KOKKOS_HIP_OPTIONS ?= ""
# Default settings specific options. # Default settings specific options.
# Options: enable_async_dispatch # Options: enable_async_dispatch
KOKKOS_HPX_OPTIONS ?= "" KOKKOS_HPX_OPTIONS ?= ""
#Options : force_host_as_device
KOKKOS_OPENACC_OPTIONS ?= ""
# Helper functions for conversion to upper case # Helper functions for conversion to upper case
uppercase_TABLE:=a,A b,B c,C d,D e,E f,F g,G h,H i,I j,J k,K l,L m,M n,N o,O p,P q,Q r,R s,S t,T u,U v,V w,W x,X y,Y z,Z uppercase_TABLE:=a,A b,B c,C d,D e,E f,F g,G h,H i,I j,J k,K l,L m,M n,N o,O p,P q,Q r,R s,S t,T u,U v,V w,W x,X y,Y z,Z
uppercase_internal=$(if $1,$$(subst $(firstword $1),$(call uppercase_internal,$(wordlist 2,$(words $1),$1),$2)),$2) uppercase_internal=$(if $1,$$(subst $(firstword $1),$(call uppercase_internal,$(wordlist 2,$(words $1),$1),$2)),$2)
@ -92,7 +95,7 @@ KOKKOS_INTERNAL_CUDA_USE_UVM := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),
KOKKOS_INTERNAL_CUDA_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),rdc) KOKKOS_INTERNAL_CUDA_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),rdc)
KOKKOS_INTERNAL_CUDA_USE_LAMBDA := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_lambda) KOKKOS_INTERNAL_CUDA_USE_LAMBDA := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_lambda)
KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_constexpr) KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_constexpr)
KOKKOS_INTERNAL_CUDA_DISABLE_MALLOC_ASYNC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),disable_malloc_async) KOKKOS_INTERNAL_CUDA_ENABLE_MALLOC_ASYNC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_malloc_async)
KOKKOS_INTERNAL_HPX_ENABLE_ASYNC_DISPATCH := $(call kokkos_has_string,$(KOKKOS_HPX_OPTIONS),enable_async_dispatch) KOKKOS_INTERNAL_HPX_ENABLE_ASYNC_DISPATCH := $(call kokkos_has_string,$(KOKKOS_HPX_OPTIONS),enable_async_dispatch)
# deprecated # deprecated
KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_desul_atomics) KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_desul_atomics)
@ -103,6 +106,8 @@ KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE := $(call kokkos_has_string,$(KOKKOS_OPT
KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_deprecation_warnings) KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_deprecation_warnings)
KOKKOS_INTERNAL_HIP_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS),rdc) KOKKOS_INTERNAL_HIP_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS),rdc)
KOKKOS_INTERNAL_HIP_ENABLE_MALLOC_ASYNC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS),enable_malloc_async)
KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE := $(call kokkos_has_string,$(KOKKOS_OPENACC_OPTIONS),force_host_as_device)
# Check for Kokkos Host Execution Spaces one of which must be on. # Check for Kokkos Host Execution Spaces one of which must be on.
KOKKOS_INTERNAL_USE_OPENMP := $(call kokkos_has_string,$(subst OpenMPTarget,,$(KOKKOS_DEVICES)),OpenMP) KOKKOS_INTERNAL_USE_OPENMP := $(call kokkos_has_string,$(subst OpenMPTarget,,$(KOKKOS_DEVICES)),OpenMP)
@ -178,7 +183,7 @@ KOKKOS_INTERNAL_COMPILER_CRAY := $(strip $(shell $(CXX) -craype-verbose 2
KOKKOS_INTERNAL_COMPILER_NVCC := $(strip $(shell echo "$(shell export OMPI_CXX=$(OMPI_CXX); export MPICH_CXX=$(MPICH_CXX); $(CXX) --version 2>&1 | grep -c nvcc)>0" | bc)) KOKKOS_INTERNAL_COMPILER_NVCC := $(strip $(shell echo "$(shell export OMPI_CXX=$(OMPI_CXX); export MPICH_CXX=$(MPICH_CXX); $(CXX) --version 2>&1 | grep -c nvcc)>0" | bc))
KOKKOS_INTERNAL_COMPILER_NVHPC := $(strip $(shell $(CXX) --version 2>&1 | grep -c "nvc++")) KOKKOS_INTERNAL_COMPILER_NVHPC := $(strip $(shell $(CXX) --version 2>&1 | grep -c "nvc++"))
KOKKOS_INTERNAL_COMPILER_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),clang) KOKKOS_INTERNAL_COMPILER_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),clang)
KOKKOS_INTERNAL_COMPILER_CRAY_CLANG := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -c "clang++")) KOKKOS_INTERNAL_COMPILER_CRAY_CLANG := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -v "error:" | grep -c "clang++"))
KOKKOS_INTERNAL_COMPILER_INTEL_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),oneAPI) KOKKOS_INTERNAL_COMPILER_INTEL_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),oneAPI)
KOKKOS_INTERNAL_COMPILER_APPLE_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),Apple clang) KOKKOS_INTERNAL_COMPILER_APPLE_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),Apple clang)
KOKKOS_INTERNAL_COMPILER_HCC := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),HCC) KOKKOS_INTERNAL_COMPILER_HCC := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),HCC)
@ -292,6 +297,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
# Set OpenACC flags. # Set OpenACC flags.
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1)
KOKKOS_INTERNAL_OPENACC_FLAG := -acc KOKKOS_INTERNAL_OPENACC_FLAG := -acc
else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
KOKKOS_INTERNAL_OPENACC_FLAG := -fopenacc -fopenacc-fake-async-wait -fopenacc-implicit-worker=vector -Wno-openacc-and-cxx -Wno-openmp-mapping -Wno-unknown-cuda-version -Wno-pass-failed
else else
$(error Makefile.kokkos: OpenACC is enabled but the compiler must be NVHPC (got version string $(KOKKOS_CXX_VERSION))) $(error Makefile.kokkos: OpenACC is enabled but the compiler must be NVHPC (got version string $(KOKKOS_CXX_VERSION)))
endif endif
@ -411,8 +418,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0)
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 1)
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
KOKKOS_INTERNAL_NVCC_PATH := $(shell which nvcc) KOKKOS_INTERNAL_NVCC_PATH := $(shell which nvcc)
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
CUDA_PATH ?= $(KOKKOS_INTERNAL_NVCC_PATH:/bin/nvcc=) CUDA_PATH ?= $(KOKKOS_INTERNAL_NVCC_PATH:/bin/nvcc=)
ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
KOKKOS_INTERNAL_OPENMPTARGET_FLAG := $(KOKKOS_INTERNAL_OPENMPTARGET_FLAG) --cuda-path=$(CUDA_PATH) KOKKOS_INTERNAL_OPENMPTARGET_FLAG := $(KOKKOS_INTERNAL_OPENMPTARGET_FLAG) --cuda-path=$(CUDA_PATH)
@ -466,6 +473,14 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100), 0)
KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100 := $(call kokkos_has_string,$(KOKKOS_ARCH),NAVI1100) KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100 := $(call kokkos_has_string,$(KOKKOS_ARCH),NAVI1100)
endif endif
KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX1103) KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX1103)
KOKKOS_INTERNAL_USE_ARCH_AMD := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX940) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100) \
+ $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103))
# Any AVX? # Any AVX?
KOKKOS_INTERNAL_USE_ARCH_AVX := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_SNB) + $(KOKKOS_INTERNAL_USE_ARCH_AMDAVX)) KOKKOS_INTERNAL_USE_ARCH_AVX := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_SNB) + $(KOKKOS_INTERNAL_USE_ARCH_AMDAVX))
@ -561,6 +576,9 @@ endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC")
ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC_FORCE_HOST_AS_DEVICE")
endif
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
@ -733,7 +751,7 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
endif endif
endif endif
ifeq ($(KOKKOS_INTERNAL_CUDA_DISABLE_MALLOC_ASYNC), 0) ifeq ($(KOKKOS_INTERNAL_CUDA_ENABLE_MALLOC_ASYNC), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC")
else else
tmp := $(call kokkos_append_header,"/* $H""undef KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC */") tmp := $(call kokkos_append_header,"/* $H""undef KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC */")
@ -1024,86 +1042,122 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
endif endif
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG=--offload-arch
endif
endif
# Do not add this flag if its the cray compiler or the nvhpc compiler. # Do not add this flag if its the cray compiler or the nvhpc compiler.
ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 0) ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 0)
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
# Lets start with adding architecture defines # Lets start with adding architecture defines
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER30), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER30), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER30") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER30")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_30 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_30
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER32), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER32), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER32") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER32")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_32 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_32
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER35), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER35), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER35") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER35")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_35 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_35
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER37), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER37), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER37") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER37")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_37 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_37
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL50), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL50), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL50") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL50")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_50 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_50
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL52), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL52), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL52") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL52")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_52 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_52
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL53), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL53), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL53") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL53")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_53 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_53
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_PASCAL60), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_PASCAL60), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL60") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL60")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_60 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_60
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_PASCAL61), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_PASCAL61), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL61") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL61")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_61 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_61
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VOLTA70), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VOLTA70), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA70") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA70")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_70 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_70
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VOLTA72), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VOLTA72), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA72") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA72")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_72 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_72
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_TURING75), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_TURING75), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_TURING75") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_TURING75")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_75 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_75
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE80), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE80), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE80") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE80")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_80 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_80
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE86), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE86), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE86") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE86")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_86 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_86
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ADA89), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ADA89), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ADA89") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ADA89")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_89 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_89
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HOPPER90), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HOPPER90), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER90") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER90")
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0)
KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_90 KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_90
endif endif
endif endif
@ -1119,6 +1173,9 @@ ifneq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0)
ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG) KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)
endif
endif endif
endif endif
@ -1126,43 +1183,43 @@ endif
# Figure out the architecture flag for ROCm. # Figure out the architecture flag for ROCm.
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX906") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX906")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx906\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx906 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx906
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX908") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX908")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx908\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx908 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx908
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX90A") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX90A")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx90A\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx90a KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx90a
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX940), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX940), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX940") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX940")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx940\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx940 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx940
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX942") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX942")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx942\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx942 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx942
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1030") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1030")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx1030\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1030 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx1030
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1100") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1100")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx1100\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1100 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx1100
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1103") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1103")
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx1103\"")
KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1103 KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx1103
endif endif
@ -1171,8 +1228,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
KOKKOS_SRC += $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp KOKKOS_SRC += $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.hpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.hpp)
KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_HIP_ARCH_FLAG) KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_AMD_ARCH_FLAG)
KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_HIP_ARCH_FLAG) KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_AMD_ARCH_FLAG)
ifeq ($(KOKKOS_INTERNAL_HIP_USE_RELOC), 1) ifeq ($(KOKKOS_INTERNAL_HIP_USE_RELOC), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE")
@ -1182,6 +1239,21 @@ ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
KOKKOS_CXXFLAGS+=-fno-gpu-rdc KOKKOS_CXXFLAGS+=-fno-gpu-rdc
KOKKOS_LDFLAGS+=-fno-gpu-rdc KOKKOS_LDFLAGS+=-fno-gpu-rdc
endif endif
ifeq ($(KOKKOS_INTERNAL_HIP_ENABLE_MALLOC_ASYNC), 1)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_HIP_MALLOC_ASYNC")
else
tmp := $(call kokkos_append_header,"/* $H""undef KOKKOS_ENABLE_IMPL_HIP_MALLOC_ASYNC */")
endif
endif
ifneq ($(KOKKOS_INTERNAL_USE_ARCH_AMD), 0)
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_AMD_ARCH_FLAG)
KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_AMD_ARCH_FLAG)
endif
endif
endif endif
# Figure out Intel architecture flags. # Figure out Intel architecture flags.
@ -1235,6 +1307,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1)
KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG)
KOKKOS_LDFLAGS+=-fsycl KOKKOS_LDFLAGS+=-fsycl
KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG)
tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_SYCL_RELOCATABLE_DEVICE_CODE")
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
@ -1322,6 +1396,8 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0)
endif endif
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/*.hpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/*.hpp)
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/View/*.hpp)
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/View/MDSpan/*.hpp)
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/impl/*.hpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/impl/*.hpp)
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/containers/src/*.hpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/containers/src/*.hpp)
KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/containers/src/impl/*.hpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/containers/src/impl/*.hpp)
@ -1374,6 +1450,48 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG) KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG)
KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG) KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG)
KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENACC_LIB) KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENACC_LIB)
ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 1)
ifneq ($(CUDA_PATH),)
ifeq ($(call kokkos_path_exists,$(CUDA_PATH)/lib), 1)
CUDA_PATH := $(CUDA_PATH:/compilers=/cuda)
endif
endif
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
ifneq ($(CUDA_PATH),)
KOKKOS_LDFLAGS += -L$(CUDA_PATH)/lib64
endif
KOKKOS_LIBS += -lcudart
endif
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1)
KOKKOS_LIBS += -cuda
endif
ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1)
$(error If a GPU architecture is specified, KOKKOS_OPENACC_OPTIONS = force_host_as_device cannot be used. Disable the force_host_as_device option)
endif
else ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD), 1)
ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1)
ifneq ($(ROCM_PATH),)
KOKKOS_CPPFLAGS += -I$(ROCM_PATH)/include
KOKKOS_LDFLAGS += -L$(ROCM_PATH)/lib
endif
KOKKOS_LIBS += -lamdhip64
endif
ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1)
$(error If a GPU architecture is specified, KOKKOS_OPENACC_OPTIONS = force_host_as_device cannot be used. Disable the force_host_as_device option)
endif
else ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1)
# Compile for kernel execution on the host. In that case,
# memory is shared between the OpenACC space and the host space.
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1)
KOKKOS_CXXFLAGS += -acc=multicore
endif
else
# Automatic fallback mode; try to offload any available GPU, and fall back
# to the host CPU if no available GPU is found.
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1)
KOKKOS_CXXFLAGS += -acc=gpu,multicore
endif
endif
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
@ -1484,10 +1602,14 @@ else
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)
ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1)
tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_OPENACC") tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_OPENACC")
else else
tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENACC */") tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENACC */")
endif endif
else
tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENACC */")
endif
tmp := $(call desul_append_header, "") tmp := $(call desul_append_header, "")
tmp := $(call desul_append_header, "$H""endif") tmp := $(call desul_append_header, "$H""endif")
@ -1512,6 +1634,12 @@ $(DESUL_CONFIG_HEADER):
KOKKOS_CPP_DEPENDS := $(DESUL_CONFIG_HEADER) KokkosCore_config.h $(KOKKOS_HEADERS) KOKKOS_CPP_DEPENDS := $(DESUL_CONFIG_HEADER) KokkosCore_config.h $(KOKKOS_HEADERS)
# Tasking is deprecated
ifeq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
TMP_KOKKOS_SRC := $(KOKKOS_SRC)
KOKKOS_SRC = $(patsubst %Task.cpp,, $(TMP_KOKKOS_SRC))
endif
KOKKOS_OBJ = $(KOKKOS_SRC:.cpp=.o) KOKKOS_OBJ = $(KOKKOS_SRC:.cpp=.o)
KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ)) KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ))

View File

@ -16,8 +16,6 @@ Kokkos_HostSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Ho
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostSpace.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostSpace.cpp
Kokkos_hwloc.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_hwloc.cpp Kokkos_hwloc.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_hwloc.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_hwloc.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_hwloc.cpp
Kokkos_TaskQueue.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_TaskQueue.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_TaskQueue.cpp
Kokkos_HostThreadTeam.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostThreadTeam.cpp Kokkos_HostThreadTeam.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostThreadTeam.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostThreadTeam.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostThreadTeam.cpp
Kokkos_HostBarrier.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostBarrier.cpp Kokkos_HostBarrier.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostBarrier.cpp
@ -38,17 +36,21 @@ Kokkos_Abort.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Abort.
ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1)
Kokkos_Serial.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial.cpp Kokkos_Serial.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial.cpp
ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
Kokkos_Serial_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial_Task.cpp Kokkos_Serial_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial_Task.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial_Task.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Serial/Kokkos_Serial_Task.cpp
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
Kokkos_Cuda_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Instance.cpp Kokkos_Cuda_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Instance.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Instance.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Instance.cpp
Kokkos_CudaSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_CudaSpace.cpp Kokkos_CudaSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_CudaSpace.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_CudaSpace.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_CudaSpace.cpp
ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
Kokkos_Cuda_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp Kokkos_Cuda_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp
endif
Lock_Array_CUDA.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_CUDA.cpp Lock_Array_CUDA.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_CUDA.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_CUDA.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_CUDA.cpp
endif endif
@ -73,6 +75,8 @@ Kokkos_HIP_Space.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp
Kokkos_HIP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp Kokkos_HIP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp
Kokkos_HIP_ZeroMemset.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp
Lock_Array_HIP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp Lock_Array_HIP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp
endif endif
@ -89,26 +93,26 @@ Kokkos_OpenMP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_Ope
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP.cpp
Kokkos_OpenMP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp Kokkos_OpenMP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp
ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
Kokkos_OpenMP_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Task.cpp Kokkos_OpenMP_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Task.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Task.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Task.cpp
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1)
Kokkos_HPX.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX.cpp Kokkos_HPX.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX.cpp
ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1)
Kokkos_HPX_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX_Task.cpp Kokkos_HPX_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX_Task.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX_Task.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX_Task.cpp
endif endif
endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1)
Kokkos_OpenMPTarget_Exec.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp
Kokkos_OpenMPTarget_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp Kokkos_OpenMPTarget_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp
Kokkos_OpenMPTargetSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp Kokkos_OpenMPTargetSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp
Kokkos_OpenMPTarget_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp
$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp
endif endif
ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1)

View File

@ -30,12 +30,12 @@ To start learning about Kokkos:
The latest release of Kokkos can be obtained from the [GitHub releases page](https://github.com/kokkos/kokkos/releases/latest). The latest release of Kokkos can be obtained from the [GitHub releases page](https://github.com/kokkos/kokkos/releases/latest).
The current release is [4.3.01](https://github.com/kokkos/kokkos/releases/tag/4.3.01). The current release is [4.5.00](https://github.com/kokkos/kokkos/releases/tag/4.5.00).
```bash ```bash
curl -OJ -L https://github.com/kokkos/kokkos/archive/refs/tags/4.3.01.tar.gz curl -OJ -L https://github.com/kokkos/kokkos/releases/download/4.5.00/kokkos-4.5.00.tar.gz
# Or with wget # Or with wget
wget https://github.com/kokkos/kokkos/archive/refs/tags/4.3.01.tar.gz wget https://github.com/kokkos/kokkos/releases/download/4.5.00/kokkos-4.5.00.tar.gz
``` ```
To clone the latest development version of Kokkos from GitHub: To clone the latest development version of Kokkos from GitHub:

View File

@ -1,7 +1,7 @@
IF (NOT Kokkos_INSTALL_TESTING) if(NOT Kokkos_INSTALL_TESTING)
ADD_SUBDIRECTORY(src) add_subdirectory(src)
ENDIF() endif()
# FIXME_OPENACC: temporarily disabled due to unimplemented features # FIXME_OPENACC: temporarily disabled due to unimplemented features
IF(NOT ((KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) OR KOKKOS_ENABLE_OPENACC)) if(NOT ((KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) OR KOKKOS_ENABLE_OPENACC))
KOKKOS_ADD_TEST_DIRECTORIES(unit_tests) kokkos_add_test_directories(unit_tests)
ENDIF() endif()

View File

@ -1,34 +1,29 @@
#I have to leave these here for tribits #I have to leave these here for tribits
KOKKOS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) kokkos_include_directories(${CMAKE_CURRENT_BINARY_DIR})
KOKKOS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) kokkos_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
FILE(GLOB ALGO_HEADERS *.hpp) file(GLOB ALGO_HEADERS *.hpp)
FILE(GLOB ALGO_SOURCES *.cpp) file(GLOB ALGO_SOURCES *.cpp)
APPEND_GLOB(ALGO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/std_algorithms/*.hpp) append_glob(ALGO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/std_algorithms/*.hpp)
APPEND_GLOB(ALGO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/std_algorithms/impl/*.hpp) append_glob(ALGO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/std_algorithms/impl/*.hpp)
INSTALL ( install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/" DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION ${KOKKOS_HEADER_DIR} DESTINATION ${KOKKOS_HEADER_DIR}
FILES_MATCHING PATTERN "*.hpp" FILES_MATCHING
PATTERN "*.hpp"
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# We have to pass the sources in here for Tribits # We have to pass the sources in here for Tribits
# These will get ignored for standalone CMake and a true interface library made # These will get ignored for standalone CMake and a true interface library made
KOKKOS_ADD_INTERFACE_LIBRARY( kokkos_add_interface_library(kokkosalgorithms NOINSTALLHEADERS ${ALGO_HEADERS} SOURCES ${ALGO_SOURCES})
kokkosalgorithms kokkos_lib_include_directories(
NOINSTALLHEADERS ${ALGO_HEADERS} kokkosalgorithms ${KOKKOS_TOP_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
SOURCES ${ALGO_SOURCES}
)
KOKKOS_LIB_INCLUDE_DIRECTORIES(kokkosalgorithms
${KOKKOS_TOP_BUILD_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
) )
KOKKOS_LINK_TPL(kokkoscontainers PUBLIC ROCTHRUST) kokkos_link_tpl(kokkoscontainers PUBLIC ROCTHRUST)
KOKKOS_LINK_TPL(kokkoscore PUBLIC ONEDPL) kokkos_link_tpl(kokkoscore PUBLIC ONEDPL)

View File

@ -615,7 +615,7 @@ template <class DeviceType>
struct Random_UniqueIndex { struct Random_UniqueIndex {
using locks_view_type = View<int**, DeviceType>; using locks_view_type = View<int**, DeviceType>;
KOKKOS_FUNCTION KOKKOS_FUNCTION
static int get_state_idx(const locks_view_type) { static int get_state_idx(const locks_view_type&) {
KOKKOS_IF_ON_HOST( KOKKOS_IF_ON_HOST(
(return DeviceType::execution_space::impl_hardware_thread_id();)) (return DeviceType::execution_space::impl_hardware_thread_id();))
@ -665,10 +665,9 @@ struct Random_UniqueIndex<
#ifdef KOKKOS_ENABLE_SYCL #ifdef KOKKOS_ENABLE_SYCL
template <class MemorySpace> template <class MemorySpace>
struct Random_UniqueIndex< struct Random_UniqueIndex<Kokkos::Device<Kokkos::SYCL, MemorySpace>> {
Kokkos::Device<Kokkos::Experimental::SYCL, MemorySpace>> {
using locks_view_type = using locks_view_type =
View<int**, Kokkos::Device<Kokkos::Experimental::SYCL, MemorySpace>>; View<int**, Kokkos::Device<Kokkos::SYCL, MemorySpace>>;
KOKKOS_FUNCTION KOKKOS_FUNCTION
static int get_state_idx(const locks_view_type& locks_) { static int get_state_idx(const locks_view_type& locks_) {
auto item = sycl::ext::oneapi::experimental::this_nd_item<3>(); auto item = sycl::ext::oneapi::experimental::this_nd_item<3>();

View File

@ -35,11 +35,11 @@ struct BinOp1D {
#endif #endif
// Construct BinOp with number of bins, minimum value and maximum value // Construct BinOp with number of bins, minimum value and maximum value
BinOp1D(int max_bins__, typename KeyViewType::const_value_type min, BinOp1D(int max_bins, typename KeyViewType::const_value_type min,
typename KeyViewType::const_value_type max) typename KeyViewType::const_value_type max)
: max_bins_(max_bins__ + 1), : max_bins_(max_bins + 1),
// Cast to double to avoid possible overflow when using integer // Cast to double to avoid possible overflow when using integer
mul_(static_cast<double>(max_bins__) / mul_(static_cast<double>(max_bins) /
(static_cast<double>(max) - static_cast<double>(min))), (static_cast<double>(max) - static_cast<double>(min))),
min_(static_cast<double>(min)) { min_(static_cast<double>(min)) {
// For integral types the number of bins may be larger than the range // For integral types the number of bins may be larger than the range
@ -47,7 +47,7 @@ struct BinOp1D {
// and then don't need to sort bins. // and then don't need to sort bins.
if (std::is_integral<typename KeyViewType::const_value_type>::value && if (std::is_integral<typename KeyViewType::const_value_type>::value &&
(static_cast<double>(max) - static_cast<double>(min)) <= (static_cast<double>(max) - static_cast<double>(min)) <=
static_cast<double>(max_bins__)) { static_cast<double>(max_bins)) {
mul_ = 1.; mul_ = 1.;
} }
} }
@ -82,16 +82,16 @@ struct BinOp3D {
BinOp3D() = delete; BinOp3D() = delete;
#endif #endif
BinOp3D(int max_bins__[], typename KeyViewType::const_value_type min[], BinOp3D(int max_bins[], typename KeyViewType::const_value_type min[],
typename KeyViewType::const_value_type max[]) { typename KeyViewType::const_value_type max[]) {
max_bins_[0] = max_bins__[0]; max_bins_[0] = max_bins[0];
max_bins_[1] = max_bins__[1]; max_bins_[1] = max_bins[1];
max_bins_[2] = max_bins__[2]; max_bins_[2] = max_bins[2];
mul_[0] = static_cast<double>(max_bins__[0]) / mul_[0] = static_cast<double>(max_bins[0]) /
(static_cast<double>(max[0]) - static_cast<double>(min[0])); (static_cast<double>(max[0]) - static_cast<double>(min[0]));
mul_[1] = static_cast<double>(max_bins__[1]) / mul_[1] = static_cast<double>(max_bins[1]) /
(static_cast<double>(max[1]) - static_cast<double>(min[1])); (static_cast<double>(max[1]) - static_cast<double>(min[1]));
mul_[2] = static_cast<double>(max_bins__[2]) / mul_[2] = static_cast<double>(max_bins[2]) /
(static_cast<double>(max[2]) - static_cast<double>(min[2])); (static_cast<double>(max[2]) - static_cast<double>(min[2]));
min_[0] = static_cast<double>(min[0]); min_[0] = static_cast<double>(min[0]);
min_[1] = static_cast<double>(min[1]); min_[1] = static_cast<double>(min[1]);

View File

@ -388,7 +388,8 @@ class BinSort {
// reasonable experimentally. // reasonable experimentally.
if (use_std_sort && bin_size > 10) { if (use_std_sort && bin_size > 10) {
KOKKOS_IF_ON_HOST( KOKKOS_IF_ON_HOST(
(std::sort(&sort_order(lower_bound), &sort_order(upper_bound), (std::sort(sort_order.data() + lower_bound,
sort_order.data() + upper_bound,
[this](int p, int q) { return bin_op(keys_rnd, p, q); });)) [this](int p, int q) { return bin_op(keys_rnd, p, q); });))
} else { } else {
for (int k = lower_bound + 1; k < upper_bound; ++k) { for (int k = lower_bound + 1; k < upper_bound; ++k) {

View File

@ -53,9 +53,13 @@ void sort(const ExecutionSpace& exec,
if constexpr (Impl::better_off_calling_std_sort_v<ExecutionSpace>) { if constexpr (Impl::better_off_calling_std_sort_v<ExecutionSpace>) {
exec.fence("Kokkos::sort without comparator use std::sort"); exec.fence("Kokkos::sort without comparator use std::sort");
if (view.span_is_contiguous()) {
std::sort(view.data(), view.data() + view.size());
} else {
auto first = ::Kokkos::Experimental::begin(view); auto first = ::Kokkos::Experimental::begin(view);
auto last = ::Kokkos::Experimental::end(view); auto last = ::Kokkos::Experimental::end(view);
std::sort(first, last); std::sort(first, last);
}
} else { } else {
Impl::sort_device_view_without_comparator(exec, view); Impl::sort_device_view_without_comparator(exec, view);
} }
@ -107,9 +111,13 @@ void sort(const ExecutionSpace& exec,
if constexpr (Impl::better_off_calling_std_sort_v<ExecutionSpace>) { if constexpr (Impl::better_off_calling_std_sort_v<ExecutionSpace>) {
exec.fence("Kokkos::sort with comparator use std::sort"); exec.fence("Kokkos::sort with comparator use std::sort");
if (view.span_is_contiguous()) {
std::sort(view.data(), view.data() + view.size(), comparator);
} else {
auto first = ::Kokkos::Experimental::begin(view); auto first = ::Kokkos::Experimental::begin(view);
auto last = ::Kokkos::Experimental::end(view); auto last = ::Kokkos::Experimental::end(view);
std::sort(first, last, comparator); std::sort(first, last, comparator);
}
} else { } else {
Impl::sort_device_view_with_comparator(exec, view, comparator); Impl::sort_device_view_with_comparator(exec, view, comparator);
} }

View File

@ -30,6 +30,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsuggest-override"
#if defined(KOKKOS_COMPILER_CLANG) #if defined(KOKKOS_COMPILER_CLANG)
// Some versions of Clang fail to compile Thrust, failing with errors like // Some versions of Clang fail to compile Thrust, failing with errors like
@ -77,12 +78,9 @@ namespace Kokkos::Impl {
template <typename T> template <typename T>
constexpr inline bool is_admissible_to_kokkos_sort_by_key = constexpr inline bool is_admissible_to_kokkos_sort_by_key =
::Kokkos::is_view<T>::value && T::rank() == 1 && ::Kokkos::is_view<T>::value && T::rank() == 1 &&
(std::is_same<typename T::traits::array_layout, (std::is_same_v<typename T::traits::array_layout, Kokkos::LayoutLeft> ||
Kokkos::LayoutLeft>::value || std::is_same_v<typename T::traits::array_layout, Kokkos::LayoutRight> ||
std::is_same<typename T::traits::array_layout, std::is_same_v<typename T::traits::array_layout, Kokkos::LayoutStride>);
Kokkos::LayoutRight>::value ||
std::is_same<typename T::traits::array_layout,
Kokkos::LayoutStride>::value);
template <class ViewType> template <class ViewType>
KOKKOS_INLINE_FUNCTION constexpr void KOKKOS_INLINE_FUNCTION constexpr void
@ -144,7 +142,7 @@ void sort_by_key_rocthrust(
#if defined(KOKKOS_ENABLE_ONEDPL) #if defined(KOKKOS_ENABLE_ONEDPL)
template <class Layout> template <class Layout>
inline constexpr bool sort_on_device_v<Kokkos::Experimental::SYCL, Layout> = inline constexpr bool sort_on_device_v<Kokkos::SYCL, Layout> =
std::is_same_v<Layout, Kokkos::LayoutLeft> || std::is_same_v<Layout, Kokkos::LayoutLeft> ||
std::is_same_v<Layout, Kokkos::LayoutRight>; std::is_same_v<Layout, Kokkos::LayoutRight>;
@ -152,7 +150,7 @@ inline constexpr bool sort_on_device_v<Kokkos::Experimental::SYCL, Layout> =
template <class KeysDataType, class... KeysProperties, class ValuesDataType, template <class KeysDataType, class... KeysProperties, class ValuesDataType,
class... ValuesProperties, class... MaybeComparator> class... ValuesProperties, class... MaybeComparator>
void sort_by_key_onedpl( void sort_by_key_onedpl(
const Kokkos::Experimental::SYCL& exec, const Kokkos::SYCL& exec,
const Kokkos::View<KeysDataType, KeysProperties...>& keys, const Kokkos::View<KeysDataType, KeysProperties...>& keys,
const Kokkos::View<ValuesDataType, ValuesProperties...>& values, const Kokkos::View<ValuesDataType, ValuesProperties...>& values,
MaybeComparator&&... maybeComparator) { MaybeComparator&&... maybeComparator) {
@ -176,7 +174,7 @@ template <typename ExecutionSpace, typename PermutationView, typename ViewType>
void applyPermutation(const ExecutionSpace& space, void applyPermutation(const ExecutionSpace& space,
const PermutationView& permutation, const PermutationView& permutation,
const ViewType& view) { const ViewType& view) {
static_assert(std::is_integral<typename PermutationView::value_type>::value); static_assert(std::is_integral_v<typename PermutationView::value_type>);
auto view_copy = Kokkos::create_mirror( auto view_copy = Kokkos::create_mirror(
Kokkos::view_alloc(space, typename ExecutionSpace::memory_space{}, Kokkos::view_alloc(space, typename ExecutionSpace::memory_space{},
@ -335,7 +333,7 @@ void sort_by_key_device_view_without_comparator(
template <class KeysDataType, class... KeysProperties, class ValuesDataType, template <class KeysDataType, class... KeysProperties, class ValuesDataType,
class... ValuesProperties> class... ValuesProperties>
void sort_by_key_device_view_without_comparator( void sort_by_key_device_view_without_comparator(
const Kokkos::Experimental::SYCL& exec, const Kokkos::SYCL& exec,
const Kokkos::View<KeysDataType, KeysProperties...>& keys, const Kokkos::View<KeysDataType, KeysProperties...>& keys,
const Kokkos::View<ValuesDataType, ValuesProperties...>& values) { const Kokkos::View<ValuesDataType, ValuesProperties...>& values) {
#ifdef KOKKOS_ONEDPL_HAS_SORT_BY_KEY #ifdef KOKKOS_ONEDPL_HAS_SORT_BY_KEY
@ -392,7 +390,7 @@ void sort_by_key_device_view_with_comparator(
template <class ComparatorType, class KeysDataType, class... KeysProperties, template <class ComparatorType, class KeysDataType, class... KeysProperties,
class ValuesDataType, class... ValuesProperties> class ValuesDataType, class... ValuesProperties>
void sort_by_key_device_view_with_comparator( void sort_by_key_device_view_with_comparator(
const Kokkos::Experimental::SYCL& exec, const Kokkos::SYCL& exec,
const Kokkos::View<KeysDataType, KeysProperties...>& keys, const Kokkos::View<KeysDataType, KeysProperties...>& keys,
const Kokkos::View<ValuesDataType, ValuesProperties...>& values, const Kokkos::View<ValuesDataType, ValuesProperties...>& values,
const ComparatorType& comparator) { const ComparatorType& comparator) {

View File

@ -34,6 +34,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsuggest-override"
#if defined(KOKKOS_COMPILER_CLANG) #if defined(KOKKOS_COMPILER_CLANG)
// Some versions of Clang fail to compile Thrust, failing with errors like // Some versions of Clang fail to compile Thrust, failing with errors like
@ -146,7 +147,7 @@ void sort_via_binsort(const ExecutionSpace& exec,
bool sort_in_bins = true; bool sort_in_bins = true;
// TODO: figure out better max_bins then this ... // TODO: figure out better max_bins then this ...
int64_t max_bins = view.extent(0) / 2; int64_t max_bins = view.extent(0) / 2;
if (std::is_integral<typename ViewType::non_const_value_type>::value) { if (std::is_integral_v<typename ViewType::non_const_value_type>) {
// Cast to double to avoid possible overflow when using integer // Cast to double to avoid possible overflow when using integer
auto const max_val = static_cast<double>(result.max_val); auto const max_val = static_cast<double>(result.max_val);
auto const min_val = static_cast<double>(result.min_val); auto const min_val = static_cast<double>(result.min_val);
@ -157,7 +158,7 @@ void sort_via_binsort(const ExecutionSpace& exec,
sort_in_bins = false; sort_in_bins = false;
} }
} }
if (std::is_floating_point<typename ViewType::non_const_value_type>::value) { if (std::is_floating_point_v<typename ViewType::non_const_value_type>) {
KOKKOS_ASSERT(std::isfinite(static_cast<double>(result.max_val) - KOKKOS_ASSERT(std::isfinite(static_cast<double>(result.max_val) -
static_cast<double>(result.min_val))); static_cast<double>(result.min_val)));
} }
@ -211,11 +212,11 @@ void sort_rocthrust(const HIP& space,
#if defined(KOKKOS_ENABLE_ONEDPL) #if defined(KOKKOS_ENABLE_ONEDPL)
template <class DataType, class... Properties, class... MaybeComparator> template <class DataType, class... Properties, class... MaybeComparator>
void sort_onedpl(const Kokkos::Experimental::SYCL& space, void sort_onedpl(const Kokkos::SYCL& space,
const Kokkos::View<DataType, Properties...>& view, const Kokkos::View<DataType, Properties...>& view,
MaybeComparator&&... maybeComparator) { MaybeComparator&&... maybeComparator) {
using ViewType = Kokkos::View<DataType, Properties...>; using ViewType = Kokkos::View<DataType, Properties...>;
static_assert(SpaceAccessibility<Kokkos::Experimental::SYCL, static_assert(SpaceAccessibility<Kokkos::SYCL,
typename ViewType::memory_space>::accessible, typename ViewType::memory_space>::accessible,
"SYCL execution space is not able to access the memory space " "SYCL execution space is not able to access the memory space "
"of the View argument!"); "of the View argument!");
@ -269,18 +270,28 @@ void copy_to_host_run_stdsort_copy_back(
// run sort on the mirror of view_dc // run sort on the mirror of view_dc
auto mv_h = create_mirror_view_and_copy(Kokkos::HostSpace(), view_dc); auto mv_h = create_mirror_view_and_copy(Kokkos::HostSpace(), view_dc);
if (view.span_is_contiguous()) {
std::sort(mv_h.data(), mv_h.data() + mv_h.size(),
std::forward<MaybeComparator>(maybeComparator)...);
} else {
auto first = KE::begin(mv_h); auto first = KE::begin(mv_h);
auto last = KE::end(mv_h); auto last = KE::end(mv_h);
std::sort(first, last, std::forward<MaybeComparator>(maybeComparator)...); std::sort(first, last, std::forward<MaybeComparator>(maybeComparator)...);
}
Kokkos::deep_copy(exec, view_dc, mv_h); Kokkos::deep_copy(exec, view_dc, mv_h);
// copy back to argument view // copy back to argument view
KE::copy(exec, KE::cbegin(view_dc), KE::cend(view_dc), KE::begin(view)); KE::copy(exec, KE::cbegin(view_dc), KE::cend(view_dc), KE::begin(view));
} else { } else {
auto view_h = create_mirror_view_and_copy(Kokkos::HostSpace(), view); auto view_h = create_mirror_view_and_copy(Kokkos::HostSpace(), view);
if (view.span_is_contiguous()) {
std::sort(view_h.data(), view_h.data() + view_h.size(),
std::forward<MaybeComparator>(maybeComparator)...);
} else {
auto first = KE::begin(view_h); auto first = KE::begin(view_h);
auto last = KE::end(view_h); auto last = KE::end(view_h);
std::sort(first, last, std::forward<MaybeComparator>(maybeComparator)...); std::sort(first, last, std::forward<MaybeComparator>(maybeComparator)...);
}
Kokkos::deep_copy(exec, view, view_h); Kokkos::deep_copy(exec, view, view_h);
} }
} }
@ -310,7 +321,7 @@ void sort_device_view_without_comparator(
#if defined(KOKKOS_ENABLE_ONEDPL) #if defined(KOKKOS_ENABLE_ONEDPL)
template <class DataType, class... Properties> template <class DataType, class... Properties>
void sort_device_view_without_comparator( void sort_device_view_without_comparator(
const Kokkos::Experimental::SYCL& exec, const Kokkos::SYCL& exec,
const Kokkos::View<DataType, Properties...>& view) { const Kokkos::View<DataType, Properties...>& view) {
using ViewType = Kokkos::View<DataType, Properties...>; using ViewType = Kokkos::View<DataType, Properties...>;
static_assert( static_assert(
@ -365,8 +376,7 @@ void sort_device_view_with_comparator(
#if defined(KOKKOS_ENABLE_ONEDPL) #if defined(KOKKOS_ENABLE_ONEDPL)
template <class ComparatorType, class DataType, class... Properties> template <class ComparatorType, class DataType, class... Properties>
void sort_device_view_with_comparator( void sort_device_view_with_comparator(
const Kokkos::Experimental::SYCL& exec, const Kokkos::SYCL& exec, const Kokkos::View<DataType, Properties...>& view,
const Kokkos::View<DataType, Properties...>& view,
const ComparatorType& comparator) { const ComparatorType& comparator) {
using ViewType = Kokkos::View<DataType, Properties...>; using ViewType = Kokkos::View<DataType, Properties...>;
static_assert( static_assert(
@ -397,12 +407,12 @@ sort_device_view_with_comparator(
// and then copies data back. Potentially, this can later be changed // and then copies data back. Potentially, this can later be changed
// with a better solution like our own quicksort on device or similar. // with a better solution like our own quicksort on device or similar.
using ViewType = Kokkos::View<DataType, Properties...>;
using MemSpace = typename ViewType::memory_space;
// Note with HIP unified memory this code path is still the right thing to do // Note with HIP unified memory this code path is still the right thing to do
// if we end up here when RocThrust is not enabled. // if we end up here when RocThrust is not enabled.
// The create_mirror_view_and_copy will do the right thing (no copy). // The create_mirror_view_and_copy will do the right thing (no copy).
#ifndef KOKKOS_ENABLE_IMPL_HIP_UNIFIED_MEMORY #ifndef KOKKOS_IMPL_HIP_UNIFIED_MEMORY
using ViewType = Kokkos::View<DataType, Properties...>;
using MemSpace = typename ViewType::memory_space;
static_assert(!SpaceAccessibility<HostSpace, MemSpace>::accessible, static_assert(!SpaceAccessibility<HostSpace, MemSpace>::accessible,
"Impl::sort_device_view_with_comparator: should not be called " "Impl::sort_device_view_with_comparator: should not be called "
"on a view that is already accessible on the host"); "on a view that is already accessible on the host");

View File

@ -91,7 +91,7 @@ template <typename ExecutionSpace, typename IteratorType, typename ValueType,
int> = 0> int> = 0>
ValueType reduce(const ExecutionSpace& ex, IteratorType first, ValueType reduce(const ExecutionSpace& ex, IteratorType first,
IteratorType last, ValueType init_reduction_value) { IteratorType last, ValueType init_reduction_value) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::reduce_default_functors_exespace_impl( return Impl::reduce_default_functors_exespace_impl(
@ -105,7 +105,7 @@ template <typename ExecutionSpace, typename IteratorType, typename ValueType,
ValueType reduce(const std::string& label, const ExecutionSpace& ex, ValueType reduce(const std::string& label, const ExecutionSpace& ex,
IteratorType first, IteratorType last, IteratorType first, IteratorType last,
ValueType init_reduction_value) { ValueType init_reduction_value) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::reduce_default_functors_exespace_impl(label, ex, first, last, return Impl::reduce_default_functors_exespace_impl(label, ex, first, last,
@ -119,7 +119,7 @@ template <typename ExecutionSpace, typename DataType, typename... Properties,
ValueType reduce(const ExecutionSpace& ex, ValueType reduce(const ExecutionSpace& ex,
const ::Kokkos::View<DataType, Properties...>& view, const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value) { ValueType init_reduction_value) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
@ -137,7 +137,7 @@ template <typename ExecutionSpace, typename DataType, typename... Properties,
ValueType reduce(const std::string& label, const ExecutionSpace& ex, ValueType reduce(const std::string& label, const ExecutionSpace& ex,
const ::Kokkos::View<DataType, Properties...>& view, const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value) { ValueType init_reduction_value) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
@ -157,7 +157,7 @@ template <typename ExecutionSpace, typename IteratorType, typename ValueType,
ValueType reduce(const ExecutionSpace& ex, IteratorType first, ValueType reduce(const ExecutionSpace& ex, IteratorType first,
IteratorType last, ValueType init_reduction_value, IteratorType last, ValueType init_reduction_value,
BinaryOp joiner) { BinaryOp joiner) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::reduce_custom_functors_exespace_impl( return Impl::reduce_custom_functors_exespace_impl(
@ -172,7 +172,7 @@ template <typename ExecutionSpace, typename IteratorType, typename ValueType,
ValueType reduce(const std::string& label, const ExecutionSpace& ex, ValueType reduce(const std::string& label, const ExecutionSpace& ex,
IteratorType first, IteratorType last, IteratorType first, IteratorType last,
ValueType init_reduction_value, BinaryOp joiner) { ValueType init_reduction_value, BinaryOp joiner) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::reduce_custom_functors_exespace_impl( return Impl::reduce_custom_functors_exespace_impl(
@ -186,7 +186,7 @@ template <typename ExecutionSpace, typename DataType, typename... Properties,
ValueType reduce(const ExecutionSpace& ex, ValueType reduce(const ExecutionSpace& ex,
const ::Kokkos::View<DataType, Properties...>& view, const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value, BinaryOp joiner) { ValueType init_reduction_value, BinaryOp joiner) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
@ -204,7 +204,7 @@ template <typename ExecutionSpace, typename DataType, typename... Properties,
ValueType reduce(const std::string& label, const ExecutionSpace& ex, ValueType reduce(const std::string& label, const ExecutionSpace& ex,
const ::Kokkos::View<DataType, Properties...>& view, const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value, BinaryOp joiner) { ValueType init_reduction_value, BinaryOp joiner) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
@ -258,7 +258,7 @@ template <
KOKKOS_FUNCTION ValueType reduce(const TeamHandleType& teamHandle, KOKKOS_FUNCTION ValueType reduce(const TeamHandleType& teamHandle,
IteratorType first, IteratorType last, IteratorType first, IteratorType last,
ValueType init_reduction_value) { ValueType init_reduction_value) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::reduce_default_functors_team_impl(teamHandle, first, last, return Impl::reduce_default_functors_team_impl(teamHandle, first, last,
@ -273,7 +273,7 @@ KOKKOS_FUNCTION ValueType
reduce(const TeamHandleType& teamHandle, reduce(const TeamHandleType& teamHandle,
const ::Kokkos::View<DataType, Properties...>& view, const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value) { ValueType init_reduction_value) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
@ -294,7 +294,7 @@ KOKKOS_FUNCTION ValueType reduce(const TeamHandleType& teamHandle,
IteratorType first, IteratorType last, IteratorType first, IteratorType last,
ValueType init_reduction_value, ValueType init_reduction_value,
BinaryOp joiner) { BinaryOp joiner) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::reduce_custom_functors_team_impl(teamHandle, first, last, return Impl::reduce_custom_functors_team_impl(teamHandle, first, last,
@ -309,7 +309,7 @@ KOKKOS_FUNCTION ValueType
reduce(const TeamHandleType& teamHandle, reduce(const TeamHandleType& teamHandle,
const ::Kokkos::View<DataType, Properties...>& view, const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value, BinaryOp joiner) { ValueType init_reduction_value, BinaryOp joiner) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;

View File

@ -117,7 +117,7 @@ ValueType transform_reduce(const ExecutionSpace& ex, IteratorType1 first1,
ValueType init_reduction_value, ValueType init_reduction_value,
BinaryJoinerType joiner, BinaryJoinerType joiner,
BinaryTransform transformer) { BinaryTransform transformer) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::transform_reduce_custom_functors_exespace_impl( return Impl::transform_reduce_custom_functors_exespace_impl(
@ -136,7 +136,7 @@ ValueType transform_reduce(const std::string& label, const ExecutionSpace& ex,
IteratorType2 first2, ValueType init_reduction_value, IteratorType2 first2, ValueType init_reduction_value,
BinaryJoinerType joiner, BinaryJoinerType joiner,
BinaryTransform transformer) { BinaryTransform transformer) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::transform_reduce_custom_functors_exespace_impl( return Impl::transform_reduce_custom_functors_exespace_impl(
@ -157,7 +157,7 @@ ValueType transform_reduce(
ValueType init_reduction_value, BinaryJoinerType joiner, ValueType init_reduction_value, BinaryJoinerType joiner,
BinaryTransform transformer) { BinaryTransform transformer) {
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view);
@ -182,7 +182,7 @@ ValueType transform_reduce(
ValueType init_reduction_value, BinaryJoinerType joiner, ValueType init_reduction_value, BinaryJoinerType joiner,
BinaryTransform transformer) { BinaryTransform transformer) {
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view);
@ -208,7 +208,7 @@ ValueType transform_reduce(const ExecutionSpace& ex, IteratorType first1,
IteratorType last1, ValueType init_reduction_value, IteratorType last1, ValueType init_reduction_value,
BinaryJoinerType joiner, BinaryJoinerType joiner,
UnaryTransform transformer) { UnaryTransform transformer) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::transform_reduce_custom_functors_exespace_impl( return Impl::transform_reduce_custom_functors_exespace_impl(
@ -228,7 +228,7 @@ ValueType transform_reduce(const std::string& label, const ExecutionSpace& ex,
ValueType init_reduction_value, ValueType init_reduction_value,
BinaryJoinerType joiner, BinaryJoinerType joiner,
UnaryTransform transformer) { UnaryTransform transformer) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::transform_reduce_custom_functors_exespace_impl( return Impl::transform_reduce_custom_functors_exespace_impl(
@ -248,7 +248,7 @@ ValueType transform_reduce(const ExecutionSpace& ex,
BinaryJoinerType joiner, BinaryJoinerType joiner,
UnaryTransform transformer) { UnaryTransform transformer) {
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view);
@ -270,7 +270,7 @@ ValueType transform_reduce(const std::string& label, const ExecutionSpace& ex,
BinaryJoinerType joiner, BinaryJoinerType joiner,
UnaryTransform transformer) { UnaryTransform transformer) {
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view);
@ -345,7 +345,7 @@ KOKKOS_FUNCTION ValueType transform_reduce(
const TeamHandleType& teamHandle, IteratorType1 first1, IteratorType1 last1, const TeamHandleType& teamHandle, IteratorType1 first1, IteratorType1 last1,
IteratorType2 first2, ValueType init_reduction_value, IteratorType2 first2, ValueType init_reduction_value,
BinaryJoinerType joiner, BinaryTransform transformer) { BinaryJoinerType joiner, BinaryTransform transformer) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::transform_reduce_custom_functors_team_impl( return Impl::transform_reduce_custom_functors_team_impl(
@ -366,7 +366,7 @@ transform_reduce(const TeamHandleType& teamHandle,
ValueType init_reduction_value, BinaryJoinerType joiner, ValueType init_reduction_value, BinaryJoinerType joiner,
BinaryTransform transformer) { BinaryTransform transformer) {
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view);
@ -393,7 +393,7 @@ KOKKOS_FUNCTION ValueType transform_reduce(const TeamHandleType& teamHandle,
ValueType init_reduction_value, ValueType init_reduction_value,
BinaryJoinerType joiner, BinaryJoinerType joiner,
UnaryTransform transformer) { UnaryTransform transformer) {
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
return Impl::transform_reduce_custom_functors_team_impl( return Impl::transform_reduce_custom_functors_team_impl(
@ -412,7 +412,7 @@ transform_reduce(const TeamHandleType& teamHandle,
ValueType init_reduction_value, BinaryJoinerType joiner, ValueType init_reduction_value, BinaryJoinerType joiner,
UnaryTransform transformer) { UnaryTransform transformer) {
namespace KE = ::Kokkos::Experimental; namespace KE = ::Kokkos::Experimental;
static_assert(std::is_move_constructible<ValueType>::value, static_assert(std::is_move_constructible_v<ValueType>,
"ValueType must be move constructible."); "ValueType must be move constructible.");
Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view);

View File

@ -33,12 +33,12 @@ struct is_admissible_to_kokkos_std_algorithms : std::false_type {};
template <typename T> template <typename T>
struct is_admissible_to_kokkos_std_algorithms< struct is_admissible_to_kokkos_std_algorithms<
T, std::enable_if_t<::Kokkos::is_view<T>::value && T::rank() == 1 && T, std::enable_if_t<::Kokkos::is_view<T>::value && T::rank() == 1 &&
(std::is_same<typename T::traits::array_layout, (std::is_same_v<typename T::traits::array_layout,
Kokkos::LayoutLeft>::value || Kokkos::LayoutLeft> ||
std::is_same<typename T::traits::array_layout, std::is_same_v<typename T::traits::array_layout,
Kokkos::LayoutRight>::value || Kokkos::LayoutRight> ||
std::is_same<typename T::traits::array_layout, std::is_same_v<typename T::traits::array_layout,
Kokkos::LayoutStride>::value)>> Kokkos::LayoutStride>)>>
: std::true_type {}; : std::true_type {};
template <class ViewType> template <class ViewType>
@ -102,8 +102,8 @@ struct are_random_access_iterators;
template <class T> template <class T>
struct are_random_access_iterators<T> { struct are_random_access_iterators<T> {
static constexpr bool value = static constexpr bool value =
is_iterator_v<T> && std::is_base_of<std::random_access_iterator_tag, is_iterator_v<T> && std::is_base_of_v<std::random_access_iterator_tag,
typename T::iterator_category>::value; typename T::iterator_category>;
}; };
template <class Head, class... Tail> template <class Head, class... Tail>
@ -165,9 +165,8 @@ struct iterators_have_matching_difference_type<T> {
template <class T1, class T2> template <class T1, class T2>
struct iterators_have_matching_difference_type<T1, T2> { struct iterators_have_matching_difference_type<T1, T2> {
static constexpr bool value = static constexpr bool value = std::is_same_v<typename T1::difference_type,
std::is_same<typename T1::difference_type, typename T2::difference_type>;
typename T2::difference_type>::value;
}; };
template <class T1, class T2, class... Tail> template <class T1, class T2, class... Tail>

View File

@ -30,7 +30,7 @@ namespace Impl {
template <class IteratorType1, class IteratorType2> template <class IteratorType1, class IteratorType2>
struct StdMoveBackwardFunctor { struct StdMoveBackwardFunctor {
using index_type = typename IteratorType1::difference_type; using index_type = typename IteratorType1::difference_type;
static_assert(std::is_signed<index_type>::value, static_assert(std::is_signed_v<index_type>,
"Kokkos: StdMoveBackwardFunctor requires signed index type"); "Kokkos: StdMoveBackwardFunctor requires signed index type");
IteratorType1 m_last; IteratorType1 m_last;

View File

@ -36,18 +36,18 @@ class RandomAccessIterator< ::Kokkos::View<DataType, Args...> > {
using iterator_type = RandomAccessIterator<view_type>; using iterator_type = RandomAccessIterator<view_type>;
using iterator_category = std::random_access_iterator_tag; using iterator_category = std::random_access_iterator_tag;
using value_type = typename view_type::value_type; using value_type = typename view_type::non_const_value_type;
using difference_type = ptrdiff_t; using difference_type = ptrdiff_t;
using pointer = typename view_type::pointer_type; using pointer = typename view_type::pointer_type;
using reference = typename view_type::reference_type; using reference = typename view_type::reference_type;
static_assert(view_type::rank == 1 && static_assert(view_type::rank == 1 &&
(std::is_same<typename view_type::traits::array_layout, (std::is_same_v<typename view_type::traits::array_layout,
Kokkos::LayoutLeft>::value || Kokkos::LayoutLeft> ||
std::is_same<typename view_type::traits::array_layout, std::is_same_v<typename view_type::traits::array_layout,
Kokkos::LayoutRight>::value || Kokkos::LayoutRight> ||
std::is_same<typename view_type::traits::array_layout, std::is_same_v<typename view_type::traits::array_layout,
Kokkos::LayoutStride>::value), Kokkos::LayoutStride>),
"RandomAccessIterator only supports 1D Views with LayoutLeft, " "RandomAccessIterator only supports 1D Views with LayoutLeft, "
"LayoutRight, LayoutStride."); "LayoutRight, LayoutStride.");
@ -61,8 +61,8 @@ class RandomAccessIterator< ::Kokkos::View<DataType, Args...> > {
#ifndef KOKKOS_ENABLE_CXX17 // C++20 and beyond #ifndef KOKKOS_ENABLE_CXX17 // C++20 and beyond
template <class OtherViewType> template <class OtherViewType>
requires(std::is_constructible_v<view_type, OtherViewType>) KOKKOS_FUNCTION requires(std::is_constructible_v<view_type, OtherViewType>)
explicit(!std::is_convertible_v<OtherViewType, view_type>) KOKKOS_FUNCTION explicit(!std::is_convertible_v<OtherViewType, view_type>)
RandomAccessIterator(const RandomAccessIterator<OtherViewType>& other) RandomAccessIterator(const RandomAccessIterator<OtherViewType>& other)
: m_view(other.m_view), m_current_index(other.m_current_index) {} : m_view(other.m_view), m_current_index(other.m_current_index) {}
#else #else

View File

@ -30,7 +30,7 @@ namespace Impl {
template <class InputIterator> template <class InputIterator>
struct StdReverseFunctor { struct StdReverseFunctor {
using index_type = typename InputIterator::difference_type; using index_type = typename InputIterator::difference_type;
static_assert(std::is_signed<index_type>::value, static_assert(std::is_signed_v<index_type>,
"Kokkos: StdReverseFunctor requires signed index type"); "Kokkos: StdReverseFunctor requires signed index type");
InputIterator m_first; InputIterator m_first;

View File

@ -30,7 +30,7 @@ namespace Impl {
template <class InputIterator, class OutputIterator> template <class InputIterator, class OutputIterator>
struct StdReverseCopyFunctor { struct StdReverseCopyFunctor {
using index_type = typename InputIterator::difference_type; using index_type = typename InputIterator::difference_type;
static_assert(std::is_signed<index_type>::value, static_assert(std::is_signed_v<index_type>,
"Kokkos: StdReverseCopyFunctor requires signed index type"); "Kokkos: StdReverseCopyFunctor requires signed index type");
InputIterator m_last; InputIterator m_last;

View File

@ -1,12 +1,10 @@
#Leave these here for now - I don't need transitive deps anyway #Leave these here for now - I don't need transitive deps anyway
KOKKOS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) kokkos_include_directories(${CMAKE_CURRENT_BINARY_DIR})
KOKKOS_INCLUDE_DIRECTORIES(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR}) kokkos_include_directories(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR})
KOKKOS_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../src ) kokkos_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
KOKKOS_INCLUDE_DIRECTORIES(${KOKKOS_SOURCE_DIR}/core/unit_test/category_files) kokkos_include_directories(${KOKKOS_SOURCE_DIR}/core/unit_test/category_files)
set(ALGORITHM UnitTestMain.cpp)
SET(ALGORITHM UnitTestMain.cpp)
foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget) foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget)
string(TOUPPER ${Tag} DEVICE) string(TOUPPER ${Tag} DEVICE)
@ -23,21 +21,11 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget)
# Generate a .cpp file for each one that runs it on the current backend (Tag), # Generate a .cpp file for each one that runs it on the current backend (Tag),
# and add this .cpp file to the sources for UnitTest_RandomAndSort. # and add this .cpp file to the sources for UnitTest_RandomAndSort.
set(ALGO_SORT_SOURCES) set(ALGO_SORT_SOURCES)
foreach(SOURCE_Input foreach(SOURCE_Input TestSort TestSortByKey TestSortCustomComp TestBinSortA TestBinSortB TestNestedSort)
TestSort
TestSortByKey
TestSortCustomComp
TestBinSortA
TestBinSortB
TestNestedSort
)
set(file ${dir}/${SOURCE_Input}.cpp) set(file ${dir}/${SOURCE_Input}.cpp)
# Write to a temporary intermediate file and call configure_file to avoid # Write to a temporary intermediate file and call configure_file to avoid
# updating timestamps triggering unnecessary rebuilds on subsequent cmake runs. # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs.
file(WRITE ${dir}/dummy.cpp file(WRITE ${dir}/dummy.cpp "#include <Test${Tag}_Category.hpp>\n" "#include <${SOURCE_Input}.hpp>\n")
"#include <Test${Tag}_Category.hpp>\n"
"#include <${SOURCE_Input}.hpp>\n"
)
configure_file(${dir}/dummy.cpp ${file}) configure_file(${dir}/dummy.cpp ${file})
list(APPEND ALGO_SORT_SOURCES ${file}) list(APPEND ALGO_SORT_SOURCES ${file})
endforeach() endforeach()
@ -47,14 +35,9 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget)
# ------------------------------------------ # ------------------------------------------
# do as above # do as above
set(ALGO_RANDOM_SOURCES) set(ALGO_RANDOM_SOURCES)
foreach(SOURCE_Input foreach(SOURCE_Input TestRandom)
TestRandom
)
set(file ${dir}/${SOURCE_Input}.cpp) set(file ${dir}/${SOURCE_Input}.cpp)
file(WRITE ${dir}/dummy.cpp file(WRITE ${dir}/dummy.cpp "#include <Test${Tag}_Category.hpp>\n" "#include <${SOURCE_Input}.hpp>\n")
"#include <Test${Tag}_Category.hpp>\n"
"#include <${SOURCE_Input}.hpp>\n"
)
configure_file(${dir}/dummy.cpp ${file}) configure_file(${dir}/dummy.cpp ${file})
list(APPEND ALGO_RANDOM_SOURCES ${file}) list(APPEND ALGO_RANDOM_SOURCES ${file})
endforeach() endforeach()
@ -65,11 +48,7 @@ endforeach()
# std set A # std set A
# ------------------------------------------ # ------------------------------------------
set(STDALGO_SOURCES_A) set(STDALGO_SOURCES_A)
foreach(Name foreach(Name StdReducers StdAlgorithmsConstraints RandomAccessIterator)
StdReducers
StdAlgorithmsConstraints
RandomAccessIterator
)
list(APPEND STDALGO_SOURCES_A Test${Name}.cpp) list(APPEND STDALGO_SOURCES_A Test${Name}.cpp)
endforeach() endforeach()
@ -77,10 +56,7 @@ endforeach()
# std set B # std set B
# ------------------------------------------ # ------------------------------------------
set(STDALGO_SOURCES_B) set(STDALGO_SOURCES_B)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsMinMaxElementOps)
StdAlgorithmsCommon
StdAlgorithmsMinMaxElementOps
)
list(APPEND STDALGO_SOURCES_B Test${Name}.cpp) list(APPEND STDALGO_SOURCES_B Test${Name}.cpp)
endforeach() endforeach()
@ -88,7 +64,8 @@ endforeach()
# std set C # std set C
# ------------------------------------------ # ------------------------------------------
set(STDALGO_SOURCES_C) set(STDALGO_SOURCES_C)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsLexicographicalCompare StdAlgorithmsLexicographicalCompare
StdAlgorithmsForEach StdAlgorithmsForEach
@ -111,7 +88,8 @@ endforeach()
# std set D # std set D
# ------------------------------------------ # ------------------------------------------
set(STDALGO_SOURCES_D) set(STDALGO_SOURCES_D)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsModOps StdAlgorithmsModOps
StdAlgorithmsModSeqOps StdAlgorithmsModSeqOps
@ -139,7 +117,8 @@ endforeach()
# std set E # std set E
# ------------------------------------------ # ------------------------------------------
set(STDALGO_SOURCES_E) set(STDALGO_SOURCES_E)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsIsSorted StdAlgorithmsIsSorted
StdAlgorithmsIsSortedUntil StdAlgorithmsIsSortedUntil
@ -160,11 +139,7 @@ endforeach()
# std team Q # std team Q
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_Q) set(STDALGO_TEAM_SOURCES_Q)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamInclusiveScan StdAlgorithmsTeamTransformInclusiveScan)
StdAlgorithmsCommon
StdAlgorithmsTeamInclusiveScan
StdAlgorithmsTeamTransformInclusiveScan
)
list(APPEND STDALGO_TEAM_SOURCES_Q Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_Q Test${Name}.cpp)
endforeach() endforeach()
@ -172,11 +147,7 @@ endforeach()
# std team P # std team P
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_P) set(STDALGO_TEAM_SOURCES_P)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamExclusiveScan StdAlgorithmsTeamTransformExclusiveScan)
StdAlgorithmsCommon
StdAlgorithmsTeamExclusiveScan
StdAlgorithmsTeamTransformExclusiveScan
)
list(APPEND STDALGO_TEAM_SOURCES_P Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_P Test${Name}.cpp)
endforeach() endforeach()
@ -184,13 +155,8 @@ endforeach()
# std team M # std team M
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_M) set(STDALGO_TEAM_SOURCES_M)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamTransformUnaryOp StdAlgorithmsTeamTransformBinaryOp
StdAlgorithmsCommon StdAlgorithmsTeamGenerate StdAlgorithmsTeamGenerate_n StdAlgorithmsTeamSwapRanges
StdAlgorithmsTeamTransformUnaryOp
StdAlgorithmsTeamTransformBinaryOp
StdAlgorithmsTeamGenerate
StdAlgorithmsTeamGenerate_n
StdAlgorithmsTeamSwapRanges
) )
list(APPEND STDALGO_TEAM_SOURCES_M Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_M Test${Name}.cpp)
endforeach() endforeach()
@ -199,13 +165,8 @@ endforeach()
# std team L # std team L
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_L) set(STDALGO_TEAM_SOURCES_L)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamIsSorted StdAlgorithmsTeamIsSortedUntil
StdAlgorithmsCommon StdAlgorithmsTeamIsPartitioned StdAlgorithmsTeamPartitionCopy StdAlgorithmsTeamPartitionPoint
StdAlgorithmsTeamIsSorted
StdAlgorithmsTeamIsSortedUntil
StdAlgorithmsTeamIsPartitioned
StdAlgorithmsTeamPartitionCopy
StdAlgorithmsTeamPartitionPoint
) )
list(APPEND STDALGO_TEAM_SOURCES_L Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_L Test${Name}.cpp)
endforeach() endforeach()
@ -214,11 +175,7 @@ endforeach()
# std team I # std team I
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_I) set(STDALGO_TEAM_SOURCES_I)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamUnique StdAlgorithmsTeamAdjacentDifference StdAlgorithmsTeamReduce
StdAlgorithmsCommon
StdAlgorithmsTeamUnique
StdAlgorithmsTeamAdjacentDifference
StdAlgorithmsTeamReduce
StdAlgorithmsTeamTransformReduce StdAlgorithmsTeamTransformReduce
) )
list(APPEND STDALGO_TEAM_SOURCES_I Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_I Test${Name}.cpp)
@ -228,7 +185,8 @@ endforeach()
# std team H # std team H
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_H) set(STDALGO_TEAM_SOURCES_H)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsTeamCopy StdAlgorithmsTeamCopy
StdAlgorithmsTeamCopy_n StdAlgorithmsTeamCopy_n
@ -247,11 +205,7 @@ endforeach()
# std team G # std team G
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_G) set(STDALGO_TEAM_SOURCES_G)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamMove StdAlgorithmsTeamMoveBackward StdAlgorithmsTeamShiftLeft
StdAlgorithmsCommon
StdAlgorithmsTeamMove
StdAlgorithmsTeamMoveBackward
StdAlgorithmsTeamShiftLeft
StdAlgorithmsTeamShiftRight StdAlgorithmsTeamShiftRight
) )
list(APPEND STDALGO_TEAM_SOURCES_G Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_G Test${Name}.cpp)
@ -261,11 +215,7 @@ endforeach()
# std team F # std team F
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_F) set(STDALGO_TEAM_SOURCES_F)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamReverse StdAlgorithmsTeamReverseCopy StdAlgorithmsTeamRotate
StdAlgorithmsCommon
StdAlgorithmsTeamReverse
StdAlgorithmsTeamReverseCopy
StdAlgorithmsTeamRotate
StdAlgorithmsTeamRotateCopy StdAlgorithmsTeamRotateCopy
) )
list(APPEND STDALGO_TEAM_SOURCES_F Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_F Test${Name}.cpp)
@ -275,7 +225,8 @@ endforeach()
# std team E # std team E
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_E) set(STDALGO_TEAM_SOURCES_E)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsTeamFill StdAlgorithmsTeamFill
StdAlgorithmsTeamFill_n StdAlgorithmsTeamFill_n
@ -291,12 +242,7 @@ endforeach()
# std team D # std team D
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_D) set(STDALGO_TEAM_SOURCES_D)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamMinElement StdAlgorithmsTeamMaxElement StdAlgorithmsTeamMinMaxElement)
StdAlgorithmsCommon
StdAlgorithmsTeamMinElement
StdAlgorithmsTeamMaxElement
StdAlgorithmsTeamMinMaxElement
)
list(APPEND STDALGO_TEAM_SOURCES_D Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_D Test${Name}.cpp)
endforeach() endforeach()
@ -304,7 +250,8 @@ endforeach()
# std team C # std team C
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_C) set(STDALGO_TEAM_SOURCES_C)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsTeamFind StdAlgorithmsTeamFind
StdAlgorithmsTeamFindIf StdAlgorithmsTeamFindIf
@ -321,11 +268,7 @@ endforeach()
# std team B # std team B
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_B) set(STDALGO_TEAM_SOURCES_B)
foreach(Name foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamEqual StdAlgorithmsTeamSearch StdAlgorithmsTeamFindEnd
StdAlgorithmsCommon
StdAlgorithmsTeamEqual
StdAlgorithmsTeamSearch
StdAlgorithmsTeamFindEnd
StdAlgorithmsTeamFindFirstOf StdAlgorithmsTeamFindFirstOf
) )
list(APPEND STDALGO_TEAM_SOURCES_B Test${Name}.cpp) list(APPEND STDALGO_TEAM_SOURCES_B Test${Name}.cpp)
@ -335,7 +278,8 @@ endforeach()
# std team A # std team A
# ------------------------------------------ # ------------------------------------------
set(STDALGO_TEAM_SOURCES_A) set(STDALGO_TEAM_SOURCES_A)
foreach(Name foreach(
Name
StdAlgorithmsCommon StdAlgorithmsCommon
StdAlgorithmsTeamAdjacentFind StdAlgorithmsTeamAdjacentFind
StdAlgorithmsTeamCount StdAlgorithmsTeamCount
@ -349,20 +293,18 @@ foreach(Name
endforeach() endforeach()
# FIXME_OPENMPTARGET - remove sort test as it leads to ICE with clang/16 and above at compile time. # FIXME_OPENMPTARGET - remove sort test as it leads to ICE with clang/16 and above at compile time.
if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL "Clang" AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0.0) if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL "Clang" AND KOKKOS_CXX_COMPILER_VERSION
list(REMOVE_ITEM ALGO_SORT_SOURCES VERSION_GREATER_EQUAL 16.0.0
TestSort.cpp
) )
list(REMOVE_ITEM ALGO_SORT_SOURCES TestSort.cpp)
endif() endif()
# FIXME_OPENMPTARGET remove tests for OpenMPTarget because in these cases # FIXME_OPENMPTARGET remove tests for OpenMPTarget because in these cases
# the impl needs to use either Kokkos or tailored reducers # the impl needs to use either Kokkos or tailored reducers
# which results in runtime memory errors. # which results in runtime memory errors.
if(KOKKOS_ENABLE_OPENMPTARGET) if(KOKKOS_ENABLE_OPENMPTARGET)
list(REMOVE_ITEM STDALGO_TEAM_SOURCES_L list(REMOVE_ITEM STDALGO_TEAM_SOURCES_L TestStdAlgorithmsTeamIsPartitioned.cpp
TestStdAlgorithmsTeamIsPartitioned.cpp TestStdAlgorithmsTeamPartitionPoint.cpp TestStdAlgorithmsTeamPartitionCopy.cpp
TestStdAlgorithmsTeamPartitionPoint.cpp
TestStdAlgorithmsTeamPartitionCopy.cpp
) )
endif() endif()
@ -370,7 +312,9 @@ endif()
# in these cases the impl needs to use either Kokkos or # in these cases the impl needs to use either Kokkos or
# tailored reducers which results in runtime memory errors. # tailored reducers which results in runtime memory errors.
if(KOKKOS_ENABLE_OPENMPTARGET) if(KOKKOS_ENABLE_OPENMPTARGET)
list(REMOVE_ITEM STDALGO_TEAM_SOURCES_C list(
REMOVE_ITEM
STDALGO_TEAM_SOURCES_C
TestStdAlgorithmsTeamFind.cpp TestStdAlgorithmsTeamFind.cpp
TestStdAlgorithmsTeamFindIf.cpp TestStdAlgorithmsTeamFindIf.cpp
TestStdAlgorithmsTeamFindIfNot.cpp TestStdAlgorithmsTeamFindIfNot.cpp
@ -386,35 +330,20 @@ endif()
# FRIZZI: 04/26/2023: not sure if the compilation error is still applicable # FRIZZI: 04/26/2023: not sure if the compilation error is still applicable
# but we conservatively leave this guard on # but we conservatively leave this guard on
if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)) if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM))
KOKKOS_ADD_EXECUTABLE_AND_TEST( kokkos_add_executable_and_test(
UnitTest_Sort UnitTest_Sort SOURCES UnitTestMain.cpp TestStdAlgorithmsCommon.cpp ${ALGO_SORT_SOURCES}
SOURCES
UnitTestMain.cpp
TestStdAlgorithmsCommon.cpp
${ALGO_SORT_SOURCES}
) )
KOKKOS_ADD_EXECUTABLE_AND_TEST( kokkos_add_executable_and_test(UnitTest_Random SOURCES UnitTestMain.cpp ${ALGO_RANDOM_SOURCES})
UnitTest_Random
SOURCES
UnitTestMain.cpp
${ALGO_RANDOM_SOURCES}
)
endif() endif()
# FIXME_OPENMPTARGET: These tests cause internal compiler errors as of 09/01/22 # FIXME_OPENMPTARGET: These tests cause internal compiler errors as of 09/01/22
# when compiling for Intel's Xe-HP GPUs. # when compiling for Intel's Xe-HP GPUs.
if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM) if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)
list(REMOVE_ITEM STDALGO_SOURCES_D list(REMOVE_ITEM STDALGO_SOURCES_D TestStdAlgorithmsCopyIf.cpp TestStdAlgorithmsRemoveCopy.cpp
TestStdAlgorithmsCopyIf.cpp TestStdAlgorithmsUnique.cpp TestStdAlgorithmsUniqueCopy.cpp
TestStdAlgorithmsRemoveCopy.cpp
TestStdAlgorithmsUnique.cpp
TestStdAlgorithmsUniqueCopy.cpp
)
list(REMOVE_ITEM STDALGO_SOURCES_E
TestStdAlgorithmsExclusiveScan.cpp
TestStdAlgorithmsInclusiveScan.cpp
) )
list(REMOVE_ITEM STDALGO_SOURCES_E TestStdAlgorithmsExclusiveScan.cpp TestStdAlgorithmsInclusiveScan.cpp)
endif() endif()
# FIXME_OPENMPTARGET remove tests for OpenMPTarget # FIXME_OPENMPTARGET remove tests for OpenMPTarget
@ -422,48 +351,31 @@ endif()
if(KOKKOS_ENABLE_OPENMPTARGET) if(KOKKOS_ENABLE_OPENMPTARGET)
# the following use either Kokkos or tailored reducers # the following use either Kokkos or tailored reducers
# which results in runtime memory errors. # which results in runtime memory errors.
list(REMOVE_ITEM STDALGO_TEAM_SOURCES_B list(REMOVE_ITEM STDALGO_TEAM_SOURCES_B TestStdAlgorithmsTeamFindEnd.cpp TestStdAlgorithmsTeamFindFirstOf.cpp
TestStdAlgorithmsTeamFindEnd.cpp
TestStdAlgorithmsTeamFindFirstOf.cpp
TestStdAlgorithmsTeamSearch.cpp TestStdAlgorithmsTeamSearch.cpp
) )
list(REMOVE_ITEM STDALGO_TEAM_SOURCES_A list(REMOVE_ITEM STDALGO_TEAM_SOURCES_A TestStdAlgorithmsTeamAdjacentFind.cpp
TestStdAlgorithmsTeamAdjacentFind.cpp TestStdAlgorithmsTeamLexicographicalCompare.cpp TestStdAlgorithmsTeamMismatch.cpp
TestStdAlgorithmsTeamLexicographicalCompare.cpp
TestStdAlgorithmsTeamMismatch.cpp
) )
# this causes an illegal memory access if team_members_have_matching_result # this causes an illegal memory access if team_members_have_matching_result
# is called # is called
list(REMOVE_ITEM STDALGO_TEAM_SOURCES_M list(REMOVE_ITEM STDALGO_TEAM_SOURCES_M TestStdAlgorithmsTeamTransformBinaryOp.cpp)
TestStdAlgorithmsTeamTransformBinaryOp.cpp
)
endif() endif()
foreach(ID A;B;C;D;E) foreach(ID A;B;C;D;E)
KOKKOS_ADD_EXECUTABLE_AND_TEST( kokkos_add_executable_and_test(AlgorithmsUnitTest_StdSet_${ID} SOURCES UnitTestMain.cpp ${STDALGO_SOURCES_${ID}})
AlgorithmsUnitTest_StdSet_${ID}
SOURCES
UnitTestMain.cpp
${STDALGO_SOURCES_${ID}}
)
endforeach() endforeach()
foreach(ID A;B;C;D;E;F;G;H;I;L;M;P;Q) foreach(ID A;B;C;D;E;F;G;H;I;L;M;P;Q)
KOKKOS_ADD_EXECUTABLE_AND_TEST( kokkos_add_executable_and_test(
AlgorithmsUnitTest_StdSet_Team_${ID} AlgorithmsUnitTest_StdSet_Team_${ID} SOURCES UnitTestMain.cpp ${STDALGO_TEAM_SOURCES_${ID}}
SOURCES
UnitTestMain.cpp
${STDALGO_TEAM_SOURCES_${ID}}
) )
endforeach() endforeach()
# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22 # FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22
# when compiling for Intel's Xe-HP GPUs. # when compiling for Intel's Xe-HP GPUs.
if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)) if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM))
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(AlgorithmsUnitTest_StdAlgoCompileOnly SOURCES TestStdAlgorithmsCompileOnly.cpp)
AlgorithmsUnitTest_StdAlgoCompileOnly
SOURCES TestStdAlgorithmsCompileOnly.cpp
)
endif() endif()

View File

@ -77,7 +77,7 @@ struct sum3D {
}; };
template <class ExecutionSpace, typename KeyType> template <class ExecutionSpace, typename KeyType>
void test_3D_sort_impl(unsigned int n) { void test_3D_sort_impl(size_t n) {
using KeyViewType = Kokkos::View<KeyType* [3], ExecutionSpace>; using KeyViewType = Kokkos::View<KeyType* [3], ExecutionSpace>;
KeyViewType keys("Keys", n * n * n); KeyViewType keys("Keys", n * n * n);
@ -219,6 +219,10 @@ void test_sort_integer_overflow() {
} // namespace BinSortSetA } // namespace BinSortSetA
TEST(TEST_CATEGORY, BinSortGenericTests) { TEST(TEST_CATEGORY, BinSortGenericTests) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
using key_type = unsigned; using key_type = unsigned;
constexpr int N = 171; constexpr int N = 171;
@ -246,11 +250,11 @@ TEST(TEST_CATEGORY, BinSortEmptyView) {
// does not matter if we use int or something else // does not matter if we use int or something else
Kokkos::View<int*, ExecutionSpace> v("v", 0); Kokkos::View<int*, ExecutionSpace> v("v", 0);
// test all exposed public sort methods // test all exposed public sort methods are callable and do not throw
ASSERT_NO_THROW(Sorter.sort(ExecutionSpace(), v, 0, 0)); Sorter.sort(ExecutionSpace(), v, 0, 0);
ASSERT_NO_THROW(Sorter.sort(v, 0, 0)); Sorter.sort(v, 0, 0);
ASSERT_NO_THROW(Sorter.sort(ExecutionSpace(), v)); Sorter.sort(ExecutionSpace(), v);
ASSERT_NO_THROW(Sorter.sort(v)); Sorter.sort(v);
} }
TEST(TEST_CATEGORY, BinSortEmptyKeysView) { TEST(TEST_CATEGORY, BinSortEmptyKeysView) {
@ -263,7 +267,26 @@ TEST(TEST_CATEGORY, BinSortEmptyKeysView) {
BinOp_t binOp(5, 0, 10); BinOp_t binOp(5, 0, 10);
Kokkos::BinSort<KeyViewType, BinOp_t> Sorter(ExecutionSpace{}, kv, binOp); Kokkos::BinSort<KeyViewType, BinOp_t> Sorter(ExecutionSpace{}, kv, binOp);
ASSERT_NO_THROW(Sorter.create_permute_vector(ExecutionSpace{})); Sorter.create_permute_vector(ExecutionSpace{}); // does not throw
}
// BinSort may delegate sorting within bins to std::sort when running on host
// and having a sufficiently large number of items within a single bin (10 by
// default). Test that this is done without undefined behavior when accessing
// the boundaries of the bin. Should be used in conjunction with a memory
// sanitizer or bounds check.
TEST(TEST_CATEGORY, BinSort_issue_7221) {
using ExecutionSpace = TEST_EXECSPACE;
using KeyViewType = Kokkos::View<int*, ExecutionSpace>;
KeyViewType kv("kv", 11);
using BinOp_t = Kokkos::BinOp1D<KeyViewType>;
BinOp_t binOp(1, -10, 10);
Kokkos::BinSort<KeyViewType, BinOp_t> Sorter(ExecutionSpace{}, kv, binOp,
/*sort_within_bins*/ true);
Sorter.create_permute_vector(ExecutionSpace{}); // does not throw
} }
} // namespace Test } // namespace Test

View File

@ -185,6 +185,10 @@ void run_for_rank2() {
} // namespace BinSortSetB } // namespace BinSortSetB
TEST(TEST_CATEGORY, BinSortUnsignedKeyLayoutStrideValues) { TEST(TEST_CATEGORY, BinSortUnsignedKeyLayoutStrideValues) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExeSpace = TEST_EXECSPACE; using ExeSpace = TEST_EXECSPACE;
using key_type = unsigned; using key_type = unsigned;
BinSortSetB::run_for_rank1<ExeSpace, key_type, int>(); BinSortSetB::run_for_rank1<ExeSpace, key_type, int>();

View File

@ -386,6 +386,11 @@ void test_nested_sort_by_key(unsigned int N, KeyType minKey, KeyType maxKey,
} // namespace NestedSortImpl } // namespace NestedSortImpl
TEST(TEST_CATEGORY, NestedSort) { TEST(TEST_CATEGORY, NestedSort) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
NestedSortImpl::test_nested_sort<ExecutionSpace, unsigned>(171, 0U, UINT_MAX); NestedSortImpl::test_nested_sort<ExecutionSpace, unsigned>(171, 0U, UINT_MAX);
NestedSortImpl::test_nested_sort<ExecutionSpace, float>(42, -1e6f, 1e6f); NestedSortImpl::test_nested_sort<ExecutionSpace, float>(42, -1e6f, 1e6f);
@ -394,6 +399,11 @@ TEST(TEST_CATEGORY, NestedSort) {
} }
TEST(TEST_CATEGORY, NestedSortByKey) { TEST(TEST_CATEGORY, NestedSortByKey) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
// Second/third template arguments are key and value respectively. // Second/third template arguments are key and value respectively.

View File

@ -542,6 +542,11 @@ void test_duplicate_stream() {
} // namespace AlgoRandomImpl } // namespace AlgoRandomImpl
TEST(TEST_CATEGORY, Random_XorShift64) { TEST(TEST_CATEGORY, Random_XorShift64) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
#if defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_CUDA) || \ #if defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_CUDA) || \
@ -562,6 +567,10 @@ TEST(TEST_CATEGORY, Random_XorShift64) {
TEST(TEST_CATEGORY, Random_XorShift1024_0) { TEST(TEST_CATEGORY, Random_XorShift1024_0) {
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
#if defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_CUDA) || \ #if defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_CUDA) || \
defined(KOKKOS_ENABLE_HIP) defined(KOKKOS_ENABLE_HIP)
@ -589,7 +598,7 @@ TEST(TEST_CATEGORY, Multi_streams) {
#endif #endif
#if defined(KOKKOS_ENABLE_SYCL) && defined(KOKKOS_IMPL_ARCH_NVIDIA_GPU) #if defined(KOKKOS_ENABLE_SYCL) && defined(KOKKOS_IMPL_ARCH_NVIDIA_GPU)
if constexpr (std::is_same_v<ExecutionSpace, Kokkos::Experimental::SYCL>) { if constexpr (std::is_same_v<ExecutionSpace, Kokkos::SYCL>) {
GTEST_SKIP() << "Failing on NVIDIA GPUs"; // FIXME_SYCL GTEST_SKIP() << "Failing on NVIDIA GPUs"; // FIXME_SYCL
} }
#endif #endif

View File

@ -23,7 +23,7 @@ namespace stdalgos {
struct random_access_iterator_test : std_algorithms_test { struct random_access_iterator_test : std_algorithms_test {
public: public:
virtual void SetUp() { void SetUp() override {
Kokkos::parallel_for(m_static_view.extent(0), Kokkos::parallel_for(m_static_view.extent(0),
AssignIndexFunctor<static_view_t>(m_static_view)); AssignIndexFunctor<static_view_t>(m_static_view));
@ -264,6 +264,37 @@ TEST_F(random_access_iterator_test, traits_helpers) {
static_assert(KE::Impl::are_iterators_v<T1_t, T2_t, T3_t>); static_assert(KE::Impl::are_iterators_v<T1_t, T2_t, T3_t>);
static_assert(KE::Impl::are_random_access_iterators_v<T1_t, T2_t, T3_t>); static_assert(KE::Impl::are_random_access_iterators_v<T1_t, T2_t, T3_t>);
static_assert(!KE::Impl::are_iterators_v<int, T2_t, T3_t>); static_assert(!KE::Impl::are_iterators_v<int, T2_t, T3_t>);
static_assert(std::is_same_v<decltype(KE::begin(m_static_view))::value_type,
value_type>);
static_assert(std::is_same_v<decltype(KE::begin(m_dynamic_view))::value_type,
value_type>);
static_assert(std::is_same_v<decltype(KE::begin(m_strided_view))::value_type,
value_type>);
static_assert(
std::is_same_v<decltype(KE::end(m_static_view))::value_type, value_type>);
static_assert(std::is_same_v<decltype(KE::end(m_dynamic_view))::value_type,
value_type>);
static_assert(std::is_same_v<decltype(KE::end(m_strided_view))::value_type,
value_type>);
static_assert(
std::is_same_v<decltype(KE::begin(m_static_view))::value_type,
decltype(KE::cbegin(m_static_view))::value_type>);
static_assert(
std::is_same_v<decltype(KE::begin(m_dynamic_view))::value_type,
decltype(KE::cbegin(m_dynamic_view))::value_type>);
static_assert(
std::is_same_v<decltype(KE::begin(m_strided_view))::value_type,
decltype(KE::cbegin(m_strided_view))::value_type>);
static_assert(std::is_same_v<decltype(KE::end(m_static_view))::value_type,
decltype(KE::cend(m_static_view))::value_type>);
static_assert(std::is_same_v<decltype(KE::end(m_dynamic_view))::value_type,
decltype(KE::cend(m_dynamic_view))::value_type>);
static_assert(std::is_same_v<decltype(KE::end(m_strided_view))::value_type,
decltype(KE::cend(m_strided_view))::value_type>);
} }
} // namespace stdalgos } // namespace stdalgos

View File

@ -209,6 +209,10 @@ void test_sort_integer_overflow() {
} // namespace SortImpl } // namespace SortImpl
TEST(TEST_CATEGORY, SortUnsignedValueType) { TEST(TEST_CATEGORY, SortUnsignedValueType) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
using key_type = unsigned; using key_type = unsigned;
constexpr int N = 171; constexpr int N = 171;
@ -224,14 +228,19 @@ TEST(TEST_CATEGORY, SortUnsignedValueType) {
} }
TEST(TEST_CATEGORY, SortEmptyView) { TEST(TEST_CATEGORY, SortEmptyView) {
// FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler
#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET)
GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM";
#endif
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
// does not matter if we use int or something else // does not matter if we use int or something else
Kokkos::View<int*, ExecutionSpace> v("v", 0); Kokkos::View<int*, ExecutionSpace> v("v", 0);
// checking that it does not throw
// TODO check the synchronous behavior of the calls below // TODO check the synchronous behavior of the calls below
ASSERT_NO_THROW(Kokkos::sort(ExecutionSpace(), v)); Kokkos::sort(ExecutionSpace(), v);
ASSERT_NO_THROW(Kokkos::sort(v)); Kokkos::sort(v);
} }
} // namespace Test } // namespace Test

View File

@ -83,8 +83,8 @@ TEST(TEST_CATEGORY, SortByKeyEmptyView) {
Kokkos::View<int *, ExecutionSpace> keys("keys", 0); Kokkos::View<int *, ExecutionSpace> keys("keys", 0);
Kokkos::View<float *, ExecutionSpace> values("values", 0); Kokkos::View<float *, ExecutionSpace> values("values", 0);
ASSERT_NO_THROW( // checking that it does not throw
Kokkos::Experimental::sort_by_key(ExecutionSpace(), keys, values)); Kokkos::Experimental::sort_by_key(ExecutionSpace(), keys, values);
} }
// Test #7036 // Test #7036
@ -95,8 +95,8 @@ TEST(TEST_CATEGORY, SortByKeyEmptyViewHost) {
Kokkos::View<int *, ExecutionSpace> keys("keys", 0); Kokkos::View<int *, ExecutionSpace> keys("keys", 0);
Kokkos::View<float *, ExecutionSpace> values("values", 0); Kokkos::View<float *, ExecutionSpace> values("values", 0);
ASSERT_NO_THROW( // checking that it does not throw
Kokkos::Experimental::sort_by_key(ExecutionSpace(), keys, values)); Kokkos::Experimental::sort_by_key(ExecutionSpace(), keys, values);
} }
TEST(TEST_CATEGORY, SortByKey) { TEST(TEST_CATEGORY, SortByKey) {
@ -183,12 +183,12 @@ TEST(TEST_CATEGORY, SortByKeyStaticExtents) {
Kokkos::View<int[10], ExecutionSpace> keys("keys"); Kokkos::View<int[10], ExecutionSpace> keys("keys");
Kokkos::View<int[10], ExecutionSpace> values_static("values_static"); Kokkos::View<int[10], ExecutionSpace> values_static("values_static");
ASSERT_NO_THROW( // checking that it does not throw
Kokkos::Experimental::sort_by_key(space, keys, values_static)); Kokkos::Experimental::sort_by_key(space, keys, values_static);
Kokkos::View<int *, ExecutionSpace> values_dynamic("values_dynamic", 10); Kokkos::View<int *, ExecutionSpace> values_dynamic("values_dynamic", 10);
ASSERT_NO_THROW( // checking that it does not throw
Kokkos::Experimental::sort_by_key(space, keys, values_dynamic)); Kokkos::Experimental::sort_by_key(space, keys, values_dynamic);
} }
template <typename ExecutionSpace, typename Keys, typename Values> template <typename ExecutionSpace, typename Keys, typename Values>
@ -234,7 +234,9 @@ TEST(TEST_CATEGORY, SortByKeyWithStrides) {
ASSERT_EQ(sort_fails, 0u); ASSERT_EQ(sort_fails, 0u);
} }
TEST(TEST_CATEGORY, SortByKeyKeysLargerThanValues) { TEST(TEST_CATEGORY_DEATH, SortByKeyKeysLargerThanValues) {
::testing::FLAGS_gtest_death_test_style = "threadsafe";
using ExecutionSpace = TEST_EXECSPACE; using ExecutionSpace = TEST_EXECSPACE;
// does not matter if we use int or something else // does not matter if we use int or something else

View File

@ -96,7 +96,7 @@ void fill_view(DestViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, aux_v_h); Kokkos::deep_copy(aux_view, aux_v_h);

View File

@ -173,7 +173,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -534,10 +534,10 @@ void fill_views_inc(ViewType view, ViewHostType host_view) {
} }
template <class ValueType, class ViewType> template <class ValueType, class ViewType>
std::enable_if_t<!std::is_same<typename ViewType::traits::array_layout, std::enable_if_t<!std::is_same_v<typename ViewType::traits::array_layout,
Kokkos::LayoutStride>::value> Kokkos::LayoutStride>>
verify_values(ValueType expected, const ViewType view) { verify_values(ValueType expected, const ViewType view) {
static_assert(std::is_same<ValueType, typename ViewType::value_type>::value, static_assert(std::is_same_v<ValueType, typename ViewType::value_type>,
"Non-matching value types of view and reference value"); "Non-matching value types of view and reference value");
auto view_h = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), view); auto view_h = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), view);
for (std::size_t i = 0; i < view_h.extent(0); i++) { for (std::size_t i = 0; i < view_h.extent(0); i++) {
@ -546,10 +546,10 @@ verify_values(ValueType expected, const ViewType view) {
} }
template <class ValueType, class ViewType> template <class ValueType, class ViewType>
std::enable_if_t<std::is_same<typename ViewType::traits::array_layout, std::enable_if_t<std::is_same_v<typename ViewType::traits::array_layout,
Kokkos::LayoutStride>::value> Kokkos::LayoutStride>>
verify_values(ValueType expected, const ViewType view) { verify_values(ValueType expected, const ViewType view) {
static_assert(std::is_same<ValueType, typename ViewType::value_type>::value, static_assert(std::is_same_v<ValueType, typename ViewType::value_type>,
"Non-matching value types of view and reference value"); "Non-matching value types of view and reference value");
using non_strided_view_t = Kokkos::View<typename ViewType::value_type*>; using non_strided_view_t = Kokkos::View<typename ViewType::value_type*>;
@ -566,11 +566,11 @@ verify_values(ValueType expected, const ViewType view) {
} }
template <class ViewType1, class ViewType2> template <class ViewType1, class ViewType2>
std::enable_if_t<!std::is_same<typename ViewType2::traits::array_layout, std::enable_if_t<!std::is_same_v<typename ViewType2::traits::array_layout,
Kokkos::LayoutStride>::value> Kokkos::LayoutStride>>
compare_views(ViewType1 expected, const ViewType2 actual) { compare_views(ViewType1 expected, const ViewType2 actual) {
static_assert(std::is_same<typename ViewType1::value_type, static_assert(std::is_same_v<typename ViewType1::value_type,
typename ViewType2::value_type>::value, typename ViewType2::value_type>,
"Non-matching value types of expected and actual view"); "Non-matching value types of expected and actual view");
auto expected_h = auto expected_h =
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), expected); Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), expected);
@ -583,11 +583,11 @@ compare_views(ViewType1 expected, const ViewType2 actual) {
} }
template <class ViewType1, class ViewType2> template <class ViewType1, class ViewType2>
std::enable_if_t<std::is_same<typename ViewType2::traits::array_layout, std::enable_if_t<std::is_same_v<typename ViewType2::traits::array_layout,
Kokkos::LayoutStride>::value> Kokkos::LayoutStride>>
compare_views(ViewType1 expected, const ViewType2 actual) { compare_views(ViewType1 expected, const ViewType2 actual) {
static_assert(std::is_same<typename ViewType1::value_type, static_assert(std::is_same_v<typename ViewType1::value_type,
typename ViewType2::value_type>::value, typename ViewType2::value_type>,
"Non-matching value types of expected and actual view"); "Non-matching value types of expected and actual view");
using non_strided_view_t = Kokkos::View<typename ViewType2::value_type*>; using non_strided_view_t = Kokkos::View<typename ViewType2::value_type*>;

View File

@ -81,7 +81,7 @@ TEST(std_algorithms, is_admissible_to_std_algorithms) {
strided_view_3d_t>::value); strided_view_3d_t>::value);
} }
TEST(std_algorithms, expect_no_overlap) { TEST(std_algorithms_DeathTest, expect_no_overlap) {
namespace KE = Kokkos::Experimental; namespace KE = Kokkos::Experimental;
using value_type = double; using value_type = double;
@ -104,6 +104,8 @@ TEST(std_algorithms, expect_no_overlap) {
// Overlapping because iterators are identical // Overlapping because iterators are identical
#if defined(KOKKOS_ENABLE_DEBUG) #if defined(KOKKOS_ENABLE_DEBUG)
::testing::FLAGS_gtest_death_test_style = "threadsafe";
auto first_s = KE::begin(static_view_1d); auto first_s = KE::begin(static_view_1d);
auto last_s = first_s + extent0; auto last_s = first_s + extent0;
EXPECT_DEATH({ KE::Impl::expect_no_overlap(first_s, last_s, first_s); }, EXPECT_DEATH({ KE::Impl::expect_no_overlap(first_s, last_s, first_s); },
@ -148,8 +150,7 @@ TEST(std_algorithms, expect_no_overlap) {
auto last_st0 = first_st0 + strided_view_1d_0.extent(0); auto last_st0 = first_st0 + strided_view_1d_0.extent(0);
auto first_st1 = KE::begin(strided_view_1d_1); // [3, 15) auto first_st1 = KE::begin(strided_view_1d_1); // [3, 15)
// Does not overlap since offset (=3) is not divisible by stride (=2) // Does not overlap since offset (=3) is not divisible by stride (=2)
EXPECT_NO_THROW( KE::Impl::expect_no_overlap(first_st0, last_st0, first_st1);
{ KE::Impl::expect_no_overlap(first_st0, last_st0, first_st1); });
// Iterating over the same range without overlapping // Iterating over the same range without overlapping
Kokkos::View<value_type[2][extent0], Kokkos::LayoutLeft> static_view_2d{ Kokkos::View<value_type[2][extent0], Kokkos::LayoutLeft> static_view_2d{
@ -160,9 +161,7 @@ TEST(std_algorithms, expect_no_overlap) {
auto sub_last_s0 = sub_first_s0 + sub_static_view_1d_0.extent(0); auto sub_last_s0 = sub_first_s0 + sub_static_view_1d_0.extent(0);
auto sub_first_s1 = KE::begin(sub_static_view_1d_1); // 1, 3, 5, ... auto sub_first_s1 = KE::begin(sub_static_view_1d_1); // 1, 3, 5, ...
EXPECT_NO_THROW({
KE::Impl::expect_no_overlap(sub_first_s0, sub_last_s0, sub_first_s1); KE::Impl::expect_no_overlap(sub_first_s0, sub_last_s0, sub_first_s1);
});
Kokkos::View<value_type**, Kokkos::LayoutLeft> dynamic_view_2d{ Kokkos::View<value_type**, Kokkos::LayoutLeft> dynamic_view_2d{
"std-algo-test-2d-contiguous-view-dynamic", 2, extent0}; "std-algo-test-2d-contiguous-view-dynamic", 2, extent0};
@ -172,9 +171,7 @@ TEST(std_algorithms, expect_no_overlap) {
auto sub_last_d0 = sub_first_d0 + sub_dynamic_view_1d_0.extent(0); auto sub_last_d0 = sub_first_d0 + sub_dynamic_view_1d_0.extent(0);
auto sub_first_d1 = KE::begin(sub_dynamic_view_1d_1); // 1, 3, 5, ... auto sub_first_d1 = KE::begin(sub_dynamic_view_1d_1); // 1, 3, 5, ...
EXPECT_NO_THROW({
KE::Impl::expect_no_overlap(sub_first_d0, sub_last_d0, sub_first_d1); KE::Impl::expect_no_overlap(sub_first_d0, sub_last_d0, sub_first_d1);
});
Kokkos::LayoutStride layout2d{2, 3, extent0, 2 * 3}; Kokkos::LayoutStride layout2d{2, 3, extent0, 2 * 3};
Kokkos::View<value_type**, Kokkos::LayoutStride> strided_view_2d{ Kokkos::View<value_type**, Kokkos::LayoutStride> strided_view_2d{
@ -185,9 +182,7 @@ TEST(std_algorithms, expect_no_overlap) {
auto sub_last_st0 = sub_first_st0 + sub_strided_view_1d_0.extent(0); auto sub_last_st0 = sub_first_st0 + sub_strided_view_1d_0.extent(0);
auto sub_first_st1 = KE::begin(sub_strided_view_1d_1); // 1, 7, 13, ... auto sub_first_st1 = KE::begin(sub_strided_view_1d_1); // 1, 7, 13, ...
EXPECT_NO_THROW({
KE::Impl::expect_no_overlap(sub_first_st0, sub_last_st0, sub_first_st1); KE::Impl::expect_no_overlap(sub_first_st0, sub_last_st0, sub_first_st1);
});
} }
} // namespace stdalgos } // namespace stdalgos

View File

@ -107,7 +107,7 @@ std::size_t fill_view(ViewType dest_view, const std::string& name,
} }
else { else {
throw std::runtime_error("invalid choice"); Kokkos::abort("invalid choice");
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -202,7 +202,7 @@ void verify_data(const std::string& name, ViewTypeFrom view_from,
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
} }

View File

@ -110,7 +110,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -55,7 +55,6 @@ void test_for_each(const ViewType view) {
std::for_each(KE::begin(expected), KE::end(expected), non_mod_functor); std::for_each(KE::begin(expected), KE::end(expected), non_mod_functor);
compare_views(expected, view); compare_views(expected, view);
#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA)
const auto mod_lambda = KOKKOS_LAMBDA(value_t & i) { ++i; }; const auto mod_lambda = KOKKOS_LAMBDA(value_t & i) { ++i; };
// pass view, lambda takes non-const ref // pass view, lambda takes non-const ref
@ -79,7 +78,6 @@ void test_for_each(const ViewType view) {
KE::for_each(exespace(), KE::cbegin(view), KE::cend(view), non_mod_lambda); KE::for_each(exespace(), KE::cbegin(view), KE::cend(view), non_mod_lambda);
std::for_each(KE::cbegin(expected), KE::cend(expected), non_mod_lambda); std::for_each(KE::cbegin(expected), KE::cend(expected), non_mod_lambda);
compare_views(expected, view); compare_views(expected, view);
#endif
} }
// std::for_each_n is C++17, so we cannot compare results directly // std::for_each_n is C++17, so we cannot compare results directly

View File

@ -104,7 +104,7 @@ struct AssignIndexFunctor {
template <class ValueType> template <class ValueType>
struct IsEvenFunctor { struct IsEvenFunctor {
static_assert(std::is_integral<ValueType>::value, static_assert(std::is_integral_v<ValueType>,
"IsEvenFunctor uses operator%, so ValueType must be int"); "IsEvenFunctor uses operator%, so ValueType must be int");
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION

View File

@ -110,7 +110,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -92,7 +92,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -122,7 +122,8 @@ bool compute_gold(const std::string& name) {
} else if (name == "large-b") { } else if (name == "large-b") {
return false; return false;
} else { } else {
throw std::runtime_error("invalid choice"); Kokkos::abort("invalid choice");
return false; // unreachable
} }
} }

View File

@ -92,7 +92,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -123,7 +123,8 @@ auto compute_gold(ViewType view, const std::string& name) {
} else if (name == "large-b") { } else if (name == "large-b") {
return KE::begin(view) + 156; return KE::begin(view) + 156;
} else { } else {
throw std::runtime_error("invalid choice"); Kokkos::abort("invalid choice");
return KE::end(view); // unreachable
} }
} }

View File

@ -86,7 +86,7 @@ void run_single_scenario(ViewType view1, ViewType view2,
v2_h(ext2 / 2) = -5; v2_h(ext2 / 2) = -5;
} }
} else { } else {
throw std::runtime_error("Kokkos: stdalgo: test: mismatch: Invalid string"); FAIL() << "Kokkos: stdalgo: test: mismatch: Invalid string";
} }
Kokkos::deep_copy(aux_view1, v1_h); Kokkos::deep_copy(aux_view1, v1_h);

View File

@ -48,7 +48,7 @@ struct MyMovableType {
TEST(std_algorithms_mod_ops_test, move) { TEST(std_algorithms_mod_ops_test, move) {
MyMovableType a; MyMovableType a;
using move_t = decltype(std::move(a)); using move_t = decltype(std::move(a));
static_assert(std::is_rvalue_reference<move_t>::value); static_assert(std::is_rvalue_reference_v<move_t>);
// move constr // move constr
MyMovableType b(std::move(a)); MyMovableType b(std::move(a));

View File

@ -23,7 +23,7 @@ namespace stdalgos {
struct std_algorithms_mod_seq_ops_test : std_algorithms_test { struct std_algorithms_mod_seq_ops_test : std_algorithms_test {
public: public:
virtual void SetUp() { void SetUp() override {
Kokkos::parallel_for(m_static_view.extent(0), Kokkos::parallel_for(m_static_view.extent(0),
AssignIndexFunctor<static_view_t>(m_static_view)); AssignIndexFunctor<static_view_t>(m_static_view));
} }

View File

@ -95,7 +95,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -110,9 +110,9 @@ void verify_data(const std::string& name, ResultType my_result,
ViewTypeDestFalse view_dest_false, PredType pred) { ViewTypeDestFalse view_dest_false, PredType pred) {
using value_type = typename ViewTypeFrom::value_type; using value_type = typename ViewTypeFrom::value_type;
static_assert( static_assert(
std::is_same<value_type, typename ViewTypeDestTrue::value_type>::value); std::is_same_v<value_type, typename ViewTypeDestTrue::value_type>);
static_assert( static_assert(
std::is_same<value_type, typename ViewTypeDestFalse::value_type>::value); std::is_same_v<value_type, typename ViewTypeDestFalse::value_type>);
const std::size_t ext = view_from.extent(0); const std::size_t ext = view_from.extent(0);

View File

@ -99,7 +99,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -110,7 +110,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -93,7 +93,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -93,7 +93,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -84,7 +84,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -153,7 +153,7 @@ void verify_data(const std::string& name, ViewType1 test_view,
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
} }

View File

@ -84,7 +84,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -175,7 +175,7 @@ void verify_data(const std::string& name, ViewTypeFrom view_from,
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
} }

View File

@ -84,7 +84,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -175,7 +175,7 @@ void verify_data(const std::string& name, ViewTypeFrom view_from,
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
} }

View File

@ -96,7 +96,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -62,7 +62,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -117,7 +117,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -117,7 +117,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -154,7 +154,7 @@ void fill_view(ViewType dest_view, ValueType value, std::size_t count,
} }
else { else {
throw std::runtime_error("Kokkos: test: search_n: this should not happen"); FAIL() << "Kokkos: test: search_n: this should not happen";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -111,7 +111,7 @@ void test_A(const bool searched_value_exist, std::size_t numTeams,
using rand_pool = using rand_pool =
Kokkos::Random_XorShift64_Pool<Kokkos::DefaultHostExecutionSpace>; Kokkos::Random_XorShift64_Pool<Kokkos::DefaultHostExecutionSpace>;
rand_pool pool(lowerBound * upperBound); rand_pool pool(static_cast<uint64_t>(lowerBound) * upperBound);
if (searched_value_exist) { if (searched_value_exist) {
Kokkos::View<std::size_t*, Kokkos::DefaultHostExecutionSpace> randomIndices( Kokkos::View<std::size_t*, Kokkos::DefaultHostExecutionSpace> randomIndices(

View File

@ -115,7 +115,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -161,7 +161,7 @@ void verify_data(ViewType1 data_view, // contains data
create_mirror_view_and_copy(Kokkos::HostSpace(), test_view_dc); create_mirror_view_and_copy(Kokkos::HostSpace(), test_view_dc);
if (test_view_h.extent(0) > 0) { if (test_view_h.extent(0) > 0) {
for (std::size_t i = 0; i < test_view_h.extent(0); ++i) { for (std::size_t i = 0; i < test_view_h.extent(0); ++i) {
if (std::is_same<gold_view_value_type, int>::value) { if (std::is_same_v<gold_view_value_type, int>) {
ASSERT_EQ(gold_h(i), test_view_h(i)); ASSERT_EQ(gold_h(i), test_view_h(i));
} else { } else {
const auto error = std::abs(gold_h(i) - test_view_h(i)); const auto error = std::abs(gold_h(i) - test_view_h(i));

View File

@ -115,7 +115,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -173,7 +173,7 @@ void verify_data(ViewType1 data_view, // contains data
create_mirror_view_and_copy(Kokkos::HostSpace(), test_view_dc); create_mirror_view_and_copy(Kokkos::HostSpace(), test_view_dc);
if (test_view_h.extent(0) > 0) { if (test_view_h.extent(0) > 0) {
for (std::size_t i = 0; i < test_view_h.extent(0); ++i) { for (std::size_t i = 0; i < test_view_h.extent(0); ++i) {
if (std::is_same<gold_view_value_type, int>::value) { if (std::is_same_v<gold_view_value_type, int>) {
ASSERT_EQ(gold_h(i), test_view_h(i)); ASSERT_EQ(gold_h(i), test_view_h(i));
} else { } else {
const auto error = std::abs(gold_h(i) - test_view_h(i)); const auto error = std::abs(gold_h(i) - test_view_h(i));

View File

@ -138,7 +138,7 @@ void fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);

View File

@ -146,7 +146,7 @@ std::size_t fill_view(ViewType dest_view, const std::string& name) {
} }
else { else {
throw std::runtime_error("invalid choice"); Kokkos::abort("invalid choice");
} }
Kokkos::deep_copy(aux_view, v_h); Kokkos::deep_copy(aux_view, v_h);
@ -235,7 +235,7 @@ void verify_data(const std::string& name, ViewTypeFrom view_from,
} }
else { else {
throw std::runtime_error("invalid choice"); FAIL() << "invalid choice";
} }
} }

View File

@ -72,7 +72,7 @@ auto create_host_view_with_reduction_order_indices(
result(8) = 7; result(8) = 7;
result(9) = 5; result(9) = 5;
} else { } else {
throw std::runtime_error("test: Invalid enum"); Kokkos::abort("test: Invalid enum");
} }
return result; return result;
@ -80,7 +80,7 @@ auto create_host_view_with_reduction_order_indices(
template <int flag, class ExeSpace, class IndexType, class ViewType> template <int flag, class ExeSpace, class IndexType, class ViewType>
auto run_min_or_max_test(ViewType view, StdReducersTestEnumOrder enValue) { auto run_min_or_max_test(ViewType view, StdReducersTestEnumOrder enValue) {
static_assert(std::is_same<ExeSpace, Kokkos::HostSpace>::value, static_assert(std::is_same_v<ExeSpace, Kokkos::HostSpace>,
"test is only enabled for HostSpace"); "test is only enabled for HostSpace");
using view_value_type = typename ViewType::value_type; using view_value_type = typename ViewType::value_type;
@ -191,7 +191,7 @@ template <class ExeSpace, class IndexType, class ViewType, class ValuesPair,
class IndexPair> class IndexPair>
void run_min_max_test(ViewType view, StdReducersTestEnumOrder enValue, void run_min_max_test(ViewType view, StdReducersTestEnumOrder enValue,
const ValuesPair gold_values, const IndexPair gold_locs) { const ValuesPair gold_values, const IndexPair gold_locs) {
static_assert(std::is_same<ExeSpace, Kokkos::HostSpace>::value, static_assert(std::is_same_v<ExeSpace, Kokkos::HostSpace>,
"test is only enabled for HostSpace"); "test is only enabled for HostSpace");
using view_value_type = typename ViewType::value_type; using view_value_type = typename ViewType::value_type;

View File

@ -1,10 +0,0 @@
image:
- Visual Studio 2019
clone_folder: c:\projects\source
build_script:
- cmd: >-
mkdir build &&
cd build &&
cmake c:\projects\source -DKokkos_ENABLE_IMPL_MDSPAN=OFF -DKokkos_ENABLE_TESTS=ON -DCMAKE_CXX_FLAGS="/W0 /EHsc" -DKokkos_ENABLE_DEPRECATED_CODE_4=ON -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF &&
cmake --build . --target install &&
ctest -C Debug --output-on-failure

View File

@ -1,12 +1,12 @@
#FIXME_OPENMPTARGET - compiling in debug mode causes ICE. #FIXME_OPENMPTARGET - compiling in debug mode causes ICE.
KOKKOS_ADD_BENCHMARK_DIRECTORIES(atomic) kokkos_add_benchmark_directories(atomic)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(gather) kokkos_add_benchmark_directories(gather)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(gups) kokkos_add_benchmark_directories(gups)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(launch_latency) kokkos_add_benchmark_directories(launch_latency)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(stream) kokkos_add_benchmark_directories(stream)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(view_copy_constructor) kokkos_add_benchmark_directories(view_copy_constructor)
#FIXME_OPENMPTARGET - These two benchmarks cause ICE. Commenting them for now but a deeper analysis on the cause and a possible fix will follow. #FIXME_OPENMPTARGET - These two benchmarks cause ICE. Commenting them for now but a deeper analysis on the cause and a possible fix will follow.
IF(NOT Kokkos_ENABLE_OPENMPTARGET) if(NOT Kokkos_ENABLE_OPENMPTARGET)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(policy_performance) kokkos_add_benchmark_directories(policy_performance)
KOKKOS_ADD_BENCHMARK_DIRECTORIES(bytes_and_flops) kokkos_add_benchmark_directories(bytes_and_flops)
ENDIF() endif()

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(atomic SOURCES main.cpp)
atomic
SOURCES main.cpp
)

View File

@ -1,4 +1,9 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(
bytes_and_flops bytes_and_flops
SOURCES bench_double.cpp bench_float.cpp bench_int32_t.cpp bench_int64_t.cpp main.cpp SOURCES
bench_double.cpp
bench_float.cpp
bench_int32_t.cpp
bench_int64_t.cpp
main.cpp
) )

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(gather SOURCES main.cpp)
gather
SOURCES main.cpp
)

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(gups SOURCES gups.cpp)
gups
SOURCES gups.cpp
)

View File

@ -140,7 +140,7 @@ int run_benchmark(const Index indicesCount, const Index dataCount,
break; break;
} }
default: { default: {
throw std::runtime_error("unexpected mode"); Kokkos::abort("unexpected mode");
} }
} }

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(launch_latency SOURCES launch_latency.cpp)
launch_latency
SOURCES launch_latency.cpp
)

View File

@ -254,7 +254,7 @@ int main(int argc, char* argv[]) {
else if (i == 3) else if (i == 3)
K = atoi(arg.data()); K = atoi(arg.data());
else { else {
throw std::runtime_error("unexpected argument!"); Kokkos::abort("unexpected argument!");
} }
} else if (arg == "--no-parallel-for") { } else if (arg == "--no-parallel-for") {
opts.par_for = false; opts.par_for = false;
@ -265,7 +265,7 @@ int main(int argc, char* argv[]) {
} else { } else {
std::stringstream ss; std::stringstream ss;
ss << "unexpected argument \"" << arg << "\" at position " << i; ss << "unexpected argument \"" << arg << "\" at position " << i;
throw std::runtime_error(ss.str()); Kokkos::abort(ss.str().c_str());
} }
} }

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(policy_performance SOURCES main.cpp)
policy_performance
SOURCES main.cpp
)

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(stream SOURCES stream-kokkos.cpp)
stream
SOURCES stream-kokkos.cpp
)

View File

@ -1,4 +1 @@
KOKKOS_ADD_EXECUTABLE( kokkos_add_executable(view_copy_constructor SOURCES view_copy_constructor.cpp)
view_copy_constructor
SOURCES view_copy_constructor.cpp
)

View File

@ -62,7 +62,7 @@ KOKKOS_COMPILER=${1}
shift shift
# store the expected C++ compiler # store the expected C++ compiler
CXX_COMPILER=${1} CXX_COMPILER=$(which "${1}")
# remove the expected C++ compiler from the arguments # remove the expected C++ compiler from the arguments
shift shift
@ -84,7 +84,7 @@ shift
# kokkos_launch_compiler ${KOKKOS_COMPILER} g++ g++ -c file.cpp -o file.o # kokkos_launch_compiler ${KOKKOS_COMPILER} g++ g++ -c file.cpp -o file.o
# results in this command being executed: # results in this command being executed:
# ${KOKKOS_COMPILER} -c file.cpp -o file.o # ${KOKKOS_COMPILER} -c file.cpp -o file.o
if [[ "${KOKKOS_DEPENDENCE}" -eq "0" || "${CXX_COMPILER}" != "${1}" ]]; then if [[ "${KOKKOS_DEPENDENCE}" -eq "0" || "${CXX_COMPILER}" != $(which "${1}") ]]; then
debug-message "$@" debug-message "$@"
# the command does not depend on Kokkos so just execute the command w/o re-directing to ${KOKKOS_COMPILER} # the command does not depend on Kokkos so just execute the command w/o re-directing to ${KOKKOS_COMPILER}
exec "$@" exec "$@"

View File

@ -1,5 +1,3 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( tribits_package_define_dependencies(LIB_OPTIONAL_TPLS Pthread CUDA HWLOC DLlib)
LIB_OPTIONAL_TPLS Pthread CUDA HWLOC DLlib
)
TRIBITS_TPL_TENTATIVELY_ENABLE(DLlib) tribits_tpl_tentatively_enable(DLlib)

View File

@ -24,7 +24,6 @@
#cmakedefine KOKKOS_ENABLE_HIP #cmakedefine KOKKOS_ENABLE_HIP
#cmakedefine KOKKOS_ENABLE_HPX #cmakedefine KOKKOS_ENABLE_HPX
#cmakedefine KOKKOS_ENABLE_SYCL #cmakedefine KOKKOS_ENABLE_SYCL
#cmakedefine KOKKOS_IMPL_SYCL_DEVICE_GLOBAL_SUPPORTED
/* General Settings */ /* General Settings */
#cmakedefine KOKKOS_ENABLE_CXX17 #cmakedefine KOKKOS_ENABLE_CXX17
@ -40,7 +39,10 @@
#cmakedefine KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY #cmakedefine KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY
#cmakedefine KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE #cmakedefine KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE
#cmakedefine KOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS #cmakedefine KOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS
#cmakedefine KOKKOS_ENABLE_IMPL_HIP_UNIFIED_MEMORY #cmakedefine KOKKOS_ENABLE_IMPL_HIP_MALLOC_ASYNC
#cmakedefine KOKKOS_ENABLE_SYCL_RELOCATABLE_DEVICE_CODE
#cmakedefine KOKKOS_IMPL_SYCL_DEVICE_GLOBAL_SUPPORTED
#cmakedefine KOKKOS_ENABLE_OPENACC_FORCE_HOST_AS_DEVICE
#cmakedefine KOKKOS_ENABLE_IMPL_HPX_ASYNC_DISPATCH #cmakedefine KOKKOS_ENABLE_IMPL_HPX_ASYNC_DISPATCH
#cmakedefine KOKKOS_ENABLE_DEBUG #cmakedefine KOKKOS_ENABLE_DEBUG
#cmakedefine KOKKOS_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK #cmakedefine KOKKOS_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK
@ -80,6 +82,7 @@
#cmakedefine KOKKOS_ARCH_POWER8 #cmakedefine KOKKOS_ARCH_POWER8
#cmakedefine KOKKOS_ARCH_POWER9 #cmakedefine KOKKOS_ARCH_POWER9
#cmakedefine KOKKOS_ARCH_RISCV_SG2042 #cmakedefine KOKKOS_ARCH_RISCV_SG2042
#cmakedefine KOKKOS_ARCH_RISCV_RVA22V
#cmakedefine KOKKOS_ARCH_INTEL_GEN #cmakedefine KOKKOS_ARCH_INTEL_GEN
#cmakedefine KOKKOS_ARCH_INTEL_DG1 #cmakedefine KOKKOS_ARCH_INTEL_DG1
#cmakedefine KOKKOS_ARCH_INTEL_GEN9 #cmakedefine KOKKOS_ARCH_INTEL_GEN9
@ -118,10 +121,11 @@
#cmakedefine KOKKOS_ARCH_AMD_GFX90A #cmakedefine KOKKOS_ARCH_AMD_GFX90A
#cmakedefine KOKKOS_ARCH_AMD_GFX940 #cmakedefine KOKKOS_ARCH_AMD_GFX940
#cmakedefine KOKKOS_ARCH_AMD_GFX942 #cmakedefine KOKKOS_ARCH_AMD_GFX942
#cmakedefine KOKKOS_ARCH_AMD_GFX942_APU
#cmakedefine KOKKOS_ARCH_AMD_GFX1030 #cmakedefine KOKKOS_ARCH_AMD_GFX1030
#cmakedefine KOKKOS_ARCH_AMD_GFX1100 #cmakedefine KOKKOS_ARCH_AMD_GFX1100
#cmakedefine KOKKOS_ARCH_AMD_GFX1103 #cmakedefine KOKKOS_ARCH_AMD_GFX1103
#cmakedefine KOKKOS_ARCH_AMD_GPU #cmakedefine KOKKOS_ARCH_AMD_GPU "@KOKKOS_ARCH_AMD_GPU@"
#cmakedefine KOKKOS_ARCH_VEGA // deprecated #cmakedefine KOKKOS_ARCH_VEGA // deprecated
#cmakedefine KOKKOS_ARCH_VEGA906 // deprecated #cmakedefine KOKKOS_ARCH_VEGA906 // deprecated
#cmakedefine KOKKOS_ARCH_VEGA908 // deprecated #cmakedefine KOKKOS_ARCH_VEGA908 // deprecated

View File

@ -1,17 +0,0 @@
IF (NOT TARGET Kokkos::kokkos)
# Compute the installation prefix relative to this file.
get_filename_component(KOKKOS_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(KOKKOS_IMPORT_PREFIX "${KOKKOS_IMPORT_PREFIX}" PATH)
get_filename_component(KOKKOS_IMPORT_PREFIX "${KOKKOS_IMPORT_PREFIX}" PATH)
get_filename_component(KOKKOS_IMPORT_PREFIX "${KOKKOS_IMPORT_PREFIX}" PATH)
if(KOKKOS_IMPORT_PREFIX STREQUAL "/")
set(KOKKOS_IMPORT_PREFIX "")
endif()
add_library(Kokkos::kokkos INTERFACE IMPORTED)
set_target_properties(Kokkos::kokkos PROPERTIES
INTERFACE_LINK_LIBRARIES "@Kokkos_LIBRARIES@;@KOKKOS_LINK_OPTIONS@"
INTERFACE_COMPILE_FEATURES "@KOKKOS_CXX_STANDARD_FEATURE@"
INTERFACE_COMPILE_OPTIONS "@KOKKOS_ALL_COMPILE_OPTIONS@"
INTERFACE_INCLUDE_DIRECTORIES "${KOKKOS_IMPORT_PREFIX}/include"
)
ENDIF()

View File

@ -483,7 +483,8 @@ endif()
# Try language- or user-provided path first. # Try language- or user-provided path first.
if(CUDAToolkit_BIN_DIR) if(CUDAToolkit_BIN_DIR)
find_program(CUDAToolkit_NVCC_EXECUTABLE find_program(
CUDAToolkit_NVCC_EXECUTABLE
NAMES nvcc nvcc.exe NAMES nvcc nvcc.exe
PATHS ${CUDAToolkit_BIN_DIR} PATHS ${CUDAToolkit_BIN_DIR}
NO_DEFAULT_PATH NO_DEFAULT_PATH
@ -491,7 +492,8 @@ if(CUDAToolkit_BIN_DIR)
endif() endif()
# Search using CUDAToolkit_ROOT # Search using CUDAToolkit_ROOT
find_program(CUDAToolkit_NVCC_EXECUTABLE find_program(
CUDAToolkit_NVCC_EXECUTABLE
NAMES nvcc nvcc.exe NAMES nvcc nvcc.exe
PATHS ENV CUDA_PATH PATHS ENV CUDA_PATH
PATH_SUFFIXES bin PATH_SUFFIXES bin
@ -602,7 +604,8 @@ if (NOT CUDAToolkit_NVCC_EXECUTABLE)
endif() endif()
# Now search for nvcc again using the platform default search paths. # Now search for nvcc again using the platform default search paths.
find_program(CUDAToolkit_NVCC_EXECUTABLE find_program(
CUDAToolkit_NVCC_EXECUTABLE
NAMES nvcc nvcc.exe NAMES nvcc nvcc.exe
PATHS ${search_paths} PATHS ${search_paths}
PATH_SUFFIXES bin PATH_SUFFIXES bin
@ -636,8 +639,7 @@ if(NOT CUDAToolkit_BIN_DIR AND CUDAToolkit_NVCC_EXECUTABLE)
unset(cuda_dir) unset(cuda_dir)
endif() endif()
if(CUDAToolkit_NVCC_EXECUTABLE AND if(CUDAToolkit_NVCC_EXECUTABLE AND CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER)
CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER)
# Need to set these based off the already computed CMAKE_CUDA_COMPILER_VERSION value # Need to set these based off the already computed CMAKE_CUDA_COMPILER_VERSION value
# This if statement will always match, but is used to provide variables for MATCH 1,2,3... # This if statement will always match, but is used to provide variables for MATCH 1,2,3...
if(CMAKE_CUDA_COMPILER_VERSION MATCHES [=[([0-9]+)\.([0-9]+)\.([0-9]+)]=]) if(CMAKE_CUDA_COMPILER_VERSION MATCHES [=[([0-9]+)\.([0-9]+)\.([0-9]+)]=])
@ -658,7 +660,6 @@ else()
unset(NVCC_OUT) unset(NVCC_OUT)
endif() endif()
get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE) get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE)
# Handle cross compilation # Handle cross compilation
@ -702,22 +703,13 @@ else()
set(_CUDAToolkit_Pop_Prefix True) set(_CUDAToolkit_Pop_Prefix True)
endif() endif()
# Find the include/ directory # Find the include/ directory
find_path(CUDAToolkit_INCLUDE_DIR find_path(CUDAToolkit_INCLUDE_DIR NAMES cuda_runtime.h)
NAMES cuda_runtime.h
)
# And find the CUDA Runtime Library libcudart # And find the CUDA Runtime Library libcudart
find_library(CUDA_CUDART find_library(CUDA_CUDART NAMES cudart PATH_SUFFIXES lib64 lib/x64)
NAMES cudart
PATH_SUFFIXES lib64 lib/x64
)
if(NOT CUDA_CUDART) if(NOT CUDA_CUDART)
find_library(CUDA_CUDART find_library(CUDA_CUDART NAMES cudart PATH_SUFFIXES lib64/stubs lib/x64/stubs)
NAMES cudart
PATH_SUFFIXES lib64/stubs lib/x64/stubs
)
endif() endif()
if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY) if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY)
@ -733,18 +725,11 @@ endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Perform version comparison and validate all required variables are set. # Perform version comparison and validate all required variables are set.
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CUDAToolkit find_package_handle_standard_args(
REQUIRED_VARS CUDAToolkit REQUIRED_VARS CUDAToolkit_INCLUDE_DIR CUDA_CUDART CUDAToolkit_NVCC_EXECUTABLE
CUDAToolkit_INCLUDE_DIR VERSION_VAR CUDAToolkit_VERSION
CUDA_CUDART
CUDAToolkit_NVCC_EXECUTABLE
VERSION_VAR
CUDAToolkit_VERSION
)
mark_as_advanced(CUDA_CUDART
CUDAToolkit_INCLUDE_DIR
CUDAToolkit_NVCC_EXECUTABLE
) )
mark_as_advanced(CUDA_CUDART CUDAToolkit_INCLUDE_DIR CUDAToolkit_NVCC_EXECUTABLE)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Construct result variables # Construct result variables
@ -762,20 +747,19 @@ if(CUDAToolkit_FOUND)
set(search_names ${lib_name} ${arg_ALT}) set(search_names ${lib_name} ${arg_ALT})
find_library(CUDA_${lib_name}_LIBRARY find_library(
CUDA_${lib_name}_LIBRARY
NAMES ${search_names} NAMES ${search_names}
HINTS ${CUDAToolkit_LIBRARY_DIR} HINTS ${CUDAToolkit_LIBRARY_DIR} ENV CUDA_PATH
ENV CUDA_PATH PATH_SUFFIXES nvidia/current lib64 lib/x64 lib ${arg_EXTRA_PATH_SUFFIXES}
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib
${arg_EXTRA_PATH_SUFFIXES}
) )
# Don't try any stub directories intil we have exhausted all other # Don't try any stub directories intil we have exhausted all other
# search locations. # search locations.
if(NOT CUDA_${lib_name}_LIBRARY) if(NOT CUDA_${lib_name}_LIBRARY)
find_library(CUDA_${lib_name}_LIBRARY find_library(
CUDA_${lib_name}_LIBRARY
NAMES ${search_names} NAMES ${search_names}
HINTS ${CUDAToolkit_LIBRARY_DIR} HINTS ${CUDAToolkit_LIBRARY_DIR} ENV CUDA_PATH
ENV CUDA_PATH
PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs
) )
endif() endif()
@ -800,16 +784,15 @@ if(CUDAToolkit_FOUND)
target_link_directories(CUDA::toolkit INTERFACE "${CUDAToolkit_LIBRARY_DIR}") target_link_directories(CUDA::toolkit INTERFACE "${CUDAToolkit_LIBRARY_DIR}")
endif() endif()
_CUDAToolkit_find_and_add_import_lib(cuda_driver ALT cuda) _cudatoolkit_find_and_add_import_lib(cuda_driver ALT cuda)
_CUDAToolkit_find_and_add_import_lib(cudart) _cudatoolkit_find_and_add_import_lib(cudart)
_CUDAToolkit_find_and_add_import_lib(cudart_static) _cudatoolkit_find_and_add_import_lib(cudart_static)
# setup dependencies that are required for cudart_static when building # setup dependencies that are required for cudart_static when building
# on linux. These are generally only required when using the CUDA toolkit # on linux. These are generally only required when using the CUDA toolkit
# when CUDA language is disabled # when CUDA language is disabled
if(NOT TARGET CUDA::cudart_static_deps if(NOT TARGET CUDA::cudart_static_deps AND TARGET CUDA::cudart_static)
AND TARGET CUDA::cudart_static)
add_library(CUDA::cudart_static_deps IMPORTED INTERFACE) add_library(CUDA::cudart_static_deps IMPORTED INTERFACE)
target_link_libraries(CUDA::cudart_static INTERFACE CUDA::cudart_static_deps) target_link_libraries(CUDA::cudart_static INTERFACE CUDA::cudart_static_deps)
@ -831,55 +814,64 @@ if(CUDAToolkit_FOUND)
endif() endif()
endif() endif()
_CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library _cudatoolkit_find_and_add_import_lib(culibos) # it's a static library
foreach(cuda_lib cublas cufft curand cusparse nppc nvjpeg) foreach(cuda_lib cublas cufft curand cusparse nppc nvjpeg)
_CUDAToolkit_find_and_add_import_lib(${cuda_lib}) _cudatoolkit_find_and_add_import_lib(${cuda_lib})
_CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos) _cudatoolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos)
endforeach() endforeach()
# cuFFTW depends on cuFFT # cuFFTW depends on cuFFT
_CUDAToolkit_find_and_add_import_lib(cufftw DEPS cufft) _cudatoolkit_find_and_add_import_lib(cufftw DEPS cufft)
_CUDAToolkit_find_and_add_import_lib(cufftw DEPS cufft_static) _cudatoolkit_find_and_add_import_lib(cufftw DEPS cufft_static)
# cuSOLVER depends on cuBLAS, and cuSPARSE # cuSOLVER depends on cuBLAS, and cuSPARSE
_CUDAToolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse) _cudatoolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse)
_CUDAToolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos) _cudatoolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos)
# nvGRAPH depends on cuRAND, and cuSOLVER. # nvGRAPH depends on cuRAND, and cuSOLVER.
_CUDAToolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver) _cudatoolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver)
_CUDAToolkit_find_and_add_import_lib(nvgraph_static DEPS curand_static cusolver_static) _cudatoolkit_find_and_add_import_lib(nvgraph_static DEPS curand_static cusolver_static)
# Process the majority of the NPP libraries. # Process the majority of the NPP libraries.
foreach (cuda_lib nppial nppicc nppidei nppif nppig nppim nppist nppitc npps nppicom nppisu) foreach(
_CUDAToolkit_find_and_add_import_lib(${cuda_lib} DEPS nppc) cuda_lib
_CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS nppc_static) nppial
nppicc
nppidei
nppif
nppig
nppim
nppist
nppitc
npps
nppicom
nppisu
)
_cudatoolkit_find_and_add_import_lib(${cuda_lib} DEPS nppc)
_cudatoolkit_find_and_add_import_lib(${cuda_lib}_static DEPS nppc_static)
endforeach() endforeach()
_CUDAToolkit_find_and_add_import_lib(cupti _cudatoolkit_find_and_add_import_lib(cupti EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ ../extras/CUPTI/lib/)
EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ _cudatoolkit_find_and_add_import_lib(cupti_static EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ ../extras/CUPTI/lib/)
../extras/CUPTI/lib/)
_CUDAToolkit_find_and_add_import_lib(cupti_static
EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/
../extras/CUPTI/lib/)
_CUDAToolkit_find_and_add_import_lib(nvrtc DEPS cuda_driver) _cudatoolkit_find_and_add_import_lib(nvrtc DEPS cuda_driver)
_CUDAToolkit_find_and_add_import_lib(nvml ALT nvidia-ml nvml) _cudatoolkit_find_and_add_import_lib(nvml ALT nvidia-ml nvml)
if(WIN32) if(WIN32)
# nvtools can be installed outside the CUDA toolkit directory # nvtools can be installed outside the CUDA toolkit directory
# so prefer the NVTOOLSEXT_PATH windows only environment variable # so prefer the NVTOOLSEXT_PATH windows only environment variable
# In addition on windows the most common name is nvToolsExt64_1 # In addition on windows the most common name is nvToolsExt64_1
find_library(CUDA_nvToolsExt_LIBRARY find_library(
CUDA_nvToolsExt_LIBRARY
NAMES nvToolsExt64_1 nvToolsExt64 nvToolsExt NAMES nvToolsExt64_1 nvToolsExt64 nvToolsExt
PATHS ENV NVTOOLSEXT_PATH PATHS ENV NVTOOLSEXT_PATH ENV CUDA_PATH
ENV CUDA_PATH
PATH_SUFFIXES lib/x64 lib PATH_SUFFIXES lib/x64 lib
) )
endif() endif()
_CUDAToolkit_find_and_add_import_lib(nvToolsExt ALT nvToolsExt64) _cudatoolkit_find_and_add_import_lib(nvToolsExt ALT nvToolsExt64)
_CUDAToolkit_find_and_add_import_lib(OpenCL) _cudatoolkit_find_and_add_import_lib(OpenCL)
endif() endif()
if(_CUDAToolkit_Pop_ROOT_PATH) if(_CUDAToolkit_Pop_ROOT_PATH)

View File

@ -1,44 +1,40 @@
IF (NOT CUDAToolkit_ROOT) if(NOT CUDAToolkit_ROOT)
IF (NOT CUDA_ROOT) if(NOT CUDA_ROOT)
SET(CUDA_ROOT $ENV{CUDA_ROOT}) set(CUDA_ROOT $ENV{CUDA_ROOT})
ENDIF() endif()
IF(CUDA_ROOT) if(CUDA_ROOT)
SET(CUDAToolkit_ROOT ${CUDA_ROOT}) set(CUDAToolkit_ROOT ${CUDA_ROOT})
ENDIF() endif()
ENDIF() endif()
IF(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL NVHPC AND CMAKE_VERSION VERSION_LESS "3.20.1") if(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL NVHPC AND CMAKE_VERSION VERSION_LESS "3.20.1")
MESSAGE(FATAL_ERROR "Using NVHPC as host compiler requires at least CMake 3.20.1") message(FATAL_ERROR "Using NVHPC as host compiler requires at least CMake 3.20.1")
ENDIF() endif()
IF(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17.0") if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17.0")
find_package(CUDAToolkit REQUIRED) find_package(CUDAToolkit REQUIRED)
KOKKOS_CREATE_IMPORTED_TPL(CUDA INTERFACE kokkos_create_imported_tpl(CUDA INTERFACE LINK_LIBRARIES CUDA::cuda_driver CUDA::cudart)
LINK_LIBRARIES CUDA::cuda_driver CUDA::cudart kokkos_export_cmake_tpl(CUDAToolkit REQUIRED)
) else()
KOKKOS_EXPORT_CMAKE_TPL(CUDAToolkit REQUIRED)
ELSE()
include(${CMAKE_CURRENT_LIST_DIR}/CudaToolkit.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CudaToolkit.cmake)
IF (TARGET CUDA::cudart) if(TARGET CUDA::cudart)
SET(FOUND_CUDART TRUE) set(FOUND_CUDART TRUE)
KOKKOS_EXPORT_IMPORTED_TPL(CUDA::cudart) kokkos_export_imported_tpl(CUDA::cudart)
ELSE() else()
SET(FOUND_CUDART FALSE) set(FOUND_CUDART FALSE)
ENDIF() endif()
IF (TARGET CUDA::cuda_driver) if(TARGET CUDA::cuda_driver)
SET(FOUND_CUDA_DRIVER TRUE) set(FOUND_CUDA_DRIVER TRUE)
KOKKOS_EXPORT_IMPORTED_TPL(CUDA::cuda_driver) kokkos_export_imported_tpl(CUDA::cuda_driver)
ELSE() else()
SET(FOUND_CUDA_DRIVER FALSE) set(FOUND_CUDA_DRIVER FALSE)
ENDIF() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TPLCUDA ${DEFAULT_MSG} FOUND_CUDART FOUND_CUDA_DRIVER) find_package_handle_standard_args(TPLCUDA ${DEFAULT_MSG} FOUND_CUDART FOUND_CUDA_DRIVER)
IF (FOUND_CUDA_DRIVER AND FOUND_CUDART) if(FOUND_CUDA_DRIVER AND FOUND_CUDART)
KOKKOS_CREATE_IMPORTED_TPL(CUDA INTERFACE kokkos_create_imported_tpl(CUDA INTERFACE LINK_LIBRARIES CUDA::cuda_driver CUDA::cudart)
LINK_LIBRARIES CUDA::cuda_driver CUDA::cudart endif()
) endif()
ENDIF()
ENDIF()

View File

@ -1,15 +1,10 @@
find_package(HPX REQUIRED 1.8.0)
FIND_PACKAGE(HPX REQUIRED 1.8.0)
#as of right now, HPX doesn't export correctly #as of right now, HPX doesn't export correctly
#so let's convert it to an interface target #so let's convert it to an interface target
KOKKOS_CREATE_IMPORTED_TPL(HPX INTERFACE kokkos_create_imported_tpl(HPX INTERFACE LINK_LIBRARIES ${HPX_LIBRARIES} INCLUDES ${HPX_INCLUDE_DIRS})
LINK_LIBRARIES ${HPX_LIBRARIES}
INCLUDES ${HPX_INCLUDE_DIRS}
)
#this is a bit funky since this is a CMake target #this is a bit funky since this is a CMake target
#but HPX doesn't export itself correctly #but HPX doesn't export itself correctly
KOKKOS_EXPORT_CMAKE_TPL(HPX) kokkos_export_cmake_tpl(HPX)
#I would prefer all of this gets replaced with #I would prefer all of this gets replaced with
#KOKKOS_IMPORT_CMAKE_TPL(HPX) #KOKKOS_IMPORT_CMAKE_TPL(HPX)

View File

@ -1 +1 @@
KOKKOS_FIND_IMPORTED(HWLOC HEADER hwloc.h LIBRARY hwloc) kokkos_find_imported(HWLOC HEADER hwloc.h LIBRARY hwloc)

View File

@ -1 +1 @@
KOKKOS_FIND_IMPORTED(LIBDL HEADER dlfcn.h INTERFACE LIBRARIES ${CMAKE_DL_LIBS}) kokkos_find_imported(LIBDL HEADER dlfcn.h INTERFACE LIBRARIES ${CMAKE_DL_LIBS})

View File

@ -2,17 +2,19 @@
# (which would not be contained in CMake's search paths anyway). # (which would not be contained in CMake's search paths anyway).
# Hence, try if the compiler supports libquadmath natively first before doing # Hence, try if the compiler supports libquadmath natively first before doing
# the standard package search. # the standard package search.
SET(CMAKE_REQUIRED_LIBRARIES "quadmath") set(CMAKE_REQUIRED_LIBRARIES "quadmath")
INCLUDE(CheckCXXSourceCompiles) include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(" check_cxx_source_compiles(
"
#include <quadmath.h> #include <quadmath.h>
int main(void){ int main(void){
__float128 foo = ::sqrtq(123.456); __float128 foo = ::sqrtq(123.456);
return foo; return foo;
}" }"
KOKKOS_QUADMATH_COMPILER_SUPPORT) KOKKOS_QUADMATH_COMPILER_SUPPORT
IF (KOKKOS_QUADMATH_COMPILER_SUPPORT) )
KOKKOS_CREATE_IMPORTED_TPL(LIBQUADMATH INTERFACE LINK_LIBRARIES quadmath) if(KOKKOS_QUADMATH_COMPILER_SUPPORT)
ELSE() kokkos_create_imported_tpl(LIBQUADMATH INTERFACE LINK_LIBRARIES quadmath)
KOKKOS_FIND_IMPORTED(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath) else()
ENDIF() kokkos_find_imported(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath)
endif()

View File

@ -1,9 +1,10 @@
INCLUDE(CheckIncludeFileCXX) include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX(oneapi/dpl/execution KOKKOS_COMPILER_HAS_ONEDPL_EXECUTION_HEADER) check_include_file_cxx(oneapi/dpl/execution KOKKOS_COMPILER_HAS_ONEDPL_EXECUTION_HEADER)
CHECK_INCLUDE_FILE_CXX(oneapi/dpl/algorithm KOKKOS_COMPILER_HAS_ONEDPL_ALGORITHM_HEADER) check_include_file_cxx(oneapi/dpl/algorithm KOKKOS_COMPILER_HAS_ONEDPL_ALGORITHM_HEADER)
INCLUDE(CheckCXXSourceCompiles) include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(" check_cxx_source_compiles(
"
#include <iostream> #include <iostream>
int main() int main()
@ -13,37 +14,40 @@ CHECK_CXX_SOURCE_COMPILES("
#endif #endif
return 0; return 0;
}" }"
KOKKOS_NO_TBB_CONFLICT) KOKKOS_NO_TBB_CONFLICT
)
IF (KOKKOS_COMPILER_HAS_ONEDPL_EXECUTION_HEADER AND KOKKOS_COMPILER_HAS_ONEDPL_ALGORITHM_HEADER) if(KOKKOS_COMPILER_HAS_ONEDPL_EXECUTION_HEADER AND KOKKOS_COMPILER_HAS_ONEDPL_ALGORITHM_HEADER)
IF(KOKKOS_NO_TBB_CONFLICT) if(KOKKOS_NO_TBB_CONFLICT)
KOKKOS_CREATE_IMPORTED_TPL( kokkos_create_imported_tpl(ONEDPL INTERFACE)
ONEDPL INTERFACE else()
) kokkos_create_imported_tpl(
ELSE() ONEDPL
KOKKOS_CREATE_IMPORTED_TPL( INTERFACE
ONEDPL INTERFACE
# https://stackoverflow.com/questions/67923287/how-to-resolve-no-member-named-task-in-namespace-tbb-error-when-using-oned/ # https://stackoverflow.com/questions/67923287/how-to-resolve-no-member-named-task-in-namespace-tbb-error-when-using-oned/
COMPILE_DEFINITIONS PSTL_USE_PARALLEL_POLICIES=0 _GLIBCXX_USE_TBB_PAR_BACKEND=0 COMPILE_DEFINITIONS
PSTL_USE_PARALLEL_POLICIES=0
_GLIBCXX_USE_TBB_PAR_BACKEND=0
) )
ENDIF() endif()
ELSE() else()
FIND_PACKAGE(oneDPL REQUIRED) find_package(oneDPL REQUIRED)
IF(KOKKOS_NO_TBB_CONFLICT) if(KOKKOS_NO_TBB_CONFLICT)
KOKKOS_CREATE_IMPORTED_TPL( kokkos_create_imported_tpl(ONEDPL INTERFACE LINK_LIBRARIES oneDPL)
ONEDPL INTERFACE else()
LINK_LIBRARIES oneDPL kokkos_create_imported_tpl(
) ONEDPL
ELSE() INTERFACE
KOKKOS_CREATE_IMPORTED_TPL( LINK_LIBRARIES
ONEDPL INTERFACE oneDPL
LINK_LIBRARIES oneDPL
# https://stackoverflow.com/questions/67923287/how-to-resolve-no-member-named-task-in-namespace-tbb-error-when-using-oned/ # https://stackoverflow.com/questions/67923287/how-to-resolve-no-member-named-task-in-namespace-tbb-error-when-using-oned/
COMPILE_DEFINITIONS PSTL_USE_PARALLEL_POLICIES=0 _GLIBCXX_USE_TBB_PAR_BACKEND=0 COMPILE_DEFINITIONS
PSTL_USE_PARALLEL_POLICIES=0
_GLIBCXX_USE_TBB_PAR_BACKEND=0
) )
ENDIF() endif()
# Export oneDPL as a Kokkos dependency # Export oneDPL as a Kokkos dependency
KOKKOS_EXPORT_CMAKE_TPL(oneDPL) kokkos_export_cmake_tpl(oneDPL)
ENDIF() endif()

View File

@ -1,7 +1,7 @@
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
FIND_LIBRARY(AMD_HIP_LIBRARY amdhip64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib) find_library(AMD_HIP_LIBRARY amdhip64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib)
FIND_LIBRARY(HSA_RUNTIME_LIBRARY hsa-runtime64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib) find_library(HSA_RUNTIME_LIBRARY hsa-runtime64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib)
# FIXME_HIP Starting with ROCm 5.5 it is not necessary to link againt clang_rt. # FIXME_HIP Starting with ROCm 5.5 it is not necessary to link againt clang_rt.
# We keep the code as is for now because it is hard to find the version of ROCM # We keep the code as is for now because it is hard to find the version of ROCM
@ -16,7 +16,8 @@ execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name --rtlib=compiler-rt COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name --rtlib=compiler-rt
OUTPUT_VARIABLE CLANG_RT_LIBRARY OUTPUT_VARIABLE CLANG_RT_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE CLANG_RT_CHECK) RESULT_VARIABLE CLANG_RT_CHECK
)
if(NOT "${CLANG_RT_CHECK}" STREQUAL "0") if(NOT "${CLANG_RT_CHECK}" STREQUAL "0")
# if the above failed, we delete CLANG_RT_LIBRARY to make the args check # if the above failed, we delete CLANG_RT_LIBRARY to make the args check
@ -24,10 +25,15 @@ if( NOT "${CLANG_RT_CHECK}" STREQUAL "0" )
unset(CLANG_RT_LIBRARY) unset(CLANG_RT_LIBRARY)
endif() endif()
find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY CLANG_RT_LIBRARY) find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY CLANG_RT_LIBRARY)
kokkos_create_imported_tpl(ROCM INTERFACE kokkos_create_imported_tpl(
LINK_LIBRARIES ${HSA_RUNTIME_LIBRARY} ${AMD_HIP_LIBRARY} ${CLANG_RT_LIBRARY} ROCM
COMPILE_DEFINITIONS __HIP_ROCclr__ INTERFACE
LINK_LIBRARIES
${HSA_RUNTIME_LIBRARY}
${AMD_HIP_LIBRARY}
${CLANG_RT_LIBRARY}
COMPILE_DEFINITIONS
__HIP_ROCclr__
) )

View File

@ -6,10 +6,10 @@
# behavior of ROCm 5.7 and later for earlier version of ROCm we set # behavior of ROCm 5.7 and later for earlier version of ROCm we set
# AMDGPU_TARGETS and GPU_TARGETS to empty and set the values in the cache. If # AMDGPU_TARGETS and GPU_TARGETS to empty and set the values in the cache. If
# the values are not cached, FIND_PACKAGE(rocthrust) will overwrite them. # the values are not cached, FIND_PACKAGE(rocthrust) will overwrite them.
SET(AMDGPU_TARGETS "" CACHE STRING "AMD GPU targets to compile for") set(AMDGPU_TARGETS "" CACHE STRING "AMD GPU targets to compile for")
SET(GPU_TARGETS "" CACHE STRING "GPU targets to compile for") set(GPU_TARGETS "" CACHE STRING "GPU targets to compile for")
FIND_PACKAGE(rocthrust REQUIRED) find_package(rocthrust REQUIRED)
KOKKOS_CREATE_IMPORTED_TPL(ROCTHRUST INTERFACE LINK_LIBRARIES roc::rocthrust) kokkos_create_imported_tpl(ROCTHRUST INTERFACE LINK_LIBRARIES roc::rocthrust)
# Export ROCTHRUST as a Kokkos dependency # Export ROCTHRUST as a Kokkos dependency
KOKKOS_EXPORT_CMAKE_TPL(rocthrust) kokkos_export_cmake_tpl(rocthrust)

View File

@ -1,15 +1,14 @@
INCLUDE(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
FIND_PACKAGE(Threads) find_package(Threads)
IF (TARGET Threads::Threads) if(TARGET Threads::Threads)
SET(FOUND_THREADS TRUE) set(FOUND_THREADS TRUE)
ELSE() else()
SET(FOUND_THREADS FALSE) set(FOUND_THREADS FALSE)
ENDIF() endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TPLTHREADS DEFAULT_MSG FOUND_THREADS) find_package_handle_standard_args(TPLTHREADS DEFAULT_MSG FOUND_THREADS)
#Only create the TPL if we succeed #Only create the TPL if we succeed
IF (FOUND_THREADS) if(FOUND_THREADS)
KOKKOS_CREATE_IMPORTED_TPL(THREADS INTERFACE LINK_OPTIONS kokkos_create_imported_tpl(THREADS INTERFACE LINK_OPTIONS ${CMAKE_THREAD_LIBS_INIT})
${CMAKE_THREAD_LIBS_INIT}) endif()
ENDIF()

View File

@ -310,20 +310,6 @@ When Kokkos is loaded by a downstream project, this TPL must be loaded.
Calling this function simply appends text recording the location where the TPL was found Calling this function simply appends text recording the location where the TPL was found
and adding a `find_dependency(...)` call that will reload the CMake target. and adding a `find_dependency(...)` call that will reload the CMake target.
### The Great TriBITS Compromise
TriBITS was a masterpiece of CMake version 2 before the modern CMake idioms of building and using.
TriBITS greatly limited verbosity of CMake files, handled complicated dependency trees between packages, and handled automatically setting up include and linker paths for dependent libraries.
Kokkos is now used by numerous projects that don't (and won't) depend on TriBITS for their build systems.
Kokkos has to work outside of TriBITS and provide a standard CMake 3+ build system.
At the same time, Kokkos is used by numerous projects that depend on TriBITS and don't (and won't) switch to a standard CMake 3+ build system.
Instead of calling functions `TRIBITS_X(...)`, the CMake calls wrapper functions `KOKKOS_X(...)`.
If TriBITS is available (as in Trilinos), `KOKKOS_X` will just be a thin wrapper around `TRIBITS_X`.
If TriBITS is not available, Kokkos maps `KOKKOS_X` calls to native CMake that complies with CMake 3 idioms.
For the time being, this seems the most sensible way to handle the competing requirements of a standalone modern CMake and TriBITS build system.
##### [LICENSE](https://github.com/kokkos/kokkos/blob/devel/LICENSE) ##### [LICENSE](https://github.com/kokkos/kokkos/blob/devel/LICENSE)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

View File

@ -2,111 +2,108 @@
find_package(Git QUIET) find_package(Git QUIET)
SET(CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) set(CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
SET(pre_configure_dir ${CMAKE_CURRENT_LIST_DIR}) set(pre_configure_dir ${CMAKE_CURRENT_LIST_DIR})
SET(post_configure_dir ${CMAKE_BINARY_DIR}/generated) set(post_configure_dir ${CMAKE_BINARY_DIR}/generated)
SET(pre_configure_file ${pre_configure_dir}/Kokkos_Version_Info.cpp.in) set(pre_configure_file ${pre_configure_dir}/Kokkos_Version_Info.cpp.in)
SET(post_configure_file ${post_configure_dir}/Kokkos_Version_Info.cpp) set(post_configure_file ${post_configure_dir}/Kokkos_Version_Info.cpp)
FUNCTION(check_git_write git_hash git_clean_status) function(check_git_write git_hash git_clean_status)
FILE( file(WRITE ${CMAKE_BINARY_DIR}/git-state.txt "${git_hash}-${git_clean_status}")
WRITE endfunction()
${CMAKE_BINARY_DIR}/git-state.txt
"${git_hash}-${git_clean_status}")
ENDFUNCTION()
FUNCTION(check_git_read git_hash) function(check_git_read git_hash)
IF(EXISTS ${CMAKE_BINARY_DIR}/git-state.txt) if(EXISTS ${CMAKE_BINARY_DIR}/git-state.txt)
FILE(STRINGS ${CMAKE_BINARY_DIR}/git-state.txt CONTENT) file(STRINGS ${CMAKE_BINARY_DIR}/git-state.txt CONTENT)
LIST(GET CONTENT 0 var) list(GET CONTENT 0 var)
message(DEBUG "Cached Git hash: ${var}") message(DEBUG "Cached Git hash: ${var}")
SET(${git_hash} ${var} PARENT_SCOPE) set(${git_hash} ${var} PARENT_SCOPE)
else() else()
SET(${git_hash} "INVALID" PARENT_SCOPE) set(${git_hash} "INVALID" PARENT_SCOPE)
ENDIF() endif()
ENDFUNCTION() endfunction()
FUNCTION(check_git_version) function(check_git_version)
IF(NOT EXISTS ${post_configure_dir}/Kokkos_Version_Info.hpp) if(NOT EXISTS ${post_configure_dir}/Kokkos_Version_Info.hpp)
FILE( file(COPY ${pre_configure_dir}/Kokkos_Version_Info.hpp DESTINATION ${post_configure_dir})
COPY ${pre_configure_dir}/Kokkos_Version_Info.hpp endif()
DESTINATION ${post_configure_dir})
ENDIF()
IF(NOT Git_FOUND OR NOT EXISTS ${KOKKOS_SOURCE_DIR}/.git) if(NOT Git_FOUND OR NOT EXISTS ${KOKKOS_SOURCE_DIR}/.git)
configure_file(${pre_configure_file} ${post_configure_file} @ONLY) configure_file(${pre_configure_file} ${post_configure_file} @ONLY)
return() return()
ENDIF() endif()
# Get the current working branch # Get the current working branch
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest commit description # Get the latest commit description
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} show -s --format=%s COMMAND ${GIT_EXECUTABLE} show -s --format=%s
WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_DESCRIPTION OUTPUT_VARIABLE GIT_COMMIT_DESCRIPTION
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest commit date # Get the latest commit date
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%cI COMMAND ${GIT_EXECUTABLE} log -1 --format=%cI
WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_VARIABLE GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Check if repo is dirty / clean # Check if repo is dirty / clean
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD -- COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD --
WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
RESULT_VARIABLE IS_DIRTY RESULT_VARIABLE IS_DIRTY
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF(IS_DIRTY EQUAL 0) if(IS_DIRTY EQUAL 0)
SET(GIT_CLEAN_STATUS "CLEAN") set(GIT_CLEAN_STATUS "CLEAN")
else() else()
SET(GIT_CLEAN_STATUS "DIRTY") set(GIT_CLEAN_STATUS "DIRTY")
ENDIF() endif()
# Get the latest abbreviated commit hash of the working branch # Get the latest abbreviated commit hash of the working branch
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE
)
check_git_read(GIT_HASH_CACHE) check_git_read(GIT_HASH_CACHE)
IF(NOT EXISTS ${post_configure_dir}) if(NOT EXISTS ${post_configure_dir})
file(MAKE_DIRECTORY ${post_configure_dir}) file(MAKE_DIRECTORY ${post_configure_dir})
ENDIF() endif()
# Only update the git_version.cpp if the hash has changed. This will # Only update the git_version.cpp if the hash has changed. This will
# prevent us from rebuilding the project more than we need to. # prevent us from rebuilding the project more than we need to.
IF(NOT "${GIT_COMMIT_HASH}-${GIT_CLEAN_STATUS}" STREQUAL ${GIT_HASH_CACHE} if(NOT "${GIT_COMMIT_HASH}-${GIT_CLEAN_STATUS}" STREQUAL ${GIT_HASH_CACHE} OR NOT EXISTS ${post_configure_file})
OR NOT EXISTS ${post_configure_file})
# Set the GIT_HASH_CACHE variable so the next build won't have # Set the GIT_HASH_CACHE variable so the next build won't have
# to regenerate the source file. # to regenerate the source file.
check_git_write(${GIT_COMMIT_HASH} ${GIT_CLEAN_STATUS}) check_git_write(${GIT_COMMIT_HASH} ${GIT_CLEAN_STATUS})
configure_file(${pre_configure_file} ${post_configure_file} @ONLY) configure_file(${pre_configure_file} ${post_configure_file} @ONLY)
message(STATUS "Configured git information in ${post_configure_file}") message(STATUS "Configured git information in ${post_configure_file}")
ENDIF() endif()
ENDFUNCTION() endfunction()
FUNCTION(check_git_setup) function(check_git_setup)
add_custom_target( add_custom_target(
AlwaysCheckGit COMMAND ${CMAKE_COMMAND} AlwaysCheckGit COMMAND ${CMAKE_COMMAND} -DRUN_CHECK_GIT_VERSION=1 -DKOKKOS_SOURCE_DIR=${Kokkos_SOURCE_DIR} -P
-DRUN_CHECK_GIT_VERSION=1 ${CURRENT_LIST_DIR}/build_env_info.cmake BYPRODUCTS ${post_configure_file}
-DKOKKOS_SOURCE_DIR=${Kokkos_SOURCE_DIR} )
-P ${CURRENT_LIST_DIR}/build_env_info.cmake
BYPRODUCTS ${post_configure_file})
add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp) add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp)
target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated) target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated)
@ -114,9 +111,9 @@ FUNCTION(check_git_setup)
add_dependencies(impl_git_version AlwaysCheckGit) add_dependencies(impl_git_version AlwaysCheckGit)
check_git_version() check_git_version()
ENDFUNCTION() endfunction()
# This is used to run this function from an external cmake process. # This is used to run this function from an external cmake process.
IF(RUN_CHECK_GIT_VERSION) if(RUN_CHECK_GIT_VERSION)
check_git_version() check_git_version()
ENDIF() endif()

View File

@ -14,5 +14,25 @@
// //
//@HEADER //@HEADER
#include <TestSYCL_Category.hpp> #include <iostream>
#include <TestTaskScheduler.hpp> #include <hip/hip_runtime_api.h>
int main() {
hipDeviceProp_t hipProp;
hipError_t error = hipGetDeviceProperties(&hipProp, 0);
if (error != hipSuccess) {
std::cout << hipGetErrorString(error) << '\n';
return error;
}
if (hipProp.integrated == 1) {
// We detected an APU
std::cout << "ON";
} else {
// We detected a discrete GPU
std::cout << "OFF";
}
return 0;
}

View File

@ -1,9 +1,6 @@
function(kokkos_set_cray_flags full_standard int_standard) function(kokkos_set_cray_flags full_standard int_standard)
STRING(TOLOWER ${full_standard} FULL_LC_STANDARD) string(TOLOWER ${full_standard} FULL_LC_STANDARD)
STRING(TOLOWER ${int_standard} INT_LC_STANDARD) string(TOLOWER ${int_standard} INT_LC_STANDARD)
SET(KOKKOS_CXX_STANDARD_FLAG "-hstd=c++${FULL_LC_STANDARD}", PARENT_SCOPE) set(KOKKOS_CXX_STANDARD_FLAG "-hstd=c++${FULL_LC_STANDARD}", PARENT_SCOPE)
SET(KOKKOS_CXX_INTERMDIATE_STANDARD_FLAG "-hstd=c++${INT_LC_STANDARD}" PARENT_SCOPE) set(KOKKOS_CXX_INTERMDIATE_STANDARD_FLAG "-hstd=c++${INT_LC_STANDARD}" PARENT_SCOPE)
endfunction() endfunction()

View File

@ -17,24 +17,24 @@
# Check for CUDA support # Check for CUDA support
SET(_CUDA_FAILURE OFF) set(_CUDA_FAILURE OFF)
# Have CMake find CUDA # Have CMake find CUDA
IF(NOT _CUDA_FAILURE) if(NOT _CUDA_FAILURE)
FIND_PACKAGE(CUDA 3.2) find_package(CUDA 3.2)
IF (NOT CUDA_FOUND) if(NOT CUDA_FOUND)
SET(_CUDA_FAILURE ON) set(_CUDA_FAILURE ON)
ENDIF() endif()
ENDIF() endif()
IF(NOT _CUDA_FAILURE) if(NOT _CUDA_FAILURE)
# if we haven't met failure # if we haven't met failure
macro(PACKAGE_ADD_CUDA_LIBRARY cuda_target) macro(PACKAGE_ADD_CUDA_LIBRARY cuda_target)
TRIBITS_ADD_LIBRARY(${cuda_target} ${ARGN} CUDALIBRARY) tribits_add_library(${cuda_target} ${ARGN} CUDALIBRARY)
endmacro() endmacro()
GLOBAL_SET(TPL_CUDA_LIBRARY_DIRS) global_set(TPL_CUDA_LIBRARY_DIRS)
GLOBAL_SET(TPL_CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE}) global_set(TPL_CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
GLOBAL_SET(TPL_CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_cufft_LIBRARY}) global_set(TPL_CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY} ${CUDA_cublas_LIBRARY} ${CUDA_cufft_LIBRARY})
ELSE() else()
SET(TPL_ENABLE_CUDA OFF) set(TPL_ENABLE_CUDA OFF)
ENDIF() endif()

View File

@ -15,7 +15,6 @@
# ************************************************************************ # ************************************************************************
# @HEADER # @HEADER
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Hardware locality detection and control library. # Hardware locality detection and control library.
# #
@ -26,7 +25,4 @@
# Version: 1.3 # Version: 1.3
# #
KOKKOS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( HWLOC kokkos_tpl_find_include_dirs_and_libraries(HWLOC REQUIRED_HEADERS hwloc.h REQUIRED_LIBS_NAMES "hwloc")
REQUIRED_HEADERS hwloc.h
REQUIRED_LIBS_NAMES "hwloc"
)

View File

@ -15,31 +15,27 @@
# ************************************************************************ # ************************************************************************
# @HEADER # @HEADER
set(USE_THREADS FALSE)
SET(USE_THREADS FALSE) if(NOT TPL_Pthread_INCLUDE_DIRS AND NOT TPL_Pthread_LIBRARY_DIRS AND NOT TPL_Pthread_LIBRARIES)
IF(NOT TPL_Pthread_INCLUDE_DIRS AND NOT TPL_Pthread_LIBRARY_DIRS AND NOT TPL_Pthread_LIBRARIES)
# Use CMake's Thread finder since it is a bit smarter in determining # Use CMake's Thread finder since it is a bit smarter in determining
# whether pthreads is already built into the compiler and doesn't need # whether pthreads is already built into the compiler and doesn't need
# a library to link. # a library to link.
FIND_PACKAGE(Threads) find_package(Threads)
#If Threads found a copy of pthreads make sure it is one of the cases the tribits #If Threads found a copy of pthreads make sure it is one of the cases the tribits
#tpl system cannot handle. #tpl system cannot handle.
IF(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
IF(CMAKE_THREAD_LIBS_INIT STREQUAL "" OR CMAKE_THREAD_LIBS_INIT STREQUAL "-pthread") if(CMAKE_THREAD_LIBS_INIT STREQUAL "" OR CMAKE_THREAD_LIBS_INIT STREQUAL "-pthread")
SET(USE_THREADS TRUE) set(USE_THREADS TRUE)
ENDIF() endif()
ENDIF() endif()
ENDIF() endif()
IF(USE_THREADS) if(USE_THREADS)
SET(TPL_Pthread_INCLUDE_DIRS "") set(TPL_Pthread_INCLUDE_DIRS "")
SET(TPL_Pthread_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") set(TPL_Pthread_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
SET(TPL_Pthread_LIBRARY_DIRS "") set(TPL_Pthread_LIBRARY_DIRS "")
KOKKOS_CREATE_IMPORTED_TPL_LIBRARY(Pthread) kokkos_create_imported_tpl_library(Pthread)
ELSE() else()
KOKKOS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( Pthread kokkos_tpl_find_include_dirs_and_libraries(Pthread REQUIRED_HEADERS pthread.h REQUIRED_LIBS_NAMES pthread)
REQUIRED_HEADERS pthread.h endif()
REQUIRED_LIBS_NAMES pthread
)
ENDIF()

View File

@ -15,7 +15,4 @@
# ************************************************************************ # ************************************************************************
# @HEADER # @HEADER
KOKKOS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( quadmath kokkos_tpl_find_include_dirs_and_libraries(quadmath REQUIRED_HEADERS quadmath.h REQUIRED_LIBS_NAMES quadmath)
REQUIRED_HEADERS quadmath.h
REQUIRED_LIBS_NAMES quadmath
)

View File

@ -1,270 +1,195 @@
#These are tribits wrappers used by all projects in the Kokkos ecosystem #These are tribits wrappers used by all projects in the Kokkos ecosystem
INCLUDE(CMakeParseArguments) include(CMakeParseArguments)
INCLUDE(CTest) include(CTest)
FUNCTION(ASSERT_DEFINED VARS) function(ASSERT_DEFINED VARS)
FOREACH(VAR ${VARS}) foreach(VAR ${VARS})
IF(NOT DEFINED ${VAR}) if(NOT DEFINED ${VAR})
MESSAGE(SEND_ERROR "Error, the variable ${VAR} is not defined!") message(SEND_ERROR "Error, the variable ${VAR} is not defined!")
ENDIF() endif()
ENDFOREACH()
ENDFUNCTION()
IF(NOT KOKKOS_HAS_TRILINOS)
MACRO(APPEND_GLOB VAR)
FILE(GLOB LOCAL_TMP_VAR ${ARGN})
LIST(APPEND ${VAR} ${LOCAL_TMP_VAR})
ENDMACRO()
MACRO(GLOBAL_SET VARNAME)
SET(${VARNAME} ${ARGN} CACHE INTERNAL "" FORCE)
ENDMACRO()
MACRO(PREPEND_GLOBAL_SET VARNAME)
ASSERT_DEFINED(${VARNAME})
GLOBAL_SET(${VARNAME} ${ARGN} ${${VARNAME}})
ENDMACRO()
ENDIF()
MACRO(ADD_INTERFACE_LIBRARY LIB_NAME)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
ADD_LIBRARY(${LIB_NAME} STATIC ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES INTERFACE TRUE)
ENDMACRO()
FUNCTION(KOKKOS_ADD_TEST)
if (KOKKOS_HAS_TRILINOS)
CMAKE_PARSE_ARGUMENTS(TEST
"SKIP_TRIBITS"
"EXE;NAME;TOOL"
"ARGS"
${ARGN})
IF(TEST_SKIP_TRIBITS)
MESSAGE(STATUS "Skipping test ${TEST_NAME} in TriBits")
RETURN()
ENDIF()
IF(TEST_EXE)
SET(EXE_ROOT ${TEST_EXE})
ELSE()
SET(EXE_ROOT ${TEST_NAME})
ENDIF()
TRIBITS_ADD_TEST(
${EXE_ROOT}
NAME ${TEST_NAME}
COMM serial mpi
NUM_MPI_PROCS 1
ARGS ${TEST_ARGS}
${TEST_UNPARSED_ARGUMENTS}
ADDED_TESTS_NAMES_OUT ALL_TESTS_ADDED
)
# We will get prepended package name here
SET(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME})
SET(EXE ${PACKAGE_NAME}_${EXE_ROOT})
# The function TRIBITS_ADD_TEST() has a CATEGORIES argument that defaults
# to BASIC. If a project elects to only enable tests marked as PERFORMANCE,
# the test won't actually be added and attempting to set a property on it below
# will yield an error.
if(TARGET ${EXE})
if(TEST_TOOL)
add_dependencies(${EXE} ${TEST_TOOL}) #make sure the exe has to build the tool
foreach(TEST_ADDED ${ALL_TESTS_ADDED})
set_property(TEST ${TEST_ADDED} APPEND PROPERTY ENVIRONMENT "KOKKOS_TOOLS_LIBS=$<TARGET_FILE:${TEST_TOOL}>")
endforeach() endforeach()
endif() endfunction()
endif()
else()
CMAKE_PARSE_ARGUMENTS(TEST
"WILL_FAIL;SKIP_TRIBITS"
"FAIL_REGULAR_EXPRESSION;PASS_REGULAR_EXPRESSION;EXE;NAME;TOOL"
"CATEGORIES;ARGS"
${ARGN})
# To match Tribits, we should always be receiving
# the root names of exes/libs
IF(TEST_EXE)
SET(EXE_ROOT ${TEST_EXE})
ELSE()
SET(EXE_ROOT ${TEST_NAME})
ENDIF()
# Prepend package name to the test name
# These should be the full target name
SET(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME})
SET(EXE ${PACKAGE_NAME}_${EXE_ROOT})
IF(WIN32)
ADD_TEST(NAME ${TEST_NAME} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
COMMAND ${EXE}${CMAKE_EXECUTABLE_SUFFIX} ${TEST_ARGS})
ELSE()
ADD_TEST(NAME ${TEST_NAME} COMMAND ${EXE} ${TEST_ARGS})
ENDIF()
IF(TEST_WILL_FAIL)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES WILL_FAIL ${TEST_WILL_FAIL})
ENDIF()
IF(TEST_FAIL_REGULAR_EXPRESSION)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION ${TEST_FAIL_REGULAR_EXPRESSION})
ENDIF()
IF(TEST_PASS_REGULAR_EXPRESSION)
SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES PASS_REGULAR_EXPRESSION ${TEST_PASS_REGULAR_EXPRESSION})
ENDIF()
IF(TEST_TOOL)
ADD_DEPENDENCIES(${EXE} ${TEST_TOOL}) #make sure the exe has to build the tool
SET_PROPERTY(TEST ${TEST_NAME} APPEND_STRING PROPERTY ENVIRONMENT "KOKKOS_PROFILE_LIBRARY=$<TARGET_FILE:${TEST_TOOL}>")
ENDIF()
VERIFY_EMPTY(KOKKOS_ADD_TEST ${TEST_UNPARSED_ARGUMENTS})
ENDIF()
ENDFUNCTION()
MACRO(KOKKOS_CREATE_IMPORTED_TPL_LIBRARY TPL_NAME) macro(APPEND_GLOB VAR)
ADD_INTERFACE_LIBRARY(TPL_LIB_${TPL_NAME}) file(GLOB LOCAL_TMP_VAR ${ARGN})
TARGET_LINK_LIBRARIES(TPL_LIB_${TPL_NAME} LINK_PUBLIC ${TPL_${TPL_NAME}_LIBRARIES}) list(APPEND ${VAR} ${LOCAL_TMP_VAR})
TARGET_INCLUDE_DIRECTORIES(TPL_LIB_${TPL_NAME} INTERFACE ${TPL_${TPL_NAME}_INCLUDE_DIRS}) endmacro()
ENDMACRO()
FUNCTION(KOKKOS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME) macro(GLOBAL_SET VARNAME)
if (KOKKOS_HAS_TRILINOS) set(${VARNAME} ${ARGN} CACHE INTERNAL "" FORCE)
TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES(${TPL_NAME} ${ARGN}) endmacro()
else()
CMAKE_PARSE_ARGUMENTS(PARSE
""
""
"REQUIRED_HEADERS;REQUIRED_LIBS_NAMES"
${ARGN})
SET(_${TPL_NAME}_ENABLE_SUCCESS TRUE) macro(PREPEND_GLOBAL_SET VARNAME)
IF (PARSE_REQUIRED_LIBS_NAMES) assert_defined(${VARNAME})
FIND_LIBRARY(TPL_${TPL_NAME}_LIBRARIES NAMES ${PARSE_REQUIRED_LIBS_NAMES}) global_set(${VARNAME} ${ARGN} ${${VARNAME}})
IF(NOT TPL_${TPL_NAME}_LIBRARIES) endmacro()
SET(_${TPL_NAME}_ENABLE_SUCCESS FALSE)
ENDIF()
ENDIF()
IF (PARSE_REQUIRED_HEADERS)
FIND_PATH(TPL_${TPL_NAME}_INCLUDE_DIRS NAMES ${PARSE_REQUIRED_HEADERS})
IF(NOT TPL_${TPL_NAME}_INCLUDE_DIRS)
SET(_${TPL_NAME}_ENABLE_SUCCESS FALSE)
ENDIF()
ENDIF()
IF (_${TPL_NAME}_ENABLE_SUCCESS)
KOKKOS_CREATE_IMPORTED_TPL_LIBRARY(${TPL_NAME})
ENDIF()
VERIFY_EMPTY(KOKKOS_CREATE_IMPORTED_TPL_LIBRARY ${PARSE_UNPARSED_ARGUMENTS})
endif()
ENDFUNCTION()
MACRO(KOKKOS_TARGET_COMPILE_OPTIONS TARGET) macro(ADD_INTERFACE_LIBRARY LIB_NAME)
if(KOKKOS_HAS_TRILINOS) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "")
TARGET_COMPILE_OPTIONS(${TARGET} ${ARGN}) add_library(${LIB_NAME} STATIC ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
else() set_target_properties(${LIB_NAME} PROPERTIES INTERFACE TRUE)
TARGET_COMPILE_OPTIONS(${TARGET} ${ARGN}) endmacro()
endif()
ENDMACRO()
FUNCTION(KOKKOS_LIB_TYPE LIB RET) function(KOKKOS_ADD_TEST)
GET_TARGET_PROPERTY(PROP ${LIB} TYPE) cmake_parse_arguments(
IF (${PROP} STREQUAL "INTERFACE_LIBRARY") TEST "WILL_FAIL;SKIP_TRIBITS" "FAIL_REGULAR_EXPRESSION;PASS_REGULAR_EXPRESSION;EXE;NAME;TOOL" "CATEGORIES;ARGS"
SET(${RET} "INTERFACE" PARENT_SCOPE)
ELSE()
SET(${RET} "PUBLIC" PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
FUNCTION(KOKKOS_TARGET_INCLUDE_DIRECTORIES TARGET)
IF(KOKKOS_HAS_TRILINOS)
KOKKOS_LIB_TYPE(${TARGET} INCTYPE)
#don't trust tribits to do this correctly - but need to add package name
TARGET_INCLUDE_DIRECTORIES(${TARGET} ${INCTYPE} ${ARGN})
ELSEIF(TARGET ${TARGET})
#the target actually exists - this means we are doing separate libs
#or this a test library
KOKKOS_LIB_TYPE(${TARGET} INCTYPE)
TARGET_INCLUDE_DIRECTORIES(${TARGET} ${INCTYPE} ${ARGN})
ELSE()
GET_PROPERTY(LIBS GLOBAL PROPERTY KOKKOS_LIBRARIES_NAMES)
IF (${TARGET} IN_LIST LIBS)
SET_PROPERTY(GLOBAL APPEND PROPERTY KOKKOS_LIBRARY_INCLUDES ${ARGN})
ELSE()
MESSAGE(FATAL_ERROR "Trying to set include directories on unknown target ${TARGET}")
ENDIF()
ENDIF()
ENDFUNCTION()
FUNCTION(KOKKOS_LINK_INTERNAL_LIBRARY TARGET DEPLIB)
IF(KOKKOS_HAS_TRILINOS)
#do nothing
ELSE()
SET(options INTERFACE)
SET(oneValueArgs)
SET(multiValueArgs)
CMAKE_PARSE_ARGUMENTS(PARSE
"INTERFACE"
""
""
${ARGN})
SET(LINK_TYPE)
IF(PARSE_INTERFACE)
SET(LINK_TYPE INTERFACE)
ELSE()
SET(LINK_TYPE PUBLIC)
ENDIF()
TARGET_LINK_LIBRARIES(${TARGET} ${LINK_TYPE} ${DEPLIB})
VERIFY_EMPTY(KOKKOS_LINK_INTERNAL_LIBRARY ${PARSE_UNPARSED_ARGUMENTS})
ENDIF()
ENDFUNCTION()
FUNCTION(KOKKOS_ADD_TEST_LIBRARY NAME)
IF (KOKKOS_HAS_TRILINOS)
TRIBITS_ADD_LIBRARY(${NAME} ${ARGN} TESTONLY)
ELSE()
SET(oneValueArgs)
SET(multiValueArgs HEADERS SOURCES)
CMAKE_PARSE_ARGUMENTS(PARSE
"STATIC;SHARED"
""
"HEADERS;SOURCES;DEPLIBS"
${ARGN})
SET(LIB_TYPE)
IF (PARSE_STATIC)
SET(LIB_TYPE STATIC)
ELSEIF (PARSE_SHARED)
SET(LIB_TYPE SHARED)
ENDIF()
IF(PARSE_HEADERS)
LIST(REMOVE_DUPLICATES PARSE_HEADERS)
ENDIF()
IF(PARSE_SOURCES)
LIST(REMOVE_DUPLICATES PARSE_SOURCES)
ENDIF()
ADD_LIBRARY(${NAME} ${LIB_TYPE} ${PARSE_SOURCES})
IF (PARSE_DEPLIBS)
TARGET_LINK_LIBRARIES(${NAME} PRIVATE ${PARSE_DEPLIBS})
ENDIF()
ENDIF()
ENDFUNCTION()
FUNCTION(KOKKOS_INCLUDE_DIRECTORIES)
IF(KOKKOS_HAS_TRILINOS)
TRIBITS_INCLUDE_DIRECTORIES(${ARGN})
ELSE()
CMAKE_PARSE_ARGUMENTS(
INC
"REQUIRED_DURING_INSTALLATION_TESTING"
""
""
${ARGN} ${ARGN}
) )
INCLUDE_DIRECTORIES(${INC_UNPARSED_ARGUMENTS}) # To match Tribits, we should always be receiving
ENDIF() # the root names of exes/libs
ENDFUNCTION() if(TEST_EXE)
set(EXE_ROOT ${TEST_EXE})
else()
set(EXE_ROOT ${TEST_NAME})
endif()
# Prepend package name to the test name
# These should be the full target name
set(TEST_NAME ${PACKAGE_NAME}_${TEST_NAME})
# For compatibility with Trilinos testing, we support:
# * `-D <fullTestName>_DISABLE=ON`
# * `-D <fullTestName>_EXTRA_ARGS="<arg0>;<arg1>;<arg2>;..."`
# * `-D <fullTestName>_SET_RUN_SERIAL=ON`
if(${TEST_NAME}_DISABLE)
return()
endif()
MACRO(PRINTALL match) set(EXE ${PACKAGE_NAME}_${EXE_ROOT})
if(WIN32)
add_test(NAME ${TEST_NAME} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${EXE}${CMAKE_EXECUTABLE_SUFFIX}
${TEST_ARGS} ${${TEST_NAME}_EXTRA_ARGS}
)
else()
add_test(NAME ${TEST_NAME} COMMAND ${EXE} ${TEST_ARGS} ${${TEST_NAME}_EXTRA_ARGS})
endif()
# Trilinos testing benefits from labeling the tests as "Kokkos" tests
set_tests_properties(${TEST_NAME} PROPERTIES LABELS Kokkos)
if(${TEST_NAME}_SET_RUN_SERIAL)
set_tests_properties(${TEST_NAME} PROPERTIES RUN_SERIAL ON)
endif()
# TriBITS doesn't actually currently support `-D <fullTestName>_ENVIRONMENT`
# but we decided to add it anyway
if(${TEST_NAME}_ENVIRONMENT)
set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT "${${TEST_NAME}_ENVIRONMENT}")
endif()
if(TEST_WILL_FAIL)
set_tests_properties(${TEST_NAME} PROPERTIES WILL_FAIL ${TEST_WILL_FAIL})
endif()
if(TEST_FAIL_REGULAR_EXPRESSION)
set_tests_properties(${TEST_NAME} PROPERTIES FAIL_REGULAR_EXPRESSION ${TEST_FAIL_REGULAR_EXPRESSION})
endif()
if(TEST_PASS_REGULAR_EXPRESSION)
set_tests_properties(${TEST_NAME} PROPERTIES PASS_REGULAR_EXPRESSION ${TEST_PASS_REGULAR_EXPRESSION})
endif()
if(TEST_TOOL)
add_dependencies(${EXE} ${TEST_TOOL}) #make sure the exe has to build the tool
set_property(
TEST ${TEST_NAME} APPEND_STRING PROPERTY ENVIRONMENT "KOKKOS_PROFILE_LIBRARY=$<TARGET_FILE:${TEST_TOOL}>"
)
endif()
verify_empty(KOKKOS_ADD_TEST ${TEST_UNPARSED_ARGUMENTS})
endfunction()
macro(KOKKOS_CREATE_IMPORTED_TPL_LIBRARY TPL_NAME)
add_interface_library(TPL_LIB_${TPL_NAME})
target_link_libraries(TPL_LIB_${TPL_NAME} LINK_PUBLIC ${TPL_${TPL_NAME}_LIBRARIES})
target_include_directories(TPL_LIB_${TPL_NAME} INTERFACE ${TPL_${TPL_NAME}_INCLUDE_DIRS})
endmacro()
function(KOKKOS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES TPL_NAME)
cmake_parse_arguments(PARSE "" "" "REQUIRED_HEADERS;REQUIRED_LIBS_NAMES" ${ARGN})
set(_${TPL_NAME}_ENABLE_SUCCESS TRUE)
if(PARSE_REQUIRED_LIBS_NAMES)
find_library(TPL_${TPL_NAME}_LIBRARIES NAMES ${PARSE_REQUIRED_LIBS_NAMES})
if(NOT TPL_${TPL_NAME}_LIBRARIES)
set(_${TPL_NAME}_ENABLE_SUCCESS FALSE)
endif()
endif()
if(PARSE_REQUIRED_HEADERS)
find_path(TPL_${TPL_NAME}_INCLUDE_DIRS NAMES ${PARSE_REQUIRED_HEADERS})
if(NOT TPL_${TPL_NAME}_INCLUDE_DIRS)
set(_${TPL_NAME}_ENABLE_SUCCESS FALSE)
endif()
endif()
if(_${TPL_NAME}_ENABLE_SUCCESS)
kokkos_create_imported_tpl_library(${TPL_NAME})
endif()
verify_empty(KOKKOS_CREATE_IMPORTED_TPL_LIBRARY ${PARSE_UNPARSED_ARGUMENTS})
endfunction()
function(KOKKOS_LIB_TYPE LIB RET)
get_target_property(PROP ${LIB} TYPE)
if(${PROP} STREQUAL "INTERFACE_LIBRARY")
set(${RET} "INTERFACE" PARENT_SCOPE)
else()
set(${RET} "PUBLIC" PARENT_SCOPE)
endif()
endfunction()
function(KOKKOS_TARGET_INCLUDE_DIRECTORIES TARGET)
if(TARGET ${TARGET})
#the target actually exists - this means we are doing separate libs
#or this a test library
kokkos_lib_type(${TARGET} INCTYPE)
target_include_directories(${TARGET} ${INCTYPE} ${ARGN})
else()
get_property(LIBS GLOBAL PROPERTY KOKKOS_LIBRARIES_NAMES)
if(${TARGET} IN_LIST LIBS)
set_property(GLOBAL APPEND PROPERTY KOKKOS_LIBRARY_INCLUDES ${ARGN})
else()
message(FATAL_ERROR "Trying to set include directories on unknown target ${TARGET}")
endif()
endif()
endfunction()
function(KOKKOS_LINK_INTERNAL_LIBRARY TARGET DEPLIB)
set(options INTERFACE)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(PARSE "INTERFACE" "" "" ${ARGN})
set(LINK_TYPE)
if(PARSE_INTERFACE)
set(LINK_TYPE INTERFACE)
else()
set(LINK_TYPE PUBLIC)
endif()
target_link_libraries(${TARGET} ${LINK_TYPE} ${DEPLIB})
verify_empty(KOKKOS_LINK_INTERNAL_LIBRARY ${PARSE_UNPARSED_ARGUMENTS})
endfunction()
function(KOKKOS_ADD_TEST_LIBRARY NAME)
set(oneValueArgs)
set(multiValueArgs HEADERS SOURCES)
cmake_parse_arguments(PARSE "STATIC;SHARED" "" "HEADERS;SOURCES;DEPLIBS" ${ARGN})
set(LIB_TYPE)
if(PARSE_STATIC)
set(LIB_TYPE STATIC)
elseif(PARSE_SHARED)
set(LIB_TYPE SHARED)
endif()
if(PARSE_HEADERS)
list(REMOVE_DUPLICATES PARSE_HEADERS)
endif()
if(PARSE_SOURCES)
list(REMOVE_DUPLICATES PARSE_SOURCES)
endif()
add_library(${NAME} ${LIB_TYPE} ${PARSE_SOURCES})
if(PARSE_DEPLIBS)
target_link_libraries(${NAME} PRIVATE ${PARSE_DEPLIBS})
endif()
endfunction()
function(KOKKOS_INCLUDE_DIRECTORIES)
cmake_parse_arguments(INC "REQUIRED_DURING_INSTALLATION_TESTING" "" "" ${ARGN})
include_directories(${INC_UNPARSED_ARGUMENTS})
endfunction()
macro(PRINTALL match)
get_cmake_property(_variableNames VARIABLES) get_cmake_property(_variableNames VARIABLES)
list(SORT _variableNames) list(SORT _variableNames)
foreach(_variableName ${_variableNames}) foreach(_variableName ${_variableNames})
@ -272,17 +197,17 @@ foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}") message(STATUS "${_variableName}=${${_variableName}}")
endif() endif()
endforeach() endforeach()
ENDMACRO() endmacro()
MACRO(SET_GLOBAL_REPLACE SUBSTR VARNAME) macro(SET_GLOBAL_REPLACE SUBSTR VARNAME)
STRING(REPLACE ${SUBSTR} ${${VARNAME}} TEMP) string(REPLACE ${SUBSTR} ${${VARNAME}} TEMP)
GLOBAL_SET(${VARNAME} ${TEMP}) global_set(${VARNAME} ${TEMP})
ENDMACRO() endmacro()
FUNCTION(GLOBAL_APPEND VARNAME) function(GLOBAL_APPEND VARNAME)
#We make this a function since we are setting variables #We make this a function since we are setting variables
#and want to use scope to avoid overwriting local variables #and want to use scope to avoid overwriting local variables
SET(TEMP ${${VARNAME}}) set(TEMP ${${VARNAME}})
LIST(APPEND TEMP ${ARGN}) list(APPEND TEMP ${ARGN})
GLOBAL_SET(${VARNAME} ${TEMP}) global_set(${VARNAME} ${TEMP})
ENDFUNCTION() endfunction()

View File

@ -1,23 +1,21 @@
function(kokkos_set_gnu_flags full_standard int_standard)
FUNCTION(kokkos_set_gnu_flags full_standard int_standard) string(TOLOWER ${full_standard} FULL_LC_STANDARD)
STRING(TOLOWER ${full_standard} FULL_LC_STANDARD) string(TOLOWER ${int_standard} INT_LC_STANDARD)
STRING(TOLOWER ${int_standard} INT_LC_STANDARD)
# The following three blocks of code were copied from # The following three blocks of code were copied from
# /Modules/Compiler/Intel-CXX.cmake from CMake 3.7.2 and then modified. # /Modules/Compiler/Intel-CXX.cmake from CMake 3.7.2 and then modified.
IF(CMAKE_CXX_SIMULATE_ID STREQUAL MSVC) if(CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
SET(_std -Qstd) set(_std -Qstd)
SET(_ext c++) set(_ext c++)
ELSE() else()
SET(_std -std) set(_std -std)
SET(_ext gnu++) set(_ext gnu++)
ENDIF() endif()
IF (CMAKE_CXX_EXTENSIONS)
SET(KOKKOS_CXX_STANDARD_FLAG "-std=gnu++${FULL_LC_STANDARD}" PARENT_SCOPE)
SET(KOKKOS_CXX_INTERMEDIATE_STANDARD_FLAG "-std=gnu++${INT_LC_STANDARD}" PARENT_SCOPE)
ELSE()
SET(KOKKOS_CXX_STANDARD_FLAG "-std=c++${FULL_LC_STANDARD}" PARENT_SCOPE)
SET(KOKKOS_CXX_INTERMEDIATE_STANDARD_FLAG "-std=c++${INT_LC_STANDARD}" PARENT_SCOPE)
ENDIF()
ENDFUNCTION()
if(CMAKE_CXX_EXTENSIONS)
set(KOKKOS_CXX_STANDARD_FLAG "-std=gnu++${FULL_LC_STANDARD}" PARENT_SCOPE)
set(KOKKOS_CXX_INTERMEDIATE_STANDARD_FLAG "-std=gnu++${INT_LC_STANDARD}" PARENT_SCOPE)
else()
set(KOKKOS_CXX_STANDARD_FLAG "-std=c++${FULL_LC_STANDARD}" PARENT_SCOPE)
set(KOKKOS_CXX_INTERMEDIATE_STANDARD_FLAG "-std=c++${INT_LC_STANDARD}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -1,18 +1,15 @@
function(kokkos_set_intel_flags full_standard int_standard)
FUNCTION(kokkos_set_intel_flags full_standard int_standard) string(TOLOWER ${full_standard} FULL_LC_STANDARD)
STRING(TOLOWER ${full_standard} FULL_LC_STANDARD) string(TOLOWER ${int_standard} INT_LC_STANDARD)
STRING(TOLOWER ${int_standard} INT_LC_STANDARD)
# The following three blocks of code were copied from # The following three blocks of code were copied from
# /Modules/Compiler/Intel-CXX.cmake from CMake 3.18.1 and then modified. # /Modules/Compiler/Intel-CXX.cmake from CMake 3.18.1 and then modified.
IF(CMAKE_CXX_SIMULATE_ID STREQUAL MSVC) if(CMAKE_CXX_SIMULATE_ID STREQUAL MSVC)
SET(_std -Qstd) set(_std -Qstd)
SET(_ext c++) set(_ext c++)
ELSE() else()
SET(_std -std) set(_std -std)
SET(_ext gnu++) set(_ext gnu++)
ENDIF() endif()
SET(KOKKOS_CXX_STANDARD_FLAG "${_std}=c++${FULL_LC_STANDARD}" PARENT_SCOPE) set(KOKKOS_CXX_STANDARD_FLAG "${_std}=c++${FULL_LC_STANDARD}" PARENT_SCOPE)
SET(KOKKOS_CXX_INTERMDIATE_STANDARD_FLAG "${_std}=${_ext}${INT_LC_STANDARD}" PARENT_SCOPE) set(KOKKOS_CXX_INTERMDIATE_STANDARD_FLAG "${_std}=${_ext}${INT_LC_STANDARD}" PARENT_SCOPE)
ENDFUNCTION() endfunction()

Some files were not shown because too many files have changed in this diff Show More