From ea8f08c2957377cf3de3ad897185d0540468980a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 22 Sep 2022 22:44:45 -0400 Subject: [PATCH 01/36] update "make install" for cmake to correctly install LAMMPS python module. --- cmake/CMakeLists.txt | 9 +++++++-- python/pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 28c3d6c027..17bef6f8b8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -840,6 +840,8 @@ if(BUILD_SHARED_LIBS OR PKG_PYTHON) find_package(PythonInterp) # Deprecated since version 3.12 if(PYTHONINTERP_FOUND) set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) + set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR}) + set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR}) endif() else() # backward compatibility @@ -849,8 +851,11 @@ if(BUILD_SHARED_LIBS OR PKG_PYTHON) find_package(Python COMPONENTS Interpreter) endif() if(Python_EXECUTABLE) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python) - install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} setup.py build -b ${CMAKE_BINARY_DIR}/python install --prefix=${CMAKE_INSTALL_PREFIX} --root=\$ENV{DESTDIR}/ WORKING_DIRECTORY ${LAMMPS_PYTHON_DIR})") + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/lib) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/python/src) + file(COPY ${LAMMPS_SOURCE_DIR}/version.h DESTINATION ${CMAKE_BINARY_DIR}/python/src) + file(COPY ${LAMMPS_PYTHON_DIR}/README ${LAMMPS_PYTHON_DIR}/pyproject.toml ${LAMMPS_PYTHON_DIR}/setup.py ${LAMMPS_PYTHON_DIR}/lammps DESTINATION ${CMAKE_BINARY_DIR}/python/lib) + install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} -m pip install ${CMAKE_BINARY_DIR}/python/lib --target=${CMAKE_INSTALL_PREFIX}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages)") endif() endif() diff --git a/python/pyproject.toml b/python/pyproject.toml index b5c9a51ece..b40f62a6a9 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = [ "setuptools>=42", "wheel" ] +requires = [ "setuptools>=42", "wheel", "build" ] build-backend = "setuptools.build_meta" From f9f9e44f2d6cc8df994d1797722d1253c5ed1b88 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Tue, 4 Oct 2022 14:04:40 -0600 Subject: [PATCH 02/36] Update Kokkos library in LAMMPS to v3.7.0 --- lib/kokkos/BUILD.md | 20 +- lib/kokkos/CHANGELOG.md | 152 + lib/kokkos/CMakeLists.txt | 31 +- lib/kokkos/Makefile.kokkos | 248 +- lib/kokkos/Makefile.targets | 25 +- lib/kokkos/README.md | 266 +- lib/kokkos/algorithms/src/CMakeLists.txt | 1 + lib/kokkos/algorithms/src/Kokkos_Random.hpp | 125 +- lib/kokkos/algorithms/src/Kokkos_Sort.hpp | 94 +- .../algorithms/src/Kokkos_StdAlgorithms.hpp | 126 +- .../Kokkos_AdjacentDifference.hpp | 99 +- .../std_algorithms/Kokkos_AdjacentFind.hpp | 124 + .../src/std_algorithms/Kokkos_AllOf.hpp | 94 + .../src/std_algorithms/Kokkos_AnyOf.hpp | 94 + .../src/std_algorithms/Kokkos_BeginEnd.hpp | 4 +- .../src/std_algorithms/Kokkos_Copy.hpp | 97 + .../std_algorithms/Kokkos_CopyBackward.hpp | 95 + .../src/std_algorithms/Kokkos_CopyIf.hpp | 99 + .../src/std_algorithms/Kokkos_CopyN.hpp | 98 + .../src/std_algorithms/Kokkos_Count.hpp | 94 + .../src/std_algorithms/Kokkos_CountIf.hpp | 99 + .../src/std_algorithms/Kokkos_Distance.hpp | 4 +- .../src/std_algorithms/Kokkos_Equal.hpp | 198 ++ .../std_algorithms/Kokkos_ExclusiveScan.hpp | 190 ++ .../src/std_algorithms/Kokkos_Fill.hpp | 86 + .../src/std_algorithms/Kokkos_FillN.hpp | 91 + .../src/std_algorithms/Kokkos_Find.hpp | 89 + .../src/std_algorithms/Kokkos_FindEnd.hpp | 149 + .../src/std_algorithms/Kokkos_FindFirstOf.hpp | 150 + .../src/std_algorithms/Kokkos_FindIf.hpp | 95 + .../src/std_algorithms/Kokkos_FindIfNot.hpp | 98 + .../src/std_algorithms/Kokkos_ForEach.hpp | 95 + .../src/std_algorithms/Kokkos_ForEachN.hpp | 96 + .../src/std_algorithms/Kokkos_Generate.hpp | 91 + .../src/std_algorithms/Kokkos_GenerateN.hpp | 93 + .../std_algorithms/Kokkos_InclusiveScan.hpp | 223 ++ .../std_algorithms/Kokkos_IsPartitioned.hpp | 92 + .../src/std_algorithms/Kokkos_IsSorted.hpp | 131 + .../std_algorithms/Kokkos_IsSortedUntil.hpp | 134 + ...yingOperations.hpp => Kokkos_IterSwap.hpp} | 31 +- .../Kokkos_LexicographicalCompare.hpp | 154 + .../src/std_algorithms/Kokkos_MaxElement.hpp | 132 + .../src/std_algorithms/Kokkos_MinElement.hpp | 132 + .../std_algorithms/Kokkos_MinMaxElement.hpp | 133 + .../Kokkos_MinMaxElementOperations.hpp | 409 --- .../src/std_algorithms/Kokkos_Mismatch.hpp | 160 + .../src/std_algorithms/Kokkos_Move.hpp | 94 + .../std_algorithms/Kokkos_MoveBackward.hpp | 95 + .../Kokkos_NonModifyingSequenceOperations.hpp | 2406 --------------- .../src/std_algorithms/Kokkos_NoneOf.hpp | 94 + .../std_algorithms/Kokkos_PartitionCopy.hpp | 110 + .../std_algorithms/Kokkos_PartitionPoint.hpp | 91 + .../Kokkos_PartitioningOperations.hpp | 491 --- .../{numeric => }/Kokkos_Reduce.hpp | 113 +- .../src/std_algorithms/Kokkos_Remove.hpp | 91 + .../src/std_algorithms/Kokkos_RemoveCopy.hpp | 106 + .../std_algorithms/Kokkos_RemoveCopyIf.hpp | 110 + .../src/std_algorithms/Kokkos_RemoveIf.hpp | 92 + .../src/std_algorithms/Kokkos_Replace.hpp | 93 + .../src/std_algorithms/Kokkos_ReplaceCopy.hpp | 107 + .../std_algorithms/Kokkos_ReplaceCopyIf.hpp | 111 + .../src/std_algorithms/Kokkos_ReplaceIf.hpp | 96 + .../src/std_algorithms/Kokkos_Reverse.hpp | 87 + .../src/std_algorithms/Kokkos_ReverseCopy.hpp | 95 + .../src/std_algorithms/Kokkos_Rotate.hpp | 89 + .../src/std_algorithms/Kokkos_RotateCopy.hpp | 100 + .../src/std_algorithms/Kokkos_Search.hpp | 148 + .../src/std_algorithms/Kokkos_SearchN.hpp | 144 + .../src/std_algorithms/Kokkos_ShiftLeft.hpp | 89 + .../src/std_algorithms/Kokkos_ShiftRight.hpp | 89 + .../Kokkos_SortingOperations.hpp | 378 --- .../src/std_algorithms/Kokkos_Swap.hpp | 69 + .../src/std_algorithms/Kokkos_SwapRanges.hpp | 97 + .../src/std_algorithms/Kokkos_Transform.hpp | 166 + .../Kokkos_TransformExclusiveScan.hpp | 131 + .../Kokkos_TransformInclusiveScan.hpp | 190 ++ .../{numeric => }/Kokkos_TransformReduce.hpp | 213 +- .../src/std_algorithms/Kokkos_Unique.hpp | 124 + .../src/std_algorithms/Kokkos_UniqueCopy.hpp | 143 + .../impl/Kokkos_AdjacentDifference.hpp | 135 + .../impl/Kokkos_AdjacentFind.hpp | 140 + .../impl/Kokkos_AllOfAnyOfNoneOf.hpp | 77 + .../{ => impl}/Kokkos_Constraints.hpp | 0 .../impl/Kokkos_CopyBackward.hpp | 103 + .../std_algorithms/impl/Kokkos_CopyCopyN.hpp | 116 + .../src/std_algorithms/impl/Kokkos_CopyIf.hpp | 142 + .../impl/Kokkos_CountCountIf.hpp | 112 + .../src/std_algorithms/impl/Kokkos_Equal.hpp | 147 + .../impl/Kokkos_ExclusiveScan.hpp | 232 ++ .../std_algorithms/impl/Kokkos_FillFillN.hpp} | 112 +- .../std_algorithms/impl/Kokkos_FindEnd.hpp | 191 ++ .../impl/Kokkos_FindFirstOf.hpp | 161 + .../impl/Kokkos_FindIfOrNot.hpp | 146 + .../impl/Kokkos_ForEachForEachN.hpp | 113 + .../impl/Kokkos_GenerateGenerateN.hpp | 105 + .../{ => impl}/Kokkos_HelperPredicates.hpp | 4 +- .../Kokkos_IdentityReferenceUnaryFunctor.hpp | 4 +- .../impl/Kokkos_InclusiveScan.hpp | 243 ++ .../impl/Kokkos_IsPartitioned.hpp | 148 + .../std_algorithms/impl/Kokkos_IsSorted.hpp | 117 + .../impl/Kokkos_IsSortedUntil.hpp | 153 + .../impl/Kokkos_LexicographicalCompare.hpp | 184 ++ .../impl/Kokkos_MinMaxMinmaxElement.hpp | 167 + .../std_algorithms/impl/Kokkos_Mismatch.hpp | 162 + .../src/std_algorithms/impl/Kokkos_Move.hpp | 100 + .../impl/Kokkos_MoveBackward.hpp | 104 + .../impl/Kokkos_PartitionCopy.hpp | 180 ++ .../impl/Kokkos_PartitionPoint.hpp | 132 + .../Kokkos_RandomAccessIterator.hpp | 24 +- .../src/std_algorithms/impl/Kokkos_Reduce.hpp | 186 ++ ...cerWithArbitraryJoinerNoNeutralElement.hpp | 11 +- .../impl/Kokkos_RemoveAllVariants.hpp | 212 ++ .../std_algorithms/impl/Kokkos_Replace.hpp | 103 + .../impl/Kokkos_ReplaceCopy.hpp | 122 + .../impl/Kokkos_ReplaceCopyIf.hpp | 123 + .../std_algorithms/impl/Kokkos_ReplaceIf.hpp | 105 + .../std_algorithms/impl/Kokkos_Reverse.hpp | 111 + .../impl/Kokkos_ReverseCopy.hpp | 102 + .../src/std_algorithms/impl/Kokkos_Rotate.hpp | 219 ++ .../std_algorithms/impl/Kokkos_RotateCopy.hpp | 149 + .../src/std_algorithms/impl/Kokkos_Search.hpp | 191 ++ .../std_algorithms/impl/Kokkos_SearchN.hpp | 205 ++ .../std_algorithms/impl/Kokkos_ShiftLeft.hpp | 139 + .../std_algorithms/impl/Kokkos_ShiftRight.hpp | 139 + .../std_algorithms/impl/Kokkos_SwapRanges.hpp | 112 + .../std_algorithms/impl/Kokkos_Transform.hpp | 158 + .../impl/Kokkos_TransformExclusiveScan.hpp | 153 + .../impl/Kokkos_TransformInclusiveScan.hpp | 235 ++ .../impl/Kokkos_TransformReduce.hpp | 245 ++ .../src/std_algorithms/impl/Kokkos_Unique.hpp | 193 ++ .../std_algorithms/impl/Kokkos_UniqueCopy.hpp | 156 + ...Kokkos_ValueWrapperForNoNeutralElement.hpp | 10 +- ...Kokkos_ModifyingSequenceOperationsSet1.hpp | 1285 -------- ...Kokkos_ModifyingSequenceOperationsSet2.hpp | 1783 ----------- .../numeric/Kokkos_ExclusiveScan.hpp | 517 ---- .../numeric/Kokkos_InclusiveScan.hpp | 699 ----- .../algorithms/unit_tests/CMakeLists.txt | 1 + .../algorithms/unit_tests/TestRandom.hpp | 20 +- .../unit_tests/TestRandomAccessIterator.cpp | 39 +- lib/kokkos/algorithms/unit_tests/TestSort.hpp | 13 +- .../TestStdAlgorithmsAdjacentDifference.cpp | 12 +- .../TestStdAlgorithmsAdjacentFind.cpp | 4 +- .../TestStdAlgorithmsAllAnyNoneOf.cpp | 4 +- .../unit_tests/TestStdAlgorithmsCommon.hpp | 68 +- .../TestStdAlgorithmsCompileOnly.cpp | 19 - .../TestStdAlgorithmsConstraints.cpp | 2 +- .../unit_tests/TestStdAlgorithmsCopyIf.cpp | 71 +- .../unit_tests/TestStdAlgorithmsCount.cpp | 2 - .../unit_tests/TestStdAlgorithmsEqual.cpp | 3 - .../TestStdAlgorithmsExclusiveScan.cpp | 58 +- .../unit_tests/TestStdAlgorithmsFind.cpp | 2 - .../unit_tests/TestStdAlgorithmsFindEnd.cpp | 10 +- .../TestStdAlgorithmsFindFirstOf.cpp | 10 +- .../unit_tests/TestStdAlgorithmsForEach.cpp | 2 - .../TestStdAlgorithmsHelperFunctors.hpp | 6 - .../TestStdAlgorithmsInclusiveScan.cpp | 58 +- .../unit_tests/TestStdAlgorithmsIsSorted.cpp | 4 +- .../TestStdAlgorithmsIsSortedUntil.cpp | 20 +- ...estStdAlgorithmsLexicographicalCompare.cpp | 5 +- .../TestStdAlgorithmsMinMaxElementOps.cpp | 23 +- .../unit_tests/TestStdAlgorithmsMismatch.cpp | 18 +- .../unit_tests/TestStdAlgorithmsModOps.cpp | 45 +- .../unit_tests/TestStdAlgorithmsModSeqOps.cpp | 42 +- .../TestStdAlgorithmsMoveBackward.cpp | 135 + .../unit_tests/TestStdAlgorithmsNumerics.cpp | 155 +- .../TestStdAlgorithmsPartitionCopy.cpp | 38 +- .../TestStdAlgorithmsPartitioningOps.cpp | 7 +- .../unit_tests/TestStdAlgorithmsRemove.cpp | 6 +- .../TestStdAlgorithmsRemoveCopy.cpp | 6 +- .../TestStdAlgorithmsRemoveCopyIf.cpp | 6 +- .../unit_tests/TestStdAlgorithmsRemoveIf.cpp | 6 +- .../unit_tests/TestStdAlgorithmsReplace.cpp | 26 +- .../TestStdAlgorithmsReplaceCopy.cpp | 58 +- .../TestStdAlgorithmsReplaceCopyIf.cpp | 58 +- .../unit_tests/TestStdAlgorithmsReplaceIf.cpp | 4 +- .../unit_tests/TestStdAlgorithmsReverse.cpp | 4 +- .../unit_tests/TestStdAlgorithmsRotate.cpp | 6 +- .../TestStdAlgorithmsRotateCopy.cpp | 12 +- .../TestStdAlgorithmsScalarRedVsView.cpp | 235 -- .../unit_tests/TestStdAlgorithmsSearch.cpp | 10 +- .../unit_tests/TestStdAlgorithmsSearch_n.cpp | 10 +- .../unit_tests/TestStdAlgorithmsShiftLeft.cpp | 6 +- .../TestStdAlgorithmsShiftRight.cpp | 6 +- ...estStdAlgorithmsTransformExclusiveScan.cpp | 22 +- ...estStdAlgorithmsTransformInclusiveScan.cpp | 22 +- .../TestStdAlgorithmsTransformUnaryOp.cpp | 4 +- .../unit_tests/TestStdAlgorithmsUnique.cpp | 12 +- .../TestStdAlgorithmsUniqueCopy.cpp | 72 +- .../algorithms/unit_tests/TestStdReducers.cpp | 4 +- lib/kokkos/appveyor.yml | 2 +- .../benchmarks/bytes_and_flops/bench.hpp | 36 +- .../bytes_and_flops/bench_double.cpp | 2 +- .../bytes_and_flops/bench_float.cpp | 2 +- .../bytes_and_flops/bench_int32_t.cpp | 2 +- .../bytes_and_flops/bench_int64_t.cpp | 2 +- .../bytes_and_flops/bench_stride.hpp | 51 +- .../bytes_and_flops/bench_unroll_stride.hpp | 90 +- .../benchmarks/bytes_and_flops/main.cpp | 42 +- lib/kokkos/bin/nvcc_wrapper | 79 +- lib/kokkos/cmake/Dependencies.cmake | 12 + lib/kokkos/cmake/KokkosConfigCommon.cmake.in | 1 + lib/kokkos/cmake/KokkosCore_config.h.in | 11 +- lib/kokkos/cmake/Modules/FindTPLLIBDL.cmake | 2 +- lib/kokkos/cmake/Modules/FindTPLTHREADS.cmake | 2 +- lib/kokkos/cmake/fake_tribits.cmake | 2 - lib/kokkos/cmake/kokkos_arch.cmake | 278 +- lib/kokkos/cmake/kokkos_compiler_id.cmake | 14 +- lib/kokkos/cmake/kokkos_enable_devices.cmake | 2 + lib/kokkos/cmake/kokkos_enable_options.cmake | 1 + lib/kokkos/cmake/kokkos_functions.cmake | 78 +- lib/kokkos/cmake/kokkos_pick_cxx_std.cmake | 4 +- lib/kokkos/cmake/kokkos_test_cxx_std.cmake | 4 +- lib/kokkos/cmake/kokkos_tpls.cmake | 5 + lib/kokkos/cmake/kokkos_tribits.cmake | 4 +- .../performance_tests/TestGlobal2LocalIds.hpp | 4 +- .../performance_tests/TestScatterView.hpp | 6 +- .../TestUnorderedMapPerformance.hpp | 2 +- lib/kokkos/containers/src/Kokkos_Bitset.hpp | 16 +- lib/kokkos/containers/src/Kokkos_DualView.hpp | 220 +- .../containers/src/Kokkos_DynRankView.hpp | 1058 ++++--- .../containers/src/Kokkos_DynamicView.hpp | 498 ++- .../containers/src/Kokkos_ErrorReporter.hpp | 8 + .../containers/src/Kokkos_Functional.hpp | 82 +- .../containers/src/Kokkos_OffsetView.hpp | 681 +++-- .../containers/src/Kokkos_ScatterView.hpp | 122 +- .../containers/src/Kokkos_StaticCrsGraph.hpp | 14 +- .../containers/src/Kokkos_UnorderedMap.hpp | 42 +- lib/kokkos/containers/src/Kokkos_Vector.hpp | 11 +- .../src/impl/Kokkos_Bitset_impl.hpp | 4 +- .../impl/Kokkos_StaticCrsGraph_factory.hpp | 18 +- .../src/impl/Kokkos_UnorderedMap_impl.cpp | 4 + .../src/impl/Kokkos_UnorderedMap_impl.hpp | 11 +- .../containers/unit_tests/TestBitset.hpp | 12 +- .../containers/unit_tests/TestDualView.hpp | 17 +- .../containers/unit_tests/TestDynViewAPI.hpp | 48 +- .../containers/unit_tests/TestOffsetView.hpp | 8 +- .../containers/unit_tests/TestScatterView.hpp | 60 +- .../unit_tests/TestUnorderedMap.hpp | 10 +- .../containers/unit_tests/TestVector.hpp | 13 + .../unit_tests/TestWithoutInitializing.hpp | 562 +++- lib/kokkos/core/perf_test/CMakeLists.txt | 3 + .../core/perf_test/PerfTestBlasKernels.hpp | 6 +- .../core/perf_test/PerfTestGramSchmidt.cpp | 2 +- lib/kokkos/core/src/CMakeLists.txt | 54 +- lib/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp | 88 +- .../Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp | 125 +- .../core/src/Cuda/Kokkos_Cuda_Error.hpp | 31 +- .../src/Cuda/Kokkos_Cuda_Half_Conversion.hpp | 90 +- .../core/src/Cuda/Kokkos_Cuda_Instance.cpp | 263 +- .../src/Cuda/Kokkos_Cuda_KernelLaunch.hpp | 2 +- .../core/src/Cuda/Kokkos_Cuda_Locks.cpp | 11 +- .../core/src/Cuda/Kokkos_Cuda_Locks.hpp | 58 +- .../core/src/Cuda/Kokkos_Cuda_Parallel.hpp | 2722 ----------------- .../src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp | 477 +++ .../src/Cuda/Kokkos_Cuda_Parallel_Range.hpp | 1049 +++++++ .../src/Cuda/Kokkos_Cuda_Parallel_Team.hpp | 1139 +++++++ .../core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp | 559 ++-- lib/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp | 4 + lib/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp | 9 +- lib/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp | 605 ++-- .../src/Cuda/Kokkos_Cuda_Vectorization.hpp | 27 +- lib/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp | 31 +- .../src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp | 10 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp | 22 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp | 89 +- .../HIP/Kokkos_HIP_BlockSize_Deduction.hpp | 6 +- .../core/src/HIP/Kokkos_HIP_Instance.cpp | 61 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp | 4 + .../src/HIP/Kokkos_HIP_Parallel_MDRange.hpp | 67 +- .../src/HIP/Kokkos_HIP_Parallel_Range.hpp | 201 +- .../core/src/HIP/Kokkos_HIP_Parallel_Team.hpp | 144 +- .../core/src/HIP/Kokkos_HIP_ReduceScan.hpp | 266 +- .../src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp | 174 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp | 265 +- lib/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp | 122 +- .../core/src/HIP/Kokkos_HIP_UniqueToken.hpp | 3 +- .../core/src/HIP/Kokkos_HIP_Vectorization.hpp | 22 +- .../src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp | 10 +- lib/kokkos/core/src/HPX/Kokkos_HPX.cpp | 81 +- lib/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp | 4 + lib/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp | 6 +- .../src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp | 8 +- lib/kokkos/core/src/KokkosExp_InterOp.hpp | 8 + .../core/src/KokkosExp_MDRangePolicy.hpp | 11 +- .../src/Kokkos_AcquireUniqueTokenImpl.hpp | 9 + lib/kokkos/core/src/Kokkos_AnonymousSpace.hpp | 9 + lib/kokkos/core/src/Kokkos_Array.hpp | 107 +- lib/kokkos/core/src/Kokkos_Atomic.hpp | 8 + .../core/src/Kokkos_Atomics_Desul_Config.hpp | 9 + .../Kokkos_Atomics_Desul_Volatile_Wrapper.hpp | 10 + .../core/src/Kokkos_Atomics_Desul_Wrapper.hpp | 10 + lib/kokkos/core/src/Kokkos_Complex.hpp | 229 +- lib/kokkos/core/src/Kokkos_Concepts.hpp | 41 +- lib/kokkos/core/src/Kokkos_CopyViews.hpp | 1242 +++++--- lib/kokkos/core/src/Kokkos_Core.hpp | 250 +- lib/kokkos/core/src/Kokkos_Core_fwd.hpp | 34 +- lib/kokkos/core/src/Kokkos_Crs.hpp | 12 +- lib/kokkos/core/src/Kokkos_Cuda.hpp | 43 +- lib/kokkos/core/src/Kokkos_CudaSpace.hpp | 107 +- lib/kokkos/core/src/Kokkos_DetectionIdiom.hpp | 8 + lib/kokkos/core/src/Kokkos_ExecPolicy.hpp | 56 +- lib/kokkos/core/src/Kokkos_Extents.hpp | 16 +- lib/kokkos/core/src/Kokkos_Future.hpp | 90 +- lib/kokkos/core/src/Kokkos_Graph.hpp | 8 + lib/kokkos/core/src/Kokkos_GraphNode.hpp | 34 +- lib/kokkos/core/src/Kokkos_Graph_fwd.hpp | 8 + lib/kokkos/core/src/Kokkos_HBWSpace.hpp | 9 + lib/kokkos/core/src/Kokkos_HIP.hpp | 9 + lib/kokkos/core/src/Kokkos_HIP_Space.hpp | 226 +- lib/kokkos/core/src/Kokkos_HPX.hpp | 584 ++-- lib/kokkos/core/src/Kokkos_Half.hpp | 8 + lib/kokkos/core/src/Kokkos_HostSpace.hpp | 56 +- lib/kokkos/core/src/Kokkos_Layout.hpp | 61 +- lib/kokkos/core/src/Kokkos_LogicalSpaces.hpp | 23 +- lib/kokkos/core/src/Kokkos_Macros.hpp | 65 +- lib/kokkos/core/src/Kokkos_MasterLock.hpp | 9 + .../core/src/Kokkos_MathematicalConstants.hpp | 8 + .../core/src/Kokkos_MathematicalFunctions.hpp | 140 +- .../Kokkos_MathematicalSpecialFunctions.hpp | 62 +- lib/kokkos/core/src/Kokkos_MemoryPool.hpp | 9 + lib/kokkos/core/src/Kokkos_MemoryTraits.hpp | 9 + lib/kokkos/core/src/Kokkos_MinMaxClamp.hpp | 18 +- lib/kokkos/core/src/Kokkos_NumericTraits.hpp | 8 + lib/kokkos/core/src/Kokkos_OpenMP.hpp | 61 +- lib/kokkos/core/src/Kokkos_OpenMPTarget.hpp | 50 +- .../core/src/Kokkos_OpenMPTargetSpace.hpp | 44 +- lib/kokkos/core/src/Kokkos_Pair.hpp | 29 +- lib/kokkos/core/src/Kokkos_Parallel.hpp | 219 +- .../core/src/Kokkos_Parallel_Reduce.hpp | 403 +-- .../core/src/Kokkos_PointerOwnership.hpp | 9 + .../src/Kokkos_Profiling_ProfileSection.hpp | 8 + lib/kokkos/core/src/Kokkos_Rank.hpp | 9 + lib/kokkos/core/src/Kokkos_SYCL.hpp | 76 +- lib/kokkos/core/src/Kokkos_SYCL_Space.hpp | 69 + lib/kokkos/core/src/Kokkos_ScratchSpace.hpp | 9 + lib/kokkos/core/src/Kokkos_Serial.hpp | 984 +----- lib/kokkos/core/src/Kokkos_TaskScheduler.hpp | 69 +- .../core/src/Kokkos_TaskScheduler_fwd.hpp | 9 + lib/kokkos/core/src/Kokkos_Threads.hpp | 51 +- lib/kokkos/core/src/Kokkos_Timer.hpp | 8 + lib/kokkos/core/src/Kokkos_Tuners.hpp | 9 + lib/kokkos/core/src/Kokkos_UniqueToken.hpp | 9 + lib/kokkos/core/src/Kokkos_Vectorization.hpp | 9 + lib/kokkos/core/src/Kokkos_View.hpp | 1278 ++++---- .../core/src/Kokkos_WorkGraphPolicy.hpp | 11 +- lib/kokkos/core/src/Kokkos_hwloc.hpp | 9 + .../core/src/OpenACC/Kokkos_OpenACC.cpp | 98 + .../core/src/OpenACC/Kokkos_OpenACC.hpp | 126 + .../core/src/OpenACC/Kokkos_OpenACCSpace.cpp | 222 ++ .../core/src/OpenACC/Kokkos_OpenACCSpace.hpp | 249 ++ .../src/OpenACC/Kokkos_OpenACC_Instance.cpp | 118 + .../src/OpenACC/Kokkos_OpenACC_Instance.hpp | 79 + .../src/OpenACC/Kokkos_OpenACC_Traits.hpp | 65 + ...MP_Exec.cpp => Kokkos_OpenMP_Instance.cpp} | 237 +- ...MP_Exec.hpp => Kokkos_OpenMP_Instance.hpp} | 123 +- .../src/OpenMP/Kokkos_OpenMP_Parallel.hpp | 604 ++-- .../core/src/OpenMP/Kokkos_OpenMP_Task.cpp | 4 + .../core/src/OpenMP/Kokkos_OpenMP_Task.hpp | 17 +- .../core/src/OpenMP/Kokkos_OpenMP_Team.hpp | 2 +- .../OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp | 4 +- .../OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp | 108 +- .../OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp | 9 +- .../OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp | 210 +- .../Kokkos_OpenMPTarget_Instance.cpp | 85 +- .../Kokkos_OpenMPTarget_Instance.hpp | 2 +- .../Kokkos_OpenMPTarget_Parallel.hpp | 288 +- .../Kokkos_OpenMPTarget_Parallel_MDRange.hpp | 251 +- .../OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp | 4 + lib/kokkos/core/src/SYCL/Kokkos_SYCL.cpp | 115 +- .../core/src/SYCL/Kokkos_SYCL_Instance.cpp | 23 +- .../core/src/SYCL/Kokkos_SYCL_Instance.hpp | 20 +- .../src/SYCL/Kokkos_SYCL_Parallel_Range.hpp | 10 +- .../src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp | 322 +- .../src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp | 77 +- .../src/SYCL/Kokkos_SYCL_Parallel_Team.hpp | 385 ++- .../core/src/SYCL/Kokkos_SYCL_Space.cpp | 136 +- lib/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp | 134 +- .../src/{impl => Serial}/Kokkos_Serial.cpp | 74 +- .../Serial/Kokkos_Serial_Parallel_MDRange.hpp | 213 ++ .../Serial/Kokkos_Serial_Parallel_Range.hpp | 337 ++ .../Serial/Kokkos_Serial_Parallel_Team.hpp | 424 +++ .../{impl => Serial}/Kokkos_Serial_Task.cpp | 11 +- .../{impl => Serial}/Kokkos_Serial_Task.hpp | 6 +- .../src/Serial/Kokkos_Serial_UniqueToken.hpp | 109 + .../Kokkos_Serial_WorkGraphPolicy.hpp | 4 +- .../core/src/Threads/Kokkos_ThreadsExec.cpp | 137 +- .../core/src/Threads/Kokkos_ThreadsExec.hpp | 195 +- .../core/src/Threads/Kokkos_ThreadsTeam.hpp | 158 +- .../src/Threads/Kokkos_Threads_Parallel.hpp | 1034 ------- .../Kokkos_Threads_Parallel_MDRange.hpp | 322 ++ .../Threads/Kokkos_Threads_Parallel_Range.hpp | 485 +++ .../Threads/Kokkos_Threads_Parallel_Team.hpp | 279 ++ .../Threads/Kokkos_Threads_UniqueToken.hpp | 157 + .../Kokkos_Threads_WorkGraphPolicy.hpp | 4 +- .../core/src/View/Hooks/Kokkos_ViewHooks.hpp | 151 + .../core/src/decl/Kokkos_Declare_CUDA.hpp | 5 +- .../src/decl/Kokkos_Declare_OPENACC.hpp} | 11 +- lib/kokkos/core/src/desul/.clang-format | 3 - lib/kokkos/core/src/desul/atomics.hpp | 19 - .../core/src/desul/atomics/Atomic_Ref.hpp | 541 ---- lib/kokkos/core/src/desul/atomics/CUDA.hpp | 541 ---- lib/kokkos/core/src/desul/atomics/Common.hpp | 201 -- .../src/desul/atomics/Compare_Exchange.hpp | 37 - .../desul/atomics/Compare_Exchange_CUDA.hpp | 268 -- .../desul/atomics/Compare_Exchange_GCC.hpp | 91 - .../desul/atomics/Compare_Exchange_HIP.hpp | 253 -- .../desul/atomics/Compare_Exchange_MSVC.hpp | 237 -- .../desul/atomics/Compare_Exchange_OpenMP.hpp | 139 - .../desul/atomics/Compare_Exchange_SYCL.hpp | 227 -- .../atomics/Compare_Exchange_ScopeCaller.hpp | 43 - .../desul/atomics/Compare_Exchange_Serial.hpp | 45 - lib/kokkos/core/src/desul/atomics/GCC.hpp | 131 - lib/kokkos/core/src/desul/atomics/Generic.hpp | 766 ----- lib/kokkos/core/src/desul/atomics/HIP.hpp | 225 -- .../core/src/desul/atomics/Lock_Array.hpp | 75 - .../src/desul/atomics/Lock_Array_Cuda.hpp | 172 -- .../core/src/desul/atomics/Lock_Array_HIP.hpp | 170 - lib/kokkos/core/src/desul/atomics/Macros.hpp | 66 - lib/kokkos/core/src/desul/atomics/OpenMP.hpp | 15 - lib/kokkos/core/src/desul/atomics/SYCL.hpp | 116 - .../src/desul/atomics/SYCLConversions.hpp | 97 - .../core/src/desul/atomics/cuda/CUDA_asm.hpp | 18 - .../desul/atomics/cuda/CUDA_asm_exchange.hpp | 8 - .../src/desul/atomics/cuda/cuda_cc7_asm.inc | 20 - .../cuda/cuda_cc7_asm_atomic_fetch_op.inc | 18 - ...da_cc7_asm_atomic_fetch_op.inc_forceglobal | 153 - .../cuda_cc7_asm_atomic_fetch_op.inc_generic | 151 - .../cuda_cc7_asm_atomic_fetch_op.inc_isglobal | 208 -- ...cuda_cc7_asm_atomic_fetch_op.inc_predicate | 250 -- .../atomics/cuda/cuda_cc7_asm_atomic_op.inc | 18 - .../cuda_cc7_asm_atomic_op.inc_forceglobal | 64 - .../cuda/cuda_cc7_asm_atomic_op.inc_generic | 64 - .../cuda/cuda_cc7_asm_atomic_op.inc_isglobal | 88 - .../cuda/cuda_cc7_asm_atomic_op.inc_predicate | 106 - .../atomics/cuda/cuda_cc7_asm_exchange.inc | 20 - .../cuda/cuda_cc7_asm_exchange_memorder.inc | 27 - .../atomics/cuda/cuda_cc7_asm_exchange_op.inc | 40 - .../atomics/cuda/cuda_cc7_asm_memorder.inc | 29 - .../src/desul/atomics/openmp/OpenMP_40.hpp | 97 - .../src/desul/atomics/openmp/OpenMP_40_op.inc | 101 - .../core/src/desul/src/Lock_Array_CUDA.cpp | 98 - .../core/src/desul/src/Lock_Array_HIP.cpp | 101 - lib/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp | 1 + .../core/src/fwd/Kokkos_Fwd_OPENACC.hpp | 56 + lib/kokkos/core/src/impl/CMakeLists.txt | 2 +- .../src/impl/KokkosExp_Host_IterateTile.hpp | 79 +- .../src/impl/KokkosExp_IterateTileGPU.hpp | 3 - .../core/src/impl/Kokkos_AnalyzePolicy.hpp | 15 + .../Kokkos_Atomic_Compare_Exchange_Strong.hpp | 64 +- .../Kokkos_Atomic_Compare_Exchange_Weak.hpp | 28 +- .../core/src/impl/Kokkos_Atomic_Exchange.hpp | 82 +- .../core/src/impl/Kokkos_Atomic_Fetch_Add.hpp | 53 +- .../core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp | 34 +- .../core/src/impl/Kokkos_Atomic_Generic.hpp | 199 +- .../core/src/impl/Kokkos_Atomic_Load.hpp | 36 +- .../core/src/impl/Kokkos_Atomic_Store.hpp | 36 +- .../core/src/impl/Kokkos_Atomic_Windows.hpp | 14 +- lib/kokkos/core/src/impl/Kokkos_BitOps.hpp | 204 +- .../core/src/impl/Kokkos_CPUDiscovery.cpp | 4 + lib/kokkos/core/src/impl/Kokkos_ChaseLev.hpp | 4 +- lib/kokkos/core/src/impl/Kokkos_ClockTic.hpp | 32 +- .../core/src/impl/Kokkos_Combined_Reducer.hpp | 115 +- .../src/impl/Kokkos_Command_Line_Parsing.cpp | 265 +- .../src/impl/Kokkos_Command_Line_Parsing.hpp | 18 +- lib/kokkos/core/src/impl/Kokkos_Core.cpp | 1138 +++---- ...alizer.hpp => Kokkos_DeviceManagement.hpp} | 27 +- lib/kokkos/core/src/impl/Kokkos_EBO.hpp | 44 +- lib/kokkos/core/src/impl/Kokkos_Error.cpp | 7 + lib/kokkos/core/src/impl/Kokkos_Error.hpp | 100 +- .../core/src/impl/Kokkos_ExecPolicy.cpp | 14 +- .../core/src/impl/Kokkos_ExecSpaceManager.hpp | 162 + .../core/src/impl/Kokkos_FunctorAdapter.hpp | 2055 ------------- .../core/src/impl/Kokkos_FunctorAnalysis.hpp | 495 ++- lib/kokkos/core/src/impl/Kokkos_HBWSpace.cpp | 4 + .../core/src/impl/Kokkos_HostBarrier.cpp | 4 + lib/kokkos/core/src/impl/Kokkos_HostSpace.cpp | 160 +- .../src/impl/Kokkos_HostSpace_deepcopy.cpp | 10 +- .../src/impl/Kokkos_HostSpace_deepcopy.hpp | 2 + .../core/src/impl/Kokkos_HostThreadTeam.cpp | 4 + .../core/src/impl/Kokkos_HostThreadTeam.hpp | 221 +- .../impl/Kokkos_InitializationSettings.hpp | 195 ++ lib/kokkos/core/src/impl/Kokkos_LIFO.hpp | 7 +- .../core/src/impl/Kokkos_MemoryPool.cpp | 4 + .../src/impl/Kokkos_MemoryPoolAllocator.hpp | 2 +- .../core/src/impl/Kokkos_MemorySpace.cpp | 4 + .../core/src/impl/Kokkos_MemorySpace.hpp | 14 + .../core/src/impl/Kokkos_Memory_Fence.hpp | 3 +- .../src/impl/Kokkos_MultipleTaskQueue.hpp | 45 +- .../core/src/impl/Kokkos_NumericTraits.cpp | 5 + .../core/src/impl/Kokkos_OptionalRef.hpp | 14 +- ...ndLineArgumentsAndEnvironmentVariables.hpp | 58 + lib/kokkos/core/src/impl/Kokkos_Profiling.cpp | 159 +- lib/kokkos/core/src/impl/Kokkos_Profiling.hpp | 8 +- .../src/impl/Kokkos_Profiling_Interface.hpp | 2 + .../src/impl/Kokkos_QuadPrecisionMath.hpp | 78 +- .../core/src/impl/Kokkos_SharedAlloc.cpp | 9 +- .../core/src/impl/Kokkos_SharedAlloc.hpp | 38 +- .../src/impl/Kokkos_SimpleTaskScheduler.hpp | 7 +- .../core/src/impl/Kokkos_SingleTaskQueue.hpp | 1 - lib/kokkos/core/src/impl/Kokkos_Spinwait.cpp | 4 + lib/kokkos/core/src/impl/Kokkos_Spinwait.hpp | 24 +- .../core/src/impl/Kokkos_Stacktrace.cpp | 5 + .../src/impl/Kokkos_StringManipulation.hpp | 220 ++ lib/kokkos/core/src/impl/Kokkos_TaskBase.hpp | 5 +- lib/kokkos/core/src/impl/Kokkos_TaskNode.hpp | 1 - lib/kokkos/core/src/impl/Kokkos_TaskQueue.hpp | 1 - .../core/src/impl/Kokkos_TaskQueueCommon.hpp | 1 - .../impl/Kokkos_TaskQueueMemoryManager.hpp | 1 - .../src/impl/Kokkos_TaskQueueMultiple.hpp | 1 - .../core/src/impl/Kokkos_TaskResult.hpp | 1 - .../core/src/impl/Kokkos_TaskTeamMember.hpp | 5 +- .../core/src/impl/Kokkos_Tools_Generic.hpp | 15 +- lib/kokkos/core/src/impl/Kokkos_Traits.hpp | 13 +- lib/kokkos/core/src/impl/Kokkos_Utilities.hpp | 3 + .../core/src/impl/Kokkos_VLAEmulation.hpp | 2 +- lib/kokkos/core/src/impl/Kokkos_ViewArray.hpp | 88 +- lib/kokkos/core/src/impl/Kokkos_ViewCtor.hpp | 33 +- .../core/src/impl/Kokkos_ViewLayoutTiled.hpp | 383 +-- .../core/src/impl/Kokkos_ViewMapping.hpp | 373 ++- .../core/src/impl/Kokkos_ViewTracker.hpp | 2 +- .../core/src/impl/Kokkos_ViewUniformType.hpp | 8 +- lib/kokkos/core/src/impl/Kokkos_hwloc.cpp | 29 +- .../core/src/setup/Kokkos_Setup_Cuda.hpp | 2 - .../core/src/setup/Kokkos_Setup_SYCL.hpp | 9 + .../core/src/traits/Kokkos_WorkTagTrait.hpp | 11 +- lib/kokkos/core/unit_test/CMakeLists.txt | 73 +- lib/kokkos/core/unit_test/Makefile | 5 +- lib/kokkos/core/unit_test/TestAbort.hpp | 138 + lib/kokkos/core/unit_test/TestAggregate.hpp | 11 +- lib/kokkos/core/unit_test/TestArray.cpp | 84 + .../core/unit_test/TestAtomicOperations.hpp | 1 - lib/kokkos/core/unit_test/TestAtomicViews.hpp | 3 +- lib/kokkos/core/unit_test/TestAtomics.hpp | 12 +- lib/kokkos/core/unit_test/TestCXX11.hpp | 3 +- lib/kokkos/core/unit_test/TestComplex.hpp | 10 +- .../core/unit_test/TestConcurrentBitset.hpp | 1 - .../core/unit_test/TestDeepCopyAlignment.hpp | 12 +- .../unit_test/TestDefaultDeviceTypeInit.hpp | 4 +- .../unit_test/TestExecSpacePartitioning.hpp | 1 - .../core/unit_test/TestExecutionSpace.hpp | 46 +- .../core/unit_test/TestFunctorAnalysis.hpp | 14 +- .../core/unit_test/TestHalfOperators.hpp | 1 - .../core/unit_test/TestHostSharedPtr.hpp | 2 +- .../TestHostSharedPtrAccessOnDevice.hpp | 16 +- lib/kokkos/core/unit_test/TestInit.hpp | 1 - .../unit_test/TestInitializationSettings.cpp | 124 + lib/kokkos/core/unit_test/TestInterOp.cpp | 38 +- .../core/unit_test/TestIrregularLayout.hpp | 1 - .../TestJoinBackwardCompatibility.hpp | 154 + .../unit_test/TestLegionInteroperability.cpp | 159 + .../core/unit_test/TestLocalDeepCopy.hpp | 1 - lib/kokkos/core/unit_test/TestMDRange.hpp | 28 +- .../unit_test/TestMathematicalFunctions.hpp | 135 +- .../unit_test/TestMathematicalFunctions1.hpp | 47 + .../unit_test/TestMathematicalFunctions2.hpp | 47 + .../TestMathematicalSpecialFunctions.hpp | 20 +- lib/kokkos/core/unit_test/TestMemoryPool.hpp | 11 +- lib/kokkos/core/unit_test/TestMinMaxClamp.hpp | 162 +- .../unit_test/TestNonTrivialScalarTypes.hpp | 81 +- .../core/unit_test/TestNumericTraits.hpp | 76 +- lib/kokkos/core/unit_test/TestOther.hpp | 6 +- .../TestParseCmdLineArgsAndEnvVars.cpp | 499 +++ .../core/unit_test/TestPolicyConstruction.hpp | 33 +- .../core/unit_test/TestQuadPrecisionMath.hpp | 52 +- lib/kokkos/core/unit_test/TestRealloc.hpp | 56 +- lib/kokkos/core/unit_test/TestReduce.hpp | 54 +- .../unit_test/TestReduceCombinatorical.hpp | 48 +- lib/kokkos/core/unit_test/TestReducers.hpp | 39 +- lib/kokkos/core/unit_test/TestReducers_d.hpp | 55 +- lib/kokkos/core/unit_test/TestResize.hpp | 64 +- lib/kokkos/core/unit_test/TestScan.hpp | 3 +- lib/kokkos/core/unit_test/TestSharedAlloc.hpp | 1 - .../core/unit_test/TestStringManipulation.cpp | 217 ++ .../core/unit_test/TestTaskScheduler.hpp | 1 - lib/kokkos/core/unit_test/TestTeam.hpp | 189 +- lib/kokkos/core/unit_test/TestTeamBasic.hpp | 54 +- .../core/unit_test/TestTeamReductionScan.hpp | 45 +- lib/kokkos/core/unit_test/TestTeamScan.hpp | 21 +- .../core/unit_test/TestTeamTeamSize.hpp | 9 - lib/kokkos/core/unit_test/TestTeamVector.hpp | 7 +- .../core/unit_test/TestTeamVectorRange.hpp | 56 - .../unit_test/TestTemplateMetaFunctions.hpp | 181 -- lib/kokkos/core/unit_test/TestUniqueToken.hpp | 26 +- lib/kokkos/core/unit_test/TestUtilities.hpp | 1 - lib/kokkos/core/unit_test/TestViewAPI.hpp | 118 +- lib/kokkos/core/unit_test/TestViewAPI_b.hpp | 2 + lib/kokkos/core/unit_test/TestViewAPI_e.hpp | 38 +- .../core/unit_test/TestViewCtorDimMatch.hpp | 430 +++ lib/kokkos/core/unit_test/TestViewHooks.hpp | 159 + .../core/unit_test/TestViewIsAssignable.hpp | 4 +- .../TestViewLayoutStrideAssignment.hpp | 21 +- .../core/unit_test/TestViewLayoutTiled.hpp | 6 + .../core/unit_test/TestViewMapping_a.hpp | 21 +- .../core/unit_test/TestViewMapping_b.hpp | 1 - .../unit_test/TestViewMapping_subview.hpp | 1 - .../TestViewMemoryAccessViolation.hpp | 221 ++ lib/kokkos/core/unit_test/TestViewOfClass.hpp | 1 - .../core/unit_test/TestViewSpaceAssign.hpp | 1 - lib/kokkos/core/unit_test/TestViewSubview.hpp | 5 +- .../unit_test/TestWithoutInitializing.hpp | 265 ++ .../TestHIPHostPinned_Category.hpp | 1 + .../TestHIPManaged_Category.hpp} | 17 +- .../category_files/TestHIP_Category.hpp | 1 + .../TestSYCLHostUSM_Category.hpp | 1 + .../TestSYCLSharedUSM_Category.hpp | 1 + .../category_files/TestSYCL_Category.hpp | 1 + .../unit_test/cuda/TestCuda_InterOp_Init.cpp | 3 +- .../cuda/TestCuda_InterOp_Streams.cpp | 3 +- .../cuda/TestCuda_ReducerViewSizeLimit.cpp | 8 - .../default/TestDefaultDeviceTypeViewAPI.cpp | 6 +- .../headers_self_contained/tstHeader.cpp | 2 + .../unit_test/hip/TestHIP_InterOp_Init.cpp | 3 +- .../unit_test/hip/TestHIP_InterOp_Streams.cpp | 3 +- .../hip/TestHIP_Memory_Requirements.cpp | 86 + .../core/unit_test/hip/TestHIP_ScanUnit.cpp | 7 +- .../core/unit_test/hip/TestHIP_Spaces.cpp | 96 + .../hpx/TestHPX_IndependentInstances.cpp | 118 +- ...X_IndependentInstancesDelayedExecution.cpp | 44 +- ...estHPX_IndependentInstancesInstanceIds.cpp | 108 +- ...estHPX_IndependentInstancesRefCounting.cpp | 50 +- .../core/unit_test/hpx/TestHPX_InterOp.cpp | 6 +- .../incremental/Test01_execspace.hpp | 6 +- .../incremental/Test14_MDRangeReduce.hpp | 6 - .../core/unit_test/openmp/TestOpenMP.hpp | 1 - .../unit_test/openmp/TestOpenMP_InterOp.cpp | 3 +- .../openmptarget/TestOpenMPTarget.hpp | 1 - .../unit_test/sycl/TestSYCL_InterOp_Init.cpp | 5 +- .../sycl/TestSYCL_InterOp_Init_Context.cpp | 4 +- .../sycl/TestSYCL_InterOp_Streams.cpp | 8 +- .../sycl/TestSYCL_TeamScratchStreams.cpp | 2 +- .../unit_test/tools/TestLogicalSpaces.hpp | 3 + .../tools/TestWithoutInitializing.cpp | 76 + .../tools/include/ToolTestingUtilities.hpp | 18 + .../build_cmake_installed/CMakeLists.txt | 6 - .../build_cmake_installed/cmake_example.cpp | 2 +- .../CMakeLists.txt | 4 - .../foo.cpp | 2 +- .../cmake_example.cpp | 2 +- .../simple_mdrangepolicy.cpp | 36 +- lib/kokkos/generate_makefile.bash | 26 +- lib/kokkos/gnu_generate_makefile.bash | 9 + lib/kokkos/master_history.txt | 1 + lib/kokkos/simd/CMakeLists.txt | 10 + lib/kokkos/simd/cmake/Dependencies.cmake | 5 + lib/kokkos/simd/src/CMakeLists.txt | 29 + lib/kokkos/simd/src/Kokkos_SIMD.hpp | 161 + lib/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp | 1023 +++++++ lib/kokkos/simd/src/Kokkos_SIMD_Common.hpp | 428 +++ lib/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp | 353 +++ lib/kokkos/simd/src/Kokkos_SIMD_dummy.cpp | 7 + lib/kokkos/simd/unit_tests/CMakeLists.txt | 5 + lib/kokkos/simd/unit_tests/TestSIMD.cpp | 376 +++ lib/kokkos/simd/unit_tests/UnitTestMain.cpp | 54 + 653 files changed, 41432 insertions(+), 33597 deletions(-) rename lib/kokkos/algorithms/src/std_algorithms/{numeric => }/Kokkos_AdjacentDifference.hpp (72%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp rename lib/kokkos/algorithms/src/std_algorithms/{Kokkos_ModifyingOperations.hpp => Kokkos_IterSwap.hpp} (79%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElementOperations.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_NonModifyingSequenceOperations.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_PartitioningOperations.hpp rename lib/kokkos/algorithms/src/std_algorithms/{numeric => }/Kokkos_Reduce.hpp (70%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_SortingOperations.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp rename lib/kokkos/algorithms/src/std_algorithms/{numeric => }/Kokkos_TransformReduce.hpp (62%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp rename lib/kokkos/algorithms/src/std_algorithms/{ => impl}/Kokkos_Constraints.hpp (100%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp rename lib/kokkos/{core/src/Threads/Kokkos_ThreadsExec_base.cpp => algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp} (52%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp rename lib/kokkos/algorithms/src/std_algorithms/{ => impl}/Kokkos_HelperPredicates.hpp (97%) rename lib/kokkos/algorithms/src/std_algorithms/{numeric => impl}/Kokkos_IdentityReferenceUnaryFunctor.hpp (93%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp rename lib/kokkos/algorithms/src/std_algorithms/{ => impl}/Kokkos_RandomAccessIterator.hpp (88%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp rename lib/kokkos/algorithms/src/std_algorithms/{ => impl}/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp (91%) create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp create mode 100644 lib/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp rename lib/kokkos/algorithms/src/std_algorithms/{ => impl}/Kokkos_ValueWrapperForNoNeutralElement.hpp (89%) delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/modifying_sequence_ops/Kokkos_ModifyingSequenceOperationsSet1.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/modifying_sequence_ops/Kokkos_ModifyingSequenceOperationsSet2.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/numeric/Kokkos_ExclusiveScan.hpp delete mode 100644 lib/kokkos/algorithms/src/std_algorithms/numeric/Kokkos_InclusiveScan.hpp create mode 100644 lib/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp delete mode 100644 lib/kokkos/algorithms/unit_tests/TestStdAlgorithmsScalarRedVsView.cpp delete mode 100644 lib/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel.hpp create mode 100644 lib/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp create mode 100644 lib/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp create mode 100644 lib/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp create mode 100644 lib/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp rename lib/kokkos/core/src/OpenMP/{Kokkos_OpenMP_Exec.cpp => Kokkos_OpenMP_Instance.cpp} (72%) rename lib/kokkos/core/src/OpenMP/{Kokkos_OpenMP_Exec.hpp => Kokkos_OpenMP_Instance.hpp} (80%) rename lib/kokkos/core/src/{impl => Serial}/Kokkos_Serial.cpp (82%) create mode 100644 lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp create mode 100644 lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp create mode 100644 lib/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp rename lib/kokkos/core/src/{impl => Serial}/Kokkos_Serial_Task.cpp (92%) rename lib/kokkos/core/src/{impl => Serial}/Kokkos_Serial_Task.hpp (98%) create mode 100644 lib/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp rename lib/kokkos/core/src/{impl => Serial}/Kokkos_Serial_WorkGraphPolicy.hpp (95%) delete mode 100644 lib/kokkos/core/src/Threads/Kokkos_Threads_Parallel.hpp create mode 100644 lib/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp create mode 100644 lib/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp create mode 100644 lib/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp create mode 100644 lib/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp create mode 100644 lib/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp rename lib/kokkos/{algorithms/src/std_algorithms/Kokkos_ModifyingSequenceOperations.hpp => core/src/decl/Kokkos_Declare_OPENACC.hpp} (89%) delete mode 100644 lib/kokkos/core/src/desul/.clang-format delete mode 100644 lib/kokkos/core/src/desul/atomics.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Atomic_Ref.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/CUDA.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Common.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_CUDA.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_GCC.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_HIP.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_MSVC.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_OpenMP.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_SYCL.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_ScopeCaller.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Compare_Exchange_Serial.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/GCC.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Generic.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/HIP.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Lock_Array.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Lock_Array_Cuda.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Lock_Array_HIP.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/Macros.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/OpenMP.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/SYCL.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/SYCLConversions.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/CUDA_asm.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/CUDA_asm_exchange.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_forceglobal delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_generic delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_forceglobal delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_generic delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_exchange.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_exchange_memorder.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/cuda/cuda_cc7_asm_memorder.inc delete mode 100644 lib/kokkos/core/src/desul/atomics/openmp/OpenMP_40.hpp delete mode 100644 lib/kokkos/core/src/desul/atomics/openmp/OpenMP_40_op.inc delete mode 100644 lib/kokkos/core/src/desul/src/Lock_Array_CUDA.cpp delete mode 100644 lib/kokkos/core/src/desul/src/Lock_Array_HIP.cpp create mode 100644 lib/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp rename lib/kokkos/core/src/impl/{Kokkos_ExecSpaceInitializer.hpp => Kokkos_DeviceManagement.hpp} (75%) create mode 100644 lib/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp delete mode 100644 lib/kokkos/core/src/impl/Kokkos_FunctorAdapter.hpp create mode 100644 lib/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp create mode 100644 lib/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp create mode 100644 lib/kokkos/core/src/impl/Kokkos_StringManipulation.hpp create mode 100644 lib/kokkos/core/unit_test/TestAbort.hpp create mode 100644 lib/kokkos/core/unit_test/TestArray.cpp create mode 100644 lib/kokkos/core/unit_test/TestInitializationSettings.cpp create mode 100644 lib/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp create mode 100644 lib/kokkos/core/unit_test/TestLegionInteroperability.cpp create mode 100644 lib/kokkos/core/unit_test/TestMathematicalFunctions1.hpp create mode 100644 lib/kokkos/core/unit_test/TestMathematicalFunctions2.hpp create mode 100644 lib/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp create mode 100644 lib/kokkos/core/unit_test/TestStringManipulation.cpp delete mode 100644 lib/kokkos/core/unit_test/TestTemplateMetaFunctions.hpp create mode 100644 lib/kokkos/core/unit_test/TestViewCtorDimMatch.hpp create mode 100644 lib/kokkos/core/unit_test/TestViewHooks.hpp create mode 100644 lib/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp rename lib/kokkos/{algorithms/src/std_algorithms/Kokkos_Numeric.hpp => core/unit_test/category_files/TestHIPManaged_Category.hpp} (82%) create mode 100644 lib/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp create mode 100644 lib/kokkos/simd/CMakeLists.txt create mode 100644 lib/kokkos/simd/cmake/Dependencies.cmake create mode 100644 lib/kokkos/simd/src/CMakeLists.txt create mode 100644 lib/kokkos/simd/src/Kokkos_SIMD.hpp create mode 100644 lib/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp create mode 100644 lib/kokkos/simd/src/Kokkos_SIMD_Common.hpp create mode 100644 lib/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp create mode 100644 lib/kokkos/simd/src/Kokkos_SIMD_dummy.cpp create mode 100644 lib/kokkos/simd/unit_tests/CMakeLists.txt create mode 100644 lib/kokkos/simd/unit_tests/TestSIMD.cpp create mode 100644 lib/kokkos/simd/unit_tests/UnitTestMain.cpp diff --git a/lib/kokkos/BUILD.md b/lib/kokkos/BUILD.md index 114baf99f1..a8985ef1fd 100644 --- a/lib/kokkos/BUILD.md +++ b/lib/kokkos/BUILD.md @@ -27,7 +27,7 @@ When configuring your project just set: -DKokkos_ROOT=${kokkos_install_prefix} \ -DCMAKE_CXX_COMPILER=${compiler_used_to_build_kokkos} ```` -Note: You may need the following if using some versions of CMake (e.g. 3.12): +Note: You may need the following if your project requires a minimum CMake version older than 3.12: ````cmake cmake_policy(SET CMP0074 NEW) ```` @@ -171,6 +171,9 @@ Options can be enabled by specifying `-DKokkos_ENABLE_X`. * Kokkos_ENABLE_HPX_ASYNC_DISPATCH * Whether HPX supports asynchronous dispatch * BOOL Default: OFF +* Kokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC + * Whether to enable CudaMallocAsync (requires CUDA Toolkit 11.2). This is an experimental performance feature and currently has issue when using with UCX. See https://github.com/kokkos/kokkos/issues/4228 for more details. + * BOOL Default: OFF * Kokkos_ENABLE_LARGE_MEM_TESTS * Whether to perform extra large memory tests * BOOL_Default: OFF @@ -235,6 +238,9 @@ The following options control `find_package` paths for CMake-based TPLs: ## Architecture Keywords Architecture-specific optimizations can be enabled by specifying `-DKokkos_ARCH_X`. +* Kokkos_ARCH_NATIVE + * Whether to optimize for the the local CPU architecture + * BOOL Default: OFF * Kokkos_ARCH_AMDAVX * Whether to optimize for the AMDAVX architecture * BOOL Default: OFF @@ -310,12 +316,24 @@ Architecture-specific optimizations can be enabled by specifying `-DKokkos_ARCH_ * Kokkos_ARCH_POWER9 * Whether to optimize for the POWER9 architecture * BOOL Default: OFF +* Kokkos_ARCH_ICL + * Whether to optimize for the ICL architecture + * BOOL Default: OFF +* Kokkos_ARCH_ICX + * Whether to optimize for the ICX architecture + * BOOL Default: OFF +* Kokkos_ARCH_SKL + * Whether to optimize for the SKL architecture + * BOOL Default: OFF * Kokkos_ARCH_SKX * Whether to optimize for the SKX architecture * BOOL Default: OFF * Kokkos_ARCH_SNB * Whether to optimize for the SNB architecture * BOOL Default: OFF +* Kokkos_ARCH_SPR + * Whether to optimize for the SPR architecture + * BOOL Default: OFF * Kokkos_ARCH_TURING75 * Whether to optimize for the TURING75 architecture * BOOL Default: OFF diff --git a/lib/kokkos/CHANGELOG.md b/lib/kokkos/CHANGELOG.md index a908507704..e81f294451 100644 --- a/lib/kokkos/CHANGELOG.md +++ b/lib/kokkos/CHANGELOG.md @@ -1,5 +1,157 @@ # Change Log +## [3.7.00](https://github.com/kokkos/kokkos/tree/3.7.00) (2022-08-22) +[Full Changelog](https://github.com/kokkos/kokkos/compare/3.6.01...3.7.00) + +### Features: +- Use non-volatile `join()` member functions and `operator+=` in `parallel_reduce/scan` [\#4931](https://github.com/kokkos/kokkos/pull/4931) [\#4954](https://github.com/kokkos/kokkos/pull/4954) [\#4951](https://github.com/kokkos/kokkos/pull/4951) +- Add `SIMD` sub package (requires C++17) [\#5016](https://github.com/kokkos/kokkos/pull/5016) +- Add `is_finalized()` [\#5247](https://github.com/kokkos/kokkos/pull/5247) +- Promote mathematical functions from `namespace Kokkos::Experimental` to `namespace Kokkos` [\#4791](https://github.com/kokkos/kokkos/pull/4791) +- Promote `min`, `max`, `clamp`, `minmax` functions from `namespace Kokkos::Experimental` to `namespace Kokkos` [\#5170](https://github.com/kokkos/kokkos/pull/5170) +- Add `round`, `logb`, `nextafter`, `copysign`, and `signbit` math functions [\#4768](https://github.com/kokkos/kokkos/pull/4768) +- Add `HIPManagedSpace`, similar to `CudaUVMSpace` [\#5112](https://github.com/kokkos/kokkos/pull/5112) +- Accept view construction allocation properties in `create_mirror[_view,_view_and_copy]` and `resize/realloc` [\#5125](https://github.com/kokkos/kokkos/pull/5125) [\#5095](https://github.com/kokkos/kokkos/pull/5095) [\#5035](https://github.com/kokkos/kokkos/pull/5035) [\#4805](https://github.com/kokkos/kokkos/pull/4805) [\#4844](https://github.com/kokkos/kokkos/pull/4844) +- Allow `MemorySpace::allocate()` to be called with execution space [\#4826](https://github.com/kokkos/kokkos/pull/4826) +- Experimental: Compile time view subscriber [\#4197](https://github.com/kokkos/kokkos/pull/4197) + +### Backends and Archs Enhancements: +- Add support for Sapphire Rapids Intel architecture [\#5015](https://github.com/kokkos/kokkos/pull/5015) +- Add support for ICX, SKL and ICL Intel architectures [\#5013](https://github.com/kokkos/kokkos/pull/5013) [\#4929](https://github.com/kokkos/kokkos/pull/4929) +- Add arch flags for Intel GPU Ponte Vecchio [\#4932](https://github.com/kokkos/kokkos/pull/4932) +- SYCL: require GPU if GPU architecture was set at configuration time (i.e. do not allow fallback to CPU device) [\#5264](https://github.com/kokkos/kokkos/pull/5264) [\#5222](https://github.com/kokkos/kokkos/pull/5222) +- SYCL: Add `SYCL::sycl_queue()` for interoperability [\#5241](https://github.com/kokkos/kokkos/pull/5241) +- SYCL: Loosen restriction for using built-in `sycl::group_broadcast` [\#4552](https://github.com/kokkos/kokkos/pull/4552) +- SYCL: preserve address space [\#4396](https://github.com/kokkos/kokkos/pull/4396) +- OpenMPTarget: Adding a workaound for team scan [\#5219](https://github.com/kokkos/kokkos/pull/5219) +- OpenMPTarget: Adding logic to skip the kernel launch if `league_size=0` [\#5067](https://github.com/kokkos/kokkos/pull/5067) +- OpenMPTarget: Make sure `Kokkos::abort()` causes abnormal program termination when called on the host-side [\#4808](https://github.com/kokkos/kokkos/pull/4808) +- HIP: Make HIPHostPinnedSpace coarse-grained [\#5152](https://github.com/kokkos/kokkos/pull/5152) +- Refactor OpenMP `parallel_for` implementation to use more native OpenMP constructs [\#4664](https://github.com/kokkos/kokkos/pull/4664) +- Add option to optimize for local CPU architecture `Kokkos_ARCH_NATIVE` [\#4930](https://github.com/kokkos/kokkos/pull/4930) + + +### Implemented enhancements +- Add command line argument/environment variable to print the configuration [\#5233](https://github.com/kokkos/kokkos/pull/5233) +- Improve error message in view memory access violations [\#4950](https://github.com/kokkos/kokkos/pull/4950) +- Remove unnecessary fences in View initialization [\#4823](https://github.com/kokkos/kokkos/pull/4823) +- Make `View::shmem_size()` device-callable [\#4936](https://github.com/kokkos/kokkos/pull/4936) +- Update numerics support for `__float128` [\#5081](https://github.com/kokkos/kokkos/pull/5081) +- Add `log10` overload for `Kokkos::complex` [\#5009](https://github.com/kokkos/kokkos/pull/5009) +- Add `[[nodiscard]]` to `ScopeGuard` [\#5224](https://github.com/kokkos/kokkos/pull/5224) +- Add structured binding support for `Kokkos::Array` [\#4962](https://github.com/kokkos/kokkos/pull/4962) +- Enable accessing `Kokkos::Array` elements in constant expressions [\#4916](https://github.com/kokkos/kokkos/pull/4916) +- Mark `as_view_of_rank_n` as KOKKOS_FUNCTION [\#5248](https://github.com/kokkos/kokkos/pull/5248) +- Cleanup/rework fence overloads [\#5148](https://github.com/kokkos/kokkos/pull/5148) +- Assert that `Layout` construction from extents is valid in functions taking integer extents [\#5209](https://github.com/kokkos/kokkos/pull/5209) +- Add `fill_random` overload that takes an execution space as first argument [\#5181](https://github.com/kokkos/kokkos/pull/5181) +- Avoid some unnecessary fences in `parallel_reduce/scan` [\#5154](https://github.com/kokkos/kokkos/pull/5154) +- Include `KOKKOS_ENABLE_LIBDL` in options when printing configuration [\#5086](https://github.com/kokkos/kokkos/pull/5086) +- DynRankView: make `layout()` return the same as a corresponding static View [\#5026](https://github.com/kokkos/kokkos/pull/5026) +- Use `_mm_malloc` for icpx [\#5012](https://github.com/kokkos/kokkos/pull/5012) +- Avoid forcing matching execution spaces in `BinSort` constructor and `sort()` [\#4919](https://github.com/kokkos/kokkos/pull/4919) +- Check number of bins in `BinSort` [\#4890](https://github.com/kokkos/kokkos/pull/4890) +- Improve performance in parallel STL-like algorithms [\#4887](https://github.com/kokkos/kokkos/pull/4887) [\#4886](https://github.com/kokkos/kokkos/pull/4886) +- Disable `memset` on A64FX and launch `parallel_for` instead (performance) [\#4884](https://github.com/kokkos/kokkos/pull/4884) +- Allow non-power-of-two team sizes for team reductions and scans [\#4809](https://github.com/kokkos/kokkos/pull/4809) + +#### Harmonization of Kokkos execution environment initialization: +- Warn when unable to detect local MPI rank and user explicitly asked for it [\#5263](https://github.com/kokkos/kokkos/pull/5263) +- Refactor parsing of command line arguments and environment variables [\#5221](https://github.com/kokkos/kokkos/pull/5221) +- Refactor device selection at initialization [\#5211](https://github.com/kokkos/kokkos/pull/5211) +- Rename tools settings for consistency [\#5201](https://github.com/kokkos/kokkos/pull/5201) +- Print help only once [\#5128](https://github.com/kokkos/kokkos/pull/5128) +- Update precedence rule in initialization [\#5130](https://github.com/kokkos/kokkos/pull/5130) +- Warn instead of just ignoring user settings when kokkos-tools is disabled [\#5088](https://github.com/kokkos/kokkos/pull/5088) +- Drop numa args in threads backend initialization [\#5127](https://github.com/kokkos/kokkos/pull/5127) +- Warn users when a flag prefixed with -[-]kokkos is not recognized and do not remove it [\#5256](https://github.com/kokkos/kokkos/pull/5256) +- Give back to Core what belongs to Core (aka moving tune_internals option from Tools back to Core) [\#5202](https://github.com/kokkos/kokkos/pull/5202) + +#### Build system updates: +- `nvcc_wrapper`: filter out -pedantic-errors from nvcc options [\#5235](https://github.com/kokkos/kokkos/pull/5235) +- `nvcc_wrapper`: add known nvcc option --source-in-ptx [\#5052](https://github.com/kokkos/kokkos/pull/5052) +- Link libdl as interface library [\#5179](https://github.com/kokkos/kokkos/pull/5179) +- Only show GPU architectures with enabled corresponding backend [\#5119](https://github.com/kokkos/kokkos/pull/5119) +- Enable optional external desul build [\#5021](https://github.com/kokkos/kokkos/pull/5021) [\#5132](https://github.com/kokkos/kokkos/pull/5132) +- Export `Kokkos_CXX_STANDARD` variable with CMake [\#5068](https://github.com/kokkos/kokkos/pull/5068) +- Suppress warnings with nvc++ [\#5031](https://github.com/kokkos/kokkos/pull/5031) +- Disallow multiple host architectures in CMake [\#4996](https://github.com/kokkos/kokkos/pull/4996) +- Do not include compiler warning flags in the compile option of the cmake target [\#4989](https://github.com/kokkos/kokkos/pull/4989) +- AOT flags for OpenMPTarget targeting Intel GPUs [\#4915](https://github.com/kokkos/kokkos/pull/4915) +- Repurpose `Kokkos_ARCH_INTEL_GEN` for SYCL to mean JIT to be conforming with OMPT [\#4894](https://github.com/kokkos/kokkos/pull/4894) +- Replace amdgpu-target with offload-arch [\#4874](https://github.com/kokkos/kokkos/pull/4874) +- Do not enable `kokkos_launch_compiler` when `CMAKE_CXX_COMPILER_LAUNCHER` is set [\#4870](https://github.com/kokkos/kokkos/pull/4870) +- Move CMake version check up [\#4797](https://github.com/kokkos/kokkos/pull/4797) + +### Incompatibilities: +- Remove `KOKKOS_THREAD_LOCAL` [\#5064](https://github.com/kokkos/kokkos/pull/5064) +- Remove `KOKKOS_ENABLE_POSIX_MEMALIGN` [\#5011](https://github.com/kokkos/kokkos/pull/5011) +- Remove unused `KOKKOS_ENABLE_TM` [\#4995](https://github.com/kokkos/kokkos/pull/4995) +- Remove unused cmakedefine `KOKKOS_ENABLE_COMPILER_WARNINGS` [\#4883](https://github.com/kokkos/kokkos/pull/4883) +- Remove unused `KOKKOS_ENABLE_DUALVIEW_MODIFY_CHECK` [\#4882](https://github.com/kokkos/kokkos/pull/4882) +- Drop Instruction Set Architecture (ISA) macros [\#4981](https://github.com/kokkos/kokkos/pull/4981) +- Warn in `ScopeGuard` about illegal usage [\#5250](https://github.com/kokkos/kokkos/pull/5250) + +### Deprecations: +- Guard against non-public header inclusion [\#5178](https://github.com/kokkos/kokkos/pull/5178) +- Raise deprecation warnings if non empty WorkTag class is used [\#5230](https://github.com/kokkos/kokkos/pull/5230) +- Deprecate `parallel_*` overloads taking the label as trailing argument [\#5141](https://github.com/kokkos/kokkos/pull/5141) +- Deprecate nested types in functional [\#5185](https://github.com/kokkos/kokkos/pull/5185) +- Deprecate `InitArguments` struct and replace it with `InitializationSettings` [\#5135](https://github.com/kokkos/kokkos/pull/5135) +- Deprecate `finalize_all()` [\#5134](https://github.com/kokkos/kokkos/pull/5134) +- Deprecate command line arguments (other than `--help`) that are not prefixed with `kokkos-*` [\#5120](https://github.com/kokkos/kokkos/pull/5120) +- Deprecate `--[kokkos-]numa` cmdline arg and `KOKKOS_NUMA` env var [\#5117](https://github.com/kokkos/kokkos/pull/5117) +- Deprecate `--[kokkos-]threads` command line argument in favor of `--[kokkos-]num-threads` [\#5111](https://github.com/kokkos/kokkos/pull/5111) +- Deprecate `Kokkos::common_view_alloc_prop` [\#5059](https://github.com/kokkos/kokkos/pull/5059) +- Deprecate `Kokkos::is_reducer_type` [\#4957](https://github.com/kokkos/kokkos/pull/4957) +- Deprecate `OffsetView` constructors taking `index_list_type` [\#4810](https://github.com/kokkos/kokkos/pull/4810) +- Deprecate overloads of `Kokkos::sort` taking a parameter `bool always_use_kokkos_sort` [\#5382](https://github.com/kokkos/kokkos/issues/5382) +- Warn about `parallel_reduce` cases that call `join()` with volatile-qualified arguments [\#5215](https://github.com/kokkos/kokkos/pull/5215) + +### Bug Fixes: +- CUDA Reductions: Fix data races reported by Nvidia `compute-sanitizer` [\#4855](https://github.com/kokkos/kokkos/pull/4855) +- Work around Intel compiler bug [\#5301](https://github.com/kokkos/kokkos/pull/5301) +- Avoid allocating memory for UniqueToken [\#5300](https://github.com/kokkos/kokkos/pull/5300) +- DynamicView: Properly resize mirror instances after construction [\#5276](https://github.com/kokkos/kokkos/pull/5276) +- Remove Kokkos::Rank limit of 6 ranks [\#5271](https://github.com/kokkos/kokkos/pull/5271) +- Do not forget to set last element to nullptr when removing a flag in `Kokkos::initialize` [\#5272](https://github.com/kokkos/kokkos/pull/5272) +- Fix CUDA+MSVC build issue [\#5261](https://github.com/kokkos/kokkos/pull/5261) +- Fix `DynamicView::resize_serial` [\#5220](https://github.com/kokkos/kokkos/pull/5220) +- Fix cmake default compiler flags for unknown compiler [\#5217](https://github.com/kokkos/kokkos/pull/5217) +- Fix `move_backward` [\#5191](https://github.com/kokkos/kokkos/pull/5191) +- Fixing issue 5196 - missing symbol with intel compiler [\#5207](https://github.com/kokkos/kokkos/pull/5207) +- Preserve `KOKKOS_INVALID_INDEX` in ViewDimension and ArrayLayout construction [\#5188](https://github.com/kokkos/kokkos/pull/5188) +- Finalize `deep_copy_space` early avoiding printing to `std::cerr` for Cuda [\#5151](https://github.com/kokkos/kokkos/pull/5151) +- Use correct policy in Threads MDRange `parallel_reduce` [\#5123](https://github.com/kokkos/kokkos/pull/5123) +- Fix building with NVCC as the CXX compiler while the CUDA backend is not enabled [\#5115](https://github.com/kokkos/kokkos/pull/5115) +- OpenMPTarget Index range fix for MDRange. [\#5089](https://github.com/kokkos/kokkos/pull/5089) +- Fix bug with CUDA's team reduction for empty ranges [\#5079](https://github.com/kokkos/kokkos/pull/5079) +- Fix using `ZeroMemset` for Serial [\#5077](https://github.com/kokkos/kokkos/pull/5077) +- Fix `Kokkos::Vector::push_back` for default execution space [\#5047](https://github.com/kokkos/kokkos/pull/5047) +- ScatterView: Fix ScatterMin/ScatterMax to use proper atomics [\#5045](https://github.com/kokkos/kokkos/pull/5045) +- Fix calling `ZeroMemset` in `deep_copy` [\#5040](https://github.com/kokkos/kokkos/pull/5040) +- Make View self-assignment not produce double-free [\#5024](https://github.com/kokkos/kokkos/pull/5024) +- Guard against unrecognized pragma with intel compilers [\#5019](https://github.com/kokkos/kokkos/pull/5019) +- Fix racing condition in `HIPParallelLaunch` [\#5008](https://github.com/kokkos/kokkos/pull/5008) +- KokkosP: Fix `device_id` in profiling [\#4997](https://github.com/kokkos/kokkos/pull/4997) +- Fix for `Kokkos::vector::insert` into empty vector with begin and end iterators [\#4988](https://github.com/kokkos/kokkos/pull/4988) +- Fix Core header files installation [\#4984](https://github.com/kokkos/kokkos/pull/4984) +- Fix bounds errors with `Kokkos::sort` [\#4980](https://github.com/kokkos/kokkos/pull/4980) +- Fixup let `RangePolicy::set_chunk_size` return a reference to self [\#4918](https://github.com/kokkos/kokkos/pull/4918) +- Fix allocating large Views [\#4907](https://github.com/kokkos/kokkos/pull/4907) +- Fix combined reductions with `Kokkos::View` [\#4896](https://github.com/kokkos/kokkos/pull/4896) +- Fixed `_CUDA_ARCH__` to `__CUDA_ARCH__` for CUDA LDG [\#4893](https://github.com/kokkos/kokkos/pull/4893) +- Fixup `View::access()` truncate parameter pack [\#4876](https://github.com/kokkos/kokkos/pull/4876) +- Fix `abort` with HIP backend for ROCm 5.0.2 and beyond [\#4873](https://github.com/kokkos/kokkos/pull/4873) +- Fix HIP version when printing the configuration [\#4872](https://github.com/kokkos/kokkos/pull/4872) +- Fix scratch lock array when using scratch level 1 [\#4871](https://github.com/kokkos/kokkos/pull/4871) +- Fix Makefile.kokkos to work with fujitsu compiler [\#4867](https://github.com/kokkos/kokkos/pull/4867) +- cmake: Correct link THREADS link option [\#4854](https://github.com/kokkos/kokkos/pull/4854) +- UniqueToken `impl_acquire` function should be device only [\#4819](https://github.com/kokkos/kokkos/pull/4819) +- Fix example calls to non existing static `print_configuration` [\#4806](https://github.com/kokkos/kokkos/pull/4806) +- Fix requests for large team scratch sizes [\#4728](https://github.com/kokkos/kokkos/pull/4728) + + ## [3.6.01](https://github.com/kokkos/kokkos/tree/3.6.01) (2022-05-23) [Full Changelog](https://github.com/kokkos/kokkos/compare/3.6.00...3.6.01) diff --git a/lib/kokkos/CMakeLists.txt b/lib/kokkos/CMakeLists.txt index b0a54118a0..a05bfcdb94 100644 --- a/lib/kokkos/CMakeLists.txt +++ b/lib/kokkos/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # Disable in-source builds to prevent source tree corruption. if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" ) @@ -28,11 +29,6 @@ SET(KOKKOS_SRC_PATH ${Kokkos_SOURCE_DIR}) SET(KOKKOS_PATH ${Kokkos_SOURCE_DIR}) SET(KOKKOS_TOP_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}) -# Needed to simplify syntax of if statements -CMAKE_POLICY(SET CMP0054 NEW) -# Needed to make IN_LIST a valid operator -CMAKE_POLICY(SET CMP0057 NEW) - # Is this a build as part of Trilinos? IF(COMMAND TRIBITS_PACKAGE_DECL) SET(KOKKOS_HAS_TRILINOS ON) @@ -72,7 +68,6 @@ ENDFUNCTION() LIST(APPEND CMAKE_MODULE_PATH cmake/Modules) IF(NOT KOKKOS_HAS_TRILINOS) - cmake_minimum_required(VERSION 3.16 FATAL_ERROR) set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) @@ -80,7 +75,7 @@ IF(NOT KOKKOS_HAS_TRILINOS) # downstream dependencies need to match this! SET(KOKKOS_COMPILE_LANGUAGE CXX) # use lower case here since we didn't parse options yet - IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) + 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. # but we still need a C++ compiler even if we build all our cpp files as CUDA only @@ -90,9 +85,7 @@ IF(NOT KOKKOS_HAS_TRILINOS) # days. SET(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX) - IF (Kokkos_ENABLE_CUDA) - SET(KOKKOS_COMPILE_LANGUAGE CUDA) - ENDIF() + SET(KOKKOS_COMPILE_LANGUAGE CUDA) ENDIF() IF (Spack_WORKAROUND) @@ -135,14 +128,11 @@ ENDIF() set(Kokkos_VERSION_MAJOR 3) -set(Kokkos_VERSION_MINOR 6) -set(Kokkos_VERSION_PATCH 01) +set(Kokkos_VERSION_MINOR 7) +set(Kokkos_VERSION_PATCH 00) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") -MESSAGE(STATUS "Setting policy CMP0074 to use _ROOT variables") -CMAKE_POLICY(SET CMP0074 NEW) - # Load either the real TriBITS or a TriBITS wrapper # for certain utility functions that are universal (like GLOBAL_SET) INCLUDE(${KOKKOS_SRC_PATH}/cmake/fake_tribits.cmake) @@ -204,11 +194,16 @@ KOKKOS_SETUP_BUILD_ENVIRONMENT() OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF) SET(KOKKOS_EXT_LIBRARIES Kokkos::kokkos Kokkos::kokkoscore Kokkos::kokkoscontainers Kokkos::kokkosalgorithms) -SET(KOKKOS_INT_LIBRARIES kokkos kokkoscore kokkoscontainers kokkosalgorithms) +SET(KOKKOS_SUB_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms) +IF (KOKKOS_CXX_STANDARD GREATER_EQUAL 17) + LIST(APPEND KOKKOS_EXT_LIBRARIES Kokkos::kokkossimd) + LIST(APPEND KOKKOS_SUB_LIBRARIES kokkossimd) +ENDIF() +SET(KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_SUB_LIBRARIES}) SET_PROPERTY(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES ${KOKKOS_INT_LIBRARIES}) IF (KOKKOS_HAS_TRILINOS) - SET(TRILINOS_INCDIR ${CMAKE_INSTALL_PREFIX}/${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) + SET(TRILINOS_INCDIR ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) SET(KOKKOS_HEADER_DIR ${TRILINOS_INCDIR}) SET(KOKKOS_IS_SUBDIRECTORY TRUE) ELSEIF(HAS_PARENT) @@ -296,7 +291,7 @@ IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING) #Make sure in-tree projects can reference this as Kokkos:: #to match the installed target names ADD_LIBRARY(Kokkos::kokkos ALIAS kokkos) - TARGET_LINK_LIBRARIES(kokkos INTERFACE kokkoscore kokkoscontainers kokkosalgorithms) + TARGET_LINK_LIBRARIES(kokkos INTERFACE ${KOKKOS_SUB_LIBRARIES}) KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(kokkos) ENDIF() INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_install.cmake) diff --git a/lib/kokkos/Makefile.kokkos b/lib/kokkos/Makefile.kokkos index 755831452b..7aa04aad7d 100644 --- a/lib/kokkos/Makefile.kokkos +++ b/lib/kokkos/Makefile.kokkos @@ -11,21 +11,21 @@ CXXFLAGS += $(SHFLAGS) endif KOKKOS_VERSION_MAJOR = 3 -KOKKOS_VERSION_MINOR = 6 -KOKKOS_VERSION_PATCH = 01 +KOKKOS_VERSION_MINOR = 7 +KOKKOS_VERSION_PATCH = 00 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial KOKKOS_DEVICES ?= "OpenMP" #KOKKOS_DEVICES ?= "Threads" # Options: -# Intel: KNC,KNL,SNB,HSW,BDW,SKX +# Intel: KNC,KNL,SNB,HSW,BDW,SKL,SKX,ICL,ICX,SPR # NVIDIA: Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61,Volta70,Volta72,Turing75,Ampere80,Ampere86 # ARM: ARMv80,ARMv81,ARMv8-ThunderX,ARMv8-TX2,A64FX # IBM: BGQ,Power7,Power8,Power9 # AMD-GPUS: Vega900,Vega906,Vega908,Vega90A # AMD-CPUS: AMDAVX,Zen,Zen2,Zen3 -# Intel-GPUs: Gen9,Gen11,Gen12LP,DG1,XeHP +# Intel-GPUs: Gen9,Gen11,Gen12LP,DG1,XeHP,PVC KOKKOS_ARCH ?= "" # Options: yes,no KOKKOS_DEBUG ?= "no" @@ -193,6 +193,8 @@ KOKKOS_INTERNAL_COMPILER_INTEL_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VE 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_GCC := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),GCC) +# TODO fujitsu can emulate gcc or clang. Only clang mode works at the moment. +KOKKOS_INTERNAL_COMPILER_FUJITSU := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),FUJITSU) # Check Host Compiler if using NVCC through nvcc_wrapper ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) @@ -221,8 +223,23 @@ endif ifeq ($(KOKKOS_INTERNAL_COMPILER_HCC), 1) KOKKOS_INTENAL_COMPILER_CLANG = 0 endif +# Fujitsu passes also as clang and gcc respectively +ifeq ($(KOKKOS_INTERNAL_COMPILER_FUJITSU), 1) + ifeq ($(KOKKOS_INTERNAL_COMPILER_GCC), 1) + # TODO handle gcc flags and workaround for bug? + # fujitsu (gcc mode) is bugged, see https://github.com/kokkos/kokkos/issues/4730 + $(warning Warning: ${CXX} in Trad Mode '-Nnoclang' (default) is not recommended. Use 'CXX = ${CXX} -Nclang' instead.) + # HACK since fujitsu only accepts some gcc flags, disable gcc here? + # KOKKOS_INTERNAL_COMPILER_GCC = 0 + endif + # TODO handle clang flags + # warnings: works fine as is + # openmp: handled + #KOKKOS_INTERNAL_COMPILER_CLANG = 0 +endif ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) + # TODO empty variable if fujitsu (clang mode) passes as clang KOKKOS_INTERNAL_COMPILER_CLANG_VERSION := $(shell $(CXX) --version | grep version | cut -d ' ' -f3 | tr -d '.') ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) @@ -272,7 +289,12 @@ else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 1) KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp else - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp + ifeq ($(KOKKOS_INTERNAL_COMPILER_FUJITSU), 1) + # fujitsu (clang mode) fails with `=libomp` + KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp + else + KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp + endif endif else ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) @@ -300,11 +322,15 @@ ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1) else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) #KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_BUG_WORKAROUND_IBM_CLANG_OMP45_VIEW_INIT -fopenmp-implicit-declare-target -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp -fopenmp=libomp - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_WORKAROUND_OPENMPTARGET_CLANG -fopenmp -fopenmp=libomp + KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_WORKAROUND_OPENMPTARGET_CLANG -fopenmp -fopenmp=libomp -Wno-openmp-mapping KOKKOS_INTERNAL_OPENMPTARGET_LIB := -lomptarget else - #Assume GCC - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fopenmp -foffload=nvptx-none + ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1) + KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fiopenmp -Wno-openmp-mapping + else + #Assume GCC + KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fopenmp -foffload=nvptx-none + endif endif endif @@ -344,8 +370,12 @@ KOKKOS_INTERNAL_USE_ARCH_WSM := $(call kokkos_has_string,$(KOKKOS_ARCH),WSM) KOKKOS_INTERNAL_USE_ARCH_SNB := $(call kokkos_has_string,$(KOKKOS_ARCH),SNB) KOKKOS_INTERNAL_USE_ARCH_HSW := $(call kokkos_has_string,$(KOKKOS_ARCH),HSW) KOKKOS_INTERNAL_USE_ARCH_BDW := $(call kokkos_has_string,$(KOKKOS_ARCH),BDW) +KOKKOS_INTERNAL_USE_ARCH_SKL := $(call kokkos_has_string,$(KOKKOS_ARCH),SKL) KOKKOS_INTERNAL_USE_ARCH_SKX := $(call kokkos_has_string,$(KOKKOS_ARCH),SKX) KOKKOS_INTERNAL_USE_ARCH_KNL := $(call kokkos_has_string,$(KOKKOS_ARCH),KNL) +KOKKOS_INTERNAL_USE_ARCH_ICL := $(call kokkos_has_string,$(KOKKOS_ARCH),ICL) +KOKKOS_INTERNAL_USE_ARCH_ICX := $(call kokkos_has_string,$(KOKKOS_ARCH),ICX) +KOKKOS_INTERNAL_USE_ARCH_SPR := $(call kokkos_has_string,$(KOKKOS_ARCH),SPR) KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen) KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9 := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen9) @@ -353,6 +383,7 @@ KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11 := $(call kokkos_has_string,$(KOKKOS_ARCH), KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen12LP) KOKKOS_INTERNAL_USE_ARCH_INTEL_DG1 := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelDG1) KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelXeHP) +KOKKOS_INTERNAL_USE_ARCH_INTEL_PVC := $(call kokkos_has_string,$(KOKKOS_ARCH),PVC) # NVIDIA based. NVCC_WRAPPER := $(KOKKOS_PATH)/bin/nvcc_wrapper @@ -436,19 +467,9 @@ KOKKOS_INTERNAL_USE_ARCH_SSE42 := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_W KOKKOS_INTERNAL_USE_ARCH_AVX := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_SNB) + $(KOKKOS_INTERNAL_USE_ARCH_AMDAVX)) KOKKOS_INTERNAL_USE_ARCH_AVX2 := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_HSW) + $(KOKKOS_INTERNAL_USE_ARCH_BDW) + $(KOKKOS_INTERNAL_USE_ARCH_ZEN) + $(KOKKOS_INTERNAL_USE_ARCH_ZEN2) + $(KOKKOS_INTERNAL_USE_ARCH_ZEN3)) KOKKOS_INTERNAL_USE_ARCH_AVX512MIC := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KNL)) -KOKKOS_INTERNAL_USE_ARCH_AVX512XEON := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_SKX)) - -# Decide what ISA level we are able to support. -KOKKOS_INTERNAL_USE_ISA_X86_64 := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_WSM) + $(KOKKOS_INTERNAL_USE_ARCH_SNB) + $(KOKKOS_INTERNAL_USE_ARCH_HSW) + $(KOKKOS_INTERNAL_USE_ARCH_BDW) + $(KOKKOS_INTERNAL_USE_ARCH_KNL) + $(KOKKOS_INTERNAL_USE_ARCH_SKX) + $(KOKKOS_INTERNAL_USE_ARCH_ZEN) + $(KOKKOS_INTERNAL_USE_ARCH_ZEN2) + $(KOKKOS_INTERNAL_USE_ARCH_ZEN3)) -KOKKOS_INTERNAL_USE_ISA_KNC := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KNC)) -KOKKOS_INTERNAL_USE_ISA_POWERPCLE := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_POWER8) + $(KOKKOS_INTERNAL_USE_ARCH_POWER9)) -KOKKOS_INTERNAL_USE_ISA_POWERPCBE := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_POWER7)) - -# Decide whether we can support transactional memory -KOKKOS_INTERNAL_USE_TM := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_BDW) + $(KOKKOS_INTERNAL_USE_ARCH_SKX)) # Incompatible flags? -KOKKOS_INTERNAL_USE_ARCH_MULTIHOST := $(strip $(shell echo "$(KOKKOS_INTERNAL_USE_ARCH_SSE42)+$(KOKKOS_INTERNAL_USE_ARCH_AVX)+$(KOKKOS_INTERNAL_USE_ARCH_AVX2)+$(KOKKOS_INTERNAL_USE_ARCH_AVX512MIC)+$(KOKKOS_INTERNAL_USE_ARCH_AVX512XEON)+$(KOKKOS_INTERNAL_USE_ARCH_KNC)+$(KOKKOS_INTERNAL_USE_ARCH_IBM)+$(KOKKOS_INTERNAL_USE_ARCH_ARM)>1") | bc) +KOKKOS_INTERNAL_USE_ARCH_MULTIHOST := $(strip $(shell echo "$(KOKKOS_INTERNAL_USE_ARCH_SSE42)+$(KOKKOS_INTERNAL_USE_ARCH_AVX)+$(KOKKOS_INTERNAL_USE_ARCH_AVX2)+$(KOKKOS_INTERNAL_USE_ARCH_AVX512MIC)+$(KOKKOS_INTERNAL_USE_ARCH_SKL)+$(KOKKOS_INTERNAL_USE_ARCH_SKX)+$(KOKKOS_INTERNAL_USE_ARCH_ICL)+$(KOKKOS_INTERNAL_USE_ARCH_ICX)+$(KOKKOS_INTERNAL_USE_ARCH_SPR)+$(KOKKOS_INTERNAL_USE_ARCH_KNC)+$(KOKKOS_INTERNAL_USE_ARCH_IBM)+$(KOKKOS_INTERNAL_USE_ARCH_ARM)>1") | bc) KOKKOS_INTERNAL_USE_ARCH_MULTIGPU := $(strip $(shell echo "$(KOKKOS_INTERNAL_USE_ARCH_NVIDIA)>1") | bc) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MULTIHOST), 1) @@ -551,36 +572,6 @@ ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_SERIAL") endif -ifeq ($(KOKKOS_INTERNAL_USE_TM), 1) - tmp := $(call kokkos_append_header,"$H""ifndef __CUDA_ARCH__") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_TM") - tmp := $(call kokkos_append_header,"$H""endif") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ISA_X86_64), 1) - tmp := $(call kokkos_append_header,"$H""ifndef __CUDA_ARCH__") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_USE_ISA_X86_64") - tmp := $(call kokkos_append_header,"$H""endif") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ISA_KNC), 1) - tmp := $(call kokkos_append_header,"$H""ifndef __CUDA_ARCH__") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_USE_ISA_KNC") - tmp := $(call kokkos_append_header,"$H""endif") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ISA_POWERPCLE), 1) - tmp := $(call kokkos_append_header,"$H""ifndef __CUDA_ARCH__") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_USE_ISA_POWERPCLE") - tmp := $(call kokkos_append_header,"$H""endif") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ISA_POWERPCBE), 1) - tmp := $(call kokkos_append_header,"$H""ifndef __CUDA_ARCH__") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_USE_ISA_POWERPCBE") - tmp := $(call kokkos_append_header,"$H""endif") -endif - #only add the c++ standard flags if this is not CMake tmp := $(call kokkos_append_header,"/* General Settings */") ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) @@ -1041,7 +1032,28 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX512MIC), 1) endif endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX512XEON), 1) +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SKL), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") + + ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) + KOKKOS_CXXFLAGS += -xSKYLAKE + KOKKOS_LDFLAGS += -xSKYLAKE + else + ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) + + else + ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) + + else + # Nothing here yet. + KOKKOS_CXXFLAGS += -march=skylake + KOKKOS_LDFLAGS += -march=skylake + endif + endif + endif +endif + +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SKX), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) @@ -1055,13 +1067,31 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX512XEON), 1) else # Nothing here yet. - KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 -mrtm - KOKKOS_LDFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 -mrtm + KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 + KOKKOS_LDFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 endif endif endif endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ICL), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") + KOKKOS_CXXFLAGS += -march=icelake-client -mtune=icelake-client + KOKKOS_LDFLAGS += -march=icelake-client -mtune=icelake-client +endif + +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ICX), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") + KOKKOS_CXXFLAGS += -march=icelake-server -mtune=icelake-server + KOKKOS_LDFLAGS += -march=icelake-server -mtune=icelake-server +endif + +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SPR), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") + KOKKOS_CXXFLAGS += -march=sapphirerapids -mtune=sapphirerapids + KOKKOS_LDFLAGS += -march=sapphirerapids -mtune=sapphirerapids +endif + ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KNC), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KNC") KOKKOS_CXXFLAGS += -mmic @@ -1091,7 +1121,7 @@ endif ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG=-fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march + KOKKOS_INTERNAL_CUDA_ARCH_FLAG=-fopenmp-targets=nvptx64 -Xopenmp-target -march endif KOKKOS_INTERNAL_USE_CUDA_ARCH = 1 endif @@ -1192,29 +1222,29 @@ ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA900), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA900") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") - KOKKOS_INTERNAL_HIP_ARCH_FLAG := --amdgpu-target=gfx900 + KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx900 endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA906), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA906") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") - KOKKOS_INTERNAL_HIP_ARCH_FLAG := --amdgpu-target=gfx906 + KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx906 endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA908), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA908") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") - KOKKOS_INTERNAL_HIP_ARCH_FLAG := --amdgpu-target=gfx908 + KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx908 endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA90A), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA90A") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") - KOKKOS_INTERNAL_HIP_ARCH_FLAG := --amdgpu-target=gfx90a + KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx90a endif KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.cpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.hpp) ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0) - KOKKOS_SRC += $(KOKKOS_PATH)/core/src/desul/src/Lock_Array_HIP.cpp + KOKKOS_SRC += $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp endif KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_HIP_ARCH_FLAG) @@ -1230,51 +1260,67 @@ ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) endif endif -# Figure out the architecture flag for SYCL. +# Figure out Intel architecture flags. ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) - # Lets start with adding architecture defines - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN") - KOKKOS_INTERNAL_SYCL_ARCH_FLAG := -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend "-device gen9-" - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN9") - KOKKOS_INTERNAL_SYCL_ARCH_FLAG := -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend "-device gen9" - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN11") - KOKKOS_INTERNAL_SYCL_ARCH_FLAG := -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend "-device gen11" - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN12LP") - KOKKOS_INTERNAL_SYCL_ARCH_FLAG := -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend "-device gen12lp" - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_DG1), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_DG1") - KOKKOS_INTERNAL_SYCL_ARCH_FLAG := -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend "-device dg1" - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_XEHP") - KOKKOS_INTERNAL_SYCL_ARCH_FLAG := -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend "-device xehp" - endif + KOKKOS_INTERNAL_LC_BACKEND := sycl +endif +ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) + KOKKOS_INTERNAL_LC_BACKEND := openmp +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64 +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN9") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device gen9" +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN11") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device gen11" +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GEN12LP") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device gen12lp" +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_DG1), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_DG1") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device dg1" +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_XEHP") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device xehp" +endif +ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_PVC), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_PVC") + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.4.0" +endif +ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/SYCL/*.cpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/SYCL/*.hpp) - KOKKOS_CXXFLAGS+=-fsycl -fno-sycl-id-queries-fit-in-int -fsycl-unnamed-lambda - KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_SYCL_ARCH_FLAG) + KOKKOS_CXXFLAGS+=-fsycl -fno-sycl-id-queries-fit-in-int -fsycl-unnamed-lambda -fsycl-dead-args-optimization + KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) KOKKOS_LDFLAGS+=-fsycl - KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_SYCL_ARCH_FLAG) + KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) +endif + +ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) + KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) -D__STRICT_ANSI__ + KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) endif ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_DESUL_ATOMICS") + KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/desul/include else ifeq ($(KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS), 1) $(error Contradictory Desul atomics options: KOKKOS_OPTIONS=$(KOKKOS_OPTIONS) ) @@ -1359,7 +1405,7 @@ KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/containers/src/impl/*.cpp) ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/Cuda/*.cpp) ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0) - KOKKOS_SRC += $(KOKKOS_PATH)/core/src/desul/src/Lock_Array_CUDA.cpp + KOKKOS_SRC += $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_CUDA.cpp endif KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/Cuda/*.hpp) ifneq ($(CUDA_PATH),) @@ -1417,6 +1463,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) KOKKOS_TPL_LIBRARY_NAMES += pthread endif +ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) + KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/Serial/*.cpp) + KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/Serial/*.hpp) +endif + ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/HPX/*.cpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/HPX/*.hpp) @@ -1449,15 +1500,6 @@ ifneq ($(KOKKOS_INTERNAL_USE_MEMKIND), 1) KOKKOS_SRC := $(filter-out $(KOKKOS_PATH)/core/src/impl/Kokkos_HBWSpace.cpp,$(KOKKOS_SRC)) endif -# Don't include Kokkos_Serial.cpp or Kokkos_Serial_Task.cpp if not using Serial -# device to avoid a link warning. -ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) -endif -ifneq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) - KOKKOS_SRC := $(filter-out $(KOKKOS_PATH)/core/src/impl/Kokkos_Serial.cpp,$(KOKKOS_SRC)) - KOKKOS_SRC := $(filter-out $(KOKKOS_PATH)/core/src/impl/Kokkos_Serial_Task.cpp,$(KOKKOS_SRC)) -endif - # With Cygwin functions such as fdopen and fileno are not defined # when strict ansi is enabled. strict ansi gets enabled with -std=c++14 # though. So we hard undefine it here. Not sure if that has any bad side effects diff --git a/lib/kokkos/Makefile.targets b/lib/kokkos/Makefile.targets index a9cb12e1b4..876726e947 100644 --- a/lib/kokkos/Makefile.targets +++ b/lib/kokkos/Makefile.targets @@ -16,10 +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 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 -Kokkos_Serial.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Serial.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Serial.cpp -Kokkos_Serial_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Serial_Task.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Serial_Task.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 @@ -41,6 +37,13 @@ Kokkos_HostSpace_deepcopy.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/ Kokkos_NumericTraits.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_NumericTraits.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_NumericTraits.cpp +ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) +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 +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 +endif + ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) 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 @@ -50,8 +53,8 @@ Kokkos_Cuda_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cu $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp Kokkos_Cuda_Locks.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Locks.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Locks.cpp -Lock_Array_CUDA.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/desul/src/Lock_Array_CUDA.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/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 endif ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) @@ -70,20 +73,18 @@ Kokkos_HIP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_ $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp Kokkos_HIP_Locks.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Locks.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Locks.cpp -Lock_Array_HIP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/desul/src/Lock_Array_HIP.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/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 endif ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) -Kokkos_ThreadsExec_base.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Threads/Kokkos_ThreadsExec_base.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Threads/Kokkos_ThreadsExec_base.cpp Kokkos_ThreadsExec.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Threads/Kokkos_ThreadsExec.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Threads/Kokkos_ThreadsExec.cpp endif ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) -Kokkos_OpenMP_Exec.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Exec.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Exec.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 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 endif diff --git a/lib/kokkos/README.md b/lib/kokkos/README.md index f6c500cc1a..033346e956 100644 --- a/lib/kokkos/README.md +++ b/lib/kokkos/README.md @@ -10,270 +10,48 @@ hierarchies and multiple types of execution resources. It currently can use CUDA, HIP, SYCL, HPX, OpenMP and C++ threads as backend programming models with several other backends in development. -Kokkos Core is part of the Kokkos C++ Performance Portability Programming EcoSystem, -which also provides math kernels (https://github.com/kokkos/kokkos-kernels), as well as -profiling and debugging tools (https://github.com/kokkos/kokkos-tools). +**Kokkos Core is part of the Kokkos C++ Performance Portability Programming EcoSystem.** + +For the complete documentation, click below: + +# [kokkos.github.io/kokkos-core-wiki](https://kokkos.github.io/kokkos-core-wiki) # Learning about Kokkos -The best way to start learning about Kokkos is going through the Kokkos Lectures. -They are online available at https://kokkos.link/the-lectures and contain a mix -of lecture videos and hands-on exercises covering all the important Kokkos Ecosystem -capabilities. +To start learning about Kokkos: -A programming guide and API reference can be found on the Wiki -(https://github.com/kokkos/kokkos/wiki). +- [Kokkos Lectures](https://kokkos.github.io/kokkos-core-wiki/videolectures.html): they contain a mix of lecture videos and hands-on exercises covering all the important Kokkos Ecosystem capabilities. + +- [Programming guide](https://kokkos.github.io/kokkos-core-wiki/programmingguide.html): contains in "narrative" form a technical description of the programming model, machine model, and the main building blocks like the Views and parallel dispatch. + +- [API reference](https://kokkos.github.io/kokkos-core-wiki/): organized by category, i.e., [core](https://kokkos.github.io/kokkos-core-wiki/API/core-index.html), [algorithms](https://kokkos.github.io/kokkos-core-wiki/API/algorithms-index.html) and [containers](https://kokkos.github.io/kokkos-core-wiki/API/containers-index.html) or, if you prefer, in [alphabetical order](https://kokkos.github.io/kokkos-core-wiki/API/alphabetical.html). + +- [Use cases and Examples](https://kokkos.github.io/kokkos-core-wiki/usecases.html): a series of examples ranging from how to use Kokkos with MPI to Fortran interoperability. For questions find us on Slack: https://kokkosteam.slack.com or open a github issue. -For non-public questions send an email to -crtrott(at)sandia.gov +For non-public questions send an email to: *crtrott(at)sandia.gov* # Contributing to Kokkos -We are open and try to encourage contributions from external developers. -To do so please first open an issue describing the contribution and then issue -a pull request against the develop branch. For larger features it may be good -to get guidance from the core development team first through the github issue. +Please see [this page](https://kokkos.github.io/kokkos-core-wiki/contributing.html) for details on how to contribute. -Note that Kokkos Core is licensed under standard 3-clause BSD terms of use. -Which means contributing to Kokkos allows anyone else to use your contributions -not just for public purposes but also for closed source commercial projects. -For specifics see the LICENSE file contained in the repository or distribution. +# Requirements, Building and Installing -# Requirements - -### Minimum Compiler Versions - -Generally Kokkos should work with all compiler versions newer than the minimum. -However as in all sufficiently complex enough code, we have to work around compiler -bugs with almost all compilers. So compiler versions we don't test may have issues -we are unaware of. - -* GCC: 5.3.0 -* Clang: 4.0.0 -* Intel: 17.0.1 -* NVCC: 9.2.88 -* NVC++: 21.5 -* ROCm: 4.3 -* MSVC: 19.29 -* IBM XL: 16.1.1 -* Fujitsu: 4.5.0 -* ARM/Clang 20.1 - -### Primary Tested Compilers - -* GCC: 5.3.0, 6.1.0, 7.3.0, 8.3, 9.2, 10.0 -* NVCC: 9.2.88, 10.1, 11.0 -* Clang: 8.0.0, 9.0.0, 10.0.0, 12.0.0 -* Intel 17.4, 18.1, 19.5 -* MSVC: 19.29 -* ARM/Clang: 20.1 -* IBM XL: 16.1.1 -* ROCm: 4.3.0 - -### Build system: - -* CMake >= 3.16: required -* CMake >= 3.18: Fortran linkage. This does not affect most mixed Fortran/Kokkos builds. See [build issues](BUILD.md#KnownIssues). -* CMake >= 3.21.1 for NVC++ - -Primary tested compiler are passing in release mode -with warnings as errors. They also are tested with a comprehensive set of -backend combinations (i.e. OpenMP, Threads, Serial, OpenMP+Serial, ...). -We are using the following set of flags: -* GCC: - ```` - -Wall -Wunused-parameter -Wshadow -pedantic - -Werror -Wsign-compare -Wtype-limits - -Wignored-qualifiers -Wempty-body - -Wclobbered -Wuninitialized - ```` -* Intel: - ```` - -Wall -Wunused-parameter -Wshadow -pedantic - -Werror -Wsign-compare -Wtype-limits - -Wuninitialized - ```` -* Clang: - ```` - -Wall -Wunused-parameter -Wshadow -pedantic - -Werror -Wsign-compare -Wtype-limits - -Wuninitialized - ```` - -* NVCC: - ```` - -Wall -Wunused-parameter -Wshadow -pedantic - -Werror -Wsign-compare -Wtype-limits - -Wuninitialized - ```` - -Other compilers are tested occasionally, in particular when pushing from develop to -master branch. These are tested less rigorously without `-Werror` and only for a select set of backends. - -# Building and Installing Kokkos -Kokkos provide a CMake build system and a raw Makefile build system. -The CMake build system is strongly encouraged and will be the most rigorously supported in future releases. -Full details are given in the [build instructions](BUILD.md). Basic setups are shown here: - -## CMake - -The best way to install Kokkos is using the CMake build system. Assuming Kokkos lives in `$srcdir`: -````bash -cmake $srcdir \ - -DCMAKE_CXX_COMPILER=$path_to_compiler \ - -DCMAKE_INSTALL_PREFIX=$path_to_install \ - -DKokkos_ENABLE_OPENMP=On \ - -DKokkos_ARCH_HSW=On \ - -DKokkos_HWLOC_DIR=$path_to_hwloc -```` -then simply type `make install`. The Kokkos CMake package will then be installed in `$path_to_install` to be used by downstream packages. - -To validate the Kokkos build, configure with -```` - -DKokkos_ENABLE_TESTS=On -```` -and run `make test` after completing the build. - -For your CMake project using Kokkos, code such as the following: - -````cmake -find_package(Kokkos) -... -target_link_libraries(myTarget Kokkos::kokkos) -```` -should be added to your CMakeLists.txt. Your configure should additionally include -```` --DKokkos_DIR=$path_to_install/cmake/lib/Kokkos -```` -or -```` --DKokkos_ROOT=$path_to_install -```` -for the install location given above. - -## Spack -An alternative to manually building with the CMake is to use the Spack package manager. -To get started, download the Spack [repo](https://github.com/spack/spack). -```` -A basic installation would be done as: -````bash -> spack install kokkos -```` -Spack allows options and and compilers to be tuned in the install command. -````bash -> spack install kokkos@3.0 %gcc@7.3.0 +openmp -```` -This example illustrates the three most common parameters to Spack: -* Variants: specified with, e.g. `+openmp`, this activates (or deactivates with, e.g. `~openmp`) certain options. -* Version: immediately following `kokkos` the `@version` can specify a particular Kokkos to build -* Compiler: a default compiler will be chosen if not specified, but an exact compiler version can be given with the `%`option. - -For a complete list of Kokkos options, run: -````bash -> spack info kokkos -```` -Spack currently installs packages to a location determined by a unique hash. This hash name is not really "human readable". -Generally, Spack usage should never really require you to reference the computer-generated unique install folder. -More details are given in the [build instructions](BUILD.md). If you must know, you can locate Spack Kokkos installations with: -````bash -> spack find -p kokkos ... -```` -where `...` is the unique spec identifying the particular Kokkos configuration and version. -Some more details can found in the Kokkos spack [documentation](Spack.md) or the Spack [website](https://spack.readthedocs.io/en/latest). - -## Raw Makefile - -Raw Makefiles are only supported via inline builds. See below. - -## Inline Builds vs. Installed Package -For individual projects, it may be preferable to build Kokkos inline rather than link to an installed package. -The main reason is that you may otherwise need many different -configurations of Kokkos installed depending on the required compile time -features an application needs. For example there is only one default -execution space, which means you need different installations to have OpenMP -or C++ threads as the default space. Also for the CUDA backend there are certain -choices, such as allowing relocatable device code, which must be made at -installation time. Building Kokkos inline uses largely the same process -as compiling an application against an installed Kokkos library. - -For CMake, this means copying over the Kokkos source code into your project and adding `add_subdirectory(kokkos)` to your CMakeLists.txt. - -For raw Makefiles, see the example benchmarks/bytes_and_flops/Makefile which can be used with an installed library and or an inline build. - -# Kokkos and CUDA UVM - -Kokkos does support UVM as a specific memory space called CudaUVMSpace. -Allocations made with that space are accessible from host and device. -You can tell Kokkos to use that as the default space for Cuda allocations. -In either case UVM comes with a number of restrictions: -* You can't access allocations on the host while a kernel is potentially -running. This will lead to segfaults. To avoid that you either need to -call Kokkos::Cuda::fence() (or just Kokkos::fence()), after kernels, or -you can set the environment variable CUDA_LAUNCH_BLOCKING=1. -* In multi socket multi GPU machines without NVLINK, UVM defaults -to using zero copy allocations for technical reasons related to using multiple -GPUs from the same process. If an executable doesn't do that (e.g. each -MPI rank of an application uses a single GPU [can be the same GPU for -multiple MPI ranks]) you can set CUDA_MANAGED_FORCE_DEVICE_ALLOC=1. -This will enforce proper UVM allocations, but can lead to errors if -more than a single GPU is used by a single process. +All requirements including minimum and primary tested compiler versions can be found [here](https://kokkos.github.io/kokkos-core-wiki/requirements.html). +Building and installation instructions are described [here](https://kokkos.github.io/kokkos-core-wiki/building.html). # Citing Kokkos -If you publish work which mentions Kokkos, please cite the following paper: +Please see the [following page](https://kokkos.github.io/kokkos-core-wiki/citation.html). -````BibTex -@ARTICLE{9485033, - author={Trott, Christian R. and Lebrun-Grandié, Damien and Arndt, Daniel and Ciesko, Jan and Dang, Vinh and Ellingwood, Nathan and Gayatri, Rahulkumar and Harvey, Evan and Hollman, Daisy S. and Ibanez, Dan and Liber, Nevin and Madsen, Jonathan and Miles, Jeff and Poliakoff, David and Powell, Amy and Rajamanickam, Sivasankaran and Simberg, Mikael and Sunderland, Dan and Turcksin, Bruno and Wilke, Jeremiah}, - journal={IEEE Transactions on Parallel and Distributed Systems}, - title={Kokkos 3: Programming Model Extensions for the Exascale Era}, - year={2022}, - volume={33}, - number={4}, - pages={805-817}, - doi={10.1109/TPDS.2021.3097283}} -```` - -If you use more than one Kokkos EcoSystem package, please also cite: - -````BibTex -@ARTICLE{9502936, - author={Trott, Christian and Berger-Vergiat, Luc and Poliakoff, David and Rajamanickam, Sivasankaran and Lebrun-Grandie, Damien and Madsen, Jonathan and Al Awar, Nader and Gligoric, Milos and Shipman, Galen and Womeldorff, Geoff}, - journal={Computing in Science Engineering}, - title={The Kokkos EcoSystem: Comprehensive Performance Portability for High Performance Computing}, - year={2021}, - volume={23}, - number={5}, - pages={10-18}, - doi={10.1109/MCSE.2021.3098509}} -```` - - -And if you feel generous: feel free to cite the original Kokkos paper which describes most of the basic Kokkos concepts: - -````BibTeX -@article{CarterEdwards20143202, - title = "Kokkos: Enabling manycore performance portability through polymorphic memory access patterns ", - journal = "Journal of Parallel and Distributed Computing ", - volume = "74", - number = "12", - pages = "3202 - 3216", - year = "2014", - note = "Domain-Specific Languages and High-Level Frameworks for High-Performance Computing ", - issn = "0743-7315", - doi = "https://doi.org/10.1016/j.jpdc.2014.07.003", - url = "http://www.sciencedirect.com/science/article/pii/S0743731514001257", - author = "H. Carter Edwards and Christian R. Trott and Daniel Sunderland" -} -```` - -##### [LICENSE](https://github.com/kokkos/kokkos/blob/master/LICENSE) +# License [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software. +The full license statement used in all headers is available [here](https://kokkos.github.io/kokkos-core-wiki/license.html) or +[here](https://github.com/kokkos/kokkos/blob/master/LICENSE). diff --git a/lib/kokkos/algorithms/src/CMakeLists.txt b/lib/kokkos/algorithms/src/CMakeLists.txt index 4b60d887f7..597626b111 100644 --- a/lib/kokkos/algorithms/src/CMakeLists.txt +++ b/lib/kokkos/algorithms/src/CMakeLists.txt @@ -11,6 +11,7 @@ FILE(GLOB ALGO_HEADERS *.hpp) FILE(GLOB ALGO_SOURCES *.cpp) LIST(APPEND ALGO_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h) APPEND_GLOB(ALGO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/std_algorithms/*.hpp) +APPEND_GLOB(ALGO_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/std_algorithms/impl/*.hpp) INSTALL ( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/" diff --git a/lib/kokkos/algorithms/src/Kokkos_Random.hpp b/lib/kokkos/algorithms/src/Kokkos_Random.hpp index 59c11afd9a..1d85ffdfb9 100644 --- a/lib/kokkos/algorithms/src/Kokkos_Random.hpp +++ b/lib/kokkos/algorithms/src/Kokkos_Random.hpp @@ -44,6 +44,10 @@ #ifndef KOKKOS_RANDOM_HPP #define KOKKOS_RANDOM_HPP +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM +#endif #include #include @@ -648,63 +652,44 @@ struct Random_UniqueIndex { } }; -#ifdef KOKKOS_ENABLE_CUDA -template -struct Random_UniqueIndex> { - using locks_view_type = - View>; - KOKKOS_FUNCTION - static int get_state_idx(const locks_view_type& locks_) { -#ifdef __CUDA_ARCH__ - const int i_offset = - (threadIdx.x * blockDim.y + threadIdx.y) * blockDim.z + threadIdx.z; - int i = (((blockIdx.x * gridDim.y + blockIdx.y) * gridDim.z + blockIdx.z) * - blockDim.x * blockDim.y * blockDim.z + - i_offset) % - locks_.extent(0); - while (Kokkos::atomic_compare_exchange(&locks_(i, 0), 0, 1)) { - i += blockDim.x * blockDim.y * blockDim.z; - if (i >= static_cast(locks_.extent(0))) { - i = i_offset; - } - } - return i; -#else - (void)locks_; - return 0; -#endif - } -}; +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) + +#if defined(KOKKOS_ENABLE_CUDA) +#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Cuda +#elif defined(KOKKOS_ENABLE_HIP) +#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Experimental::HIP #endif -#ifdef KOKKOS_ENABLE_HIP template struct Random_UniqueIndex< - Kokkos::Device> { + Kokkos::Device> { using locks_view_type = - View>; + View>; KOKKOS_FUNCTION static int get_state_idx(const locks_view_type& locks_) { -#ifdef __HIP_DEVICE_COMPILE__ - const int i_offset = - (threadIdx.x * blockDim.y + threadIdx.y) * blockDim.z + threadIdx.z; - int i = (((blockIdx.x * gridDim.y + blockIdx.y) * gridDim.z + blockIdx.z) * + KOKKOS_IF_ON_DEVICE(( + const int i_offset = + (threadIdx.x * blockDim.y + threadIdx.y) * blockDim.z + threadIdx.z; + int i = + (((blockIdx.x * gridDim.y + blockIdx.y) * gridDim.z + blockIdx.z) * blockDim.x * blockDim.y * blockDim.z + i_offset) % locks_.extent(0); - while (Kokkos::atomic_compare_exchange(&locks_(i, 0), 0, 1)) { - i += blockDim.x * blockDim.y * blockDim.z; - if (i >= static_cast(locks_.extent(0))) { - i = i_offset; - } - } - return i; -#else - (void)locks_; - return 0; -#endif + while (Kokkos::atomic_compare_exchange(&locks_(i, 0), 0, 1)) { + i += blockDim.x * blockDim.y * blockDim.z; + if (i >= static_cast(locks_.extent(0))) { + i = i_offset; + } + } + + return i;)) + KOKKOS_IF_ON_HOST(((void)locks_; return 0;)) } }; + +#undef KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP + #endif #ifdef KOKKOS_ENABLE_SYCL @@ -1279,7 +1264,6 @@ struct fill_random_functor_begin_end; template struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1303,7 +1287,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1331,7 +1314,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1361,7 +1343,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1392,7 +1373,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1424,7 +1404,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1458,7 +1437,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1494,7 +1472,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1532,7 +1509,6 @@ struct fill_random_functor_begin_end struct fill_random_functor_begin_end { - using execution_space = typename ViewType::execution_space; ViewType a; RandomPool rand_pool; typename ViewType::const_value_type begin, end; @@ -1569,34 +1545,57 @@ struct fill_random_functor_begin_end -void fill_random(ViewType a, RandomPool g, +template +void fill_random(const ExecutionSpace& exec, ViewType a, RandomPool g, typename ViewType::const_value_type begin, typename ViewType::const_value_type end) { int64_t LDA = a.extent(0); if (LDA > 0) - parallel_for("Kokkos::fill_random", (LDA + 127) / 128, - Impl::fill_random_functor_begin_end( - a, g, begin, end)); + parallel_for( + "Kokkos::fill_random", + Kokkos::RangePolicy(exec, 0, (LDA + 127) / 128), + Impl::fill_random_functor_begin_end( + a, g, begin, end)); } } // namespace Impl +template +void fill_random(const ExecutionSpace& exec, ViewType a, RandomPool g, + typename ViewType::const_value_type begin, + typename ViewType::const_value_type end) { + Impl::apply_to_view_of_static_rank( + [&](auto dst) { Kokkos::Impl::fill_random(exec, dst, g, begin, end); }, + a); +} + +template +void fill_random(const ExecutionSpace& exec, ViewType a, RandomPool g, + typename ViewType::const_value_type range) { + fill_random(exec, a, g, 0, range); +} + template void fill_random(ViewType a, RandomPool g, typename ViewType::const_value_type begin, typename ViewType::const_value_type end) { - Impl::apply_to_view_of_static_rank( - [&](auto dst) { Kokkos::Impl::fill_random(dst, g, begin, end); }, a); + fill_random(typename ViewType::execution_space{}, a, g, begin, end); } template void fill_random(ViewType a, RandomPool g, typename ViewType::const_value_type range) { - fill_random(a, g, 0, range); + fill_random(typename ViewType::execution_space{}, a, g, 0, range); } } // namespace Kokkos +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM +#endif #endif diff --git a/lib/kokkos/algorithms/src/Kokkos_Sort.hpp b/lib/kokkos/algorithms/src/Kokkos_Sort.hpp index ce97de9b7d..ad0c2d47b6 100644 --- a/lib/kokkos/algorithms/src/Kokkos_Sort.hpp +++ b/lib/kokkos/algorithms/src/Kokkos_Sort.hpp @@ -44,6 +44,10 @@ #ifndef KOKKOS_SORT_HPP_ #define KOKKOS_SORT_HPP_ +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SORT +#endif #include @@ -120,13 +124,13 @@ class BinSort { // If a Kokkos::View then can generate constant random access // otherwise can only use the constant type. - using src_view_type = typename std::conditional< + using src_view_type = std::conditional_t< Kokkos::is_view::value, Kokkos::View >, - typename SrcViewType::const_type>::type; + typename SrcViewType::const_type>; using perm_view_type = typename PermuteViewType::const_type; @@ -151,8 +155,11 @@ class BinSort { } }; - using execution_space = typename Space::execution_space; - using bin_op_type = BinSortOp; + // Naming this alias "execution_space" would be problematic since it would be + // considered as execution space for the various functors which might use + // another execution space through sort() or create_permute_vector(). + using exec_space = typename Space::execution_space; + using bin_op_type = BinSortOp; struct bin_count_tag {}; struct bin_offset_tag {}; @@ -171,13 +178,13 @@ class BinSort { // If a Kokkos::View then can generate constant random access // otherwise can only use the constant type. - using const_rnd_key_view_type = typename std::conditional< + using const_rnd_key_view_type = std::conditional_t< Kokkos::is_view::value, Kokkos::View >, - const_key_view_type>::type; + const_key_view_type>; using non_const_key_scalar = typename KeyViewType::non_const_value_type; using const_key_scalar = typename KeyViewType::const_value_type; @@ -220,6 +227,14 @@ class BinSort { range_begin(range_begin_), range_end(range_end_), sort_within_bins(sort_within_bins_) { + static_assert( + Kokkos::SpaceAccessibility::accessible, + "The provided execution space must be able to access the memory space " + "BinSort was initialized with!"); + if (bin_op.max_bins() <= 0) + Kokkos::abort( + "The number of bins in the BinSortOp object must be greater than 0!"); bin_count_atomic = Kokkos::View( "Kokkos::SortImpl::BinSortFunctor::bin_count", bin_op.max_bins()); bin_count_const = bin_count_atomic; @@ -235,7 +250,7 @@ class BinSort { BinSort(const_key_view_type keys_, int range_begin_, int range_end_, BinSortOp bin_op_, bool sort_within_bins_ = false) - : BinSort(execution_space{}, keys_, range_begin_, range_end_, bin_op_, + : BinSort(exec_space{}, keys_, range_begin_, range_end_, bin_op_, sort_within_bins_) {} template @@ -245,13 +260,19 @@ class BinSort { BinSort(const_key_view_type keys_, BinSortOp bin_op_, bool sort_within_bins_ = false) - : BinSort(execution_space{}, keys_, bin_op_, sort_within_bins_) {} + : BinSort(exec_space{}, keys_, bin_op_, sort_within_bins_) {} //---------------------------------------- // Create the permutation vector, the bin_offset array and the bin_count // array. Can be called again if keys changed - template - void create_permute_vector(const ExecutionSpace& exec = execution_space{}) { + template + void create_permute_vector(const ExecutionSpace& exec = exec_space{}) { + static_assert( + Kokkos::SpaceAccessibility::accessible, + "The provided execution space must be able to access the memory space " + "BinSort was initialized with!"); + const size_t len = range_end - range_begin; Kokkos::parallel_for( "Kokkos::Sort::BinCount", @@ -281,6 +302,17 @@ class BinSort { template void sort(const ExecutionSpace& exec, ValuesViewType const& values, int values_range_begin, int values_range_end) const { + static_assert( + Kokkos::SpaceAccessibility::accessible, + "The provided execution space must be able to access the memory space " + "BinSort was initialized with!"); + static_assert( + Kokkos::SpaceAccessibility< + ExecutionSpace, typename ValuesViewType::memory_space>::accessible, + "The provided execution space must be able to access the memory space " + "of the View argument!"); + using scratch_view_type = Kokkos::View void sort(ValuesViewType const& values, int values_range_begin, int values_range_end) const { - execution_space exec; + exec_space exec; sort(exec, values, values_range_begin, values_range_end); exec.fence("Kokkos::Sort: fence after sorting"); } @@ -428,7 +460,7 @@ struct BinOp1D { BinOp1D() = default; - // Construct BinOp with number of bins, minimum value and maxuimum value + // Construct BinOp with number of bins, minimum value and maximum value BinOp1D(int max_bins__, typename KeyViewType::const_value_type min, typename KeyViewType::const_value_type max) : max_bins_(max_bins__ + 1), @@ -554,11 +586,7 @@ struct min_max_functor { template std::enable_if_t::value> sort( - const ExecutionSpace& exec, ViewType const& view, - bool const always_use_kokkos_sort = false) { - if (!always_use_kokkos_sort) { - if (Impl::try_std_sort(view, exec)) return; - } + const ExecutionSpace& exec, ViewType const& view) { using CompType = BinOp1D; Kokkos::MinMaxScalar result; @@ -596,12 +624,38 @@ std::enable_if_t::value> sort( bin_sort.sort(exec, view); } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 +template +KOKKOS_DEPRECATED_WITH_COMMENT( + "Use the overload not taking bool always_use_kokkos_sort") +std::enable_if_t::value> sort( + const ExecutionSpace& exec, ViewType const& view, + bool const always_use_kokkos_sort) { + if (!always_use_kokkos_sort && Impl::try_std_sort(view, exec)) { + return; + } else { + sort(exec, view); + } +} +#endif + template -void sort(ViewType const& view, bool const always_use_kokkos_sort = false) { +void sort(ViewType const& view) { + typename ViewType::execution_space exec; + sort(exec, view); + exec.fence("Kokkos::Sort: fence after sorting"); +} + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 +template +KOKKOS_DEPRECATED_WITH_COMMENT( + "Use the overload not taking bool always_use_kokkos_sort") +void sort(ViewType const& view, bool const always_use_kokkos_sort) { typename ViewType::execution_space exec; sort(exec, view, always_use_kokkos_sort); exec.fence("Kokkos::Sort: fence after sorting"); } +#endif template std::enable_if_t::value> sort( @@ -635,4 +689,8 @@ void sort(ViewType view, size_t const begin, size_t const end) { } // namespace Kokkos +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SORT +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SORT +#endif #endif diff --git a/lib/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp b/lib/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp index 2e3babbcf0..3e0f731cf0 100644 --- a/lib/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp +++ b/lib/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp @@ -44,59 +44,103 @@ #ifndef KOKKOS_STD_ALGORITHMS_HPP #define KOKKOS_STD_ALGORITHMS_HPP +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STD_ALGORITHMS +#endif /// \file Kokkos_StdAlgorithms.hpp /// \brief Kokkos counterparts for Standard C++ Library algorithms -#include -#include -#include +#include "std_algorithms/impl/Kokkos_Constraints.hpp" +#include "std_algorithms/impl/Kokkos_RandomAccessIterator.hpp" +#include "std_algorithms/Kokkos_BeginEnd.hpp" // distance -#include +#include "std_algorithms/Kokkos_Distance.hpp" -// move, swap, iter_swap -#include "std_algorithms/Kokkos_ModifyingOperations.hpp" +// note that we categorize below the headers +// following the std classification. -// find, find_if, find_if_not -// for_each, for_each_n -// mismatch -// equal -// count_if, count -// all_of, any_of, none_of -// adjacent_find -// lexicographical_compare -// search, search_n -// find_first_of, find_end -#include +// modifying ops +#include "std_algorithms/Kokkos_Swap.hpp" +#include "std_algorithms/Kokkos_IterSwap.hpp" -// replace, replace_copy_if, replace_copy, replace_if -// copy, copy_n, copy_backward, copy_if -// fill, fill_n -// transform -// generate, generate_n -// reverse, reverse_copy -// move, move_backward -// swap_ranges -// unique, unique_copy -// rotate, rotate_copy -// remove, remove_if, remove_copy, remove_copy_if -// shift_left, shift_right -#include +// non-modifying sequence +#include "std_algorithms/Kokkos_AdjacentFind.hpp" +#include "std_algorithms/Kokkos_Count.hpp" +#include "std_algorithms/Kokkos_CountIf.hpp" +#include "std_algorithms/Kokkos_AllOf.hpp" +#include "std_algorithms/Kokkos_AnyOf.hpp" +#include "std_algorithms/Kokkos_NoneOf.hpp" +#include "std_algorithms/Kokkos_Equal.hpp" +#include "std_algorithms/Kokkos_Find.hpp" +#include "std_algorithms/Kokkos_FindIf.hpp" +#include "std_algorithms/Kokkos_FindIfNot.hpp" +#include "std_algorithms/Kokkos_FindEnd.hpp" +#include "std_algorithms/Kokkos_FindFirstOf.hpp" +#include "std_algorithms/Kokkos_ForEach.hpp" +#include "std_algorithms/Kokkos_ForEachN.hpp" +#include "std_algorithms/Kokkos_LexicographicalCompare.hpp" +#include "std_algorithms/Kokkos_Mismatch.hpp" +#include "std_algorithms/Kokkos_Search.hpp" +#include "std_algorithms/Kokkos_SearchN.hpp" -// is_sorted_until, is_sorted -#include +// modifying sequence +#include "std_algorithms/Kokkos_Fill.hpp" +#include "std_algorithms/Kokkos_FillN.hpp" +#include "std_algorithms/Kokkos_Replace.hpp" +#include "std_algorithms/Kokkos_ReplaceIf.hpp" +#include "std_algorithms/Kokkos_ReplaceCopyIf.hpp" +#include "std_algorithms/Kokkos_ReplaceCopy.hpp" +#include "std_algorithms/Kokkos_Copy.hpp" +#include "std_algorithms/Kokkos_CopyN.hpp" +#include "std_algorithms/Kokkos_CopyBackward.hpp" +#include "std_algorithms/Kokkos_CopyIf.hpp" +#include "std_algorithms/Kokkos_Transform.hpp" +#include "std_algorithms/Kokkos_Generate.hpp" +#include "std_algorithms/Kokkos_GenerateN.hpp" +#include "std_algorithms/Kokkos_Reverse.hpp" +#include "std_algorithms/Kokkos_ReverseCopy.hpp" +#include "std_algorithms/Kokkos_Move.hpp" +#include "std_algorithms/Kokkos_MoveBackward.hpp" +#include "std_algorithms/Kokkos_SwapRanges.hpp" +#include "std_algorithms/Kokkos_Unique.hpp" +#include "std_algorithms/Kokkos_UniqueCopy.hpp" +#include "std_algorithms/Kokkos_Rotate.hpp" +#include "std_algorithms/Kokkos_RotateCopy.hpp" +#include "std_algorithms/Kokkos_Remove.hpp" +#include "std_algorithms/Kokkos_RemoveIf.hpp" +#include "std_algorithms/Kokkos_RemoveCopy.hpp" +#include "std_algorithms/Kokkos_RemoveCopyIf.hpp" +#include "std_algorithms/Kokkos_ShiftLeft.hpp" +#include "std_algorithms/Kokkos_ShiftRight.hpp" -// min_element, max_element, minmax_element -#include +// sorting +#include "std_algorithms/Kokkos_IsSortedUntil.hpp" +#include "std_algorithms/Kokkos_IsSorted.hpp" -// is_partitioned, partition_copy, partition_point -#include +// min/max element +#include "std_algorithms/Kokkos_MinElement.hpp" +#include "std_algorithms/Kokkos_MaxElement.hpp" +#include "std_algorithms/Kokkos_MinMaxElement.hpp" -// adjacent_difference -// reduce, transform_reduce -// exclusive_scan, transform_exclusive_scan -// inclusive_scan, transform_inclusive_scan -#include +// partitioning +#include "std_algorithms/Kokkos_IsPartitioned.hpp" +#include "std_algorithms/Kokkos_PartitionCopy.hpp" +#include "std_algorithms/Kokkos_PartitionPoint.hpp" +// numeric +#include "std_algorithms/Kokkos_AdjacentDifference.hpp" +#include "std_algorithms/Kokkos_Reduce.hpp" +#include "std_algorithms/Kokkos_TransformReduce.hpp" +#include "std_algorithms/Kokkos_ExclusiveScan.hpp" +#include "std_algorithms/Kokkos_TransformExclusiveScan.hpp" +#include "std_algorithms/Kokkos_InclusiveScan.hpp" +#include "std_algorithms/Kokkos_TransformInclusiveScan.hpp" + +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STD_ALGORITHMS +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STD_ALGORITHMS +#endif #endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/numeric/Kokkos_AdjacentDifference.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp similarity index 72% rename from lib/kokkos/algorithms/src/std_algorithms/numeric/Kokkos_AdjacentDifference.hpp rename to lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp index 03e5fd6aeb..0a7cf06f5b 100644 --- a/lib/kokkos/algorithms/src/std_algorithms/numeric/Kokkos_AdjacentDifference.hpp +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp @@ -42,106 +42,15 @@ //@HEADER */ -#ifndef KOKKOS_STD_NUMERICS_ADJACENT_DIFFERENCE_HPP -#define KOKKOS_STD_NUMERICS_ADJACENT_DIFFERENCE_HPP +#ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP +#define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP -#include -#include "../Kokkos_BeginEnd.hpp" -#include "../Kokkos_Constraints.hpp" -#include "../Kokkos_Distance.hpp" +#include "impl/Kokkos_AdjacentDifference.hpp" +#include "Kokkos_BeginEnd.hpp" namespace Kokkos { namespace Experimental { -namespace Impl { -// ------------------------ -// -// functors -// -// ------------------------ -template -struct StdAdjacentDifferenceDefaultBinaryOpFunctor { - KOKKOS_FUNCTION - constexpr RetType operator()(const ValueType1& a, const ValueType2& b) const { - return a - b; - } -}; - -template -struct StdAdjacentDiffFunctor { - using index_type = typename InputIteratorType::difference_type; - - const InputIteratorType m_first_from; - const OutputIteratorType m_first_dest; - BinaryOperator m_op; - - KOKKOS_FUNCTION - void operator()(const index_type i) const { - const auto& my_value = m_first_from[i]; - if (i == 0) { - m_first_dest[i] = my_value; - } else { - const auto& left_value = m_first_from[i - 1]; - m_first_dest[i] = m_op(my_value, left_value); - } - } - - KOKKOS_FUNCTION - StdAdjacentDiffFunctor(InputIteratorType first_from, - OutputIteratorType first_dest, BinaryOperator op) - : m_first_from(std::move(first_from)), - m_first_dest(std::move(first_dest)), - m_op(std::move(op)) {} -}; - -// ------------------------------------------ -// adjacent_difference_impl -// ------------------------------------------ -template -OutputIteratorType adjacent_difference_impl(const std::string& label, - const ExecutionSpace& ex, - InputIteratorType first_from, - InputIteratorType last_from, - OutputIteratorType first_dest, - BinaryOp bin_op) { - // checks - Impl::static_assert_random_access_and_accessible(ex, first_from, first_dest); - Impl::static_assert_iterators_have_matching_difference_type(first_from, - first_dest); - Impl::expect_valid_range(first_from, last_from); - - if (first_from == last_from) { - return first_dest; - } - - // aliases - using value_type = typename OutputIteratorType::value_type; - using aux_view_type = ::Kokkos::View; - using functor_t = - StdAdjacentDiffFunctor; - - // run - const auto num_elements = - Kokkos::Experimental::distance(first_from, last_from); - aux_view_type aux_view("aux_view", num_elements); - ::Kokkos::parallel_for(label, - RangePolicy(ex, 0, num_elements), - functor_t(first_from, first_dest, bin_op)); - ex.fence("Kokkos::adjacent_difference: fence after operation"); - - // return - return first_dest + num_elements; -} - -} // end namespace Impl - -// ------------------------ -// -// public API -// -// ------------------------ template std::enable_if_t::value, diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp new file mode 100644 index 0000000000..332f9dd369 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp @@ -0,0 +1,124 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP +#define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP + +#include "impl/Kokkos_AdjacentFind.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set1 +template +IteratorType adjacent_find(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::adjacent_find_impl("Kokkos::adjacent_find_iterator_api_default", + ex, first, last); +} + +template +IteratorType adjacent_find(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::adjacent_find_impl(label, ex, first, last); +} + +template +auto adjacent_find(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl("Kokkos::adjacent_find_view_api_default", ex, + KE::begin(v), KE::end(v)); +} + +template +auto adjacent_find(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl(label, ex, KE::begin(v), KE::end(v)); +} + +// overload set2 +template +IteratorType adjacent_find(const ExecutionSpace& ex, IteratorType first, + IteratorType last, BinaryPredicateType pred) { + return Impl::adjacent_find_impl("Kokkos::adjacent_find_iterator_api_default", + ex, first, last, pred); +} + +template +IteratorType adjacent_find(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + BinaryPredicateType pred) { + return Impl::adjacent_find_impl(label, ex, first, last, pred); +} + +template +auto adjacent_find(const ExecutionSpace& ex, + const ::Kokkos::View& v, + BinaryPredicateType pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl("Kokkos::adjacent_find_view_api_default", ex, + KE::begin(v), KE::end(v), pred); +} + +template +auto adjacent_find(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + BinaryPredicateType pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl(label, ex, KE::begin(v), KE::end(v), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp new file mode 100644 index 0000000000..66a49541f3 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_HPP +#define KOKKOS_STD_ALGORITHMS_ALL_OF_HPP + +#include "impl/Kokkos_AllOfAnyOfNoneOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool all_of(const ExecutionSpace& ex, InputIterator first, InputIterator last, + Predicate predicate) { + return Impl::all_of_impl("Kokkos::all_of_iterator_api_default", ex, first, + last, predicate); +} + +template +bool all_of(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate predicate) { + return Impl::all_of_impl(label, ex, first, last, predicate); +} + +template +bool all_of(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::all_of_impl("Kokkos::all_of_view_api_default", ex, KE::cbegin(v), + KE::cend(v), std::move(predicate)); +} + +template +bool all_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::all_of_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp new file mode 100644 index 0000000000..e50e90f6da --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ANY_OF_HPP +#define KOKKOS_STD_ALGORITHMS_ANY_OF_HPP + +#include "impl/Kokkos_AllOfAnyOfNoneOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool any_of(const ExecutionSpace& ex, InputIterator first, InputIterator last, + Predicate predicate) { + return Impl::any_of_impl("Kokkos::any_of_view_api_default", ex, first, last, + predicate); +} + +template +bool any_of(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate predicate) { + return Impl::any_of_impl(label, ex, first, last, predicate); +} + +template +bool any_of(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::any_of_impl("Kokkos::any_of_view_api_default", ex, KE::cbegin(v), + KE::cend(v), std::move(predicate)); +} + +template +bool any_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::any_of_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp index beb53fdd70..5449196192 100644 --- a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp @@ -46,8 +46,8 @@ #define KOKKOS_BEGIN_END_HPP #include -#include "Kokkos_RandomAccessIterator.hpp" -#include "Kokkos_Constraints.hpp" +#include "impl/Kokkos_RandomAccessIterator.hpp" +#include "impl/Kokkos_Constraints.hpp" /// \file Kokkos_BeginEnd.hpp /// \brief Kokkos begin, end, cbegin, cend diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp new file mode 100644 index 0000000000..b3237041b7 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp @@ -0,0 +1,97 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_HPP + +#include "impl/Kokkos_CopyCopyN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator copy(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first) { + return Impl::copy_impl("Kokkos::copy_iterator_api_default", ex, first, last, + d_first); +} + +template +OutputIterator copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first) { + return Impl::copy_impl(label, ex, first, last, d_first); +} + +template +auto copy(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_impl("Kokkos::copy_view_api_default", ex, + KE::cbegin(source), KE::cend(source), KE::begin(dest)); +} + +template +auto copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_impl(label, ex, KE::cbegin(source), KE::cend(source), + KE::begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp new file mode 100644 index 0000000000..83efd96672 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP + +#include "impl/Kokkos_CopyBackward.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType2 copy_backward(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 d_last) { + return Impl::copy_backward_impl("Kokkos::copy_backward_iterator_api_default", + ex, first, last, d_last); +} + +template +IteratorType2 copy_backward(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 d_last) { + return Impl::copy_backward_impl(label, ex, first, last, d_last); +} + +template +auto copy_backward(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_backward_impl("Kokkos::copy_backward_view_api_default", ex, + cbegin(source), cend(source), end(dest)); +} + +template +auto copy_backward(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_backward_impl(label, ex, cbegin(source), cend(source), + end(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp new file mode 100644 index 0000000000..c83cc29886 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp @@ -0,0 +1,99 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_IF_HPP + +#include "impl/Kokkos_CopyIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator copy_if(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first, + Predicate pred) { + return Impl::copy_if_impl("Kokkos::copy_if_iterator_api_default", ex, first, + last, d_first, std::move(pred)); +} + +template +OutputIterator copy_if(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first, Predicate pred) { + return Impl::copy_if_impl(label, ex, first, last, d_first, std::move(pred)); +} + +template +auto copy_if(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest, Predicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_if_impl("Kokkos::copy_if_view_api_default", ex, + cbegin(source), cend(source), begin(dest), + std::move(pred)); +} + +template +auto copy_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest, Predicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_if_impl(label, ex, cbegin(source), cend(source), + begin(dest), std::move(pred)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp new file mode 100644 index 0000000000..7f3b9374c7 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp @@ -0,0 +1,98 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_N_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_N_HPP + +#include "impl/Kokkos_CopyCopyN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator copy_n(const ExecutionSpace& ex, InputIterator first, Size count, + OutputIterator result) { + return Impl::copy_n_impl("Kokkos::copy_n_iterator_api_default", ex, first, + count, result); +} + +template +OutputIterator copy_n(const std::string& label, const ExecutionSpace& ex, + InputIterator first, Size count, OutputIterator result) { + return Impl::copy_n_impl(label, ex, first, count, result); +} + +template +auto copy_n(const ExecutionSpace& ex, + const ::Kokkos::View& source, Size count, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_n_impl("Kokkos::copy_n_view_api_default", ex, + KE::cbegin(source), count, KE::begin(dest)); +} + +template +auto copy_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, Size count, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_n_impl(label, ex, KE::cbegin(source), count, + KE::begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp new file mode 100644 index 0000000000..a885ee4ad2 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COUNT_HPP +#define KOKKOS_STD_ALGORITHMS_COUNT_HPP + +#include "impl/Kokkos_CountCountIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +typename IteratorType::difference_type count(const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + const T& value) { + return Impl::count_impl("Kokkos::count_iterator_api_default", ex, first, last, + value); +} + +template +typename IteratorType::difference_type count(const std::string& label, + const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + const T& value) { + return Impl::count_impl(label, ex, first, last, value); +} + +template +auto count(const ExecutionSpace& ex, + const ::Kokkos::View& v, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_impl("Kokkos::count_view_api_default", ex, KE::cbegin(v), + KE::cend(v), value); +} + +template +auto count(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_impl(label, ex, KE::cbegin(v), KE::cend(v), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp new file mode 100644 index 0000000000..98b9d74c4c --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp @@ -0,0 +1,99 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP +#define KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP + +#include "impl/Kokkos_CountCountIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +typename IteratorType::difference_type count_if(const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + Predicate predicate) { + return Impl::count_if_impl("Kokkos::count_if_iterator_api_default", ex, first, + last, std::move(predicate)); +} + +template +typename IteratorType::difference_type count_if(const std::string& label, + const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + Predicate predicate) { + return Impl::count_if_impl(label, ex, first, last, std::move(predicate)); +} + +template +auto count_if(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_if_impl("Kokkos::count_if_view_api_default", ex, + KE::cbegin(v), KE::cend(v), std::move(predicate)); +} + +template +auto count_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_if_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp index ced4370472..4e148642b1 100644 --- a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp @@ -45,8 +45,8 @@ #ifndef KOKKOS_STD_ALGORITHMS_DISTANCE_HPP #define KOKKOS_STD_ALGORITHMS_DISTANCE_HPP -#include "Kokkos_Constraints.hpp" -#include "Kokkos_RandomAccessIterator.hpp" +#include "impl/Kokkos_Constraints.hpp" +#include "impl/Kokkos_RandomAccessIterator.hpp" namespace Kokkos { namespace Experimental { diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp new file mode 100644 index 0000000000..8634019fad --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp @@ -0,0 +1,198 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_EQUAL_HPP +#define KOKKOS_STD_ALGORITHMS_EQUAL_HPP + +#include "impl/Kokkos_Equal.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2) { + return Impl::equal_impl(label, ex, first1, last1, first2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, BinaryPredicateType predicate) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2, std::move(predicate)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + BinaryPredicateType predicate) { + return Impl::equal_impl(label, ex, first1, last1, first2, + std::move(predicate)); +} + +template +bool equal(const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl("Kokkos::equal_view_api_default", ex, + KE::cbegin(view1), KE::cend(view1), + KE::cbegin(view2)); +} + +template +bool equal(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl(label, ex, KE::cbegin(view1), KE::cend(view1), + KE::cbegin(view2)); +} + +template +bool equal(const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, + BinaryPredicateType predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl("Kokkos::equal_view_api_default", ex, + KE::cbegin(view1), KE::cend(view1), KE::cbegin(view2), + std::move(predicate)); +} + +template +bool equal(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, + BinaryPredicateType predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl(label, ex, KE::cbegin(view1), KE::cend(view1), + KE::cbegin(view2), std::move(predicate)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2, last2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, IteratorType2 last2) { + return Impl::equal_impl(label, ex, first1, last1, first2, last2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2, + BinaryPredicateType predicate) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2, last2, std::move(predicate)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, IteratorType2 last2, + BinaryPredicateType predicate) { + return Impl::equal_impl(label, ex, first1, last1, first2, last2, + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp new file mode 100644 index 0000000000..b97710f24f --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp @@ -0,0 +1,190 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP +#define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP + +#include "impl/Kokkos_ExclusiveScan.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + ValueType init_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_default_op_impl( + "Kokkos::exclusive_scan_default_functors_iterator_api", ex, first, last, + first_dest, init_value); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, ValueType init_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_default_op_impl(label, ex, first, last, + first_dest, init_value); +} + +template +auto exclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_default_op_impl( + "Kokkos::exclusive_scan_default_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + init_value); +} + +template +auto exclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_default_op_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), + KE::begin(view_dest), init_value); +} + +// overload set 2 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + ValueType init_value, BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_custom_op_impl( + "Kokkos::exclusive_scan_custom_functors_iterator_api", ex, first, last, + first_dest, init_value, bop); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, ValueType init_value, + BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_custom_op_impl(label, ex, first, last, first_dest, + init_value, bop); +} + +template +auto exclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value, BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_custom_op_impl( + "Kokkos::exclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + init_value, bop); +} + +template +auto exclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value, BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_custom_op_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), init_value, bop); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp new file mode 100644 index 0000000000..200e03b9dc --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp @@ -0,0 +1,86 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FILL_HPP +#define KOKKOS_STD_ALGORITHMS_FILL_HPP + +#include "impl/Kokkos_FillFillN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void fill(const ExecutionSpace& ex, IteratorType first, IteratorType last, + const T& value) { + Impl::fill_impl("Kokkos::fill_iterator_api_default", ex, first, last, value); +} + +template +void fill(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, const T& value) { + Impl::fill_impl(label, ex, first, last, value); +} + +template +void fill(const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::fill_impl("Kokkos::fill_view_api_default", ex, begin(view), end(view), + value); +} + +template +void fill(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::fill_impl(label, ex, begin(view), end(view), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp new file mode 100644 index 0000000000..2e814dc55f --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp @@ -0,0 +1,91 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FILL_N_HPP +#define KOKKOS_STD_ALGORITHMS_FILL_N_HPP + +#include "impl/Kokkos_FillFillN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType fill_n(const ExecutionSpace& ex, IteratorType first, SizeType n, + const T& value) { + return Impl::fill_n_impl("Kokkos::fill_n_iterator_api_default", ex, first, n, + value); +} + +template +IteratorType fill_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, SizeType n, const T& value) { + return Impl::fill_n_impl(label, ex, first, n, value); +} + +template +auto fill_n(const ExecutionSpace& ex, + const ::Kokkos::View& view, SizeType n, + const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::fill_n_impl("Kokkos::fill_n_view_api_default", ex, begin(view), + n, value); +} + +template +auto fill_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, SizeType n, + const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::fill_n_impl(label, ex, begin(view), n, value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp new file mode 100644 index 0000000000..6758f00ce4 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp @@ -0,0 +1,89 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_HPP + +#include "impl/Kokkos_FindIfOrNot.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +InputIterator find(const ExecutionSpace& ex, InputIterator first, + InputIterator last, const T& value) { + return Impl::find_impl("Kokkos::find_iterator_api_default", ex, first, last, + value); +} + +template +InputIterator find(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, const T& value) { + return Impl::find_impl(label, ex, first, last, value); +} + +template +auto find(const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_impl("Kokkos::find_view_api_default", ex, KE::begin(view), + KE::end(view), value); +} + +template +auto find(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_impl(label, ex, KE::begin(view), KE::end(view), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp new file mode 100644 index 0000000000..61b54c8225 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp @@ -0,0 +1,149 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_END_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_END_HPP + +#include "impl/Kokkos_FindEnd.hpp" +#include "Kokkos_Equal.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1: no binary predicate passed +template +IteratorType1 find_end(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last) { + return Impl::find_end_impl("Kokkos::find_end_iterator_api_default", ex, first, + last, s_first, s_last); +} + +template +IteratorType1 find_end(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last) { + return Impl::find_end_impl(label, ex, first, last, s_first, s_last); +} + +template +auto find_end(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl("Kokkos::find_end_view_api_default", ex, + KE::begin(view), KE::end(view), KE::begin(s_view), + KE::end(s_view)); +} + +template +auto find_end(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +// overload set 2: binary predicate passed +template +IteratorType1 find_end(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last, const BinaryPredicateType& pred) { + return Impl::find_end_impl("Kokkos::find_end_iterator_api_default", ex, first, + last, s_first, s_last, pred); +} + +template +IteratorType1 find_end(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::find_end_impl(label, ex, first, last, s_first, s_last, pred); +} + +template +auto find_end(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl("Kokkos::find_end_view_api_default", ex, + KE::begin(view), KE::end(view), KE::begin(s_view), + KE::end(s_view), pred); +} + +template +auto find_end(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp new file mode 100644 index 0000000000..b8c27cb272 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp @@ -0,0 +1,150 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP + +#include "impl/Kokkos_FindFirstOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1: no binary predicate passed +template +IteratorType1 find_first_of(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last) { + return Impl::find_first_of_impl("Kokkos::find_first_of_iterator_api_default", + ex, first, last, s_first, s_last); +} + +template +IteratorType1 find_first_of(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last) { + return Impl::find_first_of_impl(label, ex, first, last, s_first, s_last); +} + +template +auto find_first_of(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl("Kokkos::find_first_of_view_api_default", ex, + KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +template +auto find_first_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +// overload set 2: binary predicate passed +template +IteratorType1 find_first_of(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::find_first_of_impl("Kokkos::find_first_of_iterator_api_default", + ex, first, last, s_first, s_last, pred); +} + +template +IteratorType1 find_first_of(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::find_first_of_impl(label, ex, first, last, s_first, s_last, + pred); +} + +template +auto find_first_of(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl("Kokkos::find_first_of_view_api_default", ex, + KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +template +auto find_first_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp new file mode 100644 index 0000000000..54896da117 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_IF_HPP + +#include "impl/Kokkos_FindIfOrNot.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType find_if(const ExecutionSpace& ex, IteratorType first, + IteratorType last, PredicateType predicate) { + return Impl::find_if_or_not_impl("Kokkos::find_if_iterator_api_default", + ex, first, last, std::move(predicate)); +} + +template +IteratorType find_if(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + PredicateType predicate) { + return Impl::find_if_or_not_impl(label, ex, first, last, + std::move(predicate)); +} + +template +auto find_if(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl("Kokkos::find_if_view_api_default", ex, + KE::begin(v), KE::end(v), + std::move(predicate)); +} + +template +auto find_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl(label, ex, KE::begin(v), KE::end(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp new file mode 100644 index 0000000000..cfe6bb84d8 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp @@ -0,0 +1,98 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP + +#include "impl/Kokkos_FindIfOrNot.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType find_if_not(const ExecutionSpace& ex, IteratorType first, + IteratorType last, Predicate predicate) { + return Impl::find_if_or_not_impl( + "Kokkos::find_if_not_iterator_api_default", ex, first, last, + std::move(predicate)); +} + +template +IteratorType find_if_not(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + Predicate predicate) { + return Impl::find_if_or_not_impl(label, ex, first, last, + std::move(predicate)); +} + +template +auto find_if_not(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl( + "Kokkos::find_if_not_view_api_default", ex, KE::begin(v), KE::end(v), + std::move(predicate)); +} + +template +auto find_if_not(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl(label, ex, KE::begin(v), KE::end(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp new file mode 100644 index 0000000000..8a2f90e82b --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP +#define KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP + +#include "impl/Kokkos_ForEachForEachN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +UnaryFunctorType for_each(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + UnaryFunctorType functor) { + return Impl::for_each_impl(label, ex, first, last, std::move(functor)); +} + +template +UnaryFunctorType for_each(const ExecutionSpace& ex, IteratorType first, + IteratorType last, UnaryFunctorType functor) { + return Impl::for_each_impl("Kokkos::for_each_iterator_api_default", ex, first, + last, std::move(functor)); +} + +template +UnaryFunctorType for_each(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_impl(label, ex, KE::begin(v), KE::end(v), + std::move(functor)); +} + +template +UnaryFunctorType for_each(const ExecutionSpace& ex, + const ::Kokkos::View& v, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_impl("Kokkos::for_each_view_api_default", ex, + KE::begin(v), KE::end(v), std::move(functor)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp new file mode 100644 index 0000000000..dd917a33e8 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp @@ -0,0 +1,96 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP +#define KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP + +#include "impl/Kokkos_ForEachForEachN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType for_each_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, SizeType n, + UnaryFunctorType functor) { + return Impl::for_each_n_impl(label, ex, first, n, std::move(functor)); +} + +template +IteratorType for_each_n(const ExecutionSpace& ex, IteratorType first, + SizeType n, UnaryFunctorType functor) { + return Impl::for_each_n_impl("Kokkos::for_each_n_iterator_api_default", ex, + first, n, std::move(functor)); +} + +template +auto for_each_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, SizeType n, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_n_impl(label, ex, KE::begin(v), n, std::move(functor)); +} + +template +auto for_each_n(const ExecutionSpace& ex, + const ::Kokkos::View& v, SizeType n, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_n_impl("Kokkos::for_each_n_view_api_default", ex, + KE::begin(v), n, std::move(functor)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp new file mode 100644 index 0000000000..955cb42d4b --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp @@ -0,0 +1,91 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_GENERATE_HPP +#define KOKKOS_STD_ALGORITHMS_GENERATE_HPP + +#include "impl/Kokkos_GenerateGenerateN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void generate(const ExecutionSpace& ex, IteratorType first, IteratorType last, + Generator g) { + Impl::generate_impl("Kokkos::generate_iterator_api_default", ex, first, last, + std::move(g)); +} + +template +void generate(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, Generator g) { + Impl::generate_impl(label, ex, first, last, std::move(g)); +} + +template +void generate(const ExecutionSpace& ex, + const ::Kokkos::View& view, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::generate_impl("Kokkos::generate_view_api_default", ex, begin(view), + end(view), std::move(g)); +} + +template +void generate(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::generate_impl(label, ex, begin(view), end(view), std::move(g)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp new file mode 100644 index 0000000000..470edb1596 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp @@ -0,0 +1,93 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP +#define KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP + +#include "impl/Kokkos_GenerateGenerateN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType generate_n(const ExecutionSpace& ex, IteratorType first, + Size count, Generator g) { + Impl::generate_n_impl("Kokkos::generate_n_iterator_api_default", ex, first, + count, std::move(g)); + return first + count; +} + +template +IteratorType generate_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, Size count, Generator g) { + Impl::generate_n_impl(label, ex, first, count, std::move(g)); + return first + count; +} + +template +auto generate_n(const ExecutionSpace& ex, + const ::Kokkos::View& view, Size count, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::generate_n_impl("Kokkos::generate_n_view_api_default", ex, + begin(view), count, std::move(g)); +} + +template +auto generate_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, Size count, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::generate_n_impl(label, ex, begin(view), count, std::move(g)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp new file mode 100644 index 0000000000..c34b5f43c9 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp @@ -0,0 +1,223 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP +#define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP + +#include "impl/Kokkos_InclusiveScan.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest) { + return Impl::inclusive_scan_default_op_impl( + "Kokkos::inclusive_scan_default_functors_iterator_api", ex, first, last, + first_dest); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest) { + return Impl::inclusive_scan_default_op_impl(label, ex, first, last, + first_dest); +} + +template +auto inclusive_scan( + const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_default_op_impl( + "Kokkos::inclusive_scan_default_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest)); +} + +template +auto inclusive_scan( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_default_op_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), + KE::begin(view_dest)); +} + +// overload set 2 (accepting custom binary op) +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + BinaryOp binary_op) { + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_iterator_api", ex, first, last, + first_dest, binary_op); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, BinaryOp binary_op) { + return Impl::inclusive_scan_custom_binary_op_impl(label, ex, first, last, + first_dest, binary_op); +} + +template +auto inclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + binary_op); +} + +template +auto inclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), binary_op); +} + +// overload set 3 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + BinaryOp binary_op, ValueType init_value) { + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_iterator_api", ex, first, last, + first_dest, binary_op, init_value); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, BinaryOp binary_op, + ValueType init_value) { + return Impl::inclusive_scan_custom_binary_op_impl( + label, ex, first, last, first_dest, binary_op, init_value); +} + +template +auto inclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op, ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + binary_op, init_value); +} + +template +auto inclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op, ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), binary_op, init_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp new file mode 100644 index 0000000000..8a2ca207ae --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp @@ -0,0 +1,92 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP +#define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP + +#include "impl/Kokkos_IsPartitioned.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool is_partitioned(const ExecutionSpace& ex, IteratorType first, + IteratorType last, PredicateType p) { + return Impl::is_partitioned_impl( + "Kokkos::is_partitioned_iterator_api_default", ex, first, last, + std::move(p)); +} + +template +bool is_partitioned(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, PredicateType p) { + return Impl::is_partitioned_impl(label, ex, first, last, std::move(p)); +} + +template +bool is_partitioned(const ExecutionSpace& ex, + const ::Kokkos::View& v, + PredicateType p) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::is_partitioned_impl("Kokkos::is_partitioned_view_api_default", + ex, cbegin(v), cend(v), std::move(p)); +} + +template +bool is_partitioned(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + PredicateType p) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::is_partitioned_impl(label, ex, cbegin(v), cend(v), std::move(p)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp new file mode 100644 index 0000000000..0ab466f338 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp @@ -0,0 +1,131 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP +#define KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP + +#include "impl/Kokkos_IsSorted.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool is_sorted(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::is_sorted_impl("Kokkos::is_sorted_iterator_api_default", ex, + first, last); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::is_sorted_impl(label, ex, first, last); +} + +template +bool is_sorted(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl("Kokkos::is_sorted_view_api_default", ex, + KE::cbegin(view), KE::cend(view)); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl(label, ex, KE::cbegin(view), KE::cend(view)); +} + +template +bool is_sorted(const ExecutionSpace& ex, IteratorType first, IteratorType last, + ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + return Impl::is_sorted_impl("Kokkos::is_sorted_iterator_api_default", ex, + first, last, std::move(comp)); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + return Impl::is_sorted_impl(label, ex, first, last, std::move(comp)); +} + +template +bool is_sorted(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl("Kokkos::is_sorted_view_api_default", ex, + KE::cbegin(view), KE::cend(view), + std::move(comp)); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl(label, ex, KE::cbegin(view), KE::cend(view), + std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp new file mode 100644 index 0000000000..c480d9ee5a --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp @@ -0,0 +1,134 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP +#define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP + +#include "impl/Kokkos_IsSortedUntil.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType is_sorted_until(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::is_sorted_until_impl( + "Kokkos::is_sorted_until_iterator_api_default", ex, first, last); +} + +template +IteratorType is_sorted_until(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::is_sorted_until_impl(label, ex, first, last); +} + +template +auto is_sorted_until(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl("Kokkos::is_sorted_until_view_api_default", + ex, KE::begin(view), KE::end(view)); +} + +template +auto is_sorted_until(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl(label, ex, KE::begin(view), KE::end(view)); +} + +template +IteratorType is_sorted_until(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + return Impl::is_sorted_until_impl( + "Kokkos::is_sorted_until_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +IteratorType is_sorted_until(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::is_sorted_until_impl(label, ex, first, last, std::move(comp)); +} + +template +auto is_sorted_until(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl("Kokkos::is_sorted_until_view_api_default", + ex, KE::begin(view), KE::end(view), + std::move(comp)); +} + +template +auto is_sorted_until(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl(label, ex, KE::begin(view), KE::end(view), + std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ModifyingOperations.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp similarity index 79% rename from lib/kokkos/algorithms/src/std_algorithms/Kokkos_ModifyingOperations.hpp rename to lib/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp index f8ca3456e5..1174740a5b 100644 --- a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_ModifyingOperations.hpp +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp @@ -42,38 +42,17 @@ //@HEADER */ -#ifndef KOKKOS_MODIFYING_OPERATIONS_HPP -#define KOKKOS_MODIFYING_OPERATIONS_HPP +#ifndef KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP +#define KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP #include -#include "Kokkos_BeginEnd.hpp" -#include "Kokkos_Constraints.hpp" +#include "impl/Kokkos_Constraints.hpp" +#include "Kokkos_Swap.hpp" namespace Kokkos { namespace Experimental { - -// move -template -KOKKOS_INLINE_FUNCTION std::remove_reference_t&& move(T&& t) { - return static_cast&&>(t); -} - -// swap -template -KOKKOS_INLINE_FUNCTION void swap(T& a, T& b) noexcept { - static_assert( - std::is_move_assignable::value && std::is_move_constructible::value, - "Kokkos::Experimental::swap arguments must be move assignable " - "and move constructible"); - - T tmp = std::move(a); - a = std::move(b); - b = std::move(tmp); -} - -//---------------------------------------------------------------------------- -// this is here because we use the swap function above namespace Impl { + template struct StdIterSwapFunctor { IteratorType1 m_a; diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp new file mode 100644 index 0000000000..4704a9ec56 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp @@ -0,0 +1,154 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP +#define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP + +#include "impl/Kokkos_LexicographicalCompare.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool lexicographical_compare(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + IteratorType2 last2) { + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_iterator_api_default", ex, first1, last1, + first2, last2); +} + +template +bool lexicographical_compare(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2) { + return Impl::lexicographical_compare_impl(label, ex, first1, last1, first2, + last2); +} + +template +bool lexicographical_compare( + const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_view_api_default", ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), KE::cend(view2)); +} + +template +bool lexicographical_compare( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl(label, ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), + KE::cend(view2)); +} + +template +bool lexicographical_compare(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + IteratorType2 last2, ComparatorType comp) { + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_iterator_api_default", ex, first1, last1, + first2, last2, comp); +} + +template +bool lexicographical_compare(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2, + ComparatorType comp) { + return Impl::lexicographical_compare_impl(label, ex, first1, last1, first2, + last2, comp); +} + +template +bool lexicographical_compare( + const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_view_api_default", ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), KE::cend(view2), comp); +} + +template +bool lexicographical_compare( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl(label, ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), + KE::cend(view2), comp); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp new file mode 100644 index 0000000000..5f6e5cbf62 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp @@ -0,0 +1,132 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP +#define KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP + +#include "impl/Kokkos_MinMaxMinmaxElement.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +auto max_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::min_or_max_element_impl( + "Kokkos::max_element_iterator_api_default", ex, first, last); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::min_or_max_element_impl(label, ex, first, last); +} + +template +auto max_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::max_element_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, first, last, std::move(comp)); +} + +template +auto max_element(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl( + "Kokkos::max_element_view_api_default", ex, begin(v), end(v)); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl(label, ex, begin(v), + end(v)); +} + +template +auto max_element(const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::max_element_view_api_default", ex, begin(v), end(v), + std::move(comp)); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, begin(v), end(v), std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp new file mode 100644 index 0000000000..63cc548960 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp @@ -0,0 +1,132 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP +#define KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP + +#include "impl/Kokkos_MinMaxMinmaxElement.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +auto min_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::min_or_max_element_impl( + "Kokkos::min_element_iterator_api_default", ex, first, last); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::min_or_max_element_impl(label, ex, first, last); +} + +template +auto min_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::min_element_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, first, last, std::move(comp)); +} + +template +auto min_element(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl( + "Kokkos::min_element_view_api_default", ex, begin(v), end(v)); +} + +template +auto min_element(const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::min_element_view_api_default", ex, begin(v), end(v), + std::move(comp)); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl(label, ex, begin(v), + end(v)); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, begin(v), end(v), std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp new file mode 100644 index 0000000000..07cdefcc05 --- /dev/null +++ b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp @@ -0,0 +1,133 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP +#define KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP + +#include "impl/Kokkos_MinMaxMinmaxElement.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +auto minmax_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::minmax_element_impl( + "Kokkos::minmax_element_iterator_api_default", ex, first, last); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::minmax_element_impl(label, ex, first, last); +} + +template +auto minmax_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + "Kokkos::minmax_element_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + label, ex, first, last, std::move(comp)); +} + +template +auto minmax_element(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::minmax_element_impl( + "Kokkos::minmax_element_view_api_default", ex, begin(v), end(v)); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::minmax_element_impl(label, ex, begin(v), + end(v)); +} + +template +auto minmax_element(const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + "Kokkos::minmax_element_view_api_default", ex, begin(v), end(v), + std::move(comp)); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + label, ex, begin(v), end(v), std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElementOperations.hpp b/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElementOperations.hpp deleted file mode 100644 index aa8f5ba376..0000000000 --- a/lib/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElementOperations.hpp +++ /dev/null @@ -1,409 +0,0 @@ -/* -//@HEADER -// ************************************************************************ -// -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ -//@HEADER -*/ - -#ifndef KOKKOS_STD_MIN_MAX_ELEMENT_OPERATIONS_HPP -#define KOKKOS_STD_MIN_MAX_ELEMENT_OPERATIONS_HPP - -#include -#include "Kokkos_BeginEnd.hpp" -#include "Kokkos_Constraints.hpp" -#include "Kokkos_Distance.hpp" -#include "Kokkos_ModifyingOperations.hpp" - -namespace Kokkos { -namespace Experimental { -namespace Impl { - -template -struct StdMinOrMaxElemFunctor { - using index_type = typename IteratorType::difference_type; - using red_value_type = typename ReducerType::value_type; - - IteratorType m_first; - ReducerType m_reducer; - - KOKKOS_FUNCTION - void operator()(const index_type i, red_value_type& red_value) const { - m_reducer.join(red_value, red_value_type{m_first[i], i}); - } - - KOKKOS_FUNCTION - StdMinOrMaxElemFunctor(IteratorType first, ReducerType reducer) - : m_first(std::move(first)), m_reducer(std::move(reducer)) {} -}; - -template -struct StdMinMaxElemFunctor { - using index_type = typename IteratorType::difference_type; - using red_value_type = typename ReducerType::value_type; - IteratorType m_first; - ReducerType m_reducer; - - KOKKOS_FUNCTION - void operator()(const index_type i, red_value_type& red_value) const { - const auto& my_value = m_first[i]; - m_reducer.join(red_value, red_value_type{my_value, my_value, i, i}); - } - - KOKKOS_FUNCTION - StdMinMaxElemFunctor(IteratorType first, ReducerType reducer) - : m_first(std::move(first)), m_reducer(std::move(reducer)) {} -}; - -// ------------------------------------------ -// min_or_max_element_impl -// ------------------------------------------ -template