From 88d13ddcb24c68b05d97932ec464ebbda95d5f1d Mon Sep 17 00:00:00 2001 From: Snapshot Action Date: Sun, 19 Apr 2026 03:41:05 +0000 Subject: [PATCH 1/2] Snapshot of kokkos from commit 77f357717bc649a341ecb2aac0bb8698325d775c From repository at https://github.com/kokkos/kokkos At commit: commit 77f357717bc649a341ecb2aac0bb8698325d775c Author: Christian Trott Date: Fri Apr 17 13:33:01 2026 -0600 Merge pull request #9079 from tretre91/fix-simd-reduce-ambiguity simd: Fix a call to masked reduce with default parameters being ambiguous Signed-off-by: Snapshot Action --- packages/kokkos/.clang-tidy | 13 + packages/kokkos/.jenkins/continuous.groovy | 366 +- packages/kokkos/.jenkins/nightly.groovy | 43 +- packages/kokkos/.mailmap | 23 + packages/kokkos/.pre-commit-config.yaml | 44 + packages/kokkos/CHANGELOG.md | 216 + packages/kokkos/CMakeLists.txt | 25 +- packages/kokkos/CONTRIBUTING.md | 16 - packages/kokkos/COPYRIGHT.md | 226 + packages/kokkos/Copyright.txt | 8 - packages/kokkos/LICENSE | 2 +- packages/kokkos/LICENSE_FILE_HEADER | 15 - packages/kokkos/Makefile.kokkos | 1750 -------- packages/kokkos/Makefile.targets | 129 - packages/kokkos/README.md | 17 +- packages/kokkos/Spack.md | 268 -- packages/kokkos/algorithms/CMakeLists.txt | 6 +- .../algorithms/perf_test/CMakeLists.txt | 63 +- .../perf_test/test_inclusive_scan.cpp | 18 +- .../algorithms/perf_test/test_random.cpp | 62 + packages/kokkos/algorithms/src/CMakeLists.txt | 1 + .../algorithms/src/KokkosAlgorithms_dummy.cpp | 15 +- .../algorithms/src/Kokkos_NestedSort.hpp | 15 +- .../kokkos/algorithms/src/Kokkos_Random.cppm | 15 +- .../kokkos/algorithms/src/Kokkos_Random.hpp | 145 +- .../kokkos/algorithms/src/Kokkos_Sort.cppm | 15 +- .../kokkos/algorithms/src/Kokkos_Sort.hpp | 15 +- .../algorithms/src/Kokkos_StdAlgorithms.cppm | 15 +- .../algorithms/src/Kokkos_StdAlgorithms.hpp | 15 +- .../src/sorting/Kokkos_BinOpsPublicAPI.hpp | 23 +- .../src/sorting/Kokkos_BinSortPublicAPI.hpp | 24 +- .../sorting/Kokkos_NestedSortPublicAPI.hpp | 20 +- .../src/sorting/Kokkos_SortByKeyPublicAPI.hpp | 20 +- .../src/sorting/Kokkos_SortPublicAPI.hpp | 20 +- .../impl/Kokkos_CopyOpsForBinSortImpl.hpp | 15 +- .../sorting/impl/Kokkos_NestedSortImpl.hpp | 22 +- .../src/sorting/impl/Kokkos_SortByKeyImpl.hpp | 48 +- .../src/sorting/impl/Kokkos_SortImpl.hpp | 49 +- .../Kokkos_AdjacentDifference.hpp | 15 +- .../std_algorithms/Kokkos_AdjacentFind.hpp | 15 +- .../src/std_algorithms/Kokkos_AllOf.hpp | 15 +- .../src/std_algorithms/Kokkos_AnyOf.hpp | 15 +- .../src/std_algorithms/Kokkos_BeginEnd.hpp | 15 +- .../src/std_algorithms/Kokkos_Copy.hpp | 15 +- .../std_algorithms/Kokkos_CopyBackward.hpp | 15 +- .../src/std_algorithms/Kokkos_CopyIf.hpp | 15 +- .../src/std_algorithms/Kokkos_CopyN.hpp | 15 +- .../src/std_algorithms/Kokkos_Count.hpp | 15 +- .../src/std_algorithms/Kokkos_CountIf.hpp | 15 +- .../src/std_algorithms/Kokkos_Distance.hpp | 15 +- .../src/std_algorithms/Kokkos_Equal.hpp | 15 +- .../std_algorithms/Kokkos_ExclusiveScan.hpp | 55 +- .../src/std_algorithms/Kokkos_Fill.hpp | 15 +- .../src/std_algorithms/Kokkos_FillN.hpp | 15 +- .../src/std_algorithms/Kokkos_Find.hpp | 15 +- .../src/std_algorithms/Kokkos_FindEnd.hpp | 15 +- .../src/std_algorithms/Kokkos_FindFirstOf.hpp | 15 +- .../src/std_algorithms/Kokkos_FindIf.hpp | 15 +- .../src/std_algorithms/Kokkos_FindIfNot.hpp | 15 +- .../src/std_algorithms/Kokkos_ForEach.hpp | 15 +- .../src/std_algorithms/Kokkos_ForEachN.hpp | 15 +- .../src/std_algorithms/Kokkos_Generate.hpp | 15 +- .../src/std_algorithms/Kokkos_GenerateN.hpp | 15 +- .../std_algorithms/Kokkos_InclusiveScan.hpp | 15 +- .../std_algorithms/Kokkos_IsPartitioned.hpp | 15 +- .../src/std_algorithms/Kokkos_IsSorted.hpp | 21 +- .../std_algorithms/Kokkos_IsSortedUntil.hpp | 22 +- .../src/std_algorithms/Kokkos_IterSwap.hpp | 30 +- .../Kokkos_LexicographicalCompare.hpp | 15 +- .../src/std_algorithms/Kokkos_MaxElement.hpp | 23 +- .../src/std_algorithms/Kokkos_MinElement.hpp | 23 +- .../std_algorithms/Kokkos_MinMaxElement.hpp | 24 +- .../src/std_algorithms/Kokkos_Mismatch.hpp | 15 +- .../src/std_algorithms/Kokkos_Move.hpp | 15 +- .../std_algorithms/Kokkos_MoveBackward.hpp | 15 +- .../src/std_algorithms/Kokkos_NoneOf.hpp | 15 +- .../std_algorithms/Kokkos_PartitionCopy.hpp | 15 +- .../std_algorithms/Kokkos_PartitionPoint.hpp | 15 +- .../src/std_algorithms/Kokkos_Reduce.hpp | 15 +- .../src/std_algorithms/Kokkos_Remove.hpp | 15 +- .../src/std_algorithms/Kokkos_RemoveCopy.hpp | 15 +- .../std_algorithms/Kokkos_RemoveCopyIf.hpp | 15 +- .../src/std_algorithms/Kokkos_RemoveIf.hpp | 15 +- .../src/std_algorithms/Kokkos_Replace.hpp | 15 +- .../src/std_algorithms/Kokkos_ReplaceCopy.hpp | 15 +- .../std_algorithms/Kokkos_ReplaceCopyIf.hpp | 15 +- .../src/std_algorithms/Kokkos_ReplaceIf.hpp | 15 +- .../src/std_algorithms/Kokkos_Reverse.hpp | 15 +- .../src/std_algorithms/Kokkos_ReverseCopy.hpp | 15 +- .../src/std_algorithms/Kokkos_Rotate.hpp | 15 +- .../src/std_algorithms/Kokkos_RotateCopy.hpp | 15 +- .../src/std_algorithms/Kokkos_Search.hpp | 15 +- .../src/std_algorithms/Kokkos_SearchN.hpp | 15 +- .../src/std_algorithms/Kokkos_ShiftLeft.hpp | 15 +- .../src/std_algorithms/Kokkos_ShiftRight.hpp | 15 +- .../src/std_algorithms/Kokkos_SwapRanges.hpp | 15 +- .../src/std_algorithms/Kokkos_Transform.hpp | 15 +- .../Kokkos_TransformExclusiveScan.hpp | 21 +- .../Kokkos_TransformInclusiveScan.hpp | 30 +- .../std_algorithms/Kokkos_TransformReduce.hpp | 15 +- .../src/std_algorithms/Kokkos_Unique.hpp | 15 +- .../src/std_algorithms/Kokkos_UniqueCopy.hpp | 15 +- .../impl/Kokkos_AdjacentDifference.hpp | 20 +- .../impl/Kokkos_AdjacentFind.hpp | 20 +- .../impl/Kokkos_AllOfAnyOfNoneOf.hpp | 15 +- .../impl/Kokkos_Constraints.hpp | 46 +- .../impl/Kokkos_CopyBackward.hpp | 20 +- .../std_algorithms/impl/Kokkos_CopyCopyN.hpp | 20 +- .../src/std_algorithms/impl/Kokkos_CopyIf.hpp | 25 +- .../impl/Kokkos_CountCountIf.hpp | 20 +- .../src/std_algorithms/impl/Kokkos_Equal.hpp | 20 +- .../impl/Kokkos_ExclusiveScan.hpp | 88 +- .../std_algorithms/impl/Kokkos_FillFillN.hpp | 20 +- .../std_algorithms/impl/Kokkos_FindEnd.hpp | 20 +- .../impl/Kokkos_FindFirstOf.hpp | 20 +- .../impl/Kokkos_FindIfOrNot.hpp | 20 +- .../impl/Kokkos_ForEachForEachN.hpp | 20 +- .../impl/Kokkos_FunctorsForExclusiveScan.hpp | 20 +- .../impl/Kokkos_GenerateGenerateN.hpp | 20 +- .../impl/Kokkos_HelperPredicates.hpp | 15 +- .../Kokkos_IdentityReferenceUnaryFunctor.hpp | 15 +- .../impl/Kokkos_InclusiveScan.hpp | 58 +- .../impl/Kokkos_IsPartitioned.hpp | 20 +- .../std_algorithms/impl/Kokkos_IsSorted.hpp | 20 +- .../impl/Kokkos_IsSortedUntil.hpp | 20 +- .../impl/Kokkos_LexicographicalCompare.hpp | 20 +- .../impl/Kokkos_MinMaxMinmaxElement.hpp | 20 +- .../std_algorithms/impl/Kokkos_Mismatch.hpp | 20 +- .../src/std_algorithms/impl/Kokkos_Move.hpp | 20 +- .../impl/Kokkos_MoveBackward.hpp | 20 +- .../impl/Kokkos_MustUseKokkosSingleInTeam.hpp | 20 +- .../impl/Kokkos_PartitionCopy.hpp | 20 +- .../impl/Kokkos_PartitionPoint.hpp | 20 +- .../impl/Kokkos_RandomAccessIterator.hpp | 77 +- .../src/std_algorithms/impl/Kokkos_Reduce.hpp | 28 +- ...cerWithArbitraryJoinerNoNeutralElement.hpp | 20 +- .../impl/Kokkos_RemoveAllVariants.hpp | 20 +- .../std_algorithms/impl/Kokkos_Replace.hpp | 20 +- .../impl/Kokkos_ReplaceCopy.hpp | 20 +- .../impl/Kokkos_ReplaceCopyIf.hpp | 20 +- .../std_algorithms/impl/Kokkos_ReplaceIf.hpp | 20 +- .../std_algorithms/impl/Kokkos_Reverse.hpp | 20 +- .../impl/Kokkos_ReverseCopy.hpp | 20 +- .../src/std_algorithms/impl/Kokkos_Rotate.hpp | 20 +- .../std_algorithms/impl/Kokkos_RotateCopy.hpp | 20 +- .../src/std_algorithms/impl/Kokkos_Search.hpp | 20 +- .../std_algorithms/impl/Kokkos_SearchN.hpp | 21 +- .../std_algorithms/impl/Kokkos_ShiftLeft.hpp | 20 +- .../std_algorithms/impl/Kokkos_ShiftRight.hpp | 20 +- .../std_algorithms/impl/Kokkos_SwapRanges.hpp | 20 +- .../std_algorithms/impl/Kokkos_Transform.hpp | 20 +- .../impl/Kokkos_TransformExclusiveScan.hpp | 20 +- .../impl/Kokkos_TransformInclusiveScan.hpp | 20 +- .../impl/Kokkos_TransformReduce.hpp | 26 +- .../src/std_algorithms/impl/Kokkos_Unique.hpp | 20 +- .../std_algorithms/impl/Kokkos_UniqueCopy.hpp | 25 +- ...Kokkos_ValueWrapperForNoNeutralElement.hpp | 15 +- .../algorithms/unit_tests/CMakeLists.txt | 64 +- .../kokkos/algorithms/unit_tests/Makefile | 127 - .../algorithms/unit_tests/TestBinSortA.hpp | 24 +- .../algorithms/unit_tests/TestBinSortB.hpp | 19 +- .../algorithms/unit_tests/TestNestedSort.hpp | 26 +- .../algorithms/unit_tests/TestRandom.hpp | 48 +- .../unit_tests/TestRandomAccessIterator.cpp | 15 +- .../kokkos/algorithms/unit_tests/TestSort.hpp | 34 +- .../algorithms/unit_tests/TestSortByKey.hpp | 18 +- .../unit_tests/TestSortCustomComp.hpp | 20 +- .../TestStdAlgorithmsAdjacentDifference.cpp | 15 +- .../TestStdAlgorithmsAdjacentFind.cpp | 66 +- .../TestStdAlgorithmsAllAnyNoneOf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsCommon.cpp | 15 +- .../unit_tests/TestStdAlgorithmsCommon.hpp | 273 +- .../TestStdAlgorithmsCompileOnly.cpp | 32 +- .../TestStdAlgorithmsConstraints.cpp | 20 +- .../unit_tests/TestStdAlgorithmsCopyIf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsCount.cpp | 15 +- .../unit_tests/TestStdAlgorithmsEqual.cpp | 15 +- .../TestStdAlgorithmsExclusiveScan.cpp | 36 +- .../unit_tests/TestStdAlgorithmsFind.cpp | 15 +- .../unit_tests/TestStdAlgorithmsFindEnd.cpp | 72 +- .../TestStdAlgorithmsFindFirstOf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsForEach.cpp | 15 +- .../TestStdAlgorithmsHelperFunctors.hpp | 20 +- .../TestStdAlgorithmsInclusiveScan.cpp | 47 +- .../unit_tests/TestStdAlgorithmsIsSorted.cpp | 17 +- .../TestStdAlgorithmsIsSortedUntil.cpp | 17 +- ...estStdAlgorithmsLexicographicalCompare.cpp | 18 +- .../TestStdAlgorithmsMinMaxElementOps.cpp | 25 +- .../unit_tests/TestStdAlgorithmsMismatch.cpp | 15 +- .../unit_tests/TestStdAlgorithmsModOps.cpp | 22 +- .../unit_tests/TestStdAlgorithmsModSeqOps.cpp | 15 +- .../TestStdAlgorithmsMoveBackward.cpp | 15 +- .../unit_tests/TestStdAlgorithmsNumerics.cpp | 19 +- .../TestStdAlgorithmsPartitionCopy.cpp | 15 +- .../TestStdAlgorithmsPartitioningOps.cpp | 15 +- .../unit_tests/TestStdAlgorithmsRemove.cpp | 15 +- .../TestStdAlgorithmsRemoveCopy.cpp | 15 +- .../TestStdAlgorithmsRemoveCopyIf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsRemoveIf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsReplace.cpp | 15 +- .../TestStdAlgorithmsReplaceCopy.cpp | 15 +- .../TestStdAlgorithmsReplaceCopyIf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsReplaceIf.cpp | 30 +- .../unit_tests/TestStdAlgorithmsReverse.cpp | 15 +- .../unit_tests/TestStdAlgorithmsRotate.cpp | 15 +- .../TestStdAlgorithmsRotateCopy.cpp | 15 +- .../unit_tests/TestStdAlgorithmsSearch.cpp | 51 +- .../unit_tests/TestStdAlgorithmsSearch_n.cpp | 63 +- .../unit_tests/TestStdAlgorithmsShiftLeft.cpp | 40 +- .../TestStdAlgorithmsShiftRight.cpp | 38 +- ...estStdAlgorithmsTeamAdjacentDifference.cpp | 15 +- .../TestStdAlgorithmsTeamAdjacentFind.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamAllOf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamAnyOf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamCopy.cpp | 15 +- .../TestStdAlgorithmsTeamCopyBackward.cpp | 15 +- .../TestStdAlgorithmsTeamCopyIf.cpp | 15 +- .../TestStdAlgorithmsTeamCopy_n.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamCount.cpp | 15 +- .../TestStdAlgorithmsTeamCountIf.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamEqual.cpp | 15 +- .../TestStdAlgorithmsTeamExclusiveScan.cpp | 41 +- .../unit_tests/TestStdAlgorithmsTeamFill.cpp | 15 +- .../TestStdAlgorithmsTeamFill_n.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamFind.cpp | 15 +- .../TestStdAlgorithmsTeamFindEnd.cpp | 15 +- .../TestStdAlgorithmsTeamFindFirstOf.cpp | 15 +- .../TestStdAlgorithmsTeamFindIf.cpp | 15 +- .../TestStdAlgorithmsTeamFindIfNot.cpp | 15 +- .../TestStdAlgorithmsTeamForEach.cpp | 15 +- .../TestStdAlgorithmsTeamForEachN.cpp | 15 +- .../TestStdAlgorithmsTeamGenerate.cpp | 15 +- .../TestStdAlgorithmsTeamGenerate_n.cpp | 15 +- .../TestStdAlgorithmsTeamInclusiveScan.cpp | 36 +- .../TestStdAlgorithmsTeamIsPartitioned.cpp | 15 +- .../TestStdAlgorithmsTeamIsSorted.cpp | 24 +- .../TestStdAlgorithmsTeamIsSortedUntil.cpp | 33 +- ...tdAlgorithmsTeamLexicographicalCompare.cpp | 15 +- .../TestStdAlgorithmsTeamMaxElement.cpp | 24 +- .../TestStdAlgorithmsTeamMinElement.cpp | 24 +- .../TestStdAlgorithmsTeamMinMaxElement.cpp | 24 +- .../TestStdAlgorithmsTeamMismatch.cpp | 15 +- .../unit_tests/TestStdAlgorithmsTeamMove.cpp | 15 +- .../TestStdAlgorithmsTeamMoveBackward.cpp | 15 +- .../TestStdAlgorithmsTeamNoneOf.cpp | 15 +- .../TestStdAlgorithmsTeamPartitionCopy.cpp | 15 +- .../TestStdAlgorithmsTeamPartitionPoint.cpp | 15 +- .../TestStdAlgorithmsTeamReduce.cpp | 38 +- .../TestStdAlgorithmsTeamRemove.cpp | 15 +- .../TestStdAlgorithmsTeamRemoveCopy.cpp | 15 +- .../TestStdAlgorithmsTeamRemoveCopyIf.cpp | 15 +- .../TestStdAlgorithmsTeamRemoveIf.cpp | 15 +- .../TestStdAlgorithmsTeamReplace.cpp | 15 +- .../TestStdAlgorithmsTeamReplaceCopy.cpp | 15 +- .../TestStdAlgorithmsTeamReplaceCopyIf.cpp | 15 +- .../TestStdAlgorithmsTeamReplaceIf.cpp | 15 +- .../TestStdAlgorithmsTeamReverse.cpp | 15 +- .../TestStdAlgorithmsTeamReverseCopy.cpp | 15 +- .../TestStdAlgorithmsTeamRotate.cpp | 15 +- .../TestStdAlgorithmsTeamRotateCopy.cpp | 15 +- .../TestStdAlgorithmsTeamSearch.cpp | 15 +- .../TestStdAlgorithmsTeamSearchN.cpp | 15 +- .../TestStdAlgorithmsTeamShiftLeft.cpp | 39 +- .../TestStdAlgorithmsTeamShiftRight.cpp | 36 +- .../TestStdAlgorithmsTeamSwapRanges.cpp | 15 +- ...TestStdAlgorithmsTeamTransformBinaryOp.cpp | 15 +- ...tdAlgorithmsTeamTransformExclusiveScan.cpp | 31 +- ...tdAlgorithmsTeamTransformInclusiveScan.cpp | 36 +- .../TestStdAlgorithmsTeamTransformReduce.cpp | 41 +- .../TestStdAlgorithmsTeamTransformUnaryOp.cpp | 15 +- .../TestStdAlgorithmsTeamUnique.cpp | 15 +- .../TestStdAlgorithmsTeamUniqueCopy.cpp | 15 +- ...estStdAlgorithmsTransformExclusiveScan.cpp | 39 +- ...estStdAlgorithmsTransformInclusiveScan.cpp | 50 +- .../TestStdAlgorithmsTransformUnaryOp.cpp | 15 +- .../unit_tests/TestStdAlgorithmsUnique.cpp | 15 +- .../TestStdAlgorithmsUniqueCopy.cpp | 48 +- .../algorithms/unit_tests/TestStdReducers.cpp | 20 +- .../algorithms/unit_tests/UnitTestMain.cpp | 20 +- packages/kokkos/benchmarks/.clang-tidy | 4 + packages/kokkos/benchmarks/CMakeLists.txt | 8 +- packages/kokkos/benchmarks/atomic/Makefile | 52 - packages/kokkos/benchmarks/atomic/main.cpp | 20 +- .../benchmark_suite/scripts/build_code.bash | 2 - .../scripts/checkout_repos.bash | 3 - .../scripts/run_benchmark.bash | 2 +- .../benchmarks/bytes_and_flops/Makefile | 52 - .../benchmarks/bytes_and_flops/bench.hpp | 20 +- .../bytes_and_flops/bench_double.cpp | 15 +- .../bytes_and_flops/bench_float.cpp | 15 +- .../bytes_and_flops/bench_int32_t.cpp | 15 +- .../bytes_and_flops/bench_int64_t.cpp | 15 +- .../bytes_and_flops/bench_stride.hpp | 15 +- .../bytes_and_flops/bench_unroll_stride.hpp | 15 +- .../benchmarks/bytes_and_flops/main.cpp | 20 +- packages/kokkos/benchmarks/gather/Makefile | 52 - packages/kokkos/benchmarks/gather/gather.hpp | 15 +- .../benchmarks/gather/gather_unroll.hpp | 20 +- packages/kokkos/benchmarks/gather/main.cpp | 20 +- packages/kokkos/benchmarks/gups/gups.cpp | 15 +- .../launch_latency/launch_latency.cpp | 23 +- .../benchmarks/policy_performance/Makefile | 52 - .../benchmarks/policy_performance/main.cpp | 22 +- .../policy_performance/policy_perf_test.hpp | 22 +- .../policy_performance/script_sample_usage.sh | 6 +- packages/kokkos/benchmarks/stream/Makefile | 52 - .../benchmarks/stream/stream-kokkos.cpp | 17 +- .../benchmarks/view_copy_constructor/Makefile | 47 - .../view_copy_constructor.cpp | 21 +- packages/kokkos/bin/nvcc_wrapper | 47 +- packages/kokkos/bin/runtest | 165 - packages/kokkos/cmake/KokkosConfig.cmake.in | 4 +- .../kokkos/cmake/KokkosConfigCommon.cmake.in | 47 +- .../cmake/KokkosCore_Config_HeaderSet.in | 17 +- packages/kokkos/cmake/KokkosCore_config.h.in | 18 +- .../kokkos/cmake/Kokkos_Version_Info.cpp.in | 15 +- packages/kokkos/cmake/Kokkos_Version_Info.hpp | 15 +- .../kokkos/cmake/Modules/CudaToolkit.cmake | 880 ---- .../kokkos/cmake/Modules/FindTPLCUDA.cmake | 34 +- .../kokkos/cmake/Modules/FindTPLLIBDL.cmake | 1 - .../cmake/Modules/FindTPLLIBQUADMATH.cmake | 2 + .../kokkos/cmake/Modules/FindTPLNEXTAPI.cmake | 22 + .../kokkos/cmake/Modules/FindTPLROCM.cmake | 41 +- .../cmake/Modules/FindTPLROCTHRUST.cmake | 10 - .../kokkos/cmake/compile_tests/amd_apu.cc | 15 +- .../kokkos/cmake/compile_tests/clang_omp.cpp | 15 +- .../cmake/compile_tests/cplusplus17.cpp | 25 - .../cmake/compile_tests/cplusplus20.cpp | 21 + .../compile_tests/cuda_compute_capability.cc | 21 +- .../cmake/compile_tests/get_sve_hw_vl.cpp | 15 +- packages/kokkos/cmake/deps/CUDA.cmake | 16 +- packages/kokkos/cmake/deps/HWLOC.cmake | 16 +- packages/kokkos/cmake/deps/Pthread.cmake | 16 +- packages/kokkos/cmake/deps/quadmath.cmake | 16 +- packages/kokkos/cmake/fake_tribits.cmake | 4 +- packages/kokkos/cmake/kokkos_arch.cmake | 243 +- .../kokkos/cmake/kokkos_compiler_id.cmake | 105 +- .../cmake/kokkos_configure_trilinos.cmake | 29 +- .../kokkos/cmake/kokkos_corner_cases.cmake | 8 - .../kokkos/cmake/kokkos_enable_devices.cmake | 22 +- .../kokkos/cmake/kokkos_enable_options.cmake | 99 +- packages/kokkos/cmake/kokkos_functions.cmake | 11 +- .../kokkos/cmake/kokkos_pick_cxx_std.cmake | 19 +- .../kokkos/cmake/kokkos_test_cxx_std.cmake | 37 +- packages/kokkos/cmake/kokkos_tpls.cmake | 39 +- packages/kokkos/cmake/kokkos_tribits.cmake | 124 +- packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake | 16 +- .../kokkos/cmake/tpls/FindTPLPthread.cmake | 16 +- .../kokkos/cmake/tpls/FindTPLquadmath.cmake | 16 +- .../performance_tests/CMakeLists.txt | 2 - .../containers/performance_tests/Makefile | 103 - .../containers/performance_tests/TestCuda.cpp | 42 +- .../performance_tests/TestDualView.hpp | 226 + .../performance_tests/TestDynRankView.hpp | 21 +- .../performance_tests/TestGlobal2LocalIds.hpp | 21 +- .../containers/performance_tests/TestHIP.cpp | 34 +- .../containers/performance_tests/TestHPX.cpp | 39 +- .../containers/performance_tests/TestMain.cpp | 20 +- .../performance_tests/TestOpenMP.cpp | 39 +- .../performance_tests/TestScatterView.hpp | 20 +- .../performance_tests/TestThreads.cpp | 29 +- .../TestUnorderedMapPerformance.hpp | 15 +- packages/kokkos/containers/src/CMakeLists.txt | 25 +- .../kokkos/containers/src/Kokkos_Bitset.cppm | 17 + .../kokkos/containers/src/Kokkos_Bitset.hpp | 49 +- .../containers/src/Kokkos_DualView.cppm | 24 + .../kokkos/containers/src/Kokkos_DualView.hpp | 100 +- .../containers/src/Kokkos_DynRankView.cppm | 34 + .../containers/src/Kokkos_DynRankView.hpp | 235 +- .../src/Kokkos_DynRankView_Impl.cppm | 15 + .../containers/src/Kokkos_DynamicView.cppm | 25 + .../containers/src/Kokkos_DynamicView.hpp | 106 +- .../containers/src/Kokkos_ErrorReporter.cppm | 16 + .../containers/src/Kokkos_ErrorReporter.hpp | 194 +- .../containers/src/Kokkos_Functional.cppm | 22 + .../containers/src/Kokkos_Functional.hpp | 15 +- .../containers/src/Kokkos_OffsetView.cppm | 33 + .../containers/src/Kokkos_OffsetView.hpp | 93 +- .../containers/src/Kokkos_ScatterView.cppm | 39 + .../containers/src/Kokkos_ScatterView.hpp | 186 +- .../src/Kokkos_ScatterView_Impl.cppm | 15 + .../containers/src/Kokkos_StaticCrsGraph.hpp | 476 -- .../containers/src/Kokkos_UnorderedMap.cppm | 21 + .../containers/src/Kokkos_UnorderedMap.hpp | 173 +- .../src/Kokkos_UnorderedMap_Impl.cppm | 14 + .../kokkos/containers/src/Kokkos_Vector.hpp | 340 -- .../src/impl/Kokkos_Bitset_impl.hpp | 15 +- .../src/impl/Kokkos_Functional_impl.hpp | 15 +- .../impl/Kokkos_StaticCrsGraph_factory.hpp | 182 - .../src/impl/Kokkos_UnorderedMap_impl.cpp | 21 +- .../src/impl/Kokkos_UnorderedMap_impl.hpp | 23 +- .../containers/unit_tests/CMakeLists.txt | 12 +- .../kokkos/containers/unit_tests/Makefile | 174 - .../containers/unit_tests/TestBitset.hpp | 23 +- .../containers/unit_tests/TestCompileMain.cpp | 15 +- .../unit_tests/TestCreateMirror.cpp | 41 +- .../containers/unit_tests/TestDualView.hpp | 42 +- .../unit_tests/TestDualViewParameterPack.cpp | 43 - .../unit_tests/TestDynRankViewTypedefs.cpp | 60 +- .../unit_tests/TestDynRankView_Ctors.hpp | 97 + .../TestDynRankView_LayoutMember.hpp | 53 + .../TestDynRankView_TeamScratch.hpp | 22 +- .../TestDynRankView_ViewCustomization.hpp | 96 +- .../containers/unit_tests/TestDynViewAPI.hpp | 41 +- .../unit_tests/TestDynViewAPI_generic.hpp | 15 +- .../unit_tests/TestDynViewAPI_rank12345.hpp | 15 +- .../unit_tests/TestDynViewAPI_rank67.hpp | 15 +- .../containers/unit_tests/TestDynamicView.hpp | 25 +- .../unit_tests/TestErrorReporter.hpp | 93 +- .../containers/unit_tests/TestIsViewTrait.cpp | 25 +- .../containers/unit_tests/TestOffsetView.hpp | 122 +- .../containers/unit_tests/TestScatterView.hpp | 34 +- .../unit_tests/TestStaticCrsGraph.hpp | 271 -- .../unit_tests/TestUnorderedMap.hpp | 71 +- .../containers/unit_tests/TestVector.hpp | 258 -- .../TestViewCtorPropEmbeddedDim.hpp | 29 +- .../unit_tests/TestWithoutInitializing.hpp | 55 +- .../containers/unit_tests/UnitTestMain.cpp | 20 +- packages/kokkos/core/CMakeLists.txt | 10 +- .../kokkos/core/perf_test/BenchmarkMain.cpp | 20 +- .../core/perf_test/Benchmark_Context.cpp | 17 +- .../core/perf_test/Benchmark_Context.hpp | 20 +- packages/kokkos/core/perf_test/CMakeLists.txt | 85 +- packages/kokkos/core/perf_test/Makefile | 84 - .../core/perf_test/PerfTestBlasKernels.hpp | 15 +- .../kokkos/core/perf_test/PerfTestDriver.hpp | 401 -- .../core/perf_test/PerfTestGramSchmidt.cpp | 22 +- .../kokkos/core/perf_test/PerfTestHexGrad.cpp | 20 +- .../kokkos/core/perf_test/PerfTestMDRange.hpp | 598 --- .../perf_test/PerfTestMDRange_Stencil.cpp | 498 +++ .../core/perf_test/PerfTestMDRange_Stream.cpp | 97 + .../core/perf_test/PerfTestMDRange_Stream.hpp | 242 + .../kokkos/core/perf_test/PerfTestMain.cpp | 20 +- .../core/perf_test/PerfTest_Category.hpp | 15 +- .../perf_test/PerfTest_CustomReduction.cpp | 111 +- .../PerfTest_ExecSpacePartitioning.cpp | 22 +- .../kokkos/core/perf_test/PerfTest_Gemv.cpp | 77 + .../core/perf_test/PerfTest_MallocFree.cpp | 38 +- .../kokkos/core/perf_test/PerfTest_Stream.cpp | 266 ++ .../core/perf_test/PerfTest_ViewAllocate.cpp | 22 +- .../core/perf_test/PerfTest_ViewCopy.hpp | 21 +- .../core/perf_test/PerfTest_ViewCopy_Raw.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_a123.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_a45.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_a6.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_a7.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_a8.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_b123.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_b45.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_b6.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_b7.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_b8.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_c123.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_c45.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_c6.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_c7.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_c8.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_d123.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_d45.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_d6.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_d7.cpp | 15 +- .../core/perf_test/PerfTest_ViewCopy_d8.cpp | 15 +- .../core/perf_test/PerfTest_ViewFill.hpp | 16 +- .../core/perf_test/PerfTest_ViewFill_123.cpp | 15 +- .../core/perf_test/PerfTest_ViewFill_45.cpp | 15 +- .../core/perf_test/PerfTest_ViewFill_6.cpp | 15 +- .../core/perf_test/PerfTest_ViewFill_7.cpp | 15 +- .../core/perf_test/PerfTest_ViewFill_8.cpp | 15 +- .../core/perf_test/PerfTest_ViewFill_Raw.cpp | 15 +- .../PerfTest_ViewFirstTouch_DeepCopy.cpp | 28 + .../PerfTest_ViewFirstTouch_Initialize.cpp | 27 + .../PerfTest_ViewFirstTouch_ParallelFor.cpp | 32 + .../core/perf_test/PerfTest_ViewResize.hpp | 20 +- .../perf_test/PerfTest_ViewResize_123.cpp | 15 +- .../core/perf_test/PerfTest_ViewResize_45.cpp | 15 +- .../core/perf_test/PerfTest_ViewResize_6.cpp | 15 +- .../core/perf_test/PerfTest_ViewResize_7.cpp | 15 +- .../core/perf_test/PerfTest_ViewResize_8.cpp | 15 +- .../perf_test/PerfTest_ViewResize_Raw.cpp | 15 +- packages/kokkos/core/perf_test/run_taskdag.sh | 21 - .../kokkos/core/perf_test/test_atomic.cpp | 22 +- .../perf_test/test_atomic_minmax_simple.cpp | 20 +- .../kokkos/core/perf_test/test_mempool.cpp | 20 +- .../kokkos/core/perf_test/test_reduction.cpp | 20 +- .../core/perf_test/test_sharedSpace.cpp | 20 +- .../kokkos/core/perf_test/test_taskdag.cpp | 235 - packages/kokkos/core/src/CMakeLists.txt | 74 +- packages/kokkos/core/src/Cuda/Kokkos_Cuda.hpp | 116 +- .../kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp | 71 +- .../kokkos/core/src/Cuda/Kokkos_CudaSpace.hpp | 35 +- .../Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp | 32 +- .../core/src/Cuda/Kokkos_Cuda_Error.hpp | 15 +- .../src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp | 27 +- .../src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp | 15 +- .../core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp | 57 +- .../src/Cuda/Kokkos_Cuda_Half_Conversion.hpp | 232 +- .../src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp | 41 +- ...Kokkos_Cuda_Half_MathematicalFunctions.hpp | 43 +- .../core/src/Cuda/Kokkos_Cuda_Instance.cpp | 235 +- .../core/src/Cuda/Kokkos_Cuda_Instance.hpp | 129 +- .../src/Cuda/Kokkos_Cuda_KernelLaunch.hpp | 127 +- .../src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp | 75 +- .../src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp | 175 +- .../src/Cuda/Kokkos_Cuda_Parallel_Range.hpp | 56 +- .../src/Cuda/Kokkos_Cuda_Parallel_Team.hpp | 185 +- .../core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp | 73 +- .../kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp | 48 - .../kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp | 1248 ------ .../kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp | 19 +- .../core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp | 30 +- .../src/Cuda/Kokkos_Cuda_Vectorization.hpp | 15 +- .../kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp | 19 +- .../src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp | 21 +- .../core/src/Cuda/Kokkos_Cuda_ZeroMemset.hpp | 15 +- .../core/src/Cuda/Kokkos_Cuda_abort.hpp | 15 +- packages/kokkos/core/src/HIP/Kokkos_HIP.cpp | 95 +- packages/kokkos/core/src/HIP/Kokkos_HIP.hpp | 58 +- .../kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp | 15 +- .../HIP/Kokkos_HIP_BlockSize_Deduction.hpp | 52 +- .../core/src/HIP/Kokkos_HIP_DeepCopy.cpp | 15 +- .../core/src/HIP/Kokkos_HIP_DeepCopy.hpp | 15 +- .../kokkos/core/src/HIP/Kokkos_HIP_Error.cpp | 36 + .../kokkos/core/src/HIP/Kokkos_HIP_Error.hpp | 56 +- .../src/HIP/Kokkos_HIP_GraphNodeKernel.hpp | 29 +- .../src/HIP/Kokkos_HIP_GraphNode_Impl.hpp | 15 +- .../core/src/HIP/Kokkos_HIP_Graph_Impl.hpp | 90 +- .../src/HIP/Kokkos_HIP_Half_Conversion.hpp | 157 +- .../src/HIP/Kokkos_HIP_Half_Impl_Type.hpp | 30 +- .../Kokkos_HIP_Half_MathematicalFunctions.hpp | 156 + .../core/src/HIP/Kokkos_HIP_Instance.cpp | 113 +- .../core/src/HIP/Kokkos_HIP_Instance.hpp | 54 +- .../core/src/HIP/Kokkos_HIP_IsXnack.cpp | 15 +- .../core/src/HIP/Kokkos_HIP_IsXnack.hpp | 23 +- .../core/src/HIP/Kokkos_HIP_KernelLaunch.hpp | 41 +- .../core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp | 73 +- .../HIP/Kokkos_HIP_ParallelFor_MDRange.hpp | 160 +- .../src/HIP/Kokkos_HIP_ParallelFor_Range.hpp | 57 +- .../src/HIP/Kokkos_HIP_ParallelFor_Team.hpp | 72 +- .../HIP/Kokkos_HIP_ParallelReduce_MDRange.hpp | 15 +- .../HIP/Kokkos_HIP_ParallelReduce_Range.hpp | 29 +- .../HIP/Kokkos_HIP_ParallelReduce_Team.hpp | 70 +- .../src/HIP/Kokkos_HIP_ParallelScan_Range.hpp | 27 +- .../core/src/HIP/Kokkos_HIP_ReduceScan.hpp | 71 +- .../HIP/Kokkos_HIP_SharedAllocationRecord.cpp | 15 +- .../HIP/Kokkos_HIP_SharedAllocationRecord.hpp | 15 +- .../src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp | 15 +- .../kokkos/core/src/HIP/Kokkos_HIP_Space.cpp | 24 +- .../kokkos/core/src/HIP/Kokkos_HIP_Space.hpp | 30 +- .../kokkos/core/src/HIP/Kokkos_HIP_Team.hpp | 19 +- .../src/HIP/Kokkos_HIP_TeamPolicyInternal.hpp | 83 +- .../core/src/HIP/Kokkos_HIP_UniqueToken.hpp | 27 +- .../core/src/HIP/Kokkos_HIP_Vectorization.hpp | 15 +- .../src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp | 22 +- .../core/src/HIP/Kokkos_HIP_ZeroMemset.cpp | 15 +- .../core/src/HIP/Kokkos_HIP_ZeroMemset.hpp | 15 +- packages/kokkos/core/src/HPX/Kokkos_HPX.cpp | 72 +- packages/kokkos/core/src/HPX/Kokkos_HPX.hpp | 309 +- .../core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp | 15 +- .../kokkos/core/src/HPX/Kokkos_HPX_Task.cpp | 42 - .../kokkos/core/src/HPX/Kokkos_HPX_Task.hpp | 274 -- .../src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp | 15 +- .../kokkos/core/src/KokkosExp_InterOp.hpp | 18 +- .../core/src/KokkosExp_MDRangePolicy.hpp | 287 +- packages/kokkos/core/src/Kokkos_Abort.hpp | 32 +- .../src/Kokkos_AcquireUniqueTokenImpl.hpp | 15 +- .../kokkos/core/src/Kokkos_AnonymousSpace.hpp | 22 +- packages/kokkos/core/src/Kokkos_Array.hpp | 278 +- packages/kokkos/core/src/Kokkos_Assert.hpp | 17 +- packages/kokkos/core/src/Kokkos_Atomic.hpp | 15 +- .../core/src/Kokkos_Atomics_Desul_Wrapper.hpp | 67 +- .../core/src/Kokkos_BitManipulation.hpp | 676 ++- packages/kokkos/core/src/Kokkos_Clamp.hpp | 15 +- packages/kokkos/core/src/Kokkos_Complex.hpp | 220 +- packages/kokkos/core/src/Kokkos_Concepts.hpp | 60 +- packages/kokkos/core/src/Kokkos_CopyViews.hpp | 262 +- packages/kokkos/core/src/Kokkos_Core.cppm | 901 ++++ packages/kokkos/core/src/Kokkos_Core.hpp | 295 +- .../kokkos/core/src/Kokkos_Core_Impl.cppm | 101 + packages/kokkos/core/src/Kokkos_Core_fwd.hpp | 36 +- packages/kokkos/core/src/Kokkos_Crs.hpp | 32 +- .../kokkos/core/src/Kokkos_DetectionIdiom.hpp | 15 +- .../kokkos/core/src/Kokkos_ExecPolicy.hpp | 539 ++- packages/kokkos/core/src/Kokkos_Extents.hpp | 17 +- packages/kokkos/core/src/Kokkos_Future.hpp | 484 -- packages/kokkos/core/src/Kokkos_Graph.hpp | 63 +- packages/kokkos/core/src/Kokkos_GraphNode.hpp | 307 +- packages/kokkos/core/src/Kokkos_Graph_fwd.hpp | 22 +- packages/kokkos/core/src/Kokkos_Half.hpp | 16 +- packages/kokkos/core/src/Kokkos_HostSpace.hpp | 44 +- packages/kokkos/core/src/Kokkos_Layout.hpp | 41 +- packages/kokkos/core/src/Kokkos_Macros.hpp | 267 +- .../core/src/Kokkos_MathematicalConstants.hpp | 65 +- .../core/src/Kokkos_MathematicalFunctions.hpp | 471 +- .../Kokkos_MathematicalSpecialFunctions.hpp | 15 +- .../kokkos/core/src/Kokkos_MemoryPool.hpp | 22 +- .../kokkos/core/src/Kokkos_MemoryTraits.hpp | 30 +- packages/kokkos/core/src/Kokkos_MinMax.hpp | 15 +- .../kokkos/core/src/Kokkos_NumericTraits.hpp | 19 +- packages/kokkos/core/src/Kokkos_Pair.hpp | 129 +- packages/kokkos/core/src/Kokkos_Parallel.hpp | 126 +- .../core/src/Kokkos_Parallel_Reduce.hpp | 1532 +------ .../core/src/Kokkos_PointerOwnership.hpp | 49 - packages/kokkos/core/src/Kokkos_Printf.hpp | 19 +- .../src/Kokkos_Profiling_ProfileSection.hpp | 15 +- .../src/Kokkos_Profiling_ScopedRegion.hpp | 15 +- packages/kokkos/core/src/Kokkos_Rank.hpp | 15 +- .../core/src/Kokkos_ReductionIdentity.hpp | 429 +- .../kokkos/core/src/Kokkos_ScratchSpace.hpp | 28 +- packages/kokkos/core/src/Kokkos_Swap.hpp | 15 +- .../kokkos/core/src/Kokkos_TaskScheduler.hpp | 696 --- .../core/src/Kokkos_TaskScheduler_fwd.hpp | 223 - packages/kokkos/core/src/Kokkos_Timer.hpp | 81 +- packages/kokkos/core/src/Kokkos_Tuners.hpp | 104 +- packages/kokkos/core/src/Kokkos_TypeInfo.hpp | 19 +- .../kokkos/core/src/Kokkos_UniqueToken.hpp | 20 +- .../kokkos/core/src/Kokkos_Vectorization.hpp | 15 +- packages/kokkos/core/src/Kokkos_View.hpp | 911 ++-- .../core/src/Kokkos_WorkGraphPolicy.hpp | 15 +- packages/kokkos/core/src/Kokkos_hwloc.hpp | 15 +- .../src/NextSilicon/Kokkos_NextSilicon.cpp | 68 + .../src/NextSilicon/Kokkos_NextSilicon.hpp | 99 + .../NextSilicon/Kokkos_NextSiliconSpace.cpp | 128 + .../NextSilicon/Kokkos_NextSiliconSpace.hpp | 119 + .../NextSilicon/Kokkos_NextSilicon_Abort.hpp | 27 + .../Kokkos_NextSilicon_Instance.cpp | 46 + .../Kokkos_NextSilicon_Instance.hpp | 34 + .../NextSilicon/Kokkos_NextSilicon_Printf.hpp | 20 + ...kos_NextSilicon_SharedAllocationRecord.cpp | 10 + ...kos_NextSilicon_SharedAllocationRecord.hpp | 13 + .../Kokkos_NextSilicon_ZeroMemset.hpp | 28 + .../core/src/OpenACC/Kokkos_OpenACC.cpp | 52 +- .../core/src/OpenACC/Kokkos_OpenACC.hpp | 33 +- .../core/src/OpenACC/Kokkos_OpenACCSpace.cpp | 15 +- .../core/src/OpenACC/Kokkos_OpenACCSpace.hpp | 15 +- .../src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp | 15 +- .../OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp | 16 +- .../src/OpenACC/Kokkos_OpenACC_Instance.cpp | 52 +- .../src/OpenACC/Kokkos_OpenACC_Instance.hpp | 56 +- .../OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp | 15 +- .../src/OpenACC/Kokkos_OpenACC_Macros.hpp | 15 +- .../Kokkos_OpenACC_ParallelFor_MDRange.hpp | 19 +- .../Kokkos_OpenACC_ParallelFor_Range.hpp | 15 +- .../Kokkos_OpenACC_ParallelFor_Team.hpp | 19 +- .../Kokkos_OpenACC_ParallelReduce_MDRange.hpp | 15 +- .../Kokkos_OpenACC_ParallelReduce_Range.hpp | 436 +- .../Kokkos_OpenACC_ParallelReduce_Team.hpp | 16 +- .../Kokkos_OpenACC_ParallelScan_Range.hpp | 44 +- .../OpenACC/Kokkos_OpenACC_ScheduleType.hpp | 15 +- .../Kokkos_OpenACC_SharedAllocationRecord.cpp | 15 +- .../Kokkos_OpenACC_SharedAllocationRecord.hpp | 15 +- .../core/src/OpenACC/Kokkos_OpenACC_Team.hpp | 62 +- .../src/OpenACC/Kokkos_OpenACC_Traits.hpp | 15 +- .../kokkos/core/src/OpenMP/Kokkos_OpenMP.cpp | 160 +- .../kokkos/core/src/OpenMP/Kokkos_OpenMP.hpp | 58 +- .../src/OpenMP/Kokkos_OpenMP_Instance.cpp | 201 +- .../src/OpenMP/Kokkos_OpenMP_Instance.hpp | 94 +- .../OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp | 15 +- .../src/OpenMP/Kokkos_OpenMP_Parallel_For.hpp | 50 +- .../OpenMP/Kokkos_OpenMP_Parallel_Reduce.hpp | 39 +- .../OpenMP/Kokkos_OpenMP_Parallel_Scan.hpp | 15 +- .../core/src/OpenMP/Kokkos_OpenMP_Task.cpp | 75 - .../core/src/OpenMP/Kokkos_OpenMP_Task.hpp | 379 -- .../core/src/OpenMP/Kokkos_OpenMP_Team.hpp | 32 +- .../src/OpenMP/Kokkos_OpenMP_UniqueToken.hpp | 15 +- .../OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp | 15 +- .../src/OpenMP/Kokkos_OpenMP_ZeroMemset.hpp | 33 + .../src/OpenMPTarget/Kokkos_OpenMPTarget.hpp | 154 - .../OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp | 123 - .../OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp | 146 - .../Kokkos_OpenMPTarget_Abort.hpp | 35 - .../Kokkos_OpenMPTarget_DeepCopy.hpp | 101 - .../Kokkos_OpenMPTarget_Error.hpp | 45 - .../Kokkos_OpenMPTarget_FunctorAdapter.hpp | 48 - .../Kokkos_OpenMPTarget_Instance.cpp | 303 -- .../Kokkos_OpenMPTarget_Instance.hpp | 78 - .../Kokkos_OpenMPTarget_MDRangePolicy.hpp | 38 - .../Kokkos_OpenMPTarget_Macros.hpp | 40 - .../Kokkos_OpenMPTarget_Parallel.hpp | 748 ---- ...okkos_OpenMPTarget_ParallelFor_MDRange.hpp | 340 -- .../Kokkos_OpenMPTarget_ParallelFor_Range.hpp | 67 - .../Kokkos_OpenMPTarget_ParallelFor_Team.hpp | 182 - ...os_OpenMPTarget_ParallelReduce_MDRange.hpp | 619 --- ...kkos_OpenMPTarget_ParallelReduce_Range.hpp | 119 - ...okkos_OpenMPTarget_ParallelReduce_Team.hpp | 420 -- ...Kokkos_OpenMPTarget_ParallelScan_Range.hpp | 257 -- .../Kokkos_OpenMPTarget_ParallelScan_Team.hpp | 138 - .../Kokkos_OpenMPTarget_Parallel_Common.hpp | 654 --- .../Kokkos_OpenMPTarget_Reducer.hpp | 567 --- .../Kokkos_OpenMPTarget_UniqueToken.hpp | 107 - packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp | 81 +- packages/kokkos/core/src/SYCL/Kokkos_SYCL.hpp | 48 +- .../core/src/SYCL/Kokkos_SYCL_Abort.hpp | 23 +- .../core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp | 15 +- .../src/SYCL/Kokkos_SYCL_GraphNodeKernel.hpp | 30 +- .../src/SYCL/Kokkos_SYCL_GraphNode_Impl.hpp | 15 +- .../core/src/SYCL/Kokkos_SYCL_Graph_Impl.hpp | 58 +- .../src/SYCL/Kokkos_SYCL_Half_Conversion.hpp | 66 +- .../src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp | 20 +- ...Kokkos_SYCL_Half_MathematicalFunctions.hpp | 33 +- .../core/src/SYCL/Kokkos_SYCL_Instance.cpp | 167 +- .../core/src/SYCL/Kokkos_SYCL_Instance.hpp | 90 +- .../src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp | 74 +- .../SYCL/Kokkos_SYCL_ParallelFor_MDRange.hpp | 179 +- .../SYCL/Kokkos_SYCL_ParallelFor_Range.hpp | 87 +- .../src/SYCL/Kokkos_SYCL_ParallelFor_Team.hpp | 65 +- .../Kokkos_SYCL_ParallelReduce_MDRange.hpp | 25 +- .../SYCL/Kokkos_SYCL_ParallelReduce_Range.hpp | 27 +- .../SYCL/Kokkos_SYCL_ParallelReduce_Team.hpp | 73 +- .../SYCL/Kokkos_SYCL_ParallelScan_Range.hpp | 171 +- .../core/src/SYCL/Kokkos_SYCL_Space.cpp | 18 +- .../core/src/SYCL/Kokkos_SYCL_Space.hpp | 15 +- .../kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp | 21 +- .../core/src/SYCL/Kokkos_SYCL_TeamPolicy.hpp | 76 +- .../core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp | 27 +- .../SYCL/Kokkos_SYCL_WorkgroupReduction.hpp | 42 +- .../core/src/SYCL/Kokkos_SYCL_ZeroMemset.hpp | 15 +- .../kokkos/core/src/Serial/Kokkos_Serial.cpp | 89 +- .../kokkos/core/src/Serial/Kokkos_Serial.hpp | 86 +- .../Serial/Kokkos_Serial_MDRangePolicy.hpp | 15 +- .../Serial/Kokkos_Serial_Parallel_MDRange.hpp | 15 +- .../Serial/Kokkos_Serial_Parallel_Range.hpp | 15 +- .../Serial/Kokkos_Serial_Parallel_Team.hpp | 85 +- .../core/src/Serial/Kokkos_Serial_Task.cpp | 42 - .../core/src/Serial/Kokkos_Serial_Task.hpp | 231 - .../src/Serial/Kokkos_Serial_UniqueToken.hpp | 15 +- .../Serial/Kokkos_Serial_WorkGraphPolicy.hpp | 15 +- .../src/Serial/Kokkos_Serial_ZeroMemset.hpp | 23 +- .../core/src/Threads/Kokkos_Threads.hpp | 44 +- .../src/Threads/Kokkos_Threads_Instance.cpp | 55 +- .../src/Threads/Kokkos_Threads_Instance.hpp | 33 +- .../Threads/Kokkos_Threads_MDRangePolicy.hpp | 15 +- .../Kokkos_Threads_ParallelFor_MDRange.hpp | 15 +- .../Kokkos_Threads_ParallelFor_Range.hpp | 15 +- .../Kokkos_Threads_ParallelFor_Team.hpp | 40 +- .../Kokkos_Threads_ParallelReduce_MDRange.hpp | 15 +- .../Kokkos_Threads_ParallelReduce_Range.hpp | 15 +- .../Kokkos_Threads_ParallelReduce_Team.hpp | 38 +- .../Kokkos_Threads_ParallelScan_Range.hpp | 15 +- .../src/Threads/Kokkos_Threads_Spinwait.cpp | 15 +- .../src/Threads/Kokkos_Threads_Spinwait.hpp | 15 +- .../core/src/Threads/Kokkos_Threads_State.hpp | 15 +- .../core/src/Threads/Kokkos_Threads_Team.hpp | 84 +- .../Threads/Kokkos_Threads_UniqueToken.hpp | 15 +- .../Kokkos_Threads_WorkGraphPolicy.hpp | 15 +- .../src/Threads/Kokkos_Threads_ZeroMemset.hpp | 33 + .../core/src/View/Hooks/Kokkos_ViewHooks.hpp | 30 +- .../kokkos/core/src/View/Kokkos_BasicView.hpp | 249 +- .../Kokkos_ViewAccessPreconditionsCheck.hpp | 15 +- .../kokkos/core/src/View/Kokkos_ViewAlloc.hpp | 35 +- .../core/src/View/Kokkos_ViewAtomic.hpp | 15 +- .../core/src/View/Kokkos_ViewCommonType.hpp | 24 +- .../kokkos/core/src/View/Kokkos_ViewCtor.hpp | 64 +- .../core/src/View/Kokkos_ViewDataAnalysis.hpp | 52 +- .../core/src/View/Kokkos_ViewLegacy.hpp | 273 +- .../core/src/View/Kokkos_ViewMapping.hpp | 163 +- .../core/src/View/Kokkos_ViewTracker.hpp | 45 +- .../core/src/View/Kokkos_ViewTraits.hpp | 200 +- .../core/src/View/Kokkos_ViewUniformType.hpp | 15 +- .../View/MDSpan/Kokkos_MDSpan_Accessor.hpp | 15 +- .../src/View/MDSpan/Kokkos_MDSpan_Extents.hpp | 15 +- .../src/View/MDSpan/Kokkos_MDSpan_Header.hpp | 16 +- .../src/View/MDSpan/Kokkos_MDSpan_Layout.hpp | 37 +- .../core/src/decl/Kokkos_Declare_CUDA.hpp | 18 +- .../core/src/decl/Kokkos_Declare_HIP.hpp | 16 +- .../core/src/decl/Kokkos_Declare_HPX.hpp | 15 +- .../src/decl/Kokkos_Declare_NEXTSILICON.hpp | 14 + .../core/src/decl/Kokkos_Declare_OPENACC.hpp | 16 +- .../core/src/decl/Kokkos_Declare_OPENMP.hpp | 16 +- .../src/decl/Kokkos_Declare_OPENMPTARGET.hpp | 34 - .../core/src/decl/Kokkos_Declare_SERIAL.hpp | 15 +- .../core/src/decl/Kokkos_Declare_SYCL.hpp | 15 +- .../core/src/decl/Kokkos_Declare_THREADS.hpp | 16 +- .../kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp | 15 +- .../kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp | 15 +- .../kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp | 15 +- .../core/src/fwd/Kokkos_Fwd_NEXTSILICON.hpp | 14 + .../core/src/fwd/Kokkos_Fwd_OPENACC.hpp | 15 +- .../kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp | 15 +- .../core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp | 28 - .../kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp | 15 +- .../kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp | 15 +- .../core/src/fwd/Kokkos_Fwd_THREADS.hpp | 15 +- .../src/impl/KokkosExp_Host_IterateTile.hpp | 1123 +---- .../src/impl/KokkosExp_IterateTileGPU.hpp | 1350 ++---- .../kokkos/core/src/impl/Kokkos_Abort.cpp | 15 +- .../core/src/impl/Kokkos_AnalyzePolicy.hpp | 55 +- .../core/src/impl/Kokkos_BuiltinReducers.hpp | 1024 +++++ .../core/src/impl/Kokkos_CPUDiscovery.cpp | 17 +- .../core/src/impl/Kokkos_CPUDiscovery.hpp | 15 +- .../impl/Kokkos_CStyleMemoryManagement.hpp | 86 + .../kokkos/core/src/impl/Kokkos_ChaseLev.hpp | 286 -- .../core/src/impl/Kokkos_CheckUsage.hpp | 135 + .../src/impl/Kokkos_CheckedIntegerOps.hpp | 15 +- .../kokkos/core/src/impl/Kokkos_ClockTic.hpp | 22 +- .../core/src/impl/Kokkos_Combined_Reducer.hpp | 78 +- .../src/impl/Kokkos_Command_Line_Parsing.cpp | 15 +- .../src/impl/Kokkos_Command_Line_Parsing.hpp | 15 +- .../core/src/impl/Kokkos_ConcurrentBitset.hpp | 15 +- packages/kokkos/core/src/impl/Kokkos_Core.cpp | 80 +- .../impl/Kokkos_Default_GraphNodeKernel.hpp | 15 +- .../impl/Kokkos_Default_GraphNode_Impl.hpp | 27 +- .../src/impl/Kokkos_Default_Graph_Impl.hpp | 38 +- .../src/impl/Kokkos_Default_Graph_fwd.hpp | 15 +- .../src/impl/Kokkos_DesulAtomicsConfig.hpp | 32 +- .../core/src/impl/Kokkos_DeviceHandle.hpp | 48 + .../core/src/impl/Kokkos_DeviceManagement.hpp | 15 +- packages/kokkos/core/src/impl/Kokkos_EBO.hpp | 110 +- .../kokkos/core/src/impl/Kokkos_Error.cpp | 20 +- .../kokkos/core/src/impl/Kokkos_Error.hpp | 15 +- .../core/src/impl/Kokkos_ExecPolicy.cpp | 27 +- .../core/src/impl/Kokkos_ExecSpaceManager.hpp | 28 +- .../core/src/impl/Kokkos_FunctorAnalysis.hpp | 16 +- .../kokkos/core/src/impl/Kokkos_GraphImpl.hpp | 20 +- .../src/impl/Kokkos_GraphImpl_Utilities.hpp | 15 +- .../core/src/impl/Kokkos_GraphImpl_fwd.hpp | 17 +- .../src/impl/Kokkos_GraphNodeCtorProps.hpp | 147 + .../impl/Kokkos_GraphNodeCustomization.hpp | 15 +- .../core/src/impl/Kokkos_GraphNodeImpl.hpp | 79 +- .../src/impl/Kokkos_GraphNodeThenImpl.hpp | 56 +- .../src/impl/Kokkos_GraphNodeThenPolicy.hpp | 20 + .../impl/Kokkos_Half_FloatingPointWrapper.hpp | 53 +- .../Kokkos_Half_MathematicalFunctions.hpp | 194 +- .../src/impl/Kokkos_Half_NumericTraits.hpp | 45 +- .../impl/Kokkos_Half_ReductionIdentity.hpp | 57 + .../core/src/impl/Kokkos_HostBarrier.cpp | 17 +- .../core/src/impl/Kokkos_HostBarrier.hpp | 16 +- .../core/src/impl/Kokkos_HostSharedPtr.hpp | 15 +- .../kokkos/core/src/impl/Kokkos_HostSpace.cpp | 25 +- .../src/impl/Kokkos_HostSpace_ZeroMemset.hpp | 42 - .../src/impl/Kokkos_HostSpace_deepcopy.cpp | 60 +- .../src/impl/Kokkos_HostSpace_deepcopy.hpp | 18 +- .../core/src/impl/Kokkos_HostThreadTeam.cpp | 15 +- .../core/src/impl/Kokkos_HostThreadTeam.hpp | 62 +- .../impl/Kokkos_InitializationSettings.hpp | 41 +- .../src/impl/Kokkos_InitializeFinalize.hpp | 76 + packages/kokkos/core/src/impl/Kokkos_LIFO.hpp | 378 -- .../core/src/impl/Kokkos_LinkedListNode.hpp | 156 - .../core/src/impl/Kokkos_MemoryPool.cpp | 15 +- .../src/impl/Kokkos_MultipleTaskQueue.hpp | 506 --- .../impl/Kokkos_NvidiaGpuArchitectures.hpp | 31 +- .../core/src/impl/Kokkos_OptionalRef.hpp | 206 - ...ndLineArgumentsAndEnvironmentVariables.hpp | 15 +- .../core/src/impl/Kokkos_PartitionSpace.hpp | 86 + .../kokkos/core/src/impl/Kokkos_Profiling.cpp | 85 +- .../kokkos/core/src/impl/Kokkos_Profiling.hpp | 15 +- .../src/impl/Kokkos_Profiling_C_Interface.h | 19 +- .../src/impl/Kokkos_Profiling_DeviceInfo.hpp | 15 +- .../src/impl/Kokkos_Profiling_Interface.hpp | 23 +- .../src/impl/Kokkos_QuadPrecisionMath.hpp | 121 +- .../core/src/impl/Kokkos_ScopeGuard.hpp | 76 + .../core/src/impl/Kokkos_SharedAlloc.cpp | 24 +- .../core/src/impl/Kokkos_SharedAlloc.hpp | 44 +- .../src/impl/Kokkos_SharedAlloc_timpl.hpp | 15 +- .../src/impl/Kokkos_SimpleTaskScheduler.hpp | 483 -- .../core/src/impl/Kokkos_SingleTaskQueue.hpp | 158 - .../core/src/impl/Kokkos_Stacktrace.cpp | 15 +- .../core/src/impl/Kokkos_Stacktrace.hpp | 15 +- .../src/impl/Kokkos_StringManipulation.hpp | 17 +- .../kokkos/core/src/impl/Kokkos_TaskBase.hpp | 334 -- .../kokkos/core/src/impl/Kokkos_TaskNode.hpp | 673 --- .../core/src/impl/Kokkos_TaskPolicyData.hpp | 158 - .../kokkos/core/src/impl/Kokkos_TaskQueue.hpp | 227 - .../core/src/impl/Kokkos_TaskQueueCommon.hpp | 482 -- .../impl/Kokkos_TaskQueueMemoryManager.hpp | 204 - .../src/impl/Kokkos_TaskQueueMultiple.hpp | 258 -- .../impl/Kokkos_TaskQueueMultiple_impl.hpp | 45 - .../core/src/impl/Kokkos_TaskQueue_impl.hpp | 651 --- .../core/src/impl/Kokkos_TaskResult.hpp | 120 - .../core/src/impl/Kokkos_TaskTeamMember.hpp | 104 - .../core/src/impl/Kokkos_TeamMDPolicy.hpp | 23 +- .../kokkos/core/src/impl/Kokkos_Tools.hpp | 15 +- .../core/src/impl/Kokkos_Tools_Generic.hpp | 67 +- .../kokkos/core/src/impl/Kokkos_Traits.hpp | 15 +- .../kokkos/core/src/impl/Kokkos_Utilities.hpp | 89 +- .../core/src/impl/Kokkos_VLAEmulation.hpp | 261 -- .../core/src/impl/Kokkos_Volatile_Load.hpp | 15 +- .../core/src/impl/Kokkos_ZeroMemset_fwd.hpp | 15 +- .../kokkos/core/src/impl/Kokkos_hwloc.cpp | 22 +- .../core/src/setup/Kokkos_Setup_Cuda.hpp | 15 +- .../core/src/setup/Kokkos_Setup_HIP.hpp | 20 +- .../core/src/setup/Kokkos_Setup_SYCL.hpp | 37 +- .../src/traits/Kokkos_ExecutionSpaceTrait.hpp | 57 +- .../src/traits/Kokkos_GraphKernelTrait.hpp | 30 +- .../core/src/traits/Kokkos_IndexTypeTrait.hpp | 19 +- .../traits/Kokkos_IterationPatternTrait.hpp | 44 +- .../src/traits/Kokkos_LaunchBoundsTrait.hpp | 41 +- .../traits/Kokkos_OccupancyControlTrait.hpp | 15 +- .../src/traits/Kokkos_PolicyTraitAdaptor.hpp | 15 +- .../src/traits/Kokkos_PolicyTraitMatcher.hpp | 15 +- .../core/src/traits/Kokkos_ScheduleTrait.hpp | 47 +- .../traits/Kokkos_StaticBatchSizeTrait.hpp | 76 + .../src/traits/Kokkos_TeamHandleTrait.hpp | 46 + .../core/src/traits/Kokkos_Traits_fwd.hpp | 19 +- .../traits/Kokkos_WorkItemPropertyTrait.hpp | 29 +- .../core/src/traits/Kokkos_WorkTagTrait.hpp | 42 +- packages/kokkos/core/unit_test/CMakeLists.txt | 324 +- .../core/unit_test/IncrementalTest.cpp.in | 15 +- ...tionEnvironmentNeverInitializedFixture.hpp | 20 +- packages/kokkos/core/unit_test/Makefile | 530 --- packages/kokkos/core/unit_test/TestAbort.hpp | 30 +- packages/kokkos/core/unit_test/TestArray.cpp | 118 +- .../kokkos/core/unit_test/TestArrayOps.hpp | 328 +- .../core/unit_test/TestAtomicOperations.hpp | 104 +- .../TestAtomicOperations_complexdouble.hpp | 15 +- .../TestAtomicOperations_complexfloat.hpp | 19 +- .../unit_test/TestAtomicOperations_double.hpp | 19 +- .../unit_test/TestAtomicOperations_float.hpp | 19 +- .../unit_test/TestAtomicOperations_int.hpp | 19 +- .../unit_test/TestAtomicOperations_int16.hpp | 22 + .../unit_test/TestAtomicOperations_int8.hpp | 22 + .../TestAtomicOperations_longint.hpp | 19 +- .../TestAtomicOperations_longlongint.hpp | 19 +- .../unit_test/TestAtomicOperations_shared.hpp | 24 +- .../TestAtomicOperations_unsignedint.hpp | 19 +- .../TestAtomicOperations_unsignedlongint.hpp | 19 +- ...stAtomicOperations_unsignedlonglongint.hpp | 19 +- .../kokkos/core/unit_test/TestAtomicViews.hpp | 44 +- .../kokkos/core/unit_test/TestAtomics.hpp | 161 +- .../core/unit_test/TestBitManipulation.cpp | 19 +- .../unit_test/TestBitManipulationBuiltins.hpp | 43 +- .../core/unit_test/TestBlockSizeDeduction.hpp | 26 +- .../unit_test/TestCStyleMemoryManagement.cpp | 20 +- .../kokkos/core/unit_test/TestCTestDevice.cpp | 15 +- packages/kokkos/core/unit_test/TestCXX11.hpp | 32 +- .../core/unit_test/TestCXX11Deduction.hpp | 20 +- .../core/unit_test/TestCheckedIntegerOps.hpp | 15 +- .../TestCommonPolicyConstructors.hpp | 25 +- .../unit_test/TestCommonPolicyInterface.hpp | 78 +- .../kokkos/core/unit_test/TestCompileMain.cpp | 15 +- .../core/unit_test/TestCompilerMacros.cpp | 24 +- .../kokkos/core/unit_test/TestComplex.hpp | 158 +- .../kokkos/core/unit_test/TestConcepts.hpp | 65 +- .../core/unit_test/TestConcurrentBitset.hpp | 17 +- .../core/unit_test/TestCreateMirror.cpp | 23 +- packages/kokkos/core/unit_test/TestCrs.hpp | 20 +- .../TestCustomScalarParallelScan.hpp | 95 + .../kokkos/core/unit_test/TestDeepCopy.hpp | 62 + .../core/unit_test/TestDeepCopyAlignment.hpp | 20 +- .../unit_test/TestDeepCopy_Assignment.hpp | 57 + .../core/unit_test/TestDeepCopy_Narrowing.hpp | 42 + .../unit_test/TestDeepCopy_SameArgument.hpp | 55 + .../core/unit_test/TestDetectionIdiom.cpp | 16 +- .../core/unit_test/TestDeviceAndThreads.py | 33 +- .../unit_test/TestExecSpacePartitioning.hpp | 71 +- .../unit_test/TestExecSpaceThreadSafety.hpp | 171 +- ...onEnvironmentNonInitializedOrFinalized.cpp | 329 +- .../core/unit_test/TestExecutionSpace.hpp | 100 +- .../core/unit_test/TestFunctorAnalysis.hpp | 31 +- packages/kokkos/core/unit_test/TestGraph.hpp | 717 ++- .../core/unit_test/TestGraphAtomicLocks.hpp | 42 +- .../core/unit_test/TestGraphNodeCtorProps.hpp | 185 + packages/kokkos/core/unit_test/TestHWLOC.cpp | 15 +- .../core/unit_test/TestHalfConversion.hpp | 18 +- .../core/unit_test/TestHalfOperators.hpp | 34 +- .../core/unit_test/TestHostSharedPtr.hpp | 15 +- .../TestHostSharedPtrAccessOnDevice.hpp | 28 +- .../unit_test/TestInitializationSettings.cpp | 15 +- .../core/unit_test/TestInitializeFinalize.cpp | 20 +- .../kokkos/core/unit_test/TestInterOp.cpp | 43 +- .../core/unit_test/TestIrregularLayout.hpp | 27 +- .../TestJoinBackwardCompatibility.hpp | 20 +- ...kkosHelpCausesNormalProgramTermination.cpp | 20 +- .../unit_test/TestLegionInitialization.cpp | 21 +- .../core/unit_test/TestLocalDeepCopy.hpp | 1217 +++-- .../kokkos/core/unit_test/TestMDRange.hpp | 53 +- .../core/unit_test/TestMDRangePolicyCTAD.cpp | 24 +- .../TestMDRangePolicyConstructors.hpp | 232 +- .../core/unit_test/TestMDRangeReduce.hpp | 25 +- .../kokkos/core/unit_test/TestMDRange_a.hpp | 18 +- .../kokkos/core/unit_test/TestMDRange_b.hpp | 18 +- .../kokkos/core/unit_test/TestMDRange_c.hpp | 20 +- .../kokkos/core/unit_test/TestMDRange_d.hpp | 20 +- .../kokkos/core/unit_test/TestMDRange_e.hpp | 18 +- .../kokkos/core/unit_test/TestMDRange_f.hpp | 18 +- .../kokkos/core/unit_test/TestMDRange_g.hpp | 20 +- packages/kokkos/core/unit_test/TestMDSpan.hpp | 22 +- .../unit_test/TestMDSpanAtomicAccessor.hpp | 27 +- .../core/unit_test/TestMDSpanConversion.hpp | 23 +- .../unit_test/TestMathematicalConstants.hpp | 28 +- .../unit_test/TestMathematicalFunctions.hpp | 1545 ++++++- .../unit_test/TestMathematicalFunctions1.hpp | 15 +- .../unit_test/TestMathematicalFunctions2.hpp | 15 +- .../unit_test/TestMathematicalFunctions3.hpp | 15 +- .../TestMathematicalSpecialFunctions.hpp | 124 +- .../kokkos/core/unit_test/TestMemoryPool.hpp | 20 +- .../kokkos/core/unit_test/TestMinMaxClamp.hpp | 20 +- .../kokkos/core/unit_test/TestMultiGPU.hpp | 15 +- .../core/unit_test/TestNestedReducerCTAD.cpp | 21 +- .../unit_test/TestNonTrivialScalarTypes.hpp | 60 +- .../core/unit_test/TestNumericTraits.hpp | 67 +- .../unit_test/TestOccupancyControlTrait.hpp | 20 +- packages/kokkos/core/unit_test/TestOther.hpp | 15 +- .../unit_test/TestParallelScanRangePolicy.hpp | 154 +- .../TestParseCmdLineArgsAndEnvVars.cpp | 35 +- packages/kokkos/core/unit_test/TestPrintf.hpp | 20 +- .../core/unit_test/TestPushFinalizeHook.cpp | 20 +- .../core/unit_test/TestQuadPrecisionMath.hpp | 39 +- packages/kokkos/core/unit_test/TestRange.hpp | 126 +- .../kokkos/core/unit_test/TestRangePolicy.hpp | 15 +- .../core/unit_test/TestRangePolicyCTAD.cpp | 52 +- .../unit_test/TestRangePolicyConstructors.hpp | 173 +- .../core/unit_test/TestRangePolicyRequire.hpp | 24 +- .../kokkos/core/unit_test/TestRealloc.hpp | 20 +- packages/kokkos/core/unit_test/TestReduce.hpp | 277 +- .../unit_test/TestReduceCombinatorical.hpp | 52 +- .../core/unit_test/TestReducerCTADs.hpp | 20 +- .../kokkos/core/unit_test/TestReducers.hpp | 221 +- .../kokkos/core/unit_test/TestReducers_a.hpp | 23 +- .../kokkos/core/unit_test/TestReducers_b.hpp | 19 +- .../kokkos/core/unit_test/TestReducers_c.hpp | 21 +- .../kokkos/core/unit_test/TestReducers_d.hpp | 31 +- .../kokkos/core/unit_test/TestReducers_e.hpp | 15 +- .../kokkos/core/unit_test/TestReductions.hpp | 15 +- .../unit_test/TestReductions_DeviceView.hpp | 20 +- packages/kokkos/core/unit_test/TestResize.hpp | 52 +- .../kokkos/core/unit_test/TestScopeGuard.cpp | 20 +- .../kokkos/core/unit_test/TestSharedAlloc.hpp | 24 +- .../unit_test/TestSharedHostPinnedSpace.cpp | 20 +- .../kokkos/core/unit_test/TestSharedSpace.cpp | 22 +- .../core/unit_test/TestSpaceAwareAccessor.hpp | 28 +- .../TestSpaceAwareAccessorAccessViolation.hpp | 27 +- .../kokkos/core/unit_test/TestStackTrace.cpp | 15 +- .../kokkos/core/unit_test/TestStackTrace.hpp | 15 +- .../core/unit_test/TestStackTrace_f0.cpp | 15 +- .../core/unit_test/TestStackTrace_f1.cpp | 15 +- .../core/unit_test/TestStackTrace_f2.cpp | 15 +- .../core/unit_test/TestStackTrace_f3.cpp | 15 +- .../core/unit_test/TestStackTrace_f4.cpp | 15 +- .../core/unit_test/TestStringManipulation.cpp | 15 +- .../kokkos/core/unit_test/TestSubView_a.hpp | 35 +- .../kokkos/core/unit_test/TestSubView_b.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c01.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c02.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c03.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c04.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c05.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c06.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c07.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c08.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c09.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c10.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c11.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c12.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c13.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c14.hpp | 15 +- .../kokkos/core/unit_test/TestSubView_c15.hpp | 22 +- .../kokkos/core/unit_test/TestSubView_c16.hpp | 55 + packages/kokkos/core/unit_test/TestSwap.hpp | 20 +- .../core/unit_test/TestTaskScheduler.hpp | 839 ---- .../unit_test/TestTaskScheduler_single.hpp | 72 - packages/kokkos/core/unit_test/TestTeam.hpp | 199 +- .../kokkos/core/unit_test/TestTeamBasic.hpp | 181 +- .../unit_test/TestTeamCombinedReducers.hpp | 45 +- .../kokkos/core/unit_test/TestTeamMDRange.hpp | 476 +- .../unit_test/TestTeamMDRangePolicyCTAD.cpp | 21 +- .../core/unit_test/TestTeamPolicyCTAD.cpp | 22 +- .../unit_test/TestTeamPolicyConstructors.hpp | 131 +- .../core/unit_test/TestTeamReductionScan.hpp | 54 +- .../kokkos/core/unit_test/TestTeamScan.hpp | 39 +- .../kokkos/core/unit_test/TestTeamScratch.hpp | 20 +- .../core/unit_test/TestTeamTeamSize.hpp | 46 +- .../kokkos/core/unit_test/TestTeamVector.hpp | 50 +- .../core/unit_test/TestTeamVectorRange.hpp | 75 +- packages/kokkos/core/unit_test/TestTimer.hpp | 43 + .../kokkos/core/unit_test/TestTypeInfo.cpp | 21 +- .../kokkos/core/unit_test/TestTypeList.cpp | 95 +- .../kokkos/core/unit_test/TestUniqueToken.hpp | 37 +- .../kokkos/core/unit_test/TestUtilities.hpp | 20 +- .../core/unit_test/TestVersionMacros.cpp | 20 +- .../kokkos/core/unit_test/TestViewAPI.hpp | 86 +- .../kokkos/core/unit_test/TestViewAPI_a.hpp | 15 +- .../kokkos/core/unit_test/TestViewAPI_b.hpp | 15 +- .../kokkos/core/unit_test/TestViewAPI_c.hpp | 15 +- .../kokkos/core/unit_test/TestViewAPI_d.hpp | 15 +- .../kokkos/core/unit_test/TestViewAPI_e.hpp | 87 +- .../core/unit_test/TestViewBadAlloc.hpp | 26 +- .../kokkos/core/unit_test/TestViewCopy_a.hpp | 35 +- .../kokkos/core/unit_test/TestViewCopy_b.hpp | 35 +- .../kokkos/core/unit_test/TestViewCopy_c.hpp | 26 +- .../core/unit_test/TestViewCtorDimMatch.hpp | 24 +- .../core/unit_test/TestViewCtorProp.hpp | 21 +- .../unit_test/TestViewCtorPropEmbeddedDim.hpp | 32 +- .../TestViewEmptyRuntimeUnmanaged.hpp | 77 +- .../kokkos/core/unit_test/TestViewHooks.hpp | 178 +- .../core/unit_test/TestViewIsAssignable.hpp | 63 +- .../TestViewLayoutStrideAssignment.hpp | 169 +- .../core/unit_test/TestViewMapping_a.hpp | 97 +- .../core/unit_test/TestViewMapping_b.hpp | 42 +- .../unit_test/TestViewMapping_subview.hpp | 34 +- .../TestViewMemoryAccessViolation.hpp | 26 +- .../kokkos/core/unit_test/TestViewMove.hpp | 183 + .../kokkos/core/unit_test/TestViewOfClass.hpp | 27 +- .../kokkos/core/unit_test/TestViewOfViews.hpp | 23 +- .../unit_test/TestViewOutOfBoundsAccess.hpp | 29 +- .../kokkos/core/unit_test/TestViewRank.cpp | 22 +- .../kokkos/core/unit_test/TestViewResize.hpp | 15 +- .../core/unit_test/TestViewSpaceAssign.hpp | 20 +- .../kokkos/core/unit_test/TestViewSubview.hpp | 75 +- .../core/unit_test/TestViewTypeTraits.cpp | 20 +- .../core/unit_test/TestViewTypedefs.cpp | 58 +- .../kokkos/core/unit_test/TestView_64bit.hpp | 44 +- .../core/unit_test/TestWindowsInclude.cpp | 20 +- .../unit_test/TestWithoutInitializing.hpp | 57 +- .../kokkos/core/unit_test/TestWorkGraph.hpp | 20 +- .../core/unit_test/Test_InterOp_Streams.hpp | 20 +- .../kokkos/core/unit_test/UnitTestMain.cpp | 15 +- .../core/unit_test/UnitTestMainInit.cpp | 20 +- .../UnitTest_CMakePassCmdLineArgs.cpp | 15 +- .../UnitTest_CMakeTriBITSCompatibility.cpp | 15 +- .../unit_test/UnitTest_DeviceAndThreads.cpp | 31 +- .../TestCudaHostPinned_Category.hpp | 15 +- .../category_files/TestCudaUVM_Category.hpp | 15 +- .../category_files/TestCuda_Category.hpp | 15 +- .../TestDefaultDeviceType_Category.hpp | 15 +- .../TestHIPHostPinned_Category.hpp | 15 +- .../TestHIPManaged_Category.hpp | 15 +- .../category_files/TestHIP_Category.hpp | 15 +- .../category_files/TestHPX_Category.hpp | 15 +- .../category_files/TestOpenACC_Category.hpp | 15 +- .../TestOpenMPTarget_Category.hpp | 28 - .../category_files/TestOpenMP_Category.hpp | 15 +- .../TestSYCLHostUSM_Category.hpp | 15 +- .../TestSYCLSharedUSM_Category.hpp | 15 +- .../category_files/TestSYCL_Category.hpp | 15 +- .../category_files/TestSerial_Category.hpp | 15 +- .../category_files/TestThreads_Category.hpp | 15 +- .../configuration/test-code/CMakeLists.txt | 44 - .../configuration/test-code/Makefile | 47 - .../configuration/test-code/main.cpp | 22 - .../configuration/test-code/test_config.bash | 7 - .../test-code/test_config_arch_list.bash | 45 - .../test-code/test_config_device_list.bash | 45 - .../test-code/test_config_options_list.bash | 48 - .../test-code/test_config_run.bash | 111 - .../cuda/TestCuda_DebugPinUVMSpace.cpp | 20 +- .../cuda/TestCuda_DebugSerialExecution.cpp | 20 +- .../unit_test/cuda/TestCuda_InterOp_Graph.cpp | 42 +- .../cuda/TestCuda_InterOp_GraphMultiGPU.cpp | 106 + .../unit_test/cuda/TestCuda_InterOp_Init.cpp | 20 +- .../cuda/TestCuda_InterOp_Streams.cpp | 15 +- .../cuda/TestCuda_InterOp_StreamsMultiGPU.cpp | 17 +- .../cuda/TestCuda_ReducerViewSizeLimit.cpp | 22 +- .../core/unit_test/cuda/TestCuda_Spaces.cpp | 26 +- .../core/unit_test/cuda/TestCuda_Task.cpp | 18 - .../cuda/TestCuda_TeamScratchStreams.cpp | 22 +- .../default/TestDefaultDeviceDevelop.cpp | 20 +- .../default/TestDefaultDeviceType.cpp | 21 +- .../default/TestDefaultDeviceTypeResize.cpp | 15 +- .../default/TestDefaultDeviceTypeViewAPI.cpp | 22 +- .../default/TestDefaultDeviceType_a1.cpp | 20 +- .../default/TestDefaultDeviceType_a2.cpp | 20 +- .../default/TestDefaultDeviceType_a3.cpp | 20 +- .../default/TestDefaultDeviceType_b1.cpp | 20 +- .../default/TestDefaultDeviceType_b2.cpp | 20 +- .../default/TestDefaultDeviceType_b3.cpp | 20 +- .../default/TestDefaultDeviceType_c1.cpp | 20 +- .../default/TestDefaultDeviceType_c2.cpp | 20 +- .../default/TestDefaultDeviceType_c3.cpp | 20 +- .../headers_self_contained/CMakeLists.txt | 6 - .../headers_self_contained/tstHeader.cpp | 15 +- .../unit_test/hip/TestHIP_AsyncLauncher.cpp | 20 +- .../hip/TestHIP_BlocksizeDeduction.cpp | 20 +- .../unit_test/hip/TestHIP_InterOp_Graph.cpp | 50 +- .../unit_test/hip/TestHIP_InterOp_Init.cpp | 20 +- .../unit_test/hip/TestHIP_InterOp_Streams.cpp | 15 +- .../hip/TestHIP_InterOp_StreamsMultiGPU.cpp | 17 +- .../hip/TestHIP_Memory_Requirements.cpp | 20 +- .../core/unit_test/hip/TestHIP_ScanUnit.cpp | 20 +- .../hip/TestHIP_SharedResourceLock.cpp | 21 +- .../core/unit_test/hip/TestHIP_Spaces.cpp | 20 +- .../hip/TestHIP_TeamScratchStreams.cpp | 22 +- .../hip/TestHIP_UnifiedMemory_ZeroMemset.cpp | 20 +- .../core/unit_test/hpx/TestHPX_InParallel.cpp | 191 - .../hpx/TestHPX_IndependentInstances.cpp | 20 +- ...X_IndependentInstancesDelayedExecution.cpp | 20 +- ...estHPX_IndependentInstancesInstanceIds.cpp | 20 +- ...estHPX_IndependentInstancesRefCounting.cpp | 22 +- ...PX_IndependentInstancesSynchronization.cpp | 20 +- .../core/unit_test/hpx/TestHPX_InterOp.cpp | 20 +- .../core/unit_test/hpx/TestHPX_Task.cpp | 18 - .../core/unit_test/incremental/README.md | 2 +- .../incremental/Test01_execspace.hpp | 31 +- .../incremental/Test02_atomic_host.hpp | 20 +- .../Test03a_MemorySpace_malloc.hpp | 20 +- .../incremental/Test03b_MemorySpace_free.hpp | 20 +- .../Test04_ParallelFor_RangePolicy.hpp | 21 +- .../Test05_ParallelReduce_RangePolicy.hpp | 20 +- .../Test06_ParallelFor_MDRangePolicy.hpp | 21 +- .../incremental/Test08_deep_copy.hpp | 26 +- .../incremental/Test10_HierarchicalBasics.hpp | 33 +- .../Test11a_ParallelFor_TeamThreadRange.hpp | 20 +- .../Test11b_ParallelFor_TeamVectorRange.hpp | 20 +- .../Test11c_ParallelFor_ThreadVectorRange.hpp | 20 +- .../incremental/Test12a_ThreadScratch.hpp | 29 +- .../incremental/Test12b_TeamScratch.hpp | 29 +- .../Test13a_ParallelRed_TeamThreadRange.hpp | 20 +- .../Test13b_ParallelRed_TeamVectorRange.hpp | 20 +- .../Test13c_ParallelRed_ThreadVectorRange.hpp | 20 +- .../incremental/Test14_MDRangeReduce.hpp | 34 +- .../incremental/Test16_ParallelScan.hpp | 20 +- .../incremental/Test17_CompleteAtomic.hpp | 20 +- .../unit_test/openmp/TestOpenMP_InterOp.cpp | 20 +- .../core/unit_test/openmp/TestOpenMP_Task.cpp | 18 - .../TestRangePolicyExecutionTypes.hpp | 152 + .../core/unit_test/serial/TestSerial_Task.cpp | 18 - .../kokkos/core/unit_test/standalone/Makefile | 57 - .../unit_test/standalone/UnitTestMainInit.cpp | 60 - .../unit_test/sycl/TestSYCL_InterOp_Graph.cpp | 49 +- .../unit_test/sycl/TestSYCL_InterOp_Init.cpp | 45 +- .../sycl/TestSYCL_InterOp_Init_Context.cpp | 20 +- .../sycl/TestSYCL_InterOp_Streams.cpp | 103 +- .../sycl/TestSYCL_InterOp_StreamsMultiGPU.cpp | 15 +- .../core/unit_test/sycl/TestSYCL_Spaces.cpp | 20 +- .../sycl/TestSYCL_TeamScratchStreams.cpp | 22 +- .../core/unit_test/tools/TestAllCalls.cpp | 22 +- .../unit_test/tools/TestBuiltinTuners.cpp | 248 +- .../core/unit_test/tools/TestCInterface.c | 5 + .../unit_test/tools/TestCategoricalTuner.cpp | 20 +- .../tools/TestEmptyProfilingLibrary.cpp | 17 + .../unit_test/tools/TestEventCorrectness.cpp | 15 +- .../unit_test/tools/TestEventCorrectness.hpp | 62 +- .../core/unit_test/tools/TestIndependence.cpp | 15 +- .../core/unit_test/tools/TestKernelNames.cpp | 34 +- .../unit_test/tools/TestLogicalSpaces.cpp | 15 +- .../unit_test/tools/TestProfilingSection.cpp | 15 +- .../core/unit_test/tools/TestScopedRegion.cpp | 15 +- .../tools/TestToolsInitialization.cpp | 20 +- .../core/unit_test/tools/TestTuning.cpp | 20 +- .../tools/TestWithoutInitializing.cpp | 33 +- .../core/unit_test/tools/empty-tool.cpp | 9 + .../tools/include/ToolTestingUtilities.hpp | 20 +- .../core/unit_test/tools/printing-tool.cpp | 15 +- .../view/TestAllocationAndSpanSize.hpp | 71 + .../core/unit_test/view/TestBasicView.hpp | 69 +- .../view/TestBasicViewMDSpanConversion.cpp | 41 +- .../view/TestConversionFromPointer.cpp | 27 + .../view/TestExtentsDatatypeConversion.cpp | 21 +- .../view/TestLegacyLayoutFunction.hpp | 142 + .../unit_test/view/TestMemoryTraitTypes.cpp | 34 + .../view/TestReferenceCountedAccessor.hpp | 21 +- .../view/TestReferenceCountedDataHandle.hpp | 21 +- .../unit_test/view/TestViewCtorDataHandle.hpp | 58 + .../unit_test/view/TestViewCustomization.cpp | 22 +- .../view/TestViewCustomizationAccessorArg.hpp | 21 +- ...stViewCustomizationAccessorFromMapping.hpp | 80 +- .../TestViewCustomizationAllocationType.hpp | 143 +- .../view/TestViewEqualityOperator.hpp | 118 + packages/kokkos/doc/Doxyfile | 127 - packages/kokkos/doc/README.md | 3 - .../doc/SAND2017-10464-Kokkos-Task-DAG.pdf | Bin 761252 -> 0 bytes packages/kokkos/doc/build_docs | 15 - .../doc/design_notes_space_instances.md | 131 - packages/kokkos/doc/index.doc | 72 - packages/kokkos/docs/CODE_OF_CONDUCT.md | 3 + packages/kokkos/docs/CONTRIBUTING.md | 22 + packages/kokkos/{ => docs}/SECURITY.md | 0 packages/kokkos/{doc => docs}/TuningDesign.md | 0 packages/kokkos/example/CMakeLists.txt | 5 + packages/kokkos/example/README | 9 - .../build_cmake_in_tree/CMakeLists.txt | 4 +- .../build_cmake_in_tree/cmake_example.cpp | 15 +- .../build_cmake_installed/CMakeLists.txt | 10 +- .../build_cmake_installed/cmake_example.cpp | 15 +- .../example/build_cmake_installed/foo.f | 4 +- .../CMakeLists.txt | 8 +- .../bar.cpp | 15 +- .../foo.cpp | 15 +- .../CMakeLists.txt | 4 +- .../bar.cpp | 15 +- .../cmake_example.cpp | 15 +- .../kokkos/example/make_buildlink/Makefile | 51 - packages/kokkos/example/make_buildlink/README | 2 - .../kokkos/example/make_buildlink/main.cpp | 29 - packages/kokkos/example/query_device/Makefile | 49 - .../example/query_device/query_device.cpp | 15 +- .../example/relocatable_function/Makefile | 35 - .../example/relocatable_function/functor.cpp | 15 +- .../example/relocatable_function/main.cpp | 15 +- .../example/tutorial/01_hello_world/Makefile | 50 - .../tutorial/01_hello_world/hello_world.cpp | 15 +- .../tutorial/01_hello_world_lambda/Makefile | 51 - .../hello_world_lambda.cpp | 15 +- .../tutorial/02_simple_reduce/Makefile | 50 - .../02_simple_reduce/simple_reduce.cpp | 15 +- .../tutorial/02_simple_reduce_lambda/Makefile | 51 - .../simple_reduce_lambda.cpp | 15 +- .../example/tutorial/03_simple_view/Makefile | 51 - .../tutorial/03_simple_view/simple_view.cpp | 15 +- .../tutorial/03_simple_view_lambda/Makefile | 51 - .../simple_view_lambda.cpp | 15 +- .../tutorial/04_simple_memoryspaces/Makefile | 50 - .../simple_memoryspaces.cpp | 19 +- .../tutorial/05_simple_atomics/Makefile | 50 - .../05_simple_atomics/simple_atomics.cpp | 19 +- .../tutorial/06_simple_mdrangepolicy/Makefile | 49 - .../simple_mdrangepolicy.cpp | 15 +- .../Advanced_Views/01_data_layouts/Makefile | 50 - .../01_data_layouts/data_layouts.cpp | 15 +- .../Advanced_Views/02_memory_traits/Makefile | 50 - .../02_memory_traits/memory_traits.cpp | 17 +- .../Advanced_Views/03_subviews/Makefile | 50 - .../Advanced_Views/03_subviews/subviews.cpp | 15 +- .../Advanced_Views/04_dualviews/Makefile | 50 - .../Advanced_Views/04_dualviews/dual_view.cpp | 20 +- .../05_NVIDIA_UVM/CMakeLists.txt | 7 - .../Advanced_Views/05_NVIDIA_UVM/Makefile | 50 - .../05_NVIDIA_UVM/uvm_example.cpp | 121 - .../Advanced_Views/06_AtomicViews/Makefile | 50 - .../07_Overlapping_DeepCopy/CMakeLists.txt | 5 + .../07_Overlapping_DeepCopy/Makefile | 50 - .../overlapping_deepcopy.cpp | 16 +- .../tutorial/Advanced_Views/CMakeLists.txt | 4 +- .../example/tutorial/Advanced_Views/Makefile | 123 - .../Algorithms/01_random_numbers/Makefile | 50 - .../01_random_numbers/random_numbers.cpp | 15 +- .../example/tutorial/Algorithms/Makefile | 43 - .../kokkos/example/tutorial/CMakeLists.txt | 1 + .../Debugging/01_ErrorReporter/CMakeLists.txt | 5 + .../01_ErrorReporter/error_reporter.cpp | 70 + .../example/tutorial/Debugging/CMakeLists.txt | 1 + .../01_thread_teams/Makefile | 50 - .../01_thread_teams/thread_teams.cpp | 15 +- .../01_thread_teams_lambda/Makefile | 51 - .../thread_teams_lambda.cpp | 15 +- .../02_nested_parallel_for/Makefile | 50 - .../nested_parallel_for.cpp | 15 +- .../03_vectorization/Makefile | 50 - .../03_vectorization/vectorization.cpp | 15 +- .../04_team_scan/Makefile | 50 - .../04_team_scan/team_scan.cpp | 38 +- .../Hierarchical_Parallelism/CMakeLists.txt | 1 + .../Hierarchical_Parallelism/Makefile | 95 - packages/kokkos/example/tutorial/Makefile | 174 - packages/kokkos/example/tutorial/README | 12 - .../example/tutorial/launch_bounds/Makefile | 58 - .../launch_bounds/launch_bounds_reduce.cpp | 15 +- .../example/virtual_functions/CMakeLists.txt | 6 + .../kokkos/example/virtual_functions/Makefile | 57 - .../example/virtual_functions/classes.cpp | 15 +- .../example/virtual_functions/classes.hpp | 43 +- .../kokkos/example/virtual_functions/main.cpp | 25 +- packages/kokkos/generate_makefile.bash | 497 --- packages/kokkos/gnu_generate_makefile.bash | 423 -- packages/kokkos/master_history.txt | 47 - packages/kokkos/scripts/CTestRun.cmake | 2 +- packages/kokkos/scripts/apply-clang-format | 5 - packages/kokkos/scripts/check-copyright | 15 - packages/kokkos/scripts/diff_files | 1 - .../kokkos/scripts/docker/Dockerfile.clang | 16 - packages/kokkos/scripts/docker/Dockerfile.gcc | 29 +- .../kokkos/scripts/docker/Dockerfile.hipcc | 2 +- .../kokkos/scripts/docker/Dockerfile.modules | 2 +- .../kokkos/scripts/docker/Dockerfile.nvcc | 5 +- .../kokkos/scripts/docker/Dockerfile.nvhpc | 5 +- .../scripts/docker/Dockerfile.openmptarget | 68 - .../kokkos/scripts/docker/Dockerfile.sycl | 21 +- .../kokkos/scripts/docker/check_format_cpp.sh | 4 - ...a-12.2.2_openblas-0.3.29_x86-64.dockerfile | 42 + .../cuda-12.2.2_openblas-0.3.29_x86-64.yaml | 16 + ...it-2024.2.1-0-devel-ubuntu22.04.dockerfile | 23 + ...2.1_openblas-0.3.28_zen3_gfx90a.dockerfile | 64 + ...ocm-6.2.1_openblas-0.3.28_zen3_gfx90a.yaml | 27 + packages/kokkos/scripts/license_header.txt | 2 + packages/kokkos/scripts/snapshot.py | 78 +- .../kokkos/scripts/spack_test/CMakeLists.txt | 4 +- .../scripts/spack_test/CMakeLists.txt.in | 10 +- .../kokkos/scripts/testing_scripts/README | 5 - .../scripts/testing_scripts/TestEXEC_TEST.cpp | 18 - .../kokkos/scripts/testing_scripts/cpy_test | 9 - .../testing_scripts/obj_size_opt_check | 287 -- .../scripts/testing_scripts/test_all_sandia | 883 ---- packages/kokkos/scripts/update-copyright | 6 +- packages/kokkos/simd/CMakeLists.txt | 1 + packages/kokkos/simd/perf_tests/.clang-tidy | 4 + .../kokkos/simd/perf_tests/BenchmarkMain.cpp | 34 + .../kokkos/simd/perf_tests/CMakeLists.txt | 7 + .../kokkos/simd/perf_tests/include/Common.hpp | 135 + .../perf_tests/include/PerfTest_Device.hpp | 280 ++ .../simd/perf_tests/include/PerfTest_Host.hpp | 285 ++ .../perf_tests/include/PerfTest_Operators.hpp | 338 ++ packages/kokkos/simd/src/CMakeLists.txt | 26 +- packages/kokkos/simd/src/Kokkos_SIMD.cppm | 104 + packages/kokkos/simd/src/Kokkos_SIMD.hpp | 245 +- packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp | 3124 +++++++------ .../kokkos/simd/src/Kokkos_SIMD_AVX512.hpp | 3948 ++++++++++------- .../kokkos/simd/src/Kokkos_SIMD_Common.hpp | 343 +- .../simd/src/Kokkos_SIMD_Common_Math.hpp | 309 +- .../kokkos/simd/src/Kokkos_SIMD_Impl.cppm | 28 + packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp | 3321 +++++++++----- packages/kokkos/simd/src/Kokkos_SIMD_SVE.hpp | 3282 ++++++++------ .../kokkos/simd/src/Kokkos_SIMD_Scalar.hpp | 477 +- .../kokkos/simd/src/Kokkos_SIMD_dummy.cpp | 15 +- .../simd/src/impl/Kokkos_Neon_SVE_bridge.hpp | 15 +- .../simd/src/impl/Kokkos_SIMD_Impl_Macros.hpp | 95 + .../impl/Kokkos_SIMD_RangesCtorSupport.hpp | 104 + packages/kokkos/simd/unit_tests/TestSIMD.cpp | 21 +- .../kokkos/simd/unit_tests/UnitTestMain.cpp | 20 +- .../unit_tests/include/SIMDTesting_Ops.hpp | 468 +- .../include/SIMDTesting_Utilities.hpp | 116 +- .../include/TestSIMD_ArithmeticOps.hpp | 410 ++ .../include/TestSIMD_BitwiseOps.hpp | 577 +++ .../include/TestSIMD_ComparisonOps.hpp | 369 ++ .../unit_tests/include/TestSIMD_Condition.hpp | 25 +- .../include/TestSIMD_Construction.hpp | 66 +- .../include/TestSIMD_Conversions.hpp | 268 +- .../include/TestSIMD_GeneratorCtors.hpp | 81 +- .../unit_tests/include/TestSIMD_LoadStore.hpp | 239 + .../unit_tests/include/TestSIMD_MaskOps.hpp | 36 +- .../unit_tests/include/TestSIMD_MathOps.hpp | 198 +- .../include/TestSIMD_MemoryPermute.hpp | 355 ++ .../include/TestSIMD_Reductions.hpp | 74 +- .../unit_tests/include/TestSIMD_ShiftOps.hpp | 118 +- .../include/TestSIMD_WhereExpressions.hpp | 227 - packages/kokkos/tpls/desul-hash.txt | 1 + .../kokkos/tpls/desul/Config.hpp.cmake.in | 4 +- .../desul/include/desul/atomics/Common.hpp | 38 +- .../desul/atomics/Compare_Exchange_CUDA.hpp | 39 +- .../desul/atomics/Compare_Exchange_GCC.hpp | 47 +- .../desul/atomics/Compare_Exchange_HIP.hpp | 18 +- .../desul/atomics/Compare_Exchange_MSVC.hpp | 16 +- .../atomics/Compare_Exchange_OpenACC.hpp | 4 + .../desul/atomics/Compare_Exchange_OpenMP.hpp | 12 +- .../desul/atomics/Compare_Exchange_SYCL.hpp | 9 +- .../include/desul/atomics/Fetch_Op_GCC.hpp | 28 +- .../desul/atomics/Fetch_Op_Generic.hpp | 148 +- .../include/desul/atomics/Fetch_Op_HIP.hpp | 31 +- .../desul/include/desul/atomics/Generic.hpp | 310 +- .../include/desul/atomics/Lock_Array_CUDA.hpp | 4 +- .../include/desul/atomics/Lock_Array_HIP.hpp | 4 +- .../include/desul/atomics/Lock_Array_SYCL.hpp | 4 +- .../atomics/Lock_Based_Fetch_Op_CUDA.hpp | 11 +- .../desul/atomics/Lock_Based_Fetch_Op_HIP.hpp | 11 +- .../atomics/Lock_Based_Fetch_Op_Host.hpp | 18 +- .../atomics/Lock_Based_Fetch_Op_OpenACC.hpp | 10 +- .../atomics/Lock_Based_Fetch_Op_SYCL.hpp | 11 +- .../desul/atomics/Lock_Free_Fetch_Op.hpp | 2 +- .../desul/include/desul/atomics/Macros.hpp | 10 + .../atomics/Operator_Function_Objects.hpp | 34 +- .../desul/atomics/cuda/CUDA_asm_exchange.hpp | 8 +- .../atomics/cuda/cuda_cc9_asm_exchange.inc | 19 + .../cuda/cuda_cc9_asm_exchange_memorder.inc | 26 + .../atomics/cuda/cuda_cc9_asm_exchange_op.inc | 25 + packages/kokkos/tpls/gtest/CMakeLists.txt | 10 + packages/kokkos/tpls/mdspan-hash.txt | 1 + .../experimental/__p0009_bits/config.hpp | 9 +- .../__p0009_bits/layout_stride.hpp | 26 +- .../experimental/__p0009_bits/macros.hpp | 11 +- .../experimental/__p0009_bits/mdspan.hpp | 122 +- .../experimental/__p0009_bits/utility.hpp | 70 +- .../experimental/__p1684_bits/mdarray.hpp | 30 +- .../__p2630_bits/strided_slice.hpp | 8 +- .../__p2630_bits/submdspan_mapping.hpp | 26 +- .../__p2642_bits/layout_padded.hpp | 284 +- 1453 files changed, 39931 insertions(+), 68777 deletions(-) create mode 100644 packages/kokkos/.mailmap create mode 100644 packages/kokkos/.pre-commit-config.yaml delete mode 100644 packages/kokkos/CONTRIBUTING.md create mode 100644 packages/kokkos/COPYRIGHT.md delete mode 100644 packages/kokkos/Copyright.txt delete mode 100644 packages/kokkos/LICENSE_FILE_HEADER delete mode 100644 packages/kokkos/Makefile.kokkos delete mode 100644 packages/kokkos/Makefile.targets delete mode 100644 packages/kokkos/Spack.md create mode 100644 packages/kokkos/algorithms/perf_test/test_random.cpp delete mode 100644 packages/kokkos/algorithms/unit_tests/Makefile create mode 100644 packages/kokkos/benchmarks/.clang-tidy delete mode 100644 packages/kokkos/benchmarks/atomic/Makefile delete mode 100644 packages/kokkos/benchmarks/bytes_and_flops/Makefile delete mode 100644 packages/kokkos/benchmarks/gather/Makefile delete mode 100644 packages/kokkos/benchmarks/policy_performance/Makefile delete mode 100644 packages/kokkos/benchmarks/stream/Makefile delete mode 100644 packages/kokkos/benchmarks/view_copy_constructor/Makefile delete mode 100755 packages/kokkos/bin/runtest delete mode 100644 packages/kokkos/cmake/Modules/CudaToolkit.cmake delete mode 100644 packages/kokkos/cmake/Modules/FindTPLLIBDL.cmake create mode 100644 packages/kokkos/cmake/Modules/FindTPLNEXTAPI.cmake delete mode 100644 packages/kokkos/cmake/compile_tests/cplusplus17.cpp create mode 100644 packages/kokkos/cmake/compile_tests/cplusplus20.cpp delete mode 100644 packages/kokkos/cmake/kokkos_corner_cases.cmake delete mode 100644 packages/kokkos/containers/performance_tests/Makefile create mode 100644 packages/kokkos/containers/performance_tests/TestDualView.hpp create mode 100644 packages/kokkos/containers/src/Kokkos_Bitset.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_DualView.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_DynRankView.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_DynRankView_Impl.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_DynamicView.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_ErrorReporter.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_Functional.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_OffsetView.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_ScatterView.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_ScatterView_Impl.cppm delete mode 100644 packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp create mode 100644 packages/kokkos/containers/src/Kokkos_UnorderedMap.cppm create mode 100644 packages/kokkos/containers/src/Kokkos_UnorderedMap_Impl.cppm delete mode 100644 packages/kokkos/containers/src/Kokkos_Vector.hpp delete mode 100644 packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp delete mode 100644 packages/kokkos/containers/unit_tests/Makefile delete mode 100644 packages/kokkos/containers/unit_tests/TestDualViewParameterPack.cpp create mode 100644 packages/kokkos/containers/unit_tests/TestDynRankView_Ctors.hpp create mode 100644 packages/kokkos/containers/unit_tests/TestDynRankView_LayoutMember.hpp delete mode 100644 packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp delete mode 100644 packages/kokkos/containers/unit_tests/TestVector.hpp delete mode 100644 packages/kokkos/core/perf_test/Makefile delete mode 100644 packages/kokkos/core/perf_test/PerfTestDriver.hpp delete mode 100644 packages/kokkos/core/perf_test/PerfTestMDRange.hpp create mode 100644 packages/kokkos/core/perf_test/PerfTestMDRange_Stencil.cpp create mode 100644 packages/kokkos/core/perf_test/PerfTestMDRange_Stream.cpp create mode 100644 packages/kokkos/core/perf_test/PerfTestMDRange_Stream.hpp create mode 100644 packages/kokkos/core/perf_test/PerfTest_Gemv.cpp create mode 100644 packages/kokkos/core/perf_test/PerfTest_Stream.cpp create mode 100644 packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_DeepCopy.cpp create mode 100644 packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_Initialize.cpp create mode 100644 packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_ParallelFor.cpp delete mode 100755 packages/kokkos/core/perf_test/run_taskdag.sh delete mode 100644 packages/kokkos/core/perf_test/test_taskdag.cpp delete mode 100644 packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp delete mode 100644 packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp create mode 100644 packages/kokkos/core/src/HIP/Kokkos_HIP_Error.cpp create mode 100644 packages/kokkos/core/src/HIP/Kokkos_HIP_Half_MathematicalFunctions.hpp delete mode 100644 packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp delete mode 100644 packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp create mode 100644 packages/kokkos/core/src/Kokkos_Core.cppm create mode 100644 packages/kokkos/core/src/Kokkos_Core_Impl.cppm delete mode 100644 packages/kokkos/core/src/Kokkos_Future.hpp delete mode 100644 packages/kokkos/core/src/Kokkos_PointerOwnership.hpp delete mode 100644 packages/kokkos/core/src/Kokkos_TaskScheduler.hpp delete mode 100644 packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon.cpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSiliconSpace.cpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSiliconSpace.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_Abort.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_Instance.cpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_Instance.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_Printf.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_SharedAllocationRecord.cpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_SharedAllocationRecord.hpp create mode 100644 packages/kokkos/core/src/NextSilicon/Kokkos_NextSilicon_ZeroMemset.hpp delete mode 100644 packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp delete mode 100644 packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp create mode 100644 packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_ZeroMemset.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_DeepCopy.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_FunctorAdapter.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Macros.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelFor_MDRange.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelFor_Range.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelFor_Team.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelReduce_MDRange.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelReduce_Range.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelReduce_Team.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelScan_Range.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelScan_Team.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_Common.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Reducer.hpp delete mode 100644 packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp delete mode 100644 packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp delete mode 100644 packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp create mode 100644 packages/kokkos/core/src/Threads/Kokkos_Threads_ZeroMemset.hpp create mode 100644 packages/kokkos/core/src/decl/Kokkos_Declare_NEXTSILICON.hpp delete mode 100644 packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp create mode 100644 packages/kokkos/core/src/fwd/Kokkos_Fwd_NEXTSILICON.hpp delete mode 100644 packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_BuiltinReducers.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_CStyleMemoryManagement.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_CheckUsage.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_DeviceHandle.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_GraphNodeCtorProps.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_GraphNodeThenPolicy.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_Half_ReductionIdentity.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_HostSpace_ZeroMemset.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_InitializeFinalize.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_LIFO.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_PartitionSpace.hpp create mode 100644 packages/kokkos/core/src/impl/Kokkos_ScopeGuard.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp delete mode 100644 packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp create mode 100644 packages/kokkos/core/src/traits/Kokkos_StaticBatchSizeTrait.hpp create mode 100644 packages/kokkos/core/src/traits/Kokkos_TeamHandleTrait.hpp delete mode 100644 packages/kokkos/core/unit_test/Makefile create mode 100644 packages/kokkos/core/unit_test/TestAtomicOperations_int16.hpp create mode 100644 packages/kokkos/core/unit_test/TestAtomicOperations_int8.hpp create mode 100644 packages/kokkos/core/unit_test/TestCustomScalarParallelScan.hpp create mode 100644 packages/kokkos/core/unit_test/TestDeepCopy.hpp create mode 100644 packages/kokkos/core/unit_test/TestDeepCopy_Assignment.hpp create mode 100644 packages/kokkos/core/unit_test/TestDeepCopy_Narrowing.hpp create mode 100644 packages/kokkos/core/unit_test/TestDeepCopy_SameArgument.hpp create mode 100644 packages/kokkos/core/unit_test/TestGraphNodeCtorProps.hpp create mode 100644 packages/kokkos/core/unit_test/TestSubView_c16.hpp delete mode 100644 packages/kokkos/core/unit_test/TestTaskScheduler.hpp delete mode 100644 packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp create mode 100644 packages/kokkos/core/unit_test/TestTimer.hpp create mode 100644 packages/kokkos/core/unit_test/TestViewMove.hpp delete mode 100644 packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp delete mode 100644 packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt delete mode 100644 packages/kokkos/core/unit_test/configuration/test-code/Makefile delete mode 100644 packages/kokkos/core/unit_test/configuration/test-code/main.cpp delete mode 100755 packages/kokkos/core/unit_test/configuration/test-code/test_config.bash delete mode 100755 packages/kokkos/core/unit_test/configuration/test-code/test_config_arch_list.bash delete mode 100755 packages/kokkos/core/unit_test/configuration/test-code/test_config_device_list.bash delete mode 100755 packages/kokkos/core/unit_test/configuration/test-code/test_config_options_list.bash delete mode 100755 packages/kokkos/core/unit_test/configuration/test-code/test_config_run.bash create mode 100644 packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_GraphMultiGPU.cpp delete mode 100644 packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp delete mode 100644 packages/kokkos/core/unit_test/hpx/TestHPX_InParallel.cpp delete mode 100644 packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp delete mode 100644 packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp create mode 100644 packages/kokkos/core/unit_test/range_policy/TestRangePolicyExecutionTypes.hpp delete mode 100644 packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp delete mode 100644 packages/kokkos/core/unit_test/standalone/Makefile delete mode 100644 packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp create mode 100644 packages/kokkos/core/unit_test/tools/TestEmptyProfilingLibrary.cpp create mode 100644 packages/kokkos/core/unit_test/tools/empty-tool.cpp create mode 100644 packages/kokkos/core/unit_test/view/TestAllocationAndSpanSize.hpp create mode 100644 packages/kokkos/core/unit_test/view/TestConversionFromPointer.cpp create mode 100644 packages/kokkos/core/unit_test/view/TestLegacyLayoutFunction.hpp create mode 100644 packages/kokkos/core/unit_test/view/TestMemoryTraitTypes.cpp create mode 100644 packages/kokkos/core/unit_test/view/TestViewCtorDataHandle.hpp create mode 100644 packages/kokkos/core/unit_test/view/TestViewEqualityOperator.hpp delete mode 100644 packages/kokkos/doc/Doxyfile delete mode 100644 packages/kokkos/doc/README.md delete mode 100644 packages/kokkos/doc/SAND2017-10464-Kokkos-Task-DAG.pdf delete mode 100755 packages/kokkos/doc/build_docs delete mode 100644 packages/kokkos/doc/design_notes_space_instances.md delete mode 100644 packages/kokkos/doc/index.doc create mode 100644 packages/kokkos/docs/CODE_OF_CONDUCT.md create mode 100644 packages/kokkos/docs/CONTRIBUTING.md rename packages/kokkos/{ => docs}/SECURITY.md (100%) rename packages/kokkos/{doc => docs}/TuningDesign.md (100%) delete mode 100644 packages/kokkos/example/README delete mode 100644 packages/kokkos/example/make_buildlink/Makefile delete mode 100644 packages/kokkos/example/make_buildlink/README delete mode 100644 packages/kokkos/example/make_buildlink/main.cpp delete mode 100644 packages/kokkos/example/query_device/Makefile delete mode 100644 packages/kokkos/example/relocatable_function/Makefile delete mode 100644 packages/kokkos/example/tutorial/01_hello_world/Makefile delete mode 100644 packages/kokkos/example/tutorial/01_hello_world_lambda/Makefile delete mode 100644 packages/kokkos/example/tutorial/02_simple_reduce/Makefile delete mode 100644 packages/kokkos/example/tutorial/02_simple_reduce_lambda/Makefile delete mode 100644 packages/kokkos/example/tutorial/03_simple_view/Makefile delete mode 100644 packages/kokkos/example/tutorial/03_simple_view_lambda/Makefile delete mode 100644 packages/kokkos/example/tutorial/04_simple_memoryspaces/Makefile delete mode 100644 packages/kokkos/example/tutorial/05_simple_atomics/Makefile delete mode 100644 packages/kokkos/example/tutorial/06_simple_mdrangepolicy/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/03_subviews/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/CMakeLists.txt delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/06_AtomicViews/Makefile create mode 100644 packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/CMakeLists.txt delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/Makefile delete mode 100644 packages/kokkos/example/tutorial/Advanced_Views/Makefile delete mode 100644 packages/kokkos/example/tutorial/Algorithms/01_random_numbers/Makefile delete mode 100644 packages/kokkos/example/tutorial/Algorithms/Makefile create mode 100644 packages/kokkos/example/tutorial/Debugging/01_ErrorReporter/CMakeLists.txt create mode 100644 packages/kokkos/example/tutorial/Debugging/01_ErrorReporter/error_reporter.cpp create mode 100644 packages/kokkos/example/tutorial/Debugging/CMakeLists.txt delete mode 100644 packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/Makefile delete mode 100644 packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/Makefile delete mode 100644 packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/Makefile delete mode 100644 packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/Makefile delete mode 100644 packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/Makefile delete mode 100644 packages/kokkos/example/tutorial/Hierarchical_Parallelism/Makefile delete mode 100644 packages/kokkos/example/tutorial/Makefile delete mode 100644 packages/kokkos/example/tutorial/README delete mode 100644 packages/kokkos/example/tutorial/launch_bounds/Makefile create mode 100644 packages/kokkos/example/virtual_functions/CMakeLists.txt delete mode 100644 packages/kokkos/example/virtual_functions/Makefile delete mode 100755 packages/kokkos/generate_makefile.bash delete mode 100755 packages/kokkos/gnu_generate_makefile.bash delete mode 100644 packages/kokkos/master_history.txt delete mode 100755 packages/kokkos/scripts/check-copyright delete mode 100644 packages/kokkos/scripts/docker/Dockerfile.clang delete mode 100644 packages/kokkos/scripts/docker/Dockerfile.openmptarget delete mode 100755 packages/kokkos/scripts/docker/check_format_cpp.sh create mode 100644 packages/kokkos/scripts/docker/snl-ci-dockerfiles/cuda-12.2.2_openblas-0.3.29_x86-64.dockerfile create mode 100644 packages/kokkos/scripts/docker/snl-ci-dockerfiles/cuda-12.2.2_openblas-0.3.29_x86-64.yaml create mode 100644 packages/kokkos/scripts/docker/snl-ci-dockerfiles/intel-oneapi-basekit-2024.2.1-0-devel-ubuntu22.04.dockerfile create mode 100644 packages/kokkos/scripts/docker/snl-ci-dockerfiles/rocm-6.2.1_openblas-0.3.28_zen3_gfx90a.dockerfile create mode 100644 packages/kokkos/scripts/docker/snl-ci-dockerfiles/rocm-6.2.1_openblas-0.3.28_zen3_gfx90a.yaml create mode 100644 packages/kokkos/scripts/license_header.txt delete mode 100644 packages/kokkos/scripts/testing_scripts/README delete mode 100644 packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp delete mode 100755 packages/kokkos/scripts/testing_scripts/cpy_test delete mode 100755 packages/kokkos/scripts/testing_scripts/obj_size_opt_check delete mode 100755 packages/kokkos/scripts/testing_scripts/test_all_sandia create mode 100644 packages/kokkos/simd/perf_tests/.clang-tidy create mode 100644 packages/kokkos/simd/perf_tests/BenchmarkMain.cpp create mode 100644 packages/kokkos/simd/perf_tests/CMakeLists.txt create mode 100644 packages/kokkos/simd/perf_tests/include/Common.hpp create mode 100644 packages/kokkos/simd/perf_tests/include/PerfTest_Device.hpp create mode 100644 packages/kokkos/simd/perf_tests/include/PerfTest_Host.hpp create mode 100644 packages/kokkos/simd/perf_tests/include/PerfTest_Operators.hpp create mode 100644 packages/kokkos/simd/src/Kokkos_SIMD.cppm create mode 100644 packages/kokkos/simd/src/Kokkos_SIMD_Impl.cppm create mode 100644 packages/kokkos/simd/src/impl/Kokkos_SIMD_Impl_Macros.hpp create mode 100644 packages/kokkos/simd/src/impl/Kokkos_SIMD_RangesCtorSupport.hpp create mode 100644 packages/kokkos/simd/unit_tests/include/TestSIMD_ArithmeticOps.hpp create mode 100644 packages/kokkos/simd/unit_tests/include/TestSIMD_BitwiseOps.hpp create mode 100644 packages/kokkos/simd/unit_tests/include/TestSIMD_ComparisonOps.hpp create mode 100644 packages/kokkos/simd/unit_tests/include/TestSIMD_LoadStore.hpp create mode 100644 packages/kokkos/simd/unit_tests/include/TestSIMD_MemoryPermute.hpp delete mode 100644 packages/kokkos/simd/unit_tests/include/TestSIMD_WhereExpressions.hpp create mode 100644 packages/kokkos/tpls/desul-hash.txt create mode 100644 packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc9_asm_exchange.inc create mode 100644 packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc9_asm_exchange_memorder.inc create mode 100644 packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc9_asm_exchange_op.inc create mode 100644 packages/kokkos/tpls/gtest/CMakeLists.txt create mode 100644 packages/kokkos/tpls/mdspan-hash.txt diff --git a/packages/kokkos/.clang-tidy b/packages/kokkos/.clang-tidy index 7207a89317b9..2b8b1a718fad 100644 --- a/packages/kokkos/.clang-tidy +++ b/packages/kokkos/.clang-tidy @@ -3,14 +3,27 @@ Checks: > bugprone-*, -bugprone-argument-comment, -bugprone-easily-swappable-parameters, + -bugprone-exception-escape, -bugprone-macro-parentheses, -bugprone-narrowing-conversions, + -bugprone-random-generator-seed, -bugprone-suspicious-include, + -bugprone-throwing-static-initialization, cppcoreguidelines-pro-type-cstyle-cast, + cppcoreguidelines-rvalue-reference-param-not-moved, + cppcoreguidelines-special-member-functions, modernize-type-traits, modernize-use-nullptr, modernize-use-using, kokkos-* +CheckOptions: + - key: cppcoreguidelines-rvalue-reference-param-not-moved.AllowPartialMove + value: true + - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctionsWhenCopyIsDeleted + value: true + - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor + value: true + FormatStyle: file HeaderFilterRegex: '(algorithms|benchmarks|containers|core|example|simd).*\.hpp' diff --git a/packages/kokkos/.jenkins/continuous.groovy b/packages/kokkos/.jenkins/continuous.groovy index 12e43058aa7a..14b3e6e4ee99 100644 --- a/packages/kokkos/.jenkins/continuous.groovy +++ b/packages/kokkos/.jenkins/continuous.groovy @@ -5,6 +5,7 @@ pipeline { CCACHE_DIR = '/tmp/ccache' CCACHE_MAXSIZE = '5G' CCACHE_CPP2 = 'true' + GTEST_SHUFFLE = 1 } options { @@ -17,17 +18,19 @@ pipeline { } stages { - stage('Clang-Format') { + stage('Pre-Commit') { agent { - dockerfile { - filename 'Dockerfile.clang' - dir 'scripts/docker' + docker { + image 'jfxs/pre-commit:4.4.0-002@sha256:40078d585cc17c502d8c2390b8d57e7ecb028d75dcc821f2f75ac8e9c485bf84' label 'nvidia-docker || docker' - args '-v /tmp/ccache.kokkos:/tmp/ccache' + args '--env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } steps { - sh './scripts/docker/check_format_cpp.sh' + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + pre-commit run --all-files''' } } stage('Build-1') { @@ -37,11 +40,16 @@ pipeline { dockerfile { filename 'Dockerfile.modules' dir 'scripts/docker' - label 'docker' + label 'nvidia-docker || docker' + args '--env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } steps { - sh '''rm -rf build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && \ + set -x && \ cmake \ -B build \ -GNinja \ @@ -51,12 +59,24 @@ pipeline { -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_EXPERIMENTAL_CXX20_MODULES=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=OFF \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_EXAMPLES=ON \ -DKokkos_ENABLE_SERIAL=ON && \ + set +x && \ cmake --build build --target install -j 8 && \ - ctest --test-dir build --no-compress-output -T Test --verbose''' + ctest --test-dir build --no-compress-output -T Test --verbose && \ + cd example/build_cmake_installed_modules && \ + rm -rf build && \ + set -x && \ + cmake \ + -B build \ + -GNinja \ + -DCMAKE_CXX_COMPILER=clang++-19 \ + -DCMAKE_CXX_FLAGS="-Werror" && \ + set +x && \ + cmake --build build -j 8 && \ + ctest --test-dir build --verbose''' } post { always { @@ -64,12 +84,13 @@ pipeline { } } } - stage('GCC-8.4.0') { + stage('GCC-10.5.0') { agent { dockerfile { filename 'Dockerfile.gcc' dir 'scripts/docker' - label 'docker' + label 'nvidia-docker || docker' + args '--env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } environment { @@ -79,21 +100,26 @@ pipeline { OMP_PROC_BIND = 'true' } steps { - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_FLAGS=-Werror \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=ON \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_OPENMP=ON \ -DKokkos_ENABLE_LIBDL=OFF \ -DKokkos_ENABLE_LIBQUADMATH=ON \ -DKokkos_ENABLE_SERIAL=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose && gcc -I$PWD/../core/src/ ../core/unit_test/tools/TestCInterface.c''' } post { @@ -102,19 +128,23 @@ pipeline { } } } - stage('HIP-ROCm-5.7-CXX20') { + stage('HIP-ROCm-6.2-CXX20') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-22.04:5.7.1-complete@sha256:fc6abb843a4cb2b3e5d8e9225ed0db1450e063dbcc347f44b43252264134485d' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-22.04:6.2.4-complete@sha256:6604a97283a218fc62ab59e23c54ec34ad634be9201b001435844a59ba1b8eb5' label 'rocm-docker' - args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } steps { sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -124,11 +154,27 @@ pipeline { -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=ON \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_HIP=ON \ + -DKokkos_ENABLE_ROCTHRUST=OFF \ + -DKokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES=ON \ + -DCMAKE_INSTALL_PREFIX=${PWD}/../install \ .. && \ - make -j16 && ctest --no-compress-output -T Test --verbose''' + set +x && \ + make -j16 install && ctest --no-compress-output -T Test --verbose && \ + cd .. && \ + export CMAKE_PREFIX_PATH=${PWD}/install && \ + cd example/build_cmake_installed_multilanguage && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ + cmake \ + -DCMAKE_CXX_COMPILER=hipcc \ + -DCMAKE_CXX_FLAGS=-Werror \ + -DCMAKE_CXX_STANDARD=20 \ + .. && \ + set +x && \ + make -j8 && ctest --verbose''' } post { always { @@ -137,69 +183,90 @@ pipeline { } } } - stage('CUDA-11.0-NVCC-RDC') { + + stage('CUDA-12.2-NVCC-RDC') { agent { dockerfile { filename 'Dockerfile.nvcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:11.0.3-devel-ubuntu20.04@sha256:10ab0f09fcdc796b4a2325ef1bce8f766f4a3500eab5a83780f80475ae26c7a6 --build-arg ADDITIONAL_PACKAGES="g++-8 gfortran clang" --build-arg CMAKE_VERSION=3.17.3' + additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:12.2.2-devel-ubuntu22.04@sha256:5f603101462baa721ff6ddc44af82f6e9ba7cbd92a424c9f9f348e6e9d6d64c3 --build-arg ADDITIONAL_PACKAGES="gfortran clang" --build-arg CMAKE_VERSION=3.25.3' label 'nvidia-docker && (volta || ampere)' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } environment { + CTEST_OUTPUT_ON_FAILURE = 1 OMP_NUM_THREADS = 8 // Nested OpenMP does not work for this configuration, // so disabling it OMP_MAX_ACTIVE_LEVELS = 1 OMP_PLACES = 'threads' OMP_PROC_BIND = 'spread' - NVCC_WRAPPER_DEFAULT_COMPILER = 'g++-8' + NVCC_WRAPPER_DEFAULT_COMPILER = 'g++-11' } steps { sh 'ccache --zero-stats' - sh '''rm -rf install && mkdir -p install && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf install && mkdir -p install && \ rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_COMPILER=g++-8 \ + -DCMAKE_CXX_COMPILER=g++-11 \ -DCMAKE_CXX_FLAGS=-Werror \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_OPENMP=OFF \ -DKokkos_ENABLE_CUDA=ON \ - -DKokkos_ENABLE_CUDA_LAMBDA=OFF \ - -DKokkos_ENABLE_CUDA_UVM=ON \ -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=ON \ + -DKokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES=ON \ \ -DCMAKE_INSTALL_PREFIX=${PWD}/../install \ .. && \ + set +x && \ make -j8 install && \ cd .. && \ rm -rf build-tests && mkdir -p build-tests && cd build-tests && \ export CMAKE_PREFIX_PATH=${PWD}/../install && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=$WORKSPACE/bin/nvcc_wrapper \ -DCMAKE_CXX_FLAGS="-Werror --Werror=all-warnings -Xcudafe --diag_suppress=940" \ -DCMAKE_EXE_LINKER_FLAGS="-Xnvlink -suppress-stack-size-warning" \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_INSTALL_TESTING=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose && \ cd ../example/build_cmake_installed && \ rm -rf build && mkdir -p build && cd build && \ + set -x && \ + cmake \ + -DCMAKE_CXX_COMPILER=g++-11 \ + -DCMAKE_CXX_FLAGS=-Werror \ + -DCMAKE_CXX_STANDARD=20 \ + .. && \ + set +x && \ + make -j8 && ctest --verbose && \ + cd ../../build_cmake_installed_multilanguage && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ - -DCMAKE_CXX_COMPILER=g++-8 \ + -DCMAKE_CXX_COMPILER=g++-11 \ -DCMAKE_CXX_FLAGS=-Werror \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ .. && \ + set +x && \ make -j8 && ctest --verbose && \ cd ../.. && \ - cmake -B build_cmake_installed_different_compiler/build -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_CXX_STANDARD=17 build_cmake_installed_different_compiler && \ + cmake -B build_cmake_installed_different_compiler/build -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_CXX_STANDARD=20 build_cmake_installed_different_compiler && \ cmake --build build_cmake_installed_different_compiler/build --target all && \ cmake --build build_cmake_installed_different_compiler/build --target test''' } @@ -210,6 +277,7 @@ pipeline { } } } + } } stage('Build-2') { @@ -220,17 +288,21 @@ pipeline { filename 'Dockerfile.nvhpc' dir 'scripts/docker' label 'nvidia-docker && volta && large_images' - args '--env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' + args '--env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } environment { NVHPC_CUDA_HOME = '/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/cuda/12.2' } steps { - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ /opt/cmake/bin/cmake \ -DCMAKE_CXX_COMPILER=nvc++ \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_FLAGS=-Werror \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ @@ -238,6 +310,7 @@ pipeline { -DKokkos_ENABLE_OPENACC=ON \ -DKokkos_ARCH_VOLTA70=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose''' } post { @@ -253,7 +326,7 @@ pipeline { filename 'Dockerfile.nvhpc' dir 'scripts/docker' label 'nvidia-docker && large_images && volta' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } environment { @@ -266,19 +339,25 @@ pipeline { NVHPC_CUDA_HOME = '/opt/nvidia/hpc_sdk/Linux_x86_64/23.7/cuda/12.2' } steps { - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ /opt/cmake/bin/cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_COMPILER=nvc++ \ - -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_CXX_FLAGS="-Werror --diag_suppress=implicit_return_from_non_void_function" \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_CXX_FLAGS="-Werror -Werror=all-warnings --diag_suppress=implicit_return_from_non_void_function" \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=OFF \ -DKokkos_ENABLE_TESTS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_OPENMP=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose''' } post { @@ -294,12 +373,16 @@ pipeline { filename 'Dockerfile.sycl' dir 'scripts/docker' label 'nvidia-docker && ampere' - args '-v /tmp/ccache.kokkos:/tmp/ccache' + args '-v /tmp/ccache.kokkos:/tmp/ccache --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } steps { sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ @@ -309,15 +392,16 @@ pipeline { -DKokkos_ARCH_AMPERE80=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=OFF \ -DKokkos_ENABLE_EXAMPLES=ON \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ - -DoneDPL_ROOT=/opt/intel/oneapi/dpl/2022.7 \ + -DoneDPL_ROOT=/opt/intel/oneapi/dpl/2022.9 \ -DKokkos_ENABLE_SYCL=ON \ -DKokkos_ENABLE_SYCL_RELOCATABLE_DEVICE_CODE=ON \ -DKokkos_ENABLE_UNSUPPORTED_ARCHS=ON \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose''' } post { @@ -327,14 +411,14 @@ pipeline { } } } - stage('HIP-ROCm-5.3') { + stage('HIP-ROCm-6.3') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.3.3-complete@sha256:bac114b9d09e61d88b45fbeb40a15a315c2a78a203223c9b4ed7263b05ff3977' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-24.04:6.3.4-complete@sha256:76e99e263ef6ce69ba5d32905623c801fff3f85a6108e931820f6eb1d13eac67' label 'rocm-docker ' - args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } environment { @@ -346,22 +430,27 @@ pipeline { steps { sh 'ccache --zero-stats' sh 'echo "/opt/rocm/llvm/lib" > /etc/ld.so.conf.d/llvm.conf && ldconfig' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_COMPILER=hipcc \ -DCMAKE_CXX_FLAGS="-Werror -Wno-unused-command-line-argument -DNDEBUG" \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=OFF \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_HIP=ON \ -DKokkos_ENABLE_OPENMP=ON \ -DKokkos_ENABLE_IMPL_MDSPAN=OFF \ -DKokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS=ON \ .. && \ + set +x && \ make -j16 && ctest --no-compress-output -T Test --verbose''' } post { @@ -378,16 +467,20 @@ pipeline { dir 'scripts/docker' additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-24.04:6.2-complete@sha256:c7049ac3ae8516c7b230deec6dc6dd678a0b3f7215d5a7f7fe2f2b71880b62f8 --build-arg ADDITIONAL_PACKAGES="clang-tidy"' label 'rocm-docker' - args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } environment { - // FIXME Test returns a wrong value + // FIXME hip_hostpinned.view_allocation_large_rank test returns a wrong value GTEST_FILTER = '-hip_hostpinned.view_allocation_large_rank' } steps { sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -399,10 +492,11 @@ pipeline { -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=ON \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_HIP=ON \ .. && \ + set +x && \ make -j16 && ctest --no-compress-output -T Test --verbose''' } post { @@ -412,101 +506,23 @@ pipeline { } } } -/* - stage('OPENMPTARGET-ROCm-5.2') { - agent { - dockerfile { - filename 'Dockerfile.hipcc' - dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2' - label 'rocm-docker && vega && AMD_Radeon_Instinct_MI60' - args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' - } - } - environment { - OMP_NUM_THREADS = 8 - OMP_MAX_ACTIVE_LEVELS = 3 - OMP_PLACES = 'threads' - OMP_PROC_BIND = 'spread' - LC_ALL = 'C' - } - steps { - sh 'ccache --zero-stats' - sh 'echo "/opt/rocm/llvm/lib" > /etc/ld.so.conf.d/llvm.conf && ldconfig' - sh '''rm -rf build && \ - cmake \ - -Bbuild \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_CXX_COMPILER=amdclang++ \ - -DCMAKE_CXX_STANDARD=17 \ - -DKokkos_ARCH_NATIVE=ON \ - -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ - -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ - -DKokkos_ENABLE_OPENMPTARGET=ON \ - -DKokkos_ENABLE_OPENMP=ON \ - -DKokkos_ARCH_AMD_GFX906=ON \ - && \ - cmake --build build --parallel ${BUILD_JOBS} && \ - cd build && ctest --no-compress-output -T Test --output-on-failure - ''' - } - post { - always { - sh 'ccache --show-stats' - } - } - } -*/ - stage('OPENMPTARGET-Clang') { - agent { - dockerfile { - filename 'Dockerfile.openmptarget' - dir 'scripts/docker' - label 'nvidia-docker && volta' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' - } - } - steps { - sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ - cmake \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_CXX_FLAGS="-Wno-unknown-cuda-version -Werror -Wno-undefined-internal -Wno-pass-failed" \ - -DKokkos_ARCH_NATIVE=ON \ - -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ - -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ - -DKokkos_ENABLE_TUNING=ON \ - -DKokkos_ENABLE_OPENMPTARGET=ON \ - -DKokkos_ARCH_VOLTA70=ON \ - -DCMAKE_CXX_STANDARD=17 \ - .. && \ - make -j8 && ctest --no-compress-output -T Test --verbose''' - } - post { - always { - sh 'ccache --show-stats' - xunit([CTest(deleteOutputFiles: true, failIfNotNew: true, pattern: 'build/Testing/**/Test.xml', skipNoTestFiles: false, stopProcessingIfError: true)]) - } - } - } stage('CUDA-11.8-Clang-15') { agent { dockerfile { filename 'Dockerfile.nvcc' dir 'scripts/docker' label 'nvidia-docker && volta' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:11.8.0-devel-ubuntu22.04 --build-arg ADDITIONAL_PACKAGES="clang-15 clang-tidy-15"' } } steps { sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ @@ -517,12 +533,13 @@ pipeline { -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=ON \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_TUNING=ON \ -DKokkos_ARCH_VOLTA70=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose''' } post { @@ -538,13 +555,17 @@ pipeline { filename 'Dockerfile.nvcc' dir 'scripts/docker' label 'nvidia-docker && volta' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' + args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:12.5.1-devel-ubuntu24.04 --build-arg ADDITIONAL_PACKAGES="clang-17 clang-tidy-17"' } } steps { sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ @@ -555,13 +576,14 @@ pipeline { -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=ON \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON \ -DKokkos_ENABLE_TUNING=ON \ -DKokkos_ARCH_VOLTA70=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose''' } post { @@ -571,43 +593,50 @@ pipeline { } } } - stage('CUDA-11.6-NVCC-DEBUG') { + stage('CUDA-13.0-NVCC-DEBUG') { agent { dockerfile { filename 'Dockerfile.nvcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:11.6.2-devel-ubuntu20.04@sha256:d95d54bc231f8aea7fda79f60da620324584b20ed31a8ebdb0686cffd34dd405' - label 'nvidia-docker && (volta || ampere)' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' + additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:13.0.0-devel-ubuntu24.04@sha256:435220c0fef35cbf712e11999f8670a83835ef3cdd18564e5e8122f83078c88c --build-arg CMAKE_VERSION=3.22.6' + label 'nvidia-docker && ampere && cuda-13-driver' + args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES --env NODE_NAME=${env.NODE_NAME} --env STAGE_NAME=${env.STAGE_NAME}' } } + environment { + KOKKOS_NUM_THREADS = 8 + } steps { sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ + sh '''#!/bin/bash + exec > >(awk '{ print "[" ENVIRON["STAGE_NAME"] "]", $0 }') 2>&1 && \ + echo "Hostname: ${NODE_NAME}" && \ + rm -rf build && mkdir -p build && cd build && \ + set -x && \ cmake \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=$WORKSPACE/bin/nvcc_wrapper \ -DCMAKE_CXX_FLAGS="-Werror -Werror=all-warnings" \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEBUG=ON \ -DKokkos_ENABLE_DEBUG_BOUNDS_CHECK=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_5=OFF \ -DKokkos_ENABLE_TESTS=ON \ - -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_LIBDL=OFF \ - -DKokkos_ENABLE_OPENMP=ON \ - -DKokkos_ENABLE_IMPL_MDSPAN=OFF \ + -DKokkos_ENABLE_THREADS=ON \ -DKokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC=ON \ .. && \ + set +x && \ make -j8 && ctest --no-compress-output -T Test --verbose && \ cd ../example/build_cmake_in_tree && \ rm -rf build && mkdir -p build && cd build && \ - cmake -DCMAKE_CXX_STANDARD=17 .. && make -j8 && ctest --verbose''' + set -x && cmake -DCMAKE_CXX_STANDARD=20 .. && set +x && make -j8 && ctest --verbose''' } post { always { @@ -616,35 +645,6 @@ pipeline { } } } - stage('CUDA-11.7-NVCC') { - agent { - dockerfile { - filename 'Dockerfile.nvcc' - dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/cuda:11.7.1-devel-ubuntu20.04@sha256:fc997521e612899a01dce92820f5f5a201dd943ebfdc3e49ba0706d491a39d2d' - label 'nvidia-docker && volta' - args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' - } - } - steps { - sh 'ccache --zero-stats' - sh '''rm -rf build && mkdir -p build && cd build && \ - ../gnu_generate_makefile.bash \ - --with-options=compiler_warnings \ - --cxxflags="-Werror -Werror=all-warnings" \ - --cxxstandard=c++17 \ - --with-cuda \ - --with-cuda-options=enable_lambda \ - --arch=Volta70 \ - && \ - make test -j8''' - } - post { - always { - sh 'ccache --show-stats' - } - } - } } } } diff --git a/packages/kokkos/.jenkins/nightly.groovy b/packages/kokkos/.jenkins/nightly.groovy index 1910ddf3c5eb..610a5ce397d2 100644 --- a/packages/kokkos/.jenkins/nightly.groovy +++ b/packages/kokkos/.jenkins/nightly.groovy @@ -35,18 +35,18 @@ pipeline { rm -rf spack && \ git clone https://github.com/spack/spack.git && \ . ./spack/share/spack/setup-env.sh && \ - spack install --only=dependencies kokkos@develop+tests && \ - spack install --only=package ${CDASH_ARGS} kokkos@develop+tests && \ + spack install -v --only=dependencies kokkos@develop+tests && \ + spack install -v --only=package ${CDASH_ARGS} kokkos@develop+tests cxxstd=20 && \ spack load cmake && \ spack test run ${CDASH_ARGS} kokkos && \ spack test results -l ''' - } - } + } + } stage('spack-cuda') { agent { docker { - image 'nvidia/cuda:12.1.0-devel-ubuntu22.04' + image 'nvidia/cuda:12.9.0-devel-ubuntu24.04' label 'nvidia-docker && ampere' } } @@ -67,8 +67,8 @@ pipeline { rm -rf spack && \ git clone https://github.com/spack/spack.git && \ . ./spack/share/spack/setup-env.sh && \ - spack install --only=dependencies kokkos@develop+cuda+wrapper+tests cuda_arch=80 ^cuda@12.1.0 && \ - spack install --only=package ${CDASH_ARGS} kokkos@develop+cuda+wrapper+tests cuda_arch=80 ^cuda@12.1.0 && \ + spack install -v --only=dependencies kokkos@develop+cuda+wrapper+tests cuda_arch=80 ^cuda@12.9.0 && \ + spack install -v --only=package ${CDASH_ARGS} kokkos@develop+cuda+wrapper+tests cuda_arch=80 ^cuda@12.9.0 && \ spack load cmake && \ spack load kokkos-nvcc-wrapper && \ spack load cuda && \ @@ -76,8 +76,8 @@ pipeline { spack test run ${CDASH_ARGS} kokkos && \ spack test results -l ''' - } - } + } + } stage('GCC-15-CXX26') { agent { docker { @@ -101,6 +101,7 @@ pipeline { export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_EXAMPLES=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_TESTS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_DEPRECATED_CODE_4=ON" && \ + export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_DEPRECATED_CODE_5=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_SERIAL=ON" && \ ctest -VV -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="ornl-jenkins" -D CTEST_BUILD_NAME="GCC-15-CXX26" ''' @@ -111,20 +112,16 @@ pipeline { } } } - stage('HIP-ROCM-6.4-MI100-RDC-CXX20') { + stage('HIP-ROCM-7.0-MI100-RDC-CXX20') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-24.04:6.4.1-complete' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-24.04:7.0-complete' label 'rocm-docker && AMD_Radeon_Instinct_MI100' args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' } } - environment { - // FIXME Test returns a wrong value - GTEST_FILTER = '-hip_hostpinned.view_allocation_large_rank' - } steps { sh 'ccache --zero-stats' sh '''export CMAKE_BUILD_PARALLEL_LEVEL=16 && \ @@ -133,15 +130,17 @@ pipeline { export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_COMPILER=hipcc" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_STANDARD=20" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_FLAGS='-Werror -Wno-unused-command-line-argument'" && \ + export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_PREFIX_PATH='/opt/rocm'" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ARCH_NATIVE=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_COMPILER_WARNINGS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_DEPRECATED_CODE_4=ON" && \ + export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_DEPRECATED_CODE_5=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_TESTS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_BENCHMARKS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_EXAMPLES=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_HIP=ON" && \ - ctest -VV -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="ornl-jenkins" -D CTEST_BUILD_NAME="HIP-ROCM-6.4-MI100-RDC-CXX20" + ctest -VV -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="ornl-jenkins" -D CTEST_BUILD_NAME="HIP-ROCM-7.0-MI100-RDC-CXX20" ''' } post { @@ -151,20 +150,16 @@ pipeline { } } } - stage('HIP-ROCM-6.4-MI210-CXX23') { + stage('HIP-ROCM-7.2-MI210-CXX23') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-24.04:6.4.1-complete --build-arg CMAKE_VERSION=3.31.3' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-24.04:7.2-complete --build-arg CMAKE_VERSION=3.31.3' label 'rocm-docker && AMD_Radeon_Instinct_MI210' args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' } } - environment { - // FIXME Test returns a wrong value - GTEST_FILTER = '-hip_hostpinned.view_allocation_large_rank' - } steps { sh 'ccache --zero-stats' sh '''export CMAKE_BUILD_PARALLEL_LEVEL=16 && \ @@ -173,14 +168,16 @@ pipeline { export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_COMPILER=hipcc" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_STANDARD=23" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_CXX_FLAGS='-Werror -Wno-unused-command-line-argument'" && \ + export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DCMAKE_PREFIX_PATH='/opt/rocm'" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ARCH_NATIVE=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_COMPILER_WARNINGS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_DEPRECATED_CODE_4=ON" && \ + export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_DEPRECATED_CODE_5=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_TESTS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_BENCHMARKS=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_EXAMPLES=ON" && \ export ENV_CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS};-DKokkos_ENABLE_HIP=ON" && \ - ctest -VV -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="ornl-jenkins" -D CTEST_BUILD_NAME="HIP-ROCM-6.4-MI210-CXX23" + ctest -VV -D CDASH_MODEL="Nightly" -D CMAKE_OPTIONS="${ENV_CMAKE_OPTIONS}" -S scripts/CTestRun.cmake -D CTEST_SITE="ornl-jenkins" -D CTEST_BUILD_NAME="HIP-ROCM-7.0-MI210-CXX23" ''' } post { diff --git a/packages/kokkos/.mailmap b/packages/kokkos/.mailmap new file mode 100644 index 000000000000..006aa3714cda --- /dev/null +++ b/packages/kokkos/.mailmap @@ -0,0 +1,23 @@ +Damien Lebrun-Grandie +Damien Lebrun-Grandie +Damien Lebrun-Grandie +Damien Lebrun-Grandie +Christoph Junghans +Christoph Junghans +Christoph Junghans +Dan Ibanez +Dan Ibanez +Conrad Clevenger +Conrad Clevenger +Evan Harvey +Evan Harvey <57234914+e10harvey@users.noreply.github.com> +Jakob Bludau +Jakob Bludau +Jakob Bludau <104908666+JBludau@users.noreply.github.com> +Jeff Miles +Jeff Miles +Jeff Miles +Jonathan R. Madsen +Jonathan R. Madsen +Daniel Holladay +Daniel Holladay diff --git a/packages/kokkos/.pre-commit-config.yaml b/packages/kokkos/.pre-commit-config.yaml new file mode 100644 index 000000000000..4a7ddaa71c5a --- /dev/null +++ b/packages/kokkos/.pre-commit-config.yaml @@ -0,0 +1,44 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0 + hooks: + - id: check-case-conflict + - id: check-merge-conflict + - id: check-yaml + - id: end-of-file-fixer + exclude: '^tpls/' + - id: forbid-submodules + - id: trailing-whitespace + exclude: '^tpls/' + + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: 579d9fe3b1ee34ddd6ebc5def531f2f1acce622e # v16.0.0 + hooks: + - id: clang-format + + - repo: https://github.com/cheshirekow/cmake-format-precommit + rev: e2c2116d86a80e72e7146a06e68b7c228afc6319 # v0.6.13 + hooks: + - id: cmake-format + + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: a30f0d816e5062a67d87c8de753cfe499672b959 # v1.5.5 + hooks: + - id: insert-license + name: License and copyright headers in C++ files + args: + - --license-filepath + - scripts/license_header.txt + - --comment-style + - '//' + files: '\.(hh|hpp|cc|cpp|cppm|hip|cuh|cu)$' + exclude: '^tpls/' + - id: insert-license + name: License and copyright headers in C files + args: + - --license-filepath + - scripts/license_header.txt + - --comment-style + - '/*| *| */' + files: '\.[hc]$' + exclude: '^tpls/' diff --git a/packages/kokkos/CHANGELOG.md b/packages/kokkos/CHANGELOG.md index 526649fd25d5..efff91efa0bd 100644 --- a/packages/kokkos/CHANGELOG.md +++ b/packages/kokkos/CHANGELOG.md @@ -1,4 +1,220 @@ # CHANGELOG +## 5.1.0 + +[Full Changelog](https://github.com/kokkos/kokkos/compare/5.0.2...5.1.0) + +### Features: +* Export Kokkos type traits as C++20 concepts [\#8494](https://github.com/kokkos/kokkos/pull/8494) + +### Backend and Architecture Enhancements: + +#### CUDA: +* Added `Kokkos_ARCH_BLACKWELL103` configure option for NVIDIA B300 GPUs [\#8791](https://github.com/kokkos/kokkos/pull/8791) +* Fix compiling with Clang+Cuda+OpenMP with Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE=ON [\#8810](https://github.com/kokkos/kokkos/pull/8810) +* `nvcc_wrapper`: Add support for `-Ofc` and `--fdevice-time-trace` flags [\#8865](https://github.com/kokkos/kokkos/pull/8865) + +#### HIP: +* Search the CMake variable `ROCM_PATH` for dependencies [\#8669](https://github.com/kokkos/kokkos/pull/8669) +* Added support for brain floating-point (`bhalf_t`) [\#8705](https://github.com/kokkos/kokkos/pull/8705) +* Implemented true reduced-precision mathematical functions (instead of falling back to `float`) [\#8705](https://github.com/kokkos/kokkos/pull/8705) +* Add support for AMD MI355 and MI350 (`AMD_GFX950`) [\#8839](https://github.com/kokkos/kokkos/pull/8839) +* Fix race conditions in HIP `parallel_scan` when running on MI300A [\#8648](https://github.com/kokkos/kokkos/pull/8648) + +### General Enhancements +* Enable ScatterView to contribute into a View that is an rvalue [\#8594](https://github.com/kokkos/kokkos/pull/8594) +* Add bitwise operators to simd vectors and simd masks [\#8565](https://github.com/kokkos/kokkos/pull/8565) +* Use Array::size_type for subscript operators [\#8692](https://github.com/kokkos/kokkos/pull/8692) +* Add missing numeric trait `denorm_min` for `Kokkos::Experimental::half_t` and `Kokkos::Experimental::bhalf_t` [\#8769](https://github.com/kokkos/kokkos/pull/8769) +* Use StaticBatchSize in ViewFill [\#8795](https://github.com/kokkos/kokkos/pull/8795) +* Enforce failure when exceeding team_size_max and scratch_size_max checks [\#7445](https://github.com/kokkos/kokkos/pull/7445) +* Enable MPI detection with PALS [\#8895](https://github.com/kokkos/kokkos/pull/8895) +* Add simd memory permute functions [\#8775](https://github.com/kokkos/kokkos/pull/8775) +* Performance improvements using `MDRangePolicy` with `CUDA`, `HIP` and `SYCL` [\#8638](https://github.com/kokkos/kokkos/pull/8638), [\#8731](https://github.com/kokkos/kokkos/pull/8731) +* Add `Kokkos::norm`for `Kokkos::complex`- similar to `std::norm` [\#8627](https://github.com/kokkos/kokkos/pull/8927) +* Use neon and sve SIMD instructions if `nvcc` supports them [\#8667](https://github.com/kokkos/kokkos/pull/8667) +* Expand math support: complete the implementation of all remaining math functions and increase half-type support [\#8595](https://github.com/kokkos/kokkos/pull/8789) [\#8858](https://github.com/kokkos/kokkos/pull/8858) [\#8873](https://github.com/kokkos/kokkos/pull/8873) [\#8712](https://github.com/kokkos/kokkos/pull/8712) [\#8827](https://github.com/kokkos/kokkos/pull/8827) [\#8819](https://github.com/kokkos/kokkos/pull/8819) [\#8719](https://github.com/kokkos/kokkos/pull/8719) [\#8863](https://github.com/kokkos/kokkos/pull/8863) [\#8862](https://github.com/kokkos/kokkos/pull/8862) [\#8778](https://github.com/kokkos/kokkos/pull/8778) [\#8891](https://github.com/kokkos/kokkos/pull/8891) +* Improve performance of `deep_copy` from scalar in view fill using StaticBatchSize [\#8795](https://github.com/kokkos/kokkos/pull/8795) [\#8829](https://github.com/kokkos/kokkos/pull/8829) + +### Build System Changes +* Warn about multiple device architectures enabled by `find_package(HIP)` [\#8938](https://github.com/kokkos/kokkos/pull/8938) +* Detect ROCm TPL using `find_package(HIP)` [\#8747](https://github.com/kokkos/kokkos/pull/8747) + +### Incompatibilities (i.e. breaking changes) +* Execution spaces can only be constructed after `Kokkos::initialize()` has been called and must be destructed before `Kokkos::finalize()` [\#8546](https://github.com/kokkos/kokkos/pull/8546) [\#8677](https://github.com/kokkos/kokkos/pull/8677) +* ScatterValue isn't move constructible/assignable anymore [\#8761](https://github.com/kokkos/kokkos/pull/8761) +* Enforce TeamPolicy constructor preconditions (includes vector length must be a power of two) [\#8904](https://github.com/kokkos/kokkos/pull/8904) [\#8907](https://github.com/kokkos/kokkos/pull/8907) +* OpenMP: Warn on exec space instance created within omp region [\#8919](https://github.com/kokkos/kokkos/pull/8919) +* Remove the deprecated OpenMPTarget backend [\#8701](https://github.com/kokkos/kokkos/pull/8701) [\#8717](https://github.com/kokkos/kokkos/pull/8717) [\#8749](https://github.com/kokkos/kokkos/pull/8749) [\#8767](https://github.com/kokkos/kokkos/pull/8767) + +### Bug Fixes +* Fix reduction_identity for BAnd [\#8715](https://github.com/kokkos/kokkos/pull/8715) +* Restrict lock free host atomics to the actual sizes that are lock free [\#8809](https://github.com/kokkos/kokkos/pull/8809) +* Use intrinsics when calling min and max on simd vectors of integral types [\#8899](https://github.com/kokkos/kokkos/pull/8899) +* Adds missing `constexpr` specifiers on `conj()`, and for the `real()` and `imag()` non-member functions taking complex numbers [\#8928](https://github.com/kokkos/kokkos/pull/8928) +* Ensure that execution space instances fence on finalize [\#8626](https://github.com/kokkos/kokkos/pull/8626) +* Update `team_fan_{in|out}` member functions of `ThreadsExecTeamMember` not to call host-only fuctions on the device [\#8730](https://github.com/kokkos/kokkos/pull/8730) +* Make overloads of `isnormal` compliant with std [\#8857](https://github.com/kokkos/kokkos/pull/8857) +* Fix compiler macros identify GCC and LLVM Clang on OSX [\#8592](https://github.com/kokkos/kokkos/pull/8592) [\#8952](https://github.com/kokkos/kokkos/pull/8952) + +## 5.0.2 + +[Full Changelog](https://github.com/kokkos/kokkos/compare/5.0.1...5.0.2) + +### Bug Fixes + +* Build kokkosalgorithms and kokkossimd as position independent code [\#8815](https://github.com/kokkos/kokkos/pull/8815) +* `ATOMICS_BYPASS` handling - disable incompatible tests [\#8813](https://github.com/kokkos/kokkos/pull/8813) and default ON in Trilinos configuration [\#8816](https://github.com/kokkos/kokkos/pull/8816) +* Fix for Cuda 13.1 compilation issues (mdspan fix only) [\#8801](https://github.com/kokkos/kokkos/pull/8801) +* Fix performance issue in subview [\#8822](https://github.com/kokkos/kokkos/pull/8822) +* Fix `View::layout()` bug for `LayoutRight` and `DynRankView` [\#8838](https://github.com/kokkos/kokkos/pull/8838) + +## 5.0.1 + +[Full Changelog](https://github.com/kokkos/kokkos/compare/5.0.0...5.0.1) + +### Bug Fixes +* Fix nvcc warnings in mdspan [\#8750](https://github.com/kokkos/kokkos/pull/8750) +* Disable MallocAsync for ROCm 7+ [\#8746](https://github.com/kokkos/kokkos/pull/8746) +* Add a missing deprecation for HostMirror in DynamicView [\#8762](https://github.com/kokkos/kokkos/pull/8762) +* Replace cudaMemAdvise_v2 with cudaMemAdvise when CUDART_VERSION >= 13000 [\#8707](https://github.com/kokkos/kokkos/pull/8707) +* Use mdspan-based View in Cuda 12.9 [\#8779](https://github.com/kokkos/kokkos/pull/8779) + +## 5.0.0 + +[Full Changelog](https://github.com/kokkos/kokkos/compare/4.7.01...5.0.0) + +### Features: +* Require C++20 [\#8372](https://github.com/kokkos/kokkos/pull/8372) + * Implies a new set of minimum compiler versions +* Reenabled new `mdspan` based `View` implementation (disabled in 4.7.1) +* Complete C++20 module support [\#8222](https://github.com/kokkos/kokkos/pull/8222), [\#8263](https://github.com/kokkos/kokkos/pull/8263), [\#8218](https://github.com/kokkos/kokkos/pull/8218) +* Begin removal of features deprecated in the Kokkos 4 release cycle [\#8374](https://github.com/kokkos/kokkos/pull/8374), [\#8390](https://github.com/kokkos/kokkos/pull/8390) + +### Backend and Architecture Enhancements: + +#### CUDA: +* Leverage hardware atomics for 128-bit compare-and-swap on Hopper+ [\#8025](https://github.com/kokkos/kokkos/pull/8025) +* Enable lock-free atomic_fetch_op for 128-bit types on Hopper+ [\#8511](https://github.com/kokkos/kokkos/pull/8511) +* Use `__grid_constant__` based launch mechanism: this can lead to subtle synchronization behavior change for mid-size functors [\#8529](https://github.com/kokkos/kokkos/pull/8529) + +#### HIP: +* Fix a performance regression introduced in 4.6 when using lightweight kernel in parallel reduce [\#8268](https://github.com/kokkos/kokkos/pull/8268) +* Add support for the Navi 4 architecture [\#8501](https://github.com/kokkos/kokkos/pull/8501) +* Leverage HIP atomic builtins for `atomic_fetch_{min,max}` with floating point types [\#8554](https://github.com/kokkos/kokkos/pull/8554) +* Prefer smaller block sizes for `parallel_for` with small iteration space. [\#8512](https://github.com/kokkos/kokkos/pull/8512) + +#### SYCL: +* Change SYCL::size_type from int to unsigned - the default iteration integer type [\#8542](https://github.com/kokkos/kokkos/pull/8542) + +#### OpenMPTarget: +* Update `parallel_scan()` to support RangePolicy with non-zero begin index [\#8406](https://github.com/kokkos/kokkos/pull/8406) + +#### OpenACC: +* Add partial support for pseudorandom number generator APIs in Kokkos_Random.hpp [\#8052](https://github.com/kokkos/kokkos/pull/8052) +* Update `parallel_scan()` to support RangePolicy with non-zero begin index [\#8316](https://github.com/kokkos/kokkos/pull/8316) +* Add support for `partition_space()` API [\#7920](https://github.com/kokkos/kokkos/pull/7920) +* Add support for custom reduction with range policy for scalar reduction variables [\#8307](https://github.com/kokkos/kokkos/pull/8307) + +### General Enhancements +* Optimize View initialization with adaptive `memset`/`parallel_for` selection in parallel Host backends [\#8178](https://github.com/kokkos/kokkos/pull/8178) +* `UnorderedMap` allow using `SequentialHostInit` [\#8182](https://github.com/kokkos/kokkos/pull/8182) +* Add simd type conversions [\#8085](https://github.com/kokkos/kokkos/pull/8085) +* Make `reduction_identity<[b]half_t>` member functions return `[b]half_t` instead of `float` [\#8329](https://github.com/kokkos/kokkos/pull/8329) +* Print the commit hash of the embedded dependencies at configure time and when calling `print_configuration` [\#8385](https://github.com/kokkos/kokkos/pull/8385) +* Desul atomics: Use Clang atomic min/max GCC-style builtins [\#8507](https://github.com/kokkos/kokkos/pull/8507) +* Enable running tests on systems with only 2GB of device memory [\#8552](https://github.com/kokkos/kokkos/pull/8552) +* Added `begin()`/`end()` methods to `Kokkos::Array` [\#8577](https://github.com/kokkos/kokkos/pull/8577) +* Added missing `noexcept` specifier to some methods of `Kokkos::Array` [\#8582](https://github.com/kokkos/kokkos/pull/8582) +* Updated `ErrorReporter`: adhere to Kokkos naming conventions and change `get_reports` to return values [\#8486](https://github.com/kokkos/kokkos/pull/8486) +* Added explicit loop unrolling execution policy trait (currently only effective in CUDA) [\#8164](https://github.com/kokkos/kokkos/pull/8164) + +### Build System Changes +* Change `Kokkos_ENABLE_DEPRECATED_CODE_4` default `ON -> OFF` [\#8378](https://github.com/kokkos/kokkos/pull/8378) +* Added `Kokkos_ENABLE_DEPRECATED_CODE_5` option. Default is `ON`. [\#8340](https://github.com/kokkos/kokkos/pull/8340) +* Bump CMake minimum required version to 3.22 [\#8377](https://github.com/kokkos/kokkos/pull/8377) +* Require CMake 3.25.2 for c++20 support in the CUDA language [\#8402](https://github.com/kokkos/kokkos/pull/8402) +* Make Kokkos support multiple languages [\#8167](https://github.com/kokkos/kokkos/pull/8167) +* Allow compiling to shared libraries on Windows [\#8324](https://github.com/kokkos/kokkos/pull/8324) + +### Incompatibilities (i.e. breaking changes) +* Change `simd` to use the largest available simd size by default [\#8250](https://github.com/kokkos/kokkos/pull/8250) +* `MemoryRandomAccess` does not imply `Unmanaged` [\#8368](https://github.com/kokkos/kokkos/pull/8368) +* Drop makefile support [\#8374](https://github.com/kokkos/kokkos/pull/8374) +* Remove task DAG capabilities [\#8390](https://github.com/kokkos/kokkos/pull/8390) +* Remove support for Nvidia Kepler architecture [\#8518](https://github.com/kokkos/kokkos/pull/8518) +* Bump google benchmark minimum requirement to v1.8.3 [\#8579](https://github.com/kokkos/kokkos/pull/8579) +* Check that parallel constructs invoked before initialize or after finalize will error out [\#7675](https://github.com/kokkos/kokkos/pull/7675) +* Submit graphs on the default execution space when no execution space is specified [\#8365](https://github.com/kokkos/kokkos/pull/8365) + +### Deprecations +* Deprecate `KOKKOS_ATTRIBUTE_NODISCARD` macro [\#8388](https://github.com/kokkos/kokkos/pull/8388) +* Deprecate `{Owning,Observing}RawPtr` aliases [\#8397](https://github.com/kokkos/kokkos/pull/8397) +* Deprecate support for using nested OpenMP parallel regions without nested OpenMP enabled [\#7417](https://github.com/kokkos/kokkos/pull/7417) +* Deprecate creating Kokkos::OpenMP instances inside OpenMP parallel regions [\#8488](https://github.com/kokkos/kokkos/pull/8488) +* Deprecate `Random_XorShift{64,1024}_Pool::init` [\#8082](https://github.com/kokkos/kokkos/pull/8082) +* Deprecate simd::\[const_\]where_expression [\#7960](https://github.com/kokkos/kokkos/pull/7960) +* Deprecate View::HostMirror in favor of View::host_mirror_type [\#8232](https://github.com/kokkos/kokkos/pull/8232) +* Deprecate array_type and scalar_array_type and more enums in ViewTraits [\#7360](https://github.com/kokkos/kokkos/pull/7360) +* Deprecated old member function names in (experimental) `ErrorReporter` [\#8486](https://github.com/kokkos/kokkos/pull/8486) + +### Bug Fixes +* Track modification for `resize` only if `DualView` is not using a single device [\#8273](https://github.com/kokkos/kokkos/pull/8273) +* Fix MSVC `floating-point value does not fit in required floating-point type` warning from `reduction_identity` [\#8376](https://github.com/kokkos/kokkos/pull/8376) +* Properly delete `Timer` copy constructor and copy assignment operators [\#8399](https://github.com/kokkos/kokkos/pull/8399) +* Fix RISC-V support (compiler check at configuration time and missing semicolons at compile time) [\#8439](https://github.com/kokkos/kokkos/pull/8439) +* Corrected `bit_width` return type to be `int` instead of `T` to align with the standard library [\#8509](https://github.com/kokkos/kokkos/pull/8509) +* OpenMP: fix `partition_space` with low thread counts [\#8488](https://github.com/kokkos/kokkos/pull/8488) +* Fix `parallel_reduce` on HIP and Cuda with `LaunchBounds` values smaller than 32 [\#8452](https://github.com/kokkos/kokkos/pull/8452) +* Cuda,HIP: Launch work graph on the specified instance [\#8576](https://github.com/kokkos/kokkos/pull/8576) +* Work around a performance regression related to index computation in the mdspan-based View [\#8476](https://github.com/kokkos/kokkos/pull/8476) +* Fix a failure at configure time when SVE is enabled and the tests are disabled [\#8661](https://github.com/kokkos/kokkos/pull/8661) + +## 4.7.04 + +### Bug Fixes +* Add a missing include for legacy View [\#9062](https://github.com/kokkos/kokkos/pull/9062) +* Add a missing CMake include for configure time checking ARM SVE support [\#9061](https://github.com/kokkos/kokkos/pull/9061) +* Fix a compile time bug on MSVC with oneAPI [\#9060](https://github.com/kokkos/kokkos/pull/9060) + +## 4.7.03 + +### CUDA +* Fix compiling with Cuda 13.1 [\#9020](https://github.com/kokkos/kokkos/pull/9020) + +### HIP +* Disable MallocAsync for ROCm by default and thus supporting ROCM 7 [\#9022](https://github.com/kokkos/kokkos/pull/9022) +* Adding support for AMD MI355 and MI350 [\#9025]((https://github.com/kokkos/kokkos/pull/9025) + +### Bug Fixes +* Identify homebrew llvm and hombrew gcc as KOKKOS_COMPILER_CLANG and KOKKOS_COMPILER_GNU [\#9019](https://github.com/kokkos/kokkos/pull/9019) +* Relax compiler flags checks fatal error to warning [\#9024](https://github.com/kokkos/kokkos/pull/9024) +* Fix misalignment issues for CUDA and HIP combined reducers [\#9026]((https://github.com/kokkos/kokkos/pull/9026) + +## 4.7.02 + +[Full Changelog](https://github.com/kokkos/kokkos/compare/4.7.01...4.7.02) + +### Bug Fixes +* Link kokkoscore directly with CMAKE_DL_LIBS [\#8456](https://github.com/kokkos/kokkos/pull/8456) +* mdspan fixes for cuda >= 12.9 [\#8562](https://github.com/kokkos/kokkos/pull/8562), [\#8615](https://github.com/kokkos/kokkos/pull/8615) +* Replace cudaMemAdvise_v2 with cudaMemAdvise when CUDART_VERSION >= 13000 [\#8726](https://github.com/kokkos/kokkos/pull/8726) + +## 4.7.01 + +[Full Changelog](https://github.com/kokkos/kokkos/compare/4.7.00...4.7.01) + +### CUDA +* Support CUDA 13 [\#8298](https://github.com/kokkos/kokkos/pull/8298) + +### Performance +* Revert back to old `View` implementation by default to avoid performance regressions [\#8411](https://github.com/kokkos/kokkos/pull/8411) + * This was by default off in Trilinos and Spack builds already, as well as for older GCC versions +* Improve performance of `DynRankView` construction from internal `View` type [\#8303](https://github.com/kokkos/kokkos/pull/8303) + +### Bug Fixes +* Add missing const qualifier to `View::to_mdspan` and `View` to `mdspan` conversion [\#8333](https://github.com/kokkos/kokkos/pull/8333) +* Fix configure-time check of compilation and linker flags [\#8292](https://github.com/kokkos/kokkos/pull/8292) +* Add missing `KOKKOS_FUNCTION` annotation on `View(std::nullptr_t, ...)` constructor [\#8436](https://github.com/kokkos/kokkos/pull/8436) ## 4.7.00 diff --git a/packages/kokkos/CMakeLists.txt b/packages/kokkos/CMakeLists.txt index 7ebfb9709c4d..57ac49a2a90c 100644 --- a/packages/kokkos/CMakeLists.txt +++ b/packages/kokkos/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22 FATAL_ERROR) # scan source files for importing C++20 modules if(Kokkos_ENABLE_EXPERIMENTAL_CXX20_MODULES) @@ -101,19 +101,6 @@ if(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_HIP) set(KOKKOS_COMPILE_LANGUAGE HIP) endif() -if(Spack_WORKAROUND) - if(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) - message(FATAL_ERROR "Can't currently use Kokkos_ENABLE_COMPILER_AS_CMAKE_LANGUAGE in a spack installation!") - endif() - - #if we are explicitly using Spack for development, - #nuke the Spack compiler - set(SPACK_CXX $ENV{SPACK_CXX}) - if(SPACK_CXX) - set(CMAKE_CXX_COMPILER ${SPACK_CXX} CACHE STRING "the C++ compiler" FORCE) - set(ENV{CXX} ${SPACK_CXX}) - endif() -endif() # Always call the project command to define Kokkos_ variables # and to make sure that C++ is an enabled language project(Kokkos ${KOKKOS_COMPILE_LANGUAGE} ${KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE}) @@ -152,9 +139,9 @@ elseif(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) endif() endif() -set(Kokkos_VERSION_MAJOR 4) -set(Kokkos_VERSION_MINOR 7) -set(Kokkos_VERSION_PATCH 0) +set(Kokkos_VERSION_MAJOR 5) +set(Kokkos_VERSION_MINOR 1) +set(Kokkos_VERSION_PATCH 99) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") message(STATUS "Kokkos version: ${Kokkos_VERSION}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") @@ -204,6 +191,10 @@ if(Kokkos_ENABLE_TESTS) find_package(GTest QUIET) endif() +if(Kokkos_ENABLE_BENCHMARKS) + find_package(benchmark QUIET 1.8.3) +endif() + # Include a set of Kokkos-specific wrapper functions that # will either call raw CMake or TriBITS # These are functions like KOKKOS_INCLUDE_DIRECTORIES diff --git a/packages/kokkos/CONTRIBUTING.md b/packages/kokkos/CONTRIBUTING.md deleted file mode 100644 index e97f8c4d89c5..000000000000 --- a/packages/kokkos/CONTRIBUTING.md +++ /dev/null @@ -1,16 +0,0 @@ -# Contributing to Kokkos - -## Pull Requests -We actively welcome pull requests. -1. Fork the repo and create your branch from `develop`. -2. If you've added code that should be tested, add tests. -3. If you've changed APIs, update the documentation. -4. Ensure the test suite passes. - -Before sending your patch for review, please try to ensure that it is formatted properly. We use clang-format version 16 for this. - -## Issues -We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. - -## License -By contributing to Kokkos, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree. diff --git a/packages/kokkos/COPYRIGHT.md b/packages/kokkos/COPYRIGHT.md new file mode 100644 index 000000000000..92110e16567c --- /dev/null +++ b/packages/kokkos/COPYRIGHT.md @@ -0,0 +1,226 @@ +# Copyright Contributors to the Kokkos Project + +This file contains a (partial) list of people who contributed to the Kokkos Project +and retain applicable copyrights to their contributions. + +For each contributor, we list their organization (if known) and the email +address associated with their commits. + +Contributors are listed for specific date ranges reflecting major Kokkos versions. +These lists are generated using `git shortlog -sne --since="YYYY-MM-DD" --until="YYYY-MM-DD"` +commands. + +## Kokkos 5 + +Date Range: present -- 2025-08-11 + +### Sandia National Laboratories (SNL) + + Under the terms of Contract DE-NA0003525 with NTESS, + the U.S. Government retains certain rights in this software. + +- Christian Trott; SNL; crtrott@sandia.gov +- Nathan Ellingwood; SNL; ndellin@sandia.gov +- Dong Hun Lee; SNL; donlee@sandia.gov +- Nicolas Morales; SNL; nmmoral@sandia.gov +- Conrad Clevenger ; SNL; tccleve@sandia.gov +- Carl Pearson; SNL; cwpears@sandia.gov +- Jan Ciesko; SNL; jan.ciesko@gmail.com + +### Oak Ridge National Laboratories (ORNL) + +- Damien Lebrun-Grandie; ORNL; dalg24@gmail.com +- Daniel Arndt; ORNL; arndtd@ornl.gov +- Bruno Turcksin; ORNL; bruno.turcksin@gmail.com +- Jakob Bludau; ORNL; bludauj@ornl.gov +- Seyong Lee; ORNL; lees2@ornl.gov + +### Commissariat à l’Energie Atomique et aux Energies Alternatives (CEA) + +- Paul Zehner; CEA; paul.zehner@cea.fr +- Trévis Morvany; CEA; trevis.morvany@cea.fr +- Paul Gannay; CEA; paul.gannay@cea.fr +- Thomas Padioleau; CEA; thomas.padioleau@cea.fr +- Cédric Chevalier; CEA; cedric.chevalier@cea.fr + +### NextSilicon + + Next Silicon Ltd. + Copyright (c) 2017-2026, Next Silicon Ltd. + +- Patrick Fasano; NextSilicon; patrick.fasano@nextsilicon.com +- Adi Nissim; NextSilicon; adi.nissim@nextsilicon.com +- Christian Ulmann; NextSilicon; christian.ulmann@nextsilicon.com +- Efi Plotkin; NextSilicon; efi.plotkin@nextsilicon.com +- Guy Malinovitch; NextSilicon; guy.malinovitch@nextsilicon.com +- Ilia Sixtel; NextSilicon; ilia.sixtel@nextsilicon.com +- Irina Lipov; NextSilicon; irina.lipov@nextsilicon.com +- Johannes de Fine Licht; NextSilicon; johannes.definelicht@nextsilicon.com +- Mihailo Stojanovic; NextSilicon; mihailo.stojanovic@nextsilicon.com +- Natan Hoffmann; NextSilicon; natan.hoffmann@nextsilicon.com +- Nemanja Grujic; NextSilicon; nemanja.grujic@nextsilicon.com +- Nikola Tesic; NextSilicon; nikola.tesic@nextsilicon.com +- Stevan Cvetkovic; NextSilicon; stevan.cvetkovic@nextsilicon.com +- Yael Newman; NextSilicon; yael.newman@nextsilicon.com +- Ziv Dunkelman; NextSilicon; ziv.dunkelman@nextsilicon.com + +### Individual Contributors (OTHER) + +- Romin Tomasetti; OTHER; romin.tomasetti@gmail.com +- Maarten Arnst; OTHER; maarten.arnst@uliege.be + +## Kokkos 4 + +Date Range: 2025-08-11 -- 2022-09-20 + +### Sandia National Laboratories (SNL) + + Kokkos v. 4.0 + Copyright (2022) 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. + +- Christian Trott; SNL; crtrott@sandia.gov +- Francesco Rizzi; SNL; fnrizzi@sandia.gov +- Nathan Ellingwood; SNL; ndellin@sandia.gov +- Dong Hun Lee; SNL; donlee@sandia.gov +- Nicolas Morales; SNL; nmmoral@sandia.gov +- Conrad Clevenger ; SNL; tccleve@sandia.gov +- Carl Pearson; SNL; cwpears@sandia.gov +- Jan Ciesko; SNL; jan.ciesko@gmail.com +- Cezary Skrzyński; SNL; cezary.skrzynski@ng-analytics.com +- Arkadiusz Szczepkowicz; SNL; arek.szczepkowicz@ng-analytics.com +- Dan Ibanez; SNL; daibane@sandia.gov +- Evan Harvey; SNL; eharvey@sandia.gov + +### Oak Ridge National Laboratories (ORNL) + +- Damien Lebrun-Grandie; ORNL; dalg24@gmail.com +- Daniel Arndt; ORNL; arndtd@ornl.gov +- Bruno Turcksin; ORNL; bruno.turcksin@gmail.com +- Jakob Bludau; ORNL; bludauj@ornl.gov +- Seyong Lee; ORNL; lees2@ornl.gov +- Andrey Prokopenko; ORNL; prokopenkoav@ornl.gov + +### Commissariat à l’Energie Atomique et aux Energies Alternatives (CEA) + +- Paul Zehner; CEA; paul.zehner@cea.fr +- Thomas Padioleau; CEA; thomas.padioleau@cea.fr +- Trévis Morvany; CEA; trevis.morvany@cea.fr +- Cédric Chevalier; CEA; cedric.chevalier@cea.fr +- Paul Gannay; CEA; paul.gannay@cea.fr + +### Individual Contributors (OTHER) + +- Rahulkumar Gayatri; OTHER; rahulgayatri84@gmail.com rgayatri@lbl.gov rahulkgayatri@gmail.com +- Romin Tomasetti; OTHER; romin.tomasetti@gmail.com +- Mikael Simberg; OTHER; mikael.simberg@iki.fi +- Nevin ":-)" Liber; OTHER; nliber+github@gmail.com nliber@anl.gov +- Maarten Arnst; OTHER; maarten.arnst@uliege.be +- Christoph Junghans; OTHER; junghans@votca.org +- Timo Heister; OTHER; timo.heister@gmail.com + +## Kokkos 3 + +Date Range: 2022-09-20 -- 2019-06-24 + +### Sandia National Laboratories (SNL) + + 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. + +- Christian Trott; SNL; crtrott@sandia.gov +- D. S. Hollman; SNL; dshollm@sandia.gov +- David Poliakoff; SNL; david.poliakoff@gmail.com +- Nathan Ellingwood; SNL; ndellin@sandia.gov +- Dan Ibanez; SNL; daibane@sandia.gov +- Francesco Rizzi; SNL; fnrizzi@sandia.gov +- Dong Hun Lee; SNL; donlee@sandia.gov +- Evan Harvey; SNL; eharvey@sandia.gov +- Phil Miller; SNL; pbmille@sandia.gov +- Jeff Miles; SNL; jsmiles@sandia.gov +- Nicolas Morales; SNL; nmmoral@sandia.gov +- Jeremiah Wilke; SNL; jjwilke@sandia.gov +- Jan Ciesko; SNL; jan.ciesko@gmail.com +- Cezary Skrzyński; SNL; cezary.skrzynski@ng-analytics.com +- Brian Kelley; SNL; bmkelle@sandia.gov +- Jonathan Lifflander; SNL; jliffla@sandia.gov +- Vinh Dang; SNL; vqdang@sandia.gov +- CA Lewis; SNL; canlewi@sandia.gov +- Amy Powell; SNL; ajpowel@sandia.gov +- Eric Phipps; SNL; etphipp@sandia.gov +- Samuel Browne; SNL; sebrown@sandia.gov +- Si Hammond; SNL; sdhammo@compton1.(none) + +### Oak Ridge National Laboratories (ORNL) + +- Damien Lebrun-Grandie; ORNL; dalg24@gmail.com +- Daniel Arndt; ORNL; arndtd@ornl.gov +- Bruno Turcksin; ORNL; bruno.turcksin@gmail.com +- Seyong Lee; ORNL; lees2@ornl.gov + +### Individual Contributors (OTHER) + +- Rahul Gayatri; OTHER; rgayatri@lbl.gov rahulgayatri84@gmail.com +- Nick Curtis; OTHER; nicholas.curtis@amd.com nicurtis@amd.com +- Jonathan R. Madsen; OTHER; jonathanrmadsen@gmail.com +- Christoph Junghans; OTHER; junghans@votca.org +- Mikael Simberg; OTHER; simberg@cscs.ch mikael.simberg@iki.fi +- J Todd; OTHER; joeatodd@gmail.com +- Jakob Bludau; OTHER; jakob.bludau@tum.de +- Matt Stack; OTHER; 36867242+matt-stack@users.noreply.github.com +- Jeff Hammond; OTHER; jeff.r.hammond@intel.com +- Cameron Smith; OTHER; smithc11@rpi.edu + +## Kokkos 2 + +### Sandia National Laboratories (SNL) + + Kokkos v. 2.0 + Copyright (2014) Sandia Corporation + + Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, + the U.S. Government retains certain rights in this software. + +- Christian Trott; SNL; crtrott@sandia.gov +- Carter Edwards; SNL; hcedwar@sandia.gov +- Dan Ibanez; SNL; daibane@sandia.gov +- Nathan Ellingwood; SNL; ndellin@sandia.gov +- David Hollman; SNL; dshollm@sandia.gov +- Dan Sunderland; SNL; dsunder@sandia.gov +- James Foucar; SNL; jgfouca@sandia.gov +- Steve Bova; SNL; swbova@sandia.gov +- Vinh Dang; SNL; vqdang@sandia.gov +- Greg Mackey; SNL; gemacke@sandia.gov +- Si Hammond; SNL; sdhammo@sandia.gov +- James David Stevens; SNL; jdsteve@kokkos-dev.sandia.gov +- Mark Hoemmen; SNL; mhoemme@sandia.gov +- Jeremiah Wilke; SNL; jjwilke@sandia.gov +- Jeff Miles; SNL; jsmiles@sandia.gov +- Stan Moore; SNL; stamoor@sandia.gov +- James Elliott; SNL; jjellio@sandia.gov +- Eric Phipps; SNL; etphipp@sandia.gov +- Kyungjoo Kim; SNL; kyukim@sandia.gov +- Steven W. Bova; SNL; swbova@kokkos-dev.sandia.gov + +### Oak Ridge National Laboratories (ORNL) + +- Damien Lebrun-Grandie; ORNL; dalg24@gmail.com + +### Commissariat à l’Energie Atomique et aux Energies Alternatives (CEA) + +- Pierre Kestener; CEA; pierre.kestener@cea.fr + +### Individual Contributors (OTHER) + +- Mikael Simberg; OTHER; simberg@cscs.ch mikael.simberg@iki.fi +- Chip Freitag; OTHER; chip.freitag@amd.com +- Scott Kruger; OTHER; scott.e.kruger@gmail.com +- Christoph Junghans; OTHER; junghans@votca.org +- Daniel Holladay; OTHER; dholladay00@lanl.gov diff --git a/packages/kokkos/Copyright.txt b/packages/kokkos/Copyright.txt deleted file mode 100644 index cbba3efc7bc5..000000000000 --- a/packages/kokkos/Copyright.txt +++ /dev/null @@ -1,8 +0,0 @@ -************************************************************************ - - Kokkos v. 4.0 - Copyright (2022) 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. diff --git a/packages/kokkos/LICENSE b/packages/kokkos/LICENSE index 4d9d69d7c445..7200d2f2adb0 100644 --- a/packages/kokkos/LICENSE +++ b/packages/kokkos/LICENSE @@ -221,7 +221,7 @@ 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: + Questions? Contact: Christian R. Trott (crtrott@sandia.gov) and Damien T. Lebrun-Grandie (lebrungrandt@ornl.gov) diff --git a/packages/kokkos/LICENSE_FILE_HEADER b/packages/kokkos/LICENSE_FILE_HEADER deleted file mode 100644 index 03eb04f8bdcb..000000000000 --- a/packages/kokkos/LICENSE_FILE_HEADER +++ /dev/null @@ -1,15 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER diff --git a/packages/kokkos/Makefile.kokkos b/packages/kokkos/Makefile.kokkos deleted file mode 100644 index ef4c0d161f7b..000000000000 --- a/packages/kokkos/Makefile.kokkos +++ /dev/null @@ -1,1750 +0,0 @@ -# Default settings common options. - -ifneq ($(KOKKOS_USE_DEPRECATED_MAKEFILES), 1) - $(error Makefile support is deprecated. Only CMake builds will be supported from Kokkos 5 on. Set KOKKOS_USE_DEPRECATED_MAKEFILES=1 to silence this error.) -endif - -KOKKOS_VERSION_MAJOR = 4 -KOKKOS_VERSION_MINOR = 7 -KOKKOS_VERSION_PATCH = 0 -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,SKL,SKX,ICL,ICX,SPR -# NVIDIA: Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61,Volta70,Volta72,Turing75,Ampere80,Ampere86,Ampere87,Ada89,Hopper90,Blackwell100,Blackwell120 -# ARM: ARMv80,ARMv81,ARMv8-ThunderX,ARMv8-TX2,A64FX,ARMv9-Grace,ARMv84,ARMv84_SVE -# IBM: Power8,Power9 -# AMD-GPUS: AMD_GFX906,AMD_GFX908,AMD_GFX90A,AMD_GFX940,AMD_GFX942,AMD_GFX942_APU,AMD_GFX1030,AMD_GFX1100,AMD_GFX1103 -# AMD-CPUS: AMDAVX,Zen,Zen2,Zen3,Zen4,Zen5 -# Intel-GPUs: Intel_Gen,Intel_Gen9,Intel_Gen11,Intel_Gen12LP,Intel_DG1,Intel_DG2,Intel_XeHP,Intel_PVC -KOKKOS_ARCH ?= "" -# Options: yes,no -KOKKOS_DEBUG ?= "no" -# Options: hwloc -KOKKOS_USE_TPLS ?= "" -# Options: c++17,c++1z,c++20,c++2a,c++23,c++2b -KOKKOS_CXX_STANDARD ?= "c++17" -# Options: aggressive_vectorization,disable_profiling,enable_large_mem_tests,disable_complex_align,disable_deprecated_code,enable_deprecation_warnings -KOKKOS_OPTIONS ?= "" -KOKKOS_CMAKE ?= "no" -KOKKOS_TRIBITS ?= "no" -KOKKOS_STANDALONE_CMAKE ?= "no" - -# Default settings specific options. -# Options: force_uvm,use_ldg,rdc,enable_lambda,enable_constexpr,enable_malloc_async -KOKKOS_CUDA_OPTIONS ?= "" - -# Options: rdc,enable_malloc_async -KOKKOS_HIP_OPTIONS ?= "" - -# Default settings specific options. -# Options: enable_async_dispatch -KOKKOS_HPX_OPTIONS ?= "" - -#Options : force_host_as_device -KOKKOS_OPENACC_OPTIONS ?= "" - -# Helper functions for conversion to upper case -uppercase_TABLE:=a,A b,B c,C d,D e,E f,F g,G h,H i,I j,J k,K l,L m,M n,N o,O p,P q,Q r,R s,S t,T u,U v,V w,W x,X y,Y z,Z -uppercase_internal=$(if $1,$$(subst $(firstword $1),$(call uppercase_internal,$(wordlist 2,$(words $1),$1),$2)),$2) -uppercase=$(eval uppercase_RESULT:=$(call uppercase_internal,$(uppercase_TABLE),$1))$(uppercase_RESULT) -# Return a 1 if a string contains a substring and 0 if not -# Note the search string should be without '"' -# Example: $(call kokkos_has_string,"hwloc,libdl",hwloc) -# Will return a 1 -kokkos_has_string=$(if $(findstring $(call uppercase,$2),$(call uppercase,$1)),1,0) -# Returns 1 if the path exists, 0 otherwise -# Example: $(call kokkos_path_exists,/path/to/file) -# Will return a 1 if /path/to/file exists -kokkos_path_exists=$(if $(wildcard $1),1,0) - -# Check for general settings - -KOKKOS_INTERNAL_ENABLE_DEBUG := $(call kokkos_has_string,$(KOKKOS_DEBUG),yes) -KOKKOS_INTERNAL_ENABLE_CXX17 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++17) -KOKKOS_INTERNAL_ENABLE_CXX1Z := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++1z) -KOKKOS_INTERNAL_ENABLE_CXX20 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++20) -KOKKOS_INTERNAL_ENABLE_CXX2A := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2a) -KOKKOS_INTERNAL_ENABLE_CXX23 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++23) -KOKKOS_INTERNAL_ENABLE_CXX2B := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2b) -KOKKOS_INTERNAL_ENABLE_CXX26 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++26) -KOKKOS_INTERNAL_ENABLE_CXX2C := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2c) - -# Check for external libraries. -KOKKOS_INTERNAL_USE_HWLOC := $(call kokkos_has_string,$(KOKKOS_USE_TPLS),hwloc) - -# Check for advanced settings. -KOKKOS_INTERNAL_ENABLE_COMPILER_WARNINGS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),compiler_warnings) -KOKKOS_INTERNAL_AGGRESSIVE_VECTORIZATION := $(call kokkos_has_string,$(KOKKOS_OPTIONS),aggressive_vectorization) -KOKKOS_INTERNAL_ENABLE_TUNING := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_tuning) -KOKKOS_INTERNAL_DISABLE_COMPLEX_ALIGN := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_complex_align) -KOKKOS_INTERNAL_DISABLE_DUALVIEW_MODIFY_CHECK := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_dualview_modify_check) -KOKKOS_INTERNAL_ENABLE_LARGE_MEM_TESTS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_large_mem_tests) -# deprecated -KOKKOS_INTERNAL_CUDA_USE_LDG := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),use_ldg) -KOKKOS_INTERNAL_CUDA_USE_UVM := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),force_uvm) -KOKKOS_INTERNAL_CUDA_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),rdc) -KOKKOS_INTERNAL_CUDA_USE_LAMBDA := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_lambda) -KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_constexpr) -KOKKOS_INTERNAL_CUDA_ENABLE_MALLOC_ASYNC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),enable_malloc_async) -KOKKOS_INTERNAL_HPX_ENABLE_ASYNC_DISPATCH := $(call kokkos_has_string,$(KOKKOS_HPX_OPTIONS),enable_async_dispatch) -# deprecated -KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_desul_atomics) -# deprecated -KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_desul_atomics) -KOKKOS_INTERNAL_DISABLE_BUNDLED_MDSPAN := $(call kokkos_has_string,$(KOKKOS_OPTIONS),impl_disable_bundled_mdspan) -KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_deprecated_code) -KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_deprecation_warnings) - -KOKKOS_INTERNAL_HIP_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS),rdc) -KOKKOS_INTERNAL_HIP_ENABLE_MALLOC_ASYNC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS),enable_malloc_async) -KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE := $(call kokkos_has_string,$(KOKKOS_OPENACC_OPTIONS),force_host_as_device) - -# Check for Kokkos Host Execution Spaces one of which must be on. -KOKKOS_INTERNAL_USE_OPENMP := $(call kokkos_has_string,$(subst OpenMPTarget,,$(KOKKOS_DEVICES)),OpenMP) -KOKKOS_INTERNAL_USE_THREADS := $(call kokkos_has_string,$(KOKKOS_DEVICES),Threads) -KOKKOS_INTERNAL_USE_HPX := $(call kokkos_has_string,$(KOKKOS_DEVICES),HPX) -KOKKOS_INTERNAL_USE_SERIAL := $(call kokkos_has_string,$(KOKKOS_DEVICES),Serial) - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 0) - ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 0) - ifeq ($(KOKKOS_INTERNAL_USE_HPX), 0) - KOKKOS_INTERNAL_USE_SERIAL := 1 - endif - endif -endif - -# Check for other Execution Spaces. -KOKKOS_INTERNAL_USE_CUDA := $(call kokkos_has_string,$(KOKKOS_DEVICES),Cuda) -KOKKOS_INTERNAL_USE_HIP := $(call kokkos_has_string,$(KOKKOS_DEVICES),HIP) -KOKKOS_INTERNAL_USE_SYCL := $(call kokkos_has_string,$(KOKKOS_DEVICES),SYCL) -KOKKOS_INTERNAL_USE_OPENMPTARGET := $(call kokkos_has_string,$(KOKKOS_DEVICES),OpenMPTarget) -KOKKOS_INTERNAL_USE_OPENACC := $(call kokkos_has_string,$(KOKKOS_DEVICES),OpenACC) - -KOKKOS_DEVICELIST = -ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) - KOKKOS_DEVICELIST += Serial -endif -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) - KOKKOS_DEVICELIST += OpenMP -endif -ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) - KOKKOS_DEVICELIST += Threads -endif -ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) - KOKKOS_DEVICELIST += HPX -endif -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - KOKKOS_DEVICELIST += Cuda -endif -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - KOKKOS_DEVICELIST += HIP -endif -ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) - KOKKOS_DEVICELIST += SYCL -endif -ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - KOKKOS_DEVICELIST += OPENMPTARGET -endif -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - KOKKOS_DEVICELIST += OpenACC -endif - -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - KOKKOS_INTERNAL_NVCC_PATH := $(shell which nvcc) - ifeq ($(origin CUDA_PATH), undefined) - CUDA_PATH = $(KOKKOS_INTERNAL_NVCC_PATH:/bin/nvcc=) - endif - ifeq ($(CUDA_PATH),) - CUDA_PATH = $(KOKKOS_INTERNAL_NVCC_PATH:/bin/nvcc=) - endif - KOKKOS_INTERNAL_COMPILER_NVCC_VERSION := $(shell nvcc --version 2>&1 | grep release | cut -d' ' -f5 | cut -d',' -f1 | tr -d .) -endif - -# Check OS. -KOKKOS_OS := $(strip $(shell uname -s)) -KOKKOS_INTERNAL_OS_CYGWIN := $(call kokkos_has_string,$(KOKKOS_OS),CYGWIN) -KOKKOS_INTERNAL_OS_LINUX := $(call kokkos_has_string,$(KOKKOS_OS),Linux) -KOKKOS_INTERNAL_OS_DARWIN := $(call kokkos_has_string,$(KOKKOS_OS),Darwin) - -# Check compiler. -KOKKOS_CXX_VERSION := $(strip $(shell $(CXX) --version 2>&1)) -KOKKOS_INTERNAL_COMPILER_INTEL := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),Intel Corporation) -KOKKOS_INTERNAL_COMPILER_CRAY := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -c "CC-")) -KOKKOS_INTERNAL_COMPILER_NVCC := $(strip $(shell echo "$(shell export OMPI_CXX=$(OMPI_CXX); export MPICH_CXX=$(MPICH_CXX); $(CXX) --version 2>&1 | grep -c nvcc)>0" | bc)) -KOKKOS_INTERNAL_COMPILER_NVHPC := $(strip $(shell $(CXX) --version 2>&1 | grep -c "nvc++")) -KOKKOS_INTERNAL_COMPILER_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),clang) -KOKKOS_INTERNAL_COMPILER_CRAY_CLANG := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -v "error:" | grep -c "clang++")) -KOKKOS_INTERNAL_COMPILER_INTEL_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),oneAPI) -KOKKOS_INTERNAL_COMPILER_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) - KOKKOS_INTERNAL_COMPILER_NVCC_WRAPPER := $(strip $(shell echo $(CXX) | grep -c nvcc_wrapper)) - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC_WRAPPER), 1) - - KOKKOS_CXX_HOST_VERSION := $(strip $(shell $(CXX) $(CXXFLAGS) --host-version 2>&1)) - KOKKOS_INTERNAL_COMPILER_INTEL := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),Intel Corporation) - KOKKOS_INTERNAL_COMPILER_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),clang) - endif -endif - -ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 2) - KOKKOS_INTERNAL_COMPILER_CLANG = 1 -endif - -# Apple Clang passes both clang and apple clang tests, so turn off clang. -ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) - KOKKOS_INTERNAL_COMPILER_CLANG = 0 -endif -# AMD HCC passes both clang and hcc test so turn off clang -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) - ifeq ($(shell test $(KOKKOS_INTERNAL_COMPILER_CLANG_VERSION) -lt 400; echo $$?),0) - $(error Compiling Cuda code directly with Clang requires version 4.0.0 or higher) - endif - - KOKKOS_INTERNAL_CUDA_USE_LAMBDA := 1 - endif -endif - -# Set compiler warnings flags. -ifeq ($(KOKKOS_INTERNAL_ENABLE_COMPILER_WARNINGS), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized - else ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - # TODO check if cray accepts GNU style warnings - KOKKOS_INTERNAL_COMPILER_WARNINGS = - else - #gcc - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wclobbered -Wuninitialized - endif -else - KOKKOS_INTERNAL_COMPILER_WARNINGS = -endif - -# Set OpenMP flags. -ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp - else 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 -else - ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - # OpenMP is turned on by default in Cray compiler environment. - KOKKOS_INTERNAL_OPENMP_FLAG := - else ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -fiopenmp - else - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - # Set OpenACC flags. - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) - KOKKOS_INTERNAL_OPENACC_FLAG := -acc - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_INTERNAL_OPENACC_FLAG := -fopenacc -fopenacc-fake-async-wait -fopenacc-implicit-worker=vector -Wno-openacc-and-cxx -Wno-openmp-mapping -Wno-unknown-cuda-version -Wno-pass-failed - else - $(error Makefile.kokkos: OpenACC is enabled but the compiler must be NVHPC (got version string $(KOKKOS_CXX_VERSION))) - endif -endif - -# Set C++ version flags. -ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_INTERNAL_CXX17_FLAG := -hstd=c++17 - KOKKOS_INTERNAL_CXX1Z_FLAG := -hstd=c++1z - KOKKOS_INTERNAL_CXX20_FLAG := -hstd=c++20 - KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2a - KOKKOS_INTERNAL_CXX23_FLAG := -hstd=c++23 - KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2b -else - KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17 - KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1z - KOKKOS_INTERNAL_CXX20_FLAG := -std=c++20 - KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a - KOKKOS_INTERNAL_CXX23_FLAG := -std=c++23 - KOKKOS_INTERNAL_CXX2B_FLAG := -std=c++2b -endif - -# Check for Kokkos Architecture settings. - -# Intel based. -KOKKOS_INTERNAL_USE_ARCH_KNC := $(call kokkos_has_string,$(KOKKOS_ARCH),KNC) -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) - -# Traditionally, we supported, e.g., IntelGen9 instead of Intel_Gen9. The latter -# matches the CMake option but we also accept the former for backward-compatibility. -KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9 := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen9) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9 := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_Gen9) -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11 := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen11) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11 := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_Gen11) -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen12LP) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_Gen12LP) -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen9) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9 := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_Gen9) -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN_SET := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN9) \ - + $(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN11) \ - + $(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN12LP)) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN_SET), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelGen) - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_GEN := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_Gen) - endif -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_DG1 := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelDG1) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_DG1), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_DG1 := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_DG1) -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_DG2 := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelDG2) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_DG2), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_DG2 := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_DG2) -endif -KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP := $(call kokkos_has_string,$(KOKKOS_ARCH),IntelXeHP) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP), 0) - KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP := $(call kokkos_has_string,$(KOKKOS_ARCH),Intel_XeHP) -endif -# Traditionally the architecture was called PVC instead of Intel_PVC. This -# version makes us accept IntelPVC and Intel_PVC as well. -KOKKOS_INTERNAL_USE_ARCH_INTEL_PVC := $(call kokkos_has_string,$(KOKKOS_ARCH),PVC) - -# NVIDIA based. -NVCC_WRAPPER := $(KOKKOS_PATH)/bin/nvcc_wrapper -KOKKOS_INTERNAL_USE_ARCH_KEPLER30 := $(call kokkos_has_string,$(KOKKOS_ARCH),Kepler30) -KOKKOS_INTERNAL_USE_ARCH_KEPLER32 := $(call kokkos_has_string,$(KOKKOS_ARCH),Kepler32) -KOKKOS_INTERNAL_USE_ARCH_KEPLER35 := $(call kokkos_has_string,$(KOKKOS_ARCH),Kepler35) -KOKKOS_INTERNAL_USE_ARCH_KEPLER37 := $(call kokkos_has_string,$(KOKKOS_ARCH),Kepler37) -KOKKOS_INTERNAL_USE_ARCH_MAXWELL50 := $(call kokkos_has_string,$(KOKKOS_ARCH),Maxwell50) -KOKKOS_INTERNAL_USE_ARCH_MAXWELL52 := $(call kokkos_has_string,$(KOKKOS_ARCH),Maxwell52) -KOKKOS_INTERNAL_USE_ARCH_MAXWELL53 := $(call kokkos_has_string,$(KOKKOS_ARCH),Maxwell53) -KOKKOS_INTERNAL_USE_ARCH_PASCAL61 := $(call kokkos_has_string,$(KOKKOS_ARCH),Pascal61) -KOKKOS_INTERNAL_USE_ARCH_PASCAL60 := $(call kokkos_has_string,$(KOKKOS_ARCH),Pascal60) -KOKKOS_INTERNAL_USE_ARCH_VOLTA70 := $(call kokkos_has_string,$(KOKKOS_ARCH),Volta70) -KOKKOS_INTERNAL_USE_ARCH_VOLTA72 := $(call kokkos_has_string,$(KOKKOS_ARCH),Volta72) -KOKKOS_INTERNAL_USE_ARCH_TURING75 := $(call kokkos_has_string,$(KOKKOS_ARCH),Turing75) -KOKKOS_INTERNAL_USE_ARCH_AMPERE80 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere80) -KOKKOS_INTERNAL_USE_ARCH_AMPERE86 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere86) -KOKKOS_INTERNAL_USE_ARCH_AMPERE87 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere87) -KOKKOS_INTERNAL_USE_ARCH_ADA89 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ada89) -KOKKOS_INTERNAL_USE_ARCH_HOPPER90 := $(call kokkos_has_string,$(KOKKOS_ARCH),Hopper90) -KOKKOS_INTERNAL_USE_ARCH_BLACKWELL100 := $(call kokkos_has_string,$(KOKKOS_ARCH),Blackwell100) -KOKKOS_INTERNAL_USE_ARCH_BLACKWELL120 := $(call kokkos_has_string,$(KOKKOS_ARCH),Blackwell120) -KOKKOS_INTERNAL_USE_ARCH_NVIDIA := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KEPLER30) \ - + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER32) \ - + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER35) \ - + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER37) \ - + $(KOKKOS_INTERNAL_USE_ARCH_MAXWELL50) \ - + $(KOKKOS_INTERNAL_USE_ARCH_MAXWELL52) \ - + $(KOKKOS_INTERNAL_USE_ARCH_MAXWELL53) \ - + $(KOKKOS_INTERNAL_USE_ARCH_PASCAL61) \ - + $(KOKKOS_INTERNAL_USE_ARCH_PASCAL60) \ - + $(KOKKOS_INTERNAL_USE_ARCH_VOLTA70) \ - + $(KOKKOS_INTERNAL_USE_ARCH_VOLTA72) \ - + $(KOKKOS_INTERNAL_USE_ARCH_TURING75) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE80) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE86) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE87) \ - + $(KOKKOS_INTERNAL_USE_ARCH_ADA89) \ - + $(KOKKOS_INTERNAL_USE_ARCH_HOPPER90) \ - + $(KOKKOS_INTERNAL_USE_ARCH_BLACKWELL100) \ - + $(KOKKOS_INTERNAL_USE_ARCH_BLACKWELL120)) - -#SEK: This seems like a bug to me -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0) - KOKKOS_INTERNAL_USE_ARCH_MAXWELL50 := $(call kokkos_has_string,$(KOKKOS_ARCH),Maxwell) - KOKKOS_INTERNAL_USE_ARCH_KEPLER35 := $(call kokkos_has_string,$(KOKKOS_ARCH),Kepler) - KOKKOS_INTERNAL_USE_ARCH_NVIDIA := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KEPLER35) \ - + $(KOKKOS_INTERNAL_USE_ARCH_MAXWELL50)) -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 1) - KOKKOS_INTERNAL_NVCC_PATH := $(shell which nvcc) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - CUDA_PATH ?= $(KOKKOS_INTERNAL_NVCC_PATH:/bin/nvcc=) - ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := $(KOKKOS_INTERNAL_OPENMPTARGET_FLAG) --cuda-path=$(CUDA_PATH) - endif - endif -endif -# ARM based. -KOKKOS_INTERNAL_USE_ARCH_ARMV80 := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv80) -KOKKOS_INTERNAL_USE_ARCH_ARMV81 := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv81) -KOKKOS_INTERNAL_USE_ARCH_ARMV84 := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv84) -KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv8-ThunderX) -KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX2 := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv8-TX2) -KOKKOS_INTERNAL_USE_ARCH_A64FX := $(call kokkos_has_string,$(KOKKOS_ARCH),A64FX) -KOKKOS_INTERNAL_USE_ARCH_ARMV9_GRACE := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv9-Grace) -KOKKOS_INTERNAL_USE_ARCH_ARMV84_SVE := $(call kokkos_has_string,$(KOKKOS_ARCH),ARMv84_SVE) -KOKKOS_INTERNAL_USE_ARCH_ARM := $(strip $(shell echo $(KOKKOS_INTERNAL_USE_ARCH_ARMV80)+$(KOKKOS_INTERNAL_USE_ARCH_ARMV81)+$(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX)+$(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX2)+$(KOKKOS_INTERNAL_USE_ARCH_A64FX)+$(KOKKOS_INTERNAL_USE_ARCH_ARMV9_GRACE)+$(KOKKOS_INTERNAL_USE_ARCH_ARMV84)+$(KOKKOS_INTERNAL_USE_ARCH_ARMV84_SVE) | bc)) - -# IBM based. -KOKKOS_INTERNAL_USE_ARCH_POWER8 := $(call kokkos_has_string,$(KOKKOS_ARCH),Power8) -KOKKOS_INTERNAL_USE_ARCH_POWER9 := $(call kokkos_has_string,$(KOKKOS_ARCH),Power9) -KOKKOS_INTERNAL_USE_ARCH_IBM := $(strip $(shell echo $(KOKKOS_INTERNAL_USE_ARCH_POWER8)+$(KOKKOS_INTERNAL_USE_ARCH_POWER9) | bc)) - -# AMD based. -KOKKOS_INTERNAL_USE_ARCH_AMDAVX := $(call kokkos_has_string,$(KOKKOS_ARCH),AMDAVX) -KOKKOS_INTERNAL_USE_ARCH_ZEN5 := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen5) -KOKKOS_INTERNAL_USE_ARCH_ZEN4 := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen4) -KOKKOS_INTERNAL_USE_ARCH_ZEN3 := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen3) -KOKKOS_INTERNAL_USE_ARCH_ZEN2 := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen2) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN5), 0) - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN4), 0) - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN3), 0) - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN2), 0) - KOKKOS_INTERNAL_USE_ARCH_ZEN := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen) - endif - endif - endif -endif - -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX906) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906), 0) - KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906 := $(call kokkos_has_string,$(KOKKOS_ARCH),VEGA906) -endif -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX908) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908), 0) - KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908 := $(call kokkos_has_string,$(KOKKOS_ARCH),VEGA908) -endif -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX90A) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A), 0) - KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A := $(call kokkos_has_string,$(KOKKOS_ARCH),VEGA90A) -endif -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX940 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX940) -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942_APU := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX942_APU) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942_APU), 0) - KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX942) -endif -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX1030) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030), 0) - KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030 := $(call kokkos_has_string,$(KOKKOS_ARCH),NAVI1030) -endif -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX1100) -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100), 0) - KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100 := $(call kokkos_has_string,$(KOKKOS_ARCH),NAVI1100) -endif -KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103 := $(call kokkos_has_string,$(KOKKOS_ARCH),AMD_GFX1103) -KOKKOS_INTERNAL_USE_ARCH_AMD := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX940) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942_APU) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103)) - -# Any AVX? -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)) - -# Incompatible flags? -KOKKOS_INTERNAL_USE_ARCH_MULTIHOST := $(strip $(shell echo "$(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) - $(error Defined Multiple Host architectures: KOKKOS_ARCH=$(KOKKOS_ARCH) ) -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MULTIGPU), 1) - $(error Defined Multiple GPU architectures: KOKKOS_ARCH=$(KOKKOS_ARCH) ) -endif - -# Generating the list of Flags. - -KOKKOS_CPPFLAGS = -KOKKOS_LIBDIRS = -ifneq ($(KOKKOS_CMAKE), yes) - KOKKOS_CPPFLAGS = -I./ -I$(KOKKOS_PATH)/core/src -I$(KOKKOS_PATH)/containers/src -I$(KOKKOS_PATH)/algorithms/src -endif -KOKKOS_TPL_INCLUDE_DIRS = -KOKKOS_TPL_LIBRARY_DIRS = -KOKKOS_TPL_LIBRARY_NAMES = - -ifeq ($(KOKKOS_INTERNAL_ENABLE_COMPILER_WARNINGS), 1) - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_COMPILER_WARNINGS) -endif - -KOKKOS_LIBS = -ldl -KOKKOS_TPL_LIBRARY_NAMES += dl -ifneq ($(KOKKOS_CMAKE), yes) - KOKKOS_LIBDIRS = -L$(shell pwd) - # CXXLDFLAGS is used together with CXXFLAGS in a combined compile/link command - KOKKOS_CXXLDFLAGS = -L$(shell pwd) -endif -KOKKOS_LINK_FLAGS = -KOKKOS_SRC = -KOKKOS_HEADERS = - -# Generating the KokkosCore_config.h file. - -KOKKOS_INTERNAL_CONFIG_TMP=KokkosCore_config.tmp -KOKKOS_CONFIG_HEADER=KokkosCore_config.h -# Functions for generating config header file -kokkos_append_header = $(shell echo $1 >> $(KOKKOS_INTERNAL_CONFIG_TMP)) - -# assign hash sign to variable for compat. with make 4.3 -H := \# - -# Do not append first line -tmp := $(shell echo "/* ---------------------------------------------" > KokkosCore_config.tmp) -tmp := $(call kokkos_append_header,"Makefile constructed configuration:") -tmp := $(call kokkos_append_header,"----------------------------------------------*/") - -tmp := $(call kokkos_append_header,'$H''if !defined(KOKKOS_MACROS_HPP) || defined(KOKKOS_CORE_CONFIG_H)') -tmp := $(call kokkos_append_header,'$H''error "Do not include $(KOKKOS_CONFIG_HEADER) directly; include Kokkos_Macros.hpp instead."') -tmp := $(call kokkos_append_header,'$H''else') -tmp := $(call kokkos_append_header,'$H''define KOKKOS_CORE_CONFIG_H') -tmp := $(call kokkos_append_header,'$H''endif') - -tmp := $(call kokkos_append_header,"") -tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION $(KOKKOS_VERSION)") -tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_MAJOR $(KOKKOS_VERSION_MAJOR)") -tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_MINOR $(KOKKOS_VERSION_MINOR)") -tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_PATCH $(KOKKOS_VERSION_PATCH)") -tmp := $(call kokkos_append_header,"") - -tmp := $(call kokkos_append_header,"/* Execution Spaces */") - -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - tmp := $(call kokkos_append_header,'$H''define KOKKOS_ENABLE_HIP') -endif - -ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) - tmp := $(call kokkos_append_header,'$H''define KOKKOS_ENABLE_SYCL') -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - KOKKOS_LIBS += -latomic - tmp := $(call kokkos_append_header,'$H''define KOKKOS_ENABLE_OPENMPTARGET') -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC") - ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC_FORCE_HOST_AS_DEVICE") - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) - tmp := $(call kokkos_append_header,'$H''define KOKKOS_ENABLE_OPENMP') -endif - -ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_THREADS") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_HPX") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_SERIAL") -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) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATED_CODE_4") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATION_WARNINGS") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX17), 1) -ifneq ($(KOKKOS_STANDALONE_CMAKE), yes) - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX17_FLAG) -endif - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX17") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX1Z), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX1Z_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX17") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX20), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX20_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2A), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2A_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX23), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX23_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX23") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2B), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2B_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX23") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX26), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX26_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX26") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2C), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2C_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX26") -endif - -ifeq ($(KOKKOS_INTERNAL_ENABLE_DEBUG), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - KOKKOS_CXXFLAGS += -lineinfo - endif - - KOKKOS_CXXFLAGS += -g - KOKKOS_LDFLAGS += -g - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEBUG") - ifeq ($(KOKKOS_INTERNAL_DISABLE_DUALVIEW_MODIFY_CHECK), 0) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK") - endif -endif -ifeq ($(KOKKOS_INTERNAL_DISABLE_COMPLEX_ALIGN), 0) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_COMPLEX_ALIGN") -endif - -ifeq ($(KOKKOS_INTERNAL_ENABLE_TUNING), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_TUNING") -endif - -tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_LIBDL") - -ifeq ($(KOKKOS_INTERNAL_USE_HWLOC), 1) - ifneq ($(KOKKOS_CMAKE), yes) - ifneq ($(HWLOC_PATH),) - KOKKOS_CPPFLAGS += -I$(HWLOC_PATH)/include - KOKKOS_LIBDIRS += -L$(HWLOC_PATH)/lib - KOKKOS_CXXLDFLAGS += -L$(HWLOC_PATH)/lib - KOKKOS_TPL_INCLUDE_DIRS += $(HWLOC_PATH)/include - KOKKOS_TPL_LIBRARY_DIRS += $(HWLOC_PATH)/lib - endif - KOKKOS_LIBS += -lhwloc - KOKKOS_TPL_LIBRARY_NAMES += hwloc - endif - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_HWLOC") -endif - -ifeq ($(KOKKOS_INTERNAL_ENABLE_LARGE_MEM_TESTS), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_LARGE_MEM_TESTS") -endif - -tmp := $(call kokkos_append_header,"/* Optimization Settings */") - -ifeq ($(KOKKOS_INTERNAL_AGGRESSIVE_VECTORIZATION), 1) - # deprecated - tmp := $(call kokkos_append_header,"$H""define KOKKOS_OPT_RANGE_AGGRESSIVE_VECTORIZATION") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION") -endif - -tmp := $(call kokkos_append_header,"/* Cuda Settings */") - -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - #deprecated - ifeq ($(KOKKOS_INTERNAL_CUDA_USE_LDG), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC") - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC") - endif - - ifeq ($(KOKKOS_INTERNAL_CUDA_USE_UVM), 1) - # deprecated - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_UVM") - endif - - ifeq ($(KOKKOS_INTERNAL_CUDA_USE_RELOC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE") - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_CXXFLAGS += -fcuda-rdc - KOKKOS_LDFLAGS += -fcuda-rdc - else - KOKKOS_CXXFLAGS += --relocatable-device-code=true - KOKKOS_LDFLAGS += --relocatable-device-code=true - endif - endif - - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - ifeq ($(shell test $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION) -ge 90; echo $$?),0) - # This diagnostic is just plain wrong in CUDA 9 - # See https://github.com/kokkos/kokkos/issues/1470 - KOKKOS_CXXFLAGS += -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored - endif - endif - - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA") - KOKKOS_CXXFLAGS += -extended-lambda - endif - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA") - endif - - ifeq ($(KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_CONSTEXPR") - KOKKOS_CXXFLAGS += -expt-relaxed-constexpr - endif - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_CONSTEXPR") - endif - endif - - ifeq ($(KOKKOS_INTERNAL_CUDA_ENABLE_MALLOC_ASYNC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC") - else - tmp := $(call kokkos_append_header,"/* $H""undef KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC */") - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) - ifeq ($(KOKKOS_INTERNAL_HPX_ENABLE_ASYNC_DISPATCH), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_HPX_ASYNC_DISPATCH") - endif -endif - -# Add Architecture flags. - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV80), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV80") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8-a - KOKKOS_LDFLAGS += -march=armv8-a - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV81), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV81") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8.1-a - KOKKOS_LDFLAGS += -march=armv8.1-a - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV84), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV84") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8.4-a - KOKKOS_LDFLAGS += -march=armv8.4-a - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_A64FX), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_A64FX") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - - KOKKOS_CXXFLAGS += -march=armv8.2-a+sve - KOKKOS_LDFLAGS += -march=armv8.2-a+sve - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_CXXFLAGS += -msve-vector-bits=512 - KOKKOS_LDFLAGS += -msve-vector-bits=512 - endif - ifeq ($(KOKKOS_INTERNAL_COMPILER_GCC), 1) - KOKKOS_CXXFLAGS += -msve-vector-bits=512 - KOKKOS_LDFLAGS += -msve-vector-bits=512 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV9_GRACE), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV9_GRACE") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_SVE") - - KOKKOS_CXXFLAGS += -mcpu=neoverse-v2 -msve-vector-bits=128 - KOKKOS_LDFLAGS += -mcpu=neoverse-v2 -msve-vector-bits=128 -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV84_SVE), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV84_SVE") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_SVE") - - # try_run() to query HW SVE vector-length - tmp := $(strip $(shell mktemp)) - KOKKOS_INTERNAL_ARCH_ARM_SVE_VL := $(strip $(shell $(CXX) -march=armv8.4-a+sve \ - $(KOKKOS_PATH)/cmake/compile_tests/get_sve_hw_vl.cpp \ - -o $(tmp) > /dev/null 2>&1 \ - && $(tmp) | sed 's/SVE_HW_VL=//' \ - ; rm -f $(tmp) )) - - KOKKOS_CXXFLAGS += -march=armv8.4-a+sve -msve-vector-bits=$(KOKKOS_INTERNAL_ARCH_ARM_SVE_VL) - KOKKOS_LDFLAGS += -march=armv8.4-a+sve -msve-vector-bits=$(KOKKOS_INTERNAL_ARCH_ARM_SVE_VL) -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_ZEN") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX2") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -mavx2 - KOKKOS_LDFLAGS += -mavx2 - else - KOKKOS_CXXFLAGS += -march=znver1 -mtune=znver1 - KOKKOS_LDFLAGS += -march=znver1 -mtune=znver1 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN2), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_ZEN2") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX2") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -mavx2 - KOKKOS_LDFLAGS += -mavx2 - else - KOKKOS_CXXFLAGS += -march=znver2 -mtune=znver2 - KOKKOS_LDFLAGS += -march=znver2 -mtune=znver2 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN3), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_ZEN3") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX2") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -mavx2 - KOKKOS_LDFLAGS += -mavx2 - else - KOKKOS_CXXFLAGS += -march=znver3 -mtune=znver3 - KOKKOS_LDFLAGS += -march=znver3 -mtune=znver3 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN4), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_ZEN4") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -xCORE-AVX512 - KOKKOS_LDFLAGS += -xCORE-AVX512 - else - KOKKOS_CXXFLAGS += -march=znver4 -mtune=znver4 - KOKKOS_LDFLAGS += -march=znver4 -mtune=znver4 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN5), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_ZEN5") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512XEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -xCORE-AVX512 - KOKKOS_LDFLAGS += -xCORE-AVX512 - else - KOKKOS_CXXFLAGS += -march=znver5 -mtune=znver5 - KOKKOS_LDFLAGS += -march=znver5 -mtune=znver5 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV80") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV8_THUNDERX") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8-a -mtune=thunderx - KOKKOS_LDFLAGS += -march=armv8-a -mtune=thunderx - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX2), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV81") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARMV8_THUNDERX2") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ARM_NEON") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99 - KOKKOS_LDFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -mavx - KOKKOS_LDFLAGS += -mavx - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -mavx - KOKKOS_LDFLAGS += -mavx - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER7), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER7") - - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -mcpu=power7 -mtune=power7 - KOKKOS_LDFLAGS += -mcpu=power7 -mtune=power7 -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER8), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER8") - - KOKKOS_CXXFLAGS += -mcpu=power8 -mtune=power8 - KOKKOS_LDFLAGS += -mcpu=power8 -mtune=power8 -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER9), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER9") - - KOKKOS_CXXFLAGS += -mcpu=power9 -mtune=power9 - KOKKOS_LDFLAGS += -mcpu=power9 -mtune=power9 -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HSW), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX2") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -xCORE-AVX2 - KOKKOS_LDFLAGS += -xCORE-AVX2 - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 - KOKKOS_LDFLAGS += -march=core-avx2 -mtune=core-avx2 - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_BDW), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX2") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -xCORE-AVX2 - KOKKOS_LDFLAGS += -xCORE-AVX2 - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm - KOKKOS_LDFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX512MIC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AVX512MIC") - - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) - KOKKOS_CXXFLAGS += -xMIC-AVX512 - KOKKOS_LDFLAGS += -xMIC-AVX512 - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - else - # Asssume that this is really a GNU compiler. - KOKKOS_CXXFLAGS += -march=knl -mtune=knl - KOKKOS_LDFLAGS += -march=knl -mtune=knl - endif -endif - -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 - # Nothing here yet. - KOKKOS_CXXFLAGS += -march=skylake - KOKKOS_LDFLAGS += -march=skylake - 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) - KOKKOS_CXXFLAGS += -xCORE-AVX512 - KOKKOS_LDFLAGS += -xCORE-AVX512 - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - else - # Nothing here yet. - KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 - KOKKOS_LDFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 - 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 - KOKKOS_LDFLAGS += -mmic -endif - -# Figure out the architecture flag for Cuda. -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - KOKKOS_INTERNAL_USE_CUDA_ARCH=1 -endif -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - KOKKOS_INTERNAL_USE_CUDA_ARCH=1 - endif -endif -ifeq ($(KOKKOS_INTERNAL_USE_CUDA_ARCH), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG=-arch - else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG=--cuda-gpu-arch - KOKKOS_CXXFLAGS += -x cuda - else - $(error Makefile.kokkos: CUDA is enabled but the compiler is neither NVCC nor Clang (got version string $(KOKKOS_CXX_VERSION)) ) - endif - KOKKOS_INTERNAL_USE_CUDA_ARCH = 1 -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG=-fopenmp --offload-arch -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG=--offload-arch - endif -endif - -# Do not add this flag if its the cray compiler or the nvhpc compiler. -ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 0) - # Lets start with adding architecture defines - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER30), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER30") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_30 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER32), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER32") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_32 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER35), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER35") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_35 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_KEPLER37), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_KEPLER37") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_37 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL50), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL50") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_50 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL52), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL52") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_52 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_MAXWELL53), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_MAXWELL53") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_53 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_PASCAL60), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL60") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_60 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_PASCAL61), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_PASCAL61") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_61 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VOLTA70), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA70") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_70 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VOLTA72), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VOLTA72") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_72 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_TURING75), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_TURING75") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_75 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE80), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE80") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_80 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE86), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE86") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_86 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMPERE87), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE87") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_87 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ADA89), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ADA89") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_89 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HOPPER90), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER90") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_90 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_BLACKWELL100), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_BLACKWELL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_BLACKWELL100") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_100 - endif - endif - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_BLACKWELL120), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_BLACKWELL") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_BLACKWELL120") - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 0) - KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_120 - endif - endif -endif - -ifneq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0) - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG) - - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG) - endif - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG) - endif - ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG) - endif - endif -endif - - -# Figure out the architecture flag for ROCm. -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX906), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX906") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx906\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx906 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX908), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX908") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx908\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx908 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX90A), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX90A") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx90a\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx90a -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX940), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX940") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx940\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx940 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX942") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx942\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx942 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX942_APU), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX942_APU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx942\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx942 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1030), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1030") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx1030\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx1030 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1100), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1100") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx1100\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx1100 -endif -ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD_GFX1103), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GFX1103") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMD_GPU \"gfx1103\"") - KOKKOS_INTERNAL_AMD_ARCH_FLAG := --offload-arch=gfx1103 -endif - - -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.cpp) - KOKKOS_SRC += $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_HIP.cpp - KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.hpp) - - KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_AMD_ARCH_FLAG) - KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_AMD_ARCH_FLAG) - - ifeq ($(KOKKOS_INTERNAL_HIP_USE_RELOC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE") - KOKKOS_CXXFLAGS+=-fgpu-rdc - KOKKOS_LDFLAGS+=-fgpu-rdc - else - KOKKOS_CXXFLAGS+=-fno-gpu-rdc - KOKKOS_LDFLAGS+=-fno-gpu-rdc - endif - - ifeq ($(KOKKOS_INTERNAL_HIP_ENABLE_MALLOC_ASYNC), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_HIP_MALLOC_ASYNC") - else - tmp := $(call kokkos_append_header,"/* $H""undef KOKKOS_ENABLE_IMPL_HIP_MALLOC_ASYNC */") - endif -endif - -ifneq ($(KOKKOS_INTERNAL_USE_ARCH_AMD), 0) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_AMD_ARCH_FLAG) - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_AMD_ARCH_FLAG) - endif - endif -endif - -# Figure out Intel architecture flags. -ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) - 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_DG2), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_DG2") - KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device dg2" -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 12.50.4" -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.60.7" -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 -fsycl-dead-args-optimization - KOKKOS_CXXFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) - KOKKOS_LDFLAGS+=-fsycl - KOKKOS_LDFLAGS+=$(KOKKOS_INTERNAL_INTEL_ARCH_FLAG) - - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_SYCL_RELOCATABLE_DEVICE_CODE") -endif - -ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 1) - $(warning disable_desul_atomics option has been removed. Desul atomics cannot be disabled.) - KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS := 0 -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS), 1) - $(warning enable_desul_atomics option has been removed. Desul atomics are always enabled.) -endif -KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/desul/include - -ifeq ($(KOKKOS_INTERNAL_DISABLE_BUNDLED_MDSPAN), 0) - KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/mdspan/include -endif -tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_MDSPAN") - -tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_REF_COUNT_BRANCH_UNLIKELY") - -KOKKOS_INTERNAL_LS_CONFIG := $(shell ls KokkosCore_config.h 2>&1) - -ifeq ($(KOKKOS_INTERNAL_LS_CONFIG), KokkosCore_config.h) - KOKKOS_INTERNAL_NEW_CONFIG := $(strip $(shell diff KokkosCore_config.h KokkosCore_config.tmp | grep -c define)) -else - KOKKOS_INTERNAL_NEW_CONFIG := 1 -endif - -ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0) - tmp := $(shell cp KokkosCore_config.tmp KokkosCore_config.h) - - # Functions for generating config header file - kokkos_start_config_header = $(shell sed 's~@INCLUDE_NEXT_FILE@~~g' $(KOKKOS_PATH)/cmake/KokkosCore_Config_HeaderSet.in > $1) - kokkos_update_config_header = $(shell sed 's~@HEADER_GUARD_TAG@~$1~g' $2 > $3) - kokkos_append_config_header = $(shell echo $1 >> $2)) - tmp := $(call kokkos_start_config_header, "KokkosCore_Config_FwdBackend.tmp") - tmp := $(call kokkos_start_config_header, "KokkosCore_Config_SetupBackend.tmp") - tmp := $(call kokkos_start_config_header, "KokkosCore_Config_DeclareBackend.tmp") - tmp := $(call kokkos_start_config_header, "KokkosCore_Config_PostInclude.tmp") - tmp := $(call kokkos_update_config_header, KOKKOS_FWD_HPP_, "KokkosCore_Config_FwdBackend.tmp", "KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_update_config_header, KOKKOS_SETUP_HPP_, "KokkosCore_Config_SetupBackend.tmp", "KokkosCore_Config_SetupBackend.hpp") - tmp := $(call kokkos_update_config_header, KOKKOS_DECLARE_HPP_, "KokkosCore_Config_DeclareBackend.tmp", "KokkosCore_Config_DeclareBackend.hpp") - ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_SetupBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_SetupBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_SetupBackend.hpp") - endif - ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_FwdBackend.hpp") - tmp := $(call kokkos_append_config_header,"$H""include ","KokkosCore_Config_DeclareBackend.hpp") - endif -endif - -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/*.hpp) -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/View/*.hpp) -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/View/MDSpan/*.hpp) -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/impl/*.hpp) -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/containers/src/*.hpp) -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/containers/src/impl/*.hpp) -KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/algorithms/src/*.hpp) - -KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/impl/*.cpp) -KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/containers/src/impl/*.cpp) - -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/Cuda/*.cpp) - KOKKOS_SRC += $(KOKKOS_PATH)/tpls/desul/src/Lock_Array_CUDA.cpp - KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/Cuda/*.hpp) - ifneq ($(CUDA_PATH),) - KOKKOS_CPPLAGS += -I$(CUDA_PATH)/include - ifeq ($(call kokkos_path_exists,$(CUDA_PATH)/lib64), 1) - KOKKOS_LIBDIRS += -L$(CUDA_PATH)/lib64 - KOKKOS_CXXLDFLAGS += -L$(CUDA_PATH)/lib64 - KOKKOS_TPL_LIBRARY_DIRS += $(CUDA_PATH)/lib64 - else ifeq ($(call kokkos_path_exists,$(CUDA_PATH)/lib), 1) - KOKKOS_LIBDIRS += -L$(CUDA_PATH)/lib - KOKKOS_CXXLDFLAGS += -L$(CUDA_PATH)/lib - KOKKOS_TPL_LIBRARY_DIRS += $(CUDA_PATH)/lib - else - $(error Can't find CUDA library directory: no lib64 or lib directory in $(CUDA_PATH)) - endif - KOKKOS_TPL_INCLUDE_DIRS += $(CUDA_PATH)/include - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_CXXFLAGS += --cuda-path=$(CUDA_PATH) - endif - endif - KOKKOS_LIBS += -lcudart -lcuda - KOKKOS_TPL_LIBRARY_NAMES += cudart cuda -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenMPTarget/*.cpp) - KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenMPTarget/*.hpp) - ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - KOKKOS_CXXFLAGS += -Xcompiler $(KOKKOS_INTERNAL_OPENMPTARGET_FLAG) - else - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENMPTARGET_FLAG) - endif - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENMPTARGET_FLAG) - KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENMPTARGET_LIB) -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenACC/*.cpp) - KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenACC/*.hpp) - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG) - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG) - KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENACC_LIB) - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 1) - ifneq ($(CUDA_PATH),) - ifeq ($(call kokkos_path_exists,$(CUDA_PATH)/lib), 1) - CUDA_PATH := $(CUDA_PATH:/compilers=/cuda) - endif - endif - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - ifneq ($(CUDA_PATH),) - KOKKOS_LDFLAGS += -L$(CUDA_PATH)/lib64 - endif - KOKKOS_LIBS += -lcudart - endif - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) - KOKKOS_LIBS += -cuda - endif - ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1) - $(error If a GPU architecture is specified, KOKKOS_OPENACC_OPTIONS = force_host_as_device cannot be used. Disable the force_host_as_device option) - endif - else ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AMD), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - ifneq ($(ROCM_PATH),) - KOKKOS_CPPFLAGS += -I$(ROCM_PATH)/include - KOKKOS_LDFLAGS += -L$(ROCM_PATH)/lib - endif - KOKKOS_LIBS += -lamdhip64 - endif - ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1) - $(error If a GPU architecture is specified, KOKKOS_OPENACC_OPTIONS = force_host_as_device cannot be used. Disable the force_host_as_device option) - endif - else ifeq ($(KOKKOS_INTERNAL_OPENACC_FORCE_HOST_AS_DEVICE), 1) - # Compile for kernel execution on the host. In that case, - # memory is shared between the OpenACC space and the host space. - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) - KOKKOS_CXXFLAGS += -acc=multicore - endif - else - # Automatic fallback mode; try to offload any available GPU, and fall back - # to the host CPU if no available GPU is found. - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) - KOKKOS_CXXFLAGS += -acc=gpu,multicore - endif - endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) - KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenMP/*.cpp) - KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenMP/*.hpp) - - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - KOKKOS_CXXFLAGS += -Xcompiler $(KOKKOS_INTERNAL_OPENMP_FLAG) - else - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENMP_FLAG) - endif - - KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENMP_FLAG) - KOKKOS_LINK_FLAGS += $(KOKKOS_INTERNAL_OPENMP_FLAG) -endif - -ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) - KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/Threads/*.cpp) - KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/Threads/*.hpp) - KOKKOS_LIBS += -lpthread - 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) - ifneq ($(HPX_PATH),) - ifeq ($(KOKKOS_INTERNAL_ENABLE_DEBUG), 1) - KOKKOS_CXXFLAGS += $(shell PKG_CONFIG_PATH=$(HPX_PATH)/lib64/pkgconfig pkg-config --cflags hpx_application_debug) - KOKKOS_CXXLDFLAGS += $(shell PKG_CONFIG_PATH=$(HPX_PATH)/lib64/pkgconfig pkg-config --libs hpx_application_debug) - KOKKOS_LIBS += $(shell PKG_CONFIG_PATH=$(HPX_PATH)/lib64/pkgconfig pkg-config --libs hpx_application_debug) - else - KOKKOS_CXXFLAGS += $(shell PKG_CONFIG_PATH=$(HPX_PATH)/lib64/pkgconfig pkg-config --cflags hpx_application) - KOKKOS_CXXLDFLAGS += $(shell PKG_CONFIG_PATH=$(HPX_PATH)/lib64/pkgconfig pkg-config --libs hpx_application) - KOKKOS_LIBS += $(shell PKG_CONFIG_PATH=$(HPX_PATH)/lib64/pkgconfig pkg-config --libs hpx_application) - endif - else - ifeq ($(KOKKOS_INTERNAL_ENABLE_DEBUG), 1) - KOKKOS_CXXFLAGS += $(shell pkg-config --cflags hpx_application_debug) - KOKKOS_CXXLDFLAGS += $(shell pkg-config --libs hpx_application_debug) - KOKKOS_LIBS += $(shell pkg-config --libs hpx_application_debug) - else - KOKKOS_CXXFLAGS += $(shell pkg-config --cflags hpx_application) - KOKKOS_CXXLDFLAGS += $(shell pkg-config --libs hpx_application) - KOKKOS_LIBS += $(shell pkg-config --libs hpx_application) - endif - endif - KOKKOS_TPL_LIBRARY_NAMES += hpx -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 -# This is needed for gtest actually, not for Kokkos itself! -ifeq ($(KOKKOS_INTERNAL_OS_CYGWIN), 1) - KOKKOS_CXXFLAGS += -U__STRICT_ANSI__ -endif - -# Set KokkosExtraLibs and add -lkokkos to link line -KOKKOS_EXTRA_LIBS := ${KOKKOS_LIBS} -KOKKOS_LIBS := -lkokkos ${KOKKOS_LIBS} - -# Generating the header -DESUL_INTERNAL_CONFIG_TMP=Desul_Config.tmp -DESUL_CONFIG_HEADER=desul/atomics/Config.hpp -desul_append_header = $(shell echo $1 >> $(DESUL_INTERNAL_CONFIG_TMP)) -tmp := $(call desul_append_header, "// generated by on-demand build system by crtrott" > $(DESUL_INTERNAL_CONFIG_TMP)) -tmp := $(call desul_append_header, "$H""ifndef DESUL_ATOMICS_CONFIG_HPP_") -tmp := $(call desul_append_header, "$H""define DESUL_ATOMICS_CONFIG_HPP_") -tmp := $(call desul_append_header, "") -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_CUDA") -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_CUDA */") -endif -ifeq ($(KOKKOS_INTERNAL_CUDA_USE_RELOC), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_CUDA_SEPARABLE_COMPILATION") -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_CUDA_SEPARABLE_COMPILATION */") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_HIP") -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_HIP */") -endif -ifeq ($(KOKKOS_INTERNAL_HIP_USE_RELOC), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_HIP_SEPARABLE_COMPILATION") -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_HIP_SEPARABLE_COMPILATION */") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_SYCL") -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_SYCL */") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_OPENMP") -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENMP */") -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) - tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_OPENACC") - else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENACC */") - endif -else - tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENACC */") -endif -tmp := $(call desul_append_header, "") -tmp := $(call desul_append_header, "$H""endif") - -DESUL_INTERNAL_LS_CONFIG := $(shell ls $(DESUL_CONFIG_HEADER) 2>&1) - -ifeq ($(DESUL_INTERNAL_LS_CONFIG), $(DESUL_CONFIG_HEADER)) - DESUL_INTERNAL_NEW_CONFIG := $(strip $(shell diff $(DESUL_CONFIG_HEADER) $(DESUL_INTERNAL_CONFIG_TMP) | grep -c define)) -else - DESUL_INTERNAL_NEW_CONFIG := 1 -endif - -ifneq ($(DESUL_INTERNAL_NEW_CONFIG), 0) - tmp := $(shell mkdir -p desul/atomics) - tmp := $(shell cp $(DESUL_INTERNAL_CONFIG_TMP) $(DESUL_CONFIG_HEADER)) -endif - -# Setting up dependencies. - -KokkosCore_config.h: - -$(DESUL_CONFIG_HEADER): - -KOKKOS_CPP_DEPENDS := $(DESUL_CONFIG_HEADER) KokkosCore_config.h $(KOKKOS_HEADERS) - -# Tasking is deprecated -ifeq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) - TMP_KOKKOS_SRC := $(KOKKOS_SRC) - KOKKOS_SRC = $(patsubst %Task.cpp,, $(TMP_KOKKOS_SRC)) -endif - -KOKKOS_OBJ = $(KOKKOS_SRC:.cpp=.o) -KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ)) - -include $(KOKKOS_PATH)/Makefile.targets - -kokkos-clean: - rm -f $(KOKKOS_OBJ_LINK) $(DESUL_CONFIG_HEADER) $(DESUL_INTERNAL_CONFIG_TMP) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a KokkosCore_Config_SetupBackend.hpp \ - KokkosCore_Config_FwdBackend.hpp KokkosCore_Config_DeclareBackend.hpp KokkosCore_Config_DeclareBackend.tmp \ - KokkosCore_Config_FwdBackend.tmp KokkosCore_Config_SetupBackend.tmp - -libkokkos.a: $(KOKKOS_OBJ_LINK) $(KOKKOS_SRC) $(KOKKOS_HEADERS) - ar cr libkokkos.a $(KOKKOS_OBJ_LINK) - ranlib libkokkos.a - -print-cxx-flags: - echo "$(KOKKOS_CXXFLAGS)" - -KOKKOS_LINK_DEPENDS=libkokkos.a - -#we have carefully separated LDFLAGS from LIBS and LIBDIRS -#we have also separated CPPFLAGS from CXXFLAGS -#if this is not cmake, for backwards compatibility -#we just jam everything together into the CXXFLAGS and LDFLAGS -ifneq ($(KOKKOS_CMAKE), yes) - KOKKOS_CXXFLAGS += $(KOKKOS_CPPFLAGS) - KOKKOS_LDFLAGS += $(KOKKOS_LIBDIRS) -endif diff --git a/packages/kokkos/Makefile.targets b/packages/kokkos/Makefile.targets deleted file mode 100644 index 1e0285772bef..000000000000 --- a/packages/kokkos/Makefile.targets +++ /dev/null @@ -1,129 +0,0 @@ -Kokkos_UnorderedMap_impl.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/containers/src/impl/Kokkos_UnorderedMap_impl.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/containers/src/impl/Kokkos_UnorderedMap_impl.cpp -Kokkos_Core.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Core.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Core.cpp -Kokkos_CPUDiscovery.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_CPUDiscovery.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_CPUDiscovery.cpp -Kokkos_Error.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Error.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Error.cpp -Kokkos_Stacktrace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Stacktrace.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Stacktrace.cpp -Kokkos_ExecPolicy.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_ExecPolicy.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_ExecPolicy.cpp -Kokkos_Command_Line_Parsing.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Command_Line_Parsing.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Command_Line_Parsing.cpp -Kokkos_HostSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostSpace.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostSpace.cpp -Kokkos_hwloc.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_hwloc.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_hwloc.cpp -Kokkos_HostThreadTeam.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostThreadTeam.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostThreadTeam.cpp -Kokkos_HostBarrier.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostBarrier.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostBarrier.cpp -Kokkos_Profiling.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Profiling.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Profiling.cpp -Kokkos_SharedAlloc.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_SharedAlloc.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_SharedAlloc.cpp -Kokkos_MemoryPool.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_MemoryPool.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_MemoryPool.cpp -Kokkos_HostSpace_deepcopy.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HostSpace_deepcopy.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HostSpace_deepcopy.cpp -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 -Kokkos_Abort.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_Abort.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_Abort.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 -ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) -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 -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 -Kokkos_CudaSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_CudaSpace.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_CudaSpace.cpp -ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) -Kokkos_Cuda_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Cuda/Kokkos_Cuda_Task.cpp -endif -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) -Kokkos_SYCL.o : $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/SYCL/Kokkos_SYCL.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/SYCL/Kokkos_SYCL.cpp -Kokkos_SYCL_Space.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/SYCL/Kokkos_SYCL_Space.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/SYCL/Kokkos_SYCL_Space.cpp -Kokkos_SYCL_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/SYCL/Kokkos_SYCL_Instance.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/SYCL/Kokkos_SYCL_Instance.cpp -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) -Kokkos_HIP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP.cpp -Kokkos_HIP_SharedAllocationRecord.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp -Kokkos_HIP_DeepCopy.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_DeepCopy.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_DeepCopy.cpp -Kokkos_HIP_Space.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp -Kokkos_HIP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp -Kokkos_HIP_ZeroMemset.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp -Kokkos_HIP_IsXnack.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_IsXnack.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_IsXnack.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_Threads_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Threads/Kokkos_Threads_Instance.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Threads/Kokkos_Threads_Instance.cpp -Kokkos_Threads_Spinwait.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/Threads/Kokkos_Threads_Spinwait.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/Threads/Kokkos_Threads_Spinwait.cpp -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) -Kokkos_OpenMP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP.cpp -Kokkos_OpenMP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp -ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) -Kokkos_OpenMP_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Task.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMP/Kokkos_OpenMP_Task.cpp -endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) -Kokkos_HPX.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX.cpp -ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) -Kokkos_HPX_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX_Task.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HPX/Kokkos_HPX_Task.cpp -endif -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) -Kokkos_OpenMPTarget_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp -Kokkos_OpenMPTargetSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) -Kokkos_OpenACC.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC.cpp -Kokkos_OpenACCSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACCSpace.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACCSpace.cpp -Kokkos_OpenACC_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp -Kokkos_OpenACC_SharedAllocationRecord.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp -endif diff --git a/packages/kokkos/README.md b/packages/kokkos/README.md index 7c5f03d76537..c0f917cde355 100644 --- a/packages/kokkos/README.md +++ b/packages/kokkos/README.md @@ -24,7 +24,7 @@ To start learning about Kokkos: - [Programming guide](https://kokkos.org/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.org/kokkos-core-wiki/): organized by category, i.e., [core](https://kokkos.org/kokkos-core-wiki/API/core-index.html), [algorithms](https://kokkos.org/kokkos-core-wiki/API/algorithms-index.html) and [containers](https://kokkos.org/kokkos-core-wiki/API/containers-index.html) or, if you prefer, in [alphabetical order](https://kokkos.org/kokkos-core-wiki/API/alphabetical.html). +- [API reference](https://kokkos.org/kokkos-core-wiki/): organized by category, i.e., [core](https://kokkos.org/kokkos-core-wiki/API/core-index.html), [algorithms](https://kokkos.org/kokkos-core-wiki/API/algorithms-index.html), [containers](https://kokkos.org/kokkos-core-wiki/API/containers-index.html), and [simd](https://kokkos.org/kokkos-core-wiki/API/simd-index.html). - [Use cases and Examples](https://kokkos.org/kokkos-core-wiki/tutorials-and-examples/use-cases-and-examples.html): a serie of examples ranging from how to use Kokkos with MPI to Fortran interoperability. @@ -32,23 +32,25 @@ To start learning about Kokkos: The latest release of Kokkos can be obtained from the [GitHub releases page](https://github.com/kokkos/kokkos/releases/latest). -The current release is [4.7.00](https://github.com/kokkos/kokkos/releases/tag/4.7.00). +The current release is [5.1.0](https://github.com/kokkos/kokkos/releases/tag/5.1.0). ```bash -curl -OJ -L https://github.com/kokkos/kokkos/releases/download/4.7.00/kokkos-4.7.00.tar.gz +curl -OJ -L https://github.com/kokkos/kokkos/releases/download/5.1.0/kokkos-5.1.0.tar.gz # Or with wget -wget https://github.com/kokkos/kokkos/releases/download/4.7.00/kokkos-4.7.00.tar.gz +wget https://github.com/kokkos/kokkos/releases/download/5.1.0/kokkos-5.1.0.tar.gz +# Or with git +git clone --depth=2 --branch 5.1.0 https://github.com/kokkos/kokkos.git ``` To clone the latest development version of Kokkos from GitHub: ```bash -git clone -b develop https://github.com/kokkos/kokkos.git +git clone --branch develop https://github.com/kokkos/kokkos.git ``` ### Building Kokkos -To build Kokkos, you will need to have a C++ compiler that supports C++17 or later. +To build Kokkos, you will need to have a C++ compiler that supports C++20 or later. All requirements including minimum and primary tested compiler versions can be found [here](https://kokkos.org/kokkos-core-wiki/get-started/requirements.html). Building and installation instructions are described [here](https://kokkos.org/kokkos-core-wiki/get-started/building-from-source.html#configuring-and-building-kokkos). @@ -75,8 +77,5 @@ Please see the [following page](https://kokkos.org/kokkos-core-wiki/citation.htm [![License](https://img.shields.io/badge/License-Apache--2.0_WITH_LLVM--exception-blue)](https://spdx.org/licenses/LLVM-exception.html) -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.org/kokkos-core-wiki/license.html) or [here](https://github.com/kokkos/kokkos/blob/develop/LICENSE). diff --git a/packages/kokkos/Spack.md b/packages/kokkos/Spack.md deleted file mode 100644 index 06c763a64ee0..000000000000 --- a/packages/kokkos/Spack.md +++ /dev/null @@ -1,268 +0,0 @@ -![Kokkos](https://avatars2.githubusercontent.com/u/10199860?s=200&v=4) - -# Kokkos Spack - -This gives instructions for using Spack to install Kokkos and developing packages that depend on Kokkos. - -## Getting Started - -Make sure you have downloaded [Spack](https://github.com/spack/spack). -The easiest way to configure the Spack environment is: -````bash -> source spack/share/spack/setup-env.sh -```` -with other scripts available for other shells. -You can display information about how to install packages with: -````bash -> spack info kokkos -```` -This will print all the information about how to install Kokkos with Spack. -For detailed instructions on how to use Spack, see the [User Manual](https://spack.readthedocs.io). - -## Setting Up Spack: Avoiding the Package Cascade -By default, Spack doesn't 'see' anything on your system - including things like CMake and CUDA. -This can be limited by adding a `packages.yaml` to your `$HOME/.spack` folder that includes CMake (and CUDA, if applicable). For example, your `packages.yaml` file could be: -````yaml -packages: - cuda: - buildable: false - externals: - - prefix: /opt/local/ppc64le-pwr8-nvidia/cuda/10.1.243 - spec: cuda@10.1.243 - - modules: - - cuda/10.1.243 - spec: cuda@10.1.243 - cmake: - buildable: false - externals: - - prefix: /opt/local/ppc64le/cmake/3.16.8 - spec: cmake@3.16.8 - - modules: - - cmake/3.16.8 - spec: cmake@3.16.8 -```` -The `modules` entry is only necessary on systems that require loading Modules (i.e. most DOE systems). -The `buildable` flag is useful to make sure Spack crashes if there is a path error, -rather than having a type-o and Spack rebuilding everything because `cmake` isn't found. -You can verify your environment is set up correctly by running `spack graph` or `spack spec`. -For example: -````bash -> spack graph kokkos +cuda -o kokkos -|\ -o | cuda - / -o cmake -```` -Without the existing CUDA and CMake being identified in `packages.yaml`, a (subset!) of the output would be: -````bash -o kokkos -|\ -| o cmake -| |\ -| | | |\ -| | | | | |\ -| | | | | | | |\ -| | | | | | | | | |\ -| | | | | | | o | | | libarchive -| | | | | | | |\ \ \ \ -| | | | | | | | | |\ \ \ \ -| | | | | | | | | | | | |_|/ -| | | | | | | | | | | |/| | -| | | | | | | | | | | | | o curl -| | |_|_|_|_|_|_|_|_|_|_|/| -| |/| | | |_|_|_|_|_|_|_|/ -| | | | |/| | | | | | | | -| | | | o | | | | | | | | openssl -| |/| | | | | | | | | | | -| | | | | | | | | | o | | libxml2 -| | |_|_|_|_|_|_|_|/| | | -| | | | | | | | | | |\ \ \ -| o | | | | | | | | | | | | zlib -| / / / / / / / / / / / / -| o | | | | | | | | | | | xz -| / / / / / / / / / / / -| o | | | | | | | | | | rhash -| / / / / / / / / / / -| | | | o | | | | | | nettle -| | | | |\ \ \ \ \ \ \ -| | | o | | | | | | | | libuv -| | | | o | | | | | | | autoconf -| | |_|/| | | | | | | | -| | | | |/ / / / / / / -| o | | | | | | | | | perl -| o | | | | | | | | | gdbm -| o | | | | | | | | | readline -```` - -## Configuring Kokkos as a Project Dependency -Say you have a project "SuperScience" which needs to use Kokkos. -In your `package.py` file, you would generally include something like: -````python -class SuperScience(CMakePackage): - ... - depends_on("kokkos") -```` -Often projects want to tweak behavior when using certain features, e.g. -````python - depends_on("kokkos+cuda", when="+cuda") -```` -if your project needs CUDA-specific logic to configure and build. -This illustrates the general principle in Spack of "flowing-up". -A user requests a feature in the final app: -````bash -> spack install superscience+cuda -```` -This flows upstream to the Kokkos dependency, causing the `kokkos+cuda` variant to build. -The downstream app (SuperScience) tells the upstream app (Kokkos) how to build. - -Because Kokkos is a performance portability library, it somewhat inverts this principle. -Kokkos "flows-down", telling your application how best to configure for performance. -Rather than a downstream app (SuperScience) telling the upstream (Kokkos) what variants to build, -a pre-built Kokkos should be telling the downstream app SuperScience what variants to use. -Kokkos works best when there is an "expert" configuration installed on your system. -Your build should simply request `-DKokkos_ROOT=` and configure appropriately based on the Kokkos it finds. - -Kokkos has many, many build variants. -Where possible, projects should only depend on a general Kokkos, not specific variants. -We recommend instead adding for each system you build on a Kokkos configuration to your `packages.yaml` file (usually found in `~/.spack` for specific users). -For a Xeon + Volta system, this could look like: -````yaml - kokkos: - variants: +cuda +openmp +cuda_lambda +wrapper ^cuda@10.1 cuda_arch=70 - compiler: [gcc@7.2.0] -```` -which gives the "best" Kokkos configuration as CUDA+OpenMP optimized for a Volta 70 architecture using CUDA 10.1. -It also enables support for CUDA Lambdas. -The `+wrapper` option tells Kokkos to build with the special `nvcc_wrapper` (more below). -Note here that we use the built-in `cuda_arch` variant of Spack to specify the archicture. -For a Haswell system, we use -````yaml - kokkos: - variants: +openmp std=14 target=haswell - compiler: [intel@18] -```` -which uses the built-in microarchitecture variants of Spack. -Consult the Spack documentation for more details of Spack microarchitectures -and CUDA architectures. -Spack does not currently provide an AMD GPU microarchitecture option. -If building for HIP or an AMD GPU, Kokkos provides an `amd_gpu_arch` similar to `cuda_arch`. -````yaml - kokkos: - variants: +hip amd_gpu_arch=vega900 -```` - -Without an optimal default in your `packages.yaml` file, it is highly likely that the default Kokkos configuration you get will not be what you want. -For example, CUDA is not enabled by default (there is no easy logic to conditionally activate this for CUDA-enabled systems). -If you don't specify a CUDA build variant in a `packages.yaml` and you build your Kokkos-dependent project: -````bash -> spack install superscience -```` -you may end up just getting the default Kokkos (i.e. Serial). -Before running `spack install ` we recommend running `spack spec ` to confirm your dependency tree is correct. -For example, with Kokkos Kernels: -````bash -kokkos-kernels@3.0%gcc@8.3.0~blas build_type=RelWithDebInfo ~cblas~complex_double~complex_float~cublas~cuda cuda_arch=none ~cusparse~diy+double execspace_cuda=auto execspace_openmp=auto execspace_serial=auto execspace_threads=auto ~float~lapack~lapacke+layoutleft~layoutright memspace_cudaspace=auto memspace_cudauvmspace=auto +memspace_hostspace~mkl+offset_int+offset_size_t~openmp+ordinal_int~ordinal_int64_t~serial~superlu arch=linux-rhel7-skylake_avx512 - ^cmake@3.16.2%gcc@8.3.0~doc+ncurses+openssl+ownlibs~qt arch=linux-rhel7-skylake_avx512 - ^kokkos@3.0%gcc@8.3.0~aggressive_vectorization~amdavx~armv80~armv81~armv8_thunderx~armv8_tx2~bdw~bgq build_type=RelWithDebInfo ~carrizo~compiler_warnings+cuda cuda_arch=none +cuda_lambda~cuda_ldg_intrinsic~cuda_relocatable_device_code~cuda_uvm~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~diy~epyc~examples~explicit_instantiation~fiji~gfx901~hpx~hpx_async_dispatch~hsw~hwloc~kaveri~kepler30~kepler32~kepler35~kepler37~knc~knl~maxwell50~maxwell52~maxwell53~memkind~numactl+openmp~pascal60~pascal61~power7~power8~power9+profiling~profiling_load_print~pthread~qthread~rocm~ryzen~serial~skx~snb std=14 ~tests~turing75~vega+volta70~volta72+wrapper~wsm arch=linux-rhel7-skylake_avx512 - ^cuda@10.1%gcc@8.3.0 arch=linux-rhel7-skylake_avx512 - ^kokkos-nvcc-wrapper@old%gcc@8.3.0 build_type=RelWithDebInfo +mpi arch=linux-rhel7-skylake_avx512 - ^openmpi@4.0.2%gcc@8.3.0~cuda+cxx_exceptions fabrics=none ~java~legacylaunchers~memchecker patches=073477a76bba780c67c36e959cd3ee6910743e2735c7e76850ffba6791d498e4 ~pmi schedulers=none ~sqlite3~thread_multiple+vt arch=linux-rhel7-skylake_avx512 -```` -The output can be very verbose, but we can verify the expected `kokkos`: -````bash -kokkos@3.0%gcc@8.3.0~aggressive_vectorization~amdavx~armv80~armv81~armv8_thunderx~armv8_tx2~bdw~bgq build_type=RelWithDebInfo ~carrizo~compiler_warnings+cuda cuda_arch=none +cuda_lambda~cuda_ldg_intrinsic~cuda_relocatable_device_code~cuda_uvm~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~diy~epyc~examples~explicit_instantiation~fiji~gfx901~hpx~hpx_async_dispatch~hsw~hwloc~kaveri~kepler30~kepler32~kepler35~kepler37~knc~knl~maxwell50~maxwell52~maxwell53~memkind~numactl+openmp~pascal60~pascal61~power7~power8~power9+profiling~profiling_load_print~pthread~qthread~rocm~ryzen~serial~skx~snb std=11 ~tests~turing75~vega+volta70~volta72+wrapper~wsm arch=linux-rhel7-skylake_avx512 -```` -We see that we do have `+volta70` and `+wrapper`, e.g. - -### Spack Environments -The encouraged way to use Spack is with Spack environments ([more details here](https://spack-tutorial.readthedocs.io/en/latest/tutorial_environments.html#dealing-with-many-specs-at-once)). -Rather than installing packages one-at-a-time, you add packages to an environment. -After adding all packages, you concretize and install them all. -Using environments, one can explicitly add a desired Kokkos for the environment, e.g. -````bash -> spack add kokkos +cuda +cuda_lambda +volta70 -> spack add my_project +my_variant -> ... -> spack install -```` -All packages within the environment will build against the CUDA-enabled Kokkos, -even if they only request a default Kokkos. - -## NVCC Wrapper -Kokkos is a C++ project, but often builds for the CUDA backend. -This is particularly problematic with CMake. At this point, `nvcc` does not accept all the flags that normally get passed to a C++ compiler. -Kokkos provides `nvcc_wrapper` that identifies correctly as a C++ compiler to CMake and accepts C++ flags, but uses `nvcc` as the underlying compiler. -`nvcc` itself also uses an underlying host compiler, e.g. GCC. - -In Spack, the underlying host compiler is specified as below, e.g.: -````bash -> spack install package %gcc@8.0.0 -```` -This is still valid for Kokkos. To use the special wrapper for CUDA builds, request a desired compiler and simply add the `+wrapper` variant. -````bash -> spack install kokkos +cuda +wrapper %gcc@7.2.0 -```` -Downstream projects depending on Kokkos need to override their compiler. -Kokkos provides the compiler in a `kokkos_cxx` variable, -which points to either `nvcc_wrapper` when needed or the regular compiler otherwise. -Spack projects already do this to use MPI compiler wrappers. -````python -def cmake_args(self): - options = [] - ... - options.append("-DCMAKE_CXX_COMPILER=%s" % self.spec["kokkos"].kokkos_cxx) - ... - return options -```` -Note: `nvcc_wrapper` works with the MPI compiler wrappers. -If building your project with MPI, do NOT set your compiler to `nvcc_wrapper`. -Instead set your compiler to `mpicxx` and `nvcc_wrapper` will be used under the hood. -````python -def cmake_args(self): - options = [] - ... - options.append("-DCMAKE_CXX_COMPILER=%s" % self.spec["mpi"].mpicxx) - ... - return options -```` -To accomplish this, `nvcc_wrapper` must depend on MPI (even though it uses no MPI). -This has the unfortunate consequence that Kokkos CUDA projects not using MPI will implicitly depend on MPI anyway. -This behavior is necessary for now, but will hopefully be removed later. -When using environments, if MPI is not needed, you can remove the MPI dependency with: -````bash -> spack add kokkos-nvcc-wrapper ~mpi -```` - -## Developing With Spack - -Spack has historically been much more suited to *deployment* of mature packages than active testing or developing. -However, recent features have improved support for development. -Future releases are likely to make this even easier and incorporate Git integration. -The most common commands will do a full build and install of the packages. -If doing development, you may wish to merely set up a build environment. -This allows you to modify the source and re-build. -In this case, you can stop after configuring. -Suppose you have Kokkos checkout in the folder `kokkos-src`: -````bash -> spack dev-build -d kokkos-src -u cmake kokkos@develop +wrapper +openmp -```` -This sets up a development environment for you in `kokkos-src` which you can use (Bash example shown): -Note: Always specify `develop` as the version when doing `dev-build`, except in rare cases. -You are usually developing a feature branch that will merge into `develop`, -hence you are making a new `develop` branch. - -````bash -> cd kokko-src -> source spack-build-env.txt -> cd spack-build -> make -```` -Before sourcing the Spack development environment, you may wish to save your current environment: -````bash -> declare -px > myenv.sh -```` -When done with Spack, you can then restore your original environment: -````bash -> source myenv.sh -```` diff --git a/packages/kokkos/algorithms/CMakeLists.txt b/packages/kokkos/algorithms/CMakeLists.txt index e257e4ccce00..26d9b1386c15 100644 --- a/packages/kokkos/algorithms/CMakeLists.txt +++ b/packages/kokkos/algorithms/CMakeLists.txt @@ -2,10 +2,8 @@ if(NOT Kokkos_INSTALL_TESTING) add_subdirectory(src) endif() # FIXME_OPENACC: temporarily disabled due to unimplemented features -if(NOT ((KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) OR KOKKOS_ENABLE_OPENACC)) +if(NOT KOKKOS_ENABLE_OPENACC) kokkos_add_test_directories(unit_tests) endif() -if(Kokkos_ENABLE_BENCHMARKS) - add_subdirectory(perf_test) -endif() +kokkos_add_benchmark_directories(perf_test) diff --git a/packages/kokkos/algorithms/perf_test/CMakeLists.txt b/packages/kokkos/algorithms/perf_test/CMakeLists.txt index a41d3f891b10..0b56debf3d04 100644 --- a/packages/kokkos/algorithms/perf_test/CMakeLists.txt +++ b/packages/kokkos/algorithms/perf_test/CMakeLists.txt @@ -1,63 +1,2 @@ -# FIXME: The following logic should be moved from here and also from `core/perf_test/CMakeLists.txt` to -# the root `CMakeLists.txt` in the form of a macro -# Find or download google/benchmark library -find_package(benchmark QUIET 1.5.6) -if(benchmark_FOUND) - message(STATUS "Using google benchmark found in ${benchmark_DIR}") -else() - message(STATUS "No installed google benchmark found, fetching from GitHub") - include(FetchContent) - set(BENCHMARK_ENABLE_TESTING OFF) - - list(APPEND CMAKE_MESSAGE_INDENT "[benchmark] ") - FetchContent_Declare( - googlebenchmark - DOWNLOAD_EXTRACT_TIMESTAMP FALSE - URL https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz - URL_HASH MD5=0459a6c530df9851bee6504c3e37c2e7 - ) - FetchContent_MakeAvailable(googlebenchmark) - list(POP_BACK CMAKE_MESSAGE_INDENT) - - # Suppress clang-tidy diagnostics on code that we do not have control over - if(CMAKE_CXX_CLANG_TIDY) - set_target_properties(benchmark PROPERTIES CXX_CLANG_TIDY "") - endif() - - # FIXME: Check whether the following target_compile_options are needed. - # If so, clarify why. - target_compile_options(benchmark PRIVATE -w) - target_compile_options(benchmark_main PRIVATE -w) -endif() - -# FIXME: This function should be moved from here and also from `core/perf_test/CMakeLists.txt` to -# the root `CMakeLists.txt` -# FIXME: Could NAME be a one_value_keyword specified in cmake_parse_arguments? -function(KOKKOS_ADD_BENCHMARK NAME) - cmake_parse_arguments(BENCHMARK "" "" "SOURCES" ${ARGN}) - if(DEFINED BENCHMARK_UNPARSED_ARGUMENTS) - message(WARNING "Unexpected arguments when adding a benchmark: " ${BENCHMARK_UNPARSED_ARGUMENTS}) - endif() - - set(BENCHMARK_NAME Kokkos_${NAME}) - # FIXME: BenchmarkMain.cpp and Benchmark_Context.cpp should be moved to a common location from which - # they can be used by all performance tests. - list(APPEND BENCHMARK_SOURCES ../../core/perf_test/BenchmarkMain.cpp ../../core/perf_test/Benchmark_Context.cpp) - - add_executable(${BENCHMARK_NAME} ${BENCHMARK_SOURCES}) - target_link_libraries(${BENCHMARK_NAME} PRIVATE benchmark::benchmark Kokkos::kokkos impl_git_version) - target_include_directories(${BENCHMARK_NAME} SYSTEM PRIVATE ${benchmark_SOURCE_DIR}/include) - - # FIXME: This alone will not work. It might need an architecture and standard which need to be defined on target level. - # It will potentially go away with #7582. - foreach(SOURCE_FILE ${BENCHMARK_SOURCES}) - set_source_files_properties(${SOURCE_FILE} PROPERTIES LANGUAGE ${KOKKOS_COMPILE_LANGUAGE}) - endforeach() - - string(TIMESTAMP BENCHMARK_TIME "%Y-%m-%d_T%H-%M-%S" UTC) - set(BENCHMARK_ARGS --benchmark_counters_tabular=true --benchmark_out=${BENCHMARK_NAME}_${BENCHMARK_TIME}.json) - - add_test(NAME ${BENCHMARK_NAME} COMMAND ${BENCHMARK_NAME} ${BENCHMARK_ARGS}) -endfunction() - kokkos_add_benchmark(PerformanceTest_InclusiveScan SOURCES test_inclusive_scan.cpp) +kokkos_add_benchmark(PerformanceTest_Random SOURCES test_random.cpp) diff --git a/packages/kokkos/algorithms/perf_test/test_inclusive_scan.cpp b/packages/kokkos/algorithms/perf_test/test_inclusive_scan.cpp index 9a8e89cc483a..e2e85586d2a7 100644 --- a/packages/kokkos/algorithms/perf_test/test_inclusive_scan.cpp +++ b/packages/kokkos/algorithms/perf_test/test_inclusive_scan.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -23,11 +10,12 @@ #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.std_algorithms; #else +#include #include #endif -#include #include // FIXME: Benchmark_Context.hpp should be moved to a common location #include "../../core/perf_test/Benchmark_Context.hpp" diff --git a/packages/kokkos/algorithms/perf_test/test_random.cpp b/packages/kokkos/algorithms/perf_test/test_random.cpp new file mode 100644 index 000000000000..c98442ed6bdb --- /dev/null +++ b/packages/kokkos/algorithms/perf_test/test_random.cpp @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include +#include +#include +// FIXME: Benchmark_Context.hpp should be moved to a common location +#include "../../core/perf_test/Benchmark_Context.hpp" + +namespace Benchmark { + +// Fills each entry of +// * a view of size N +// * with the sum of K random numbers +template +static void Random(benchmark::State &state) { + const size_t N = state.range(0); + const size_t K = state.range(1); + constexpr double I = 1024; + + Kokkos::View out("out", N); + Pool random_pool(/*seed=*/12345); + + for ([[maybe_unused]] auto _ : state) { + Kokkos::parallel_for( + N, KOKKOS_LAMBDA(const int i) { + auto generator = random_pool.get_state(); + double acc = 0; + + for (size_t k = 0; k < K; ++k) { + acc += generator.drand(I); + } + random_pool.free_state(generator); + out(i) = acc; + }); + Kokkos::fence(); + } + + state.counters[KokkosBenchmark::benchmark_fom("rate")] = benchmark::Counter( + state.iterations() * N * K, benchmark::Counter::kIsRate); +} + +static void Random64(benchmark::State &state) { + return Random>(state); +} + +static void Random1024(benchmark::State &state) { + return Random>(state); +} + +#define RANDOM_ARGS() \ + ArgNames({"N", "K"}) \ + ->ArgsProduct({{1 << 21}, {1, 256}}) \ + ->UseRealTime() \ + ->Unit(benchmark::kMicrosecond) + +BENCHMARK(Random64)->RANDOM_ARGS(); +BENCHMARK(Random1024)->RANDOM_ARGS(); + +#undef RANDOM_ARGS + +} // namespace Benchmark diff --git a/packages/kokkos/algorithms/src/CMakeLists.txt b/packages/kokkos/algorithms/src/CMakeLists.txt index 2802b8e76309..72a8a920e988 100644 --- a/packages/kokkos/algorithms/src/CMakeLists.txt +++ b/packages/kokkos/algorithms/src/CMakeLists.txt @@ -22,6 +22,7 @@ install( kokkos_add_library( kokkosalgorithms + STATIC # MSVC can't deal with empty shared libraries HEADERS ${ALGO_HEADERS} MODULE_INTERFACE diff --git a/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp b/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp index ddd6374483ec..6c19a1f1d293 100644 --- a/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp +++ b/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp @@ -1,17 +1,4 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project void KOKKOS_ALGORITHMS_SRC_DUMMY_PREVENT_LINK_ERROR() {} diff --git a/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp b/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp index 18e0674efea2..8cc0be59bd51 100644 --- a/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_NESTED_SORT_HPP_ #define KOKKOS_NESTED_SORT_HPP_ diff --git a/packages/kokkos/algorithms/src/Kokkos_Random.cppm b/packages/kokkos/algorithms/src/Kokkos_Random.cppm index b94f003ab63e..e2ba35d86d33 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Random.cppm +++ b/packages/kokkos/algorithms/src/Kokkos_Random.cppm @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project module; diff --git a/packages/kokkos/algorithms/src/Kokkos_Random.hpp b/packages/kokkos/algorithms/src/Kokkos_Random.hpp index 236ec22e7736..dd2cd18ebc91 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Random.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_Random.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_RANDOM_HPP #define KOKKOS_RANDOM_HPP @@ -21,7 +8,13 @@ #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM #endif +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.core_impl; +#else #include +#endif #include #include #include @@ -77,13 +70,24 @@ namespace Kokkos { //Default constructor: does not initialize a pool Pool(); - //Initializing constructor: calls init(seed,Device_Specific_Number); - Pool(unsigned int seed); + //Initializing constructor + //Initialize Pool with seed as a starting seed + Pool(uint64_t seed); - //Initialize Pool with seed as a starting seed with a pool_size of num_states - //The Random_XorShift64 generator is used in serial to initialize all states, + //Initializing constructor + //Initialize Pool with seed as a starting seed and a pool_size of num_states + //Note: The generator is used in serial to initialize all states, //thus the initialization process is platform independent and deterministic. - void init(unsigned int seed, int num_states); + Pool(uint64_t seed, uint64_t num_states); + + //Initializing constructor + //Initialize Pool with seed as a starting seed using the specified execution space instance + Pool(const execution_space& exec, uint64_t seed); + + //Initializing constructor + //Initialize Pool with seed as a starting seed with a pool_size of num_states using the + //specified execution space instance + Pool(const execution_space& exec, uint64_t seed, uint64_t num_states); //Get a generator. This will lock one of the states, guaranteeing that each thread //will have its private generator. Note: on Cuda getting a state involves atomics, @@ -585,7 +589,7 @@ struct Random_XorShift1024_State { template KOKKOS_FUNCTION Random_XorShift1024_State(const StateViewType& v, int state_idx) - : state_(&v(state_idx, 0)), stride_(v.stride_1()) {} + : state_(&v(state_idx, 0)), stride_(v.stride(1)) {} // NOLINTBEGIN(bugprone-implicit-widening-of-multiplication-result) KOKKOS_FUNCTION @@ -607,11 +611,6 @@ struct Random_XorShift1024_UseCArrayState : std::false_type {}; template <> struct Random_XorShift1024_UseCArrayState : std::false_type {}; #endif -#ifdef KOKKOS_ENABLE_OPENMPTARGET -template <> -struct Random_XorShift1024_UseCArrayState - : std::false_type {}; -#endif #ifdef KOKKOS_ENABLE_OPENACC template <> struct Random_XorShift1024_UseCArrayState @@ -712,28 +711,6 @@ struct Random_UniqueIndex> { }; #endif -#ifdef KOKKOS_ENABLE_OPENMPTARGET -template -struct Random_UniqueIndex< - Kokkos::Device> { - using locks_view_type = - View>; - KOKKOS_FUNCTION - static int get_state_idx(const locks_view_type& locks) { - const int team_size = omp_get_num_threads(); - int i = omp_get_team_num() * team_size + omp_get_thread_num(); - const int lock_size = locks.extent_int(0); - - i %= lock_size; - while (Kokkos::atomic_compare_exchange(&locks(i, 0), 0, 1)) { - i = (i + 1) % lock_size; - } - return i; - } -}; -#endif - #ifdef KOKKOS_ENABLE_OPENACC template struct Random_UniqueIndex< @@ -928,44 +905,30 @@ class Random_XorShift64_Pool { public: using generator_type = Random_XorShift64; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool() = default; - - KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool( - Random_XorShift64_Pool const&) = default; - - KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool& operator=( - Random_XorShift64_Pool const&) = default; -#else - Random_XorShift64_Pool() = default; -#endif + Random_XorShift64_Pool() = default; Random_XorShift64_Pool(uint64_t seed) { - init(execution_space(), seed, execution_space().concurrency()); + init_impl(execution_space(), seed, execution_space().concurrency()); execution_space().fence("Random_XorShift64_Pool: Constructor"); } Random_XorShift64_Pool(uint64_t seed, uint64_t num_states) { - init(execution_space(), seed, num_states); + init_impl(execution_space(), seed, num_states); execution_space().fence("Random_XorShift64_Pool: Constructor"); } Random_XorShift64_Pool(const execution_space& exec, uint64_t seed) { - init(exec, seed, exec.concurrency()); + init_impl(exec, seed, exec.concurrency()); } Random_XorShift64_Pool(const execution_space& exec, uint64_t seed, uint64_t num_states) { - init(exec, seed, num_states); - } - - void init(uint64_t seed, uint64_t num_states) { - init(execution_space(), seed, num_states); - execution_space().fence("Random_XorShift64_Pool::init"); + init_impl(exec, seed, num_states); } private: - void init(execution_space const& exec, uint64_t seed, uint64_t num_states) { + void init_impl(execution_space const& exec, uint64_t seed, + uint64_t num_states) { num_states_ = num_states; if (seed == 0) seed = uint64_t(1318319); @@ -980,9 +943,9 @@ class Random_XorShift64_Pool { state_data_type(view_alloc(exec, "Kokkos::Random_XorShift64::state"), num_states_, padding_); - typename state_data_type::HostMirror h_state = + typename state_data_type::host_mirror_type h_state = Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state_); - typename locks_type::HostMirror h_lock = + typename locks_type::host_mirror_type h_lock = Kokkos::create_mirror_view(Kokkos::WithoutInitializing, locks_); // if the host mirror is the device view, need to fence here @@ -990,8 +953,9 @@ class Random_XorShift64_Pool { if (state_.data() == h_state.data()) exec.fence("Random_XorShift64_Pool::init UnifiedMemory"); - // Execute on the HostMirror's default execution space. - Random_XorShift64 + // Execute on the host_mirror_type's default execution space. + Random_XorShift64< + typename state_data_type::host_mirror_type::execution_space> gen(seed, 0); for (int i = 0; i < 17; i++) gen.rand(); for (int i = 0; i < num_states_; i++) { @@ -1204,44 +1168,30 @@ class Random_XorShift1024_Pool { public: using generator_type = Random_XorShift1024; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool() = default; - - KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool( - Random_XorShift1024_Pool const&) = default; - - KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool& operator=( - Random_XorShift1024_Pool const&) = default; -#else Random_XorShift1024_Pool() = default; -#endif Random_XorShift1024_Pool(uint64_t seed) { - init(execution_space(), seed, execution_space().concurrency()); + init_impl(execution_space(), seed, execution_space().concurrency()); execution_space().fence("Random_XorShift1024_Pool: Constructor"); } Random_XorShift1024_Pool(uint64_t seed, uint64_t num_states) { - init(execution_space(), seed, num_states); + init_impl(execution_space(), seed, num_states); execution_space().fence("Random_XorShift1024_Pool: Constructor"); } Random_XorShift1024_Pool(const execution_space& exec, uint64_t seed) { - init(exec, seed, exec.concurrency()); + init_impl(exec, seed, exec.concurrency()); } Random_XorShift1024_Pool(const execution_space& exec, uint64_t seed, uint64_t num_states) { - init(exec, seed, num_states); - } - - void init(uint64_t seed, uint64_t num_states) { - init(execution_space(), seed, num_states); - execution_space().fence("Random_XorShift1024_Pool::init"); + init_impl(exec, seed, num_states); } private: - void init(execution_space const& exec, uint64_t seed, uint64_t num_states) { + void init_impl(execution_space const& exec, uint64_t seed, + uint64_t num_states) { num_states_ = num_states; if (seed == 0) seed = uint64_t(1318319); @@ -1256,11 +1206,11 @@ class Random_XorShift1024_Pool { p_ = int_view_type(view_alloc(exec, "Kokkos::Random_XorShift1024::p"), num_states_, padding_); - typename state_data_type::HostMirror h_state = + typename state_data_type::host_mirror_type h_state = Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state_); - typename locks_type::HostMirror h_lock = + typename locks_type::host_mirror_type h_lock = Kokkos::create_mirror_view(Kokkos::WithoutInitializing, locks_); - typename int_view_type::HostMirror h_p = + typename int_view_type::host_mirror_type h_p = Kokkos::create_mirror_view(Kokkos::WithoutInitializing, p_); // if the host mirror is the device view, need to fence here @@ -1268,8 +1218,9 @@ class Random_XorShift1024_Pool { if (state_.data() == h_state.data()) exec.fence("Random_XorShift1024_Pool::init UnifiedMemory"); - // Execute on the HostMirror's default execution space. - Random_XorShift64 + // Execute on the host_mirror_type's default execution space. + Random_XorShift64< + typename state_data_type::host_mirror_type::execution_space> gen(seed, 0); for (int i = 0; i < 17; i++) gen.rand(); for (int i = 0; i < num_states_; i++) { diff --git a/packages/kokkos/algorithms/src/Kokkos_Sort.cppm b/packages/kokkos/algorithms/src/Kokkos_Sort.cppm index be3eb233448a..fd5e752b8a59 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Sort.cppm +++ b/packages/kokkos/algorithms/src/Kokkos_Sort.cppm @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project module; diff --git a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp index 136b4ec82dcd..88c549362540 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_SORT_HPP_ #define KOKKOS_SORT_HPP_ diff --git a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.cppm b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.cppm index ce3e37a6db03..6e8269420e4c 100644 --- a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.cppm +++ b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.cppm @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project module; diff --git a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp index b532a774e130..219ca0a7f2b5 100644 --- a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_HPP #define KOKKOS_STD_ALGORITHMS_HPP diff --git a/packages/kokkos/algorithms/src/sorting/Kokkos_BinOpsPublicAPI.hpp b/packages/kokkos/algorithms/src/sorting/Kokkos_BinOpsPublicAPI.hpp index b093b72ad64c..ddc4e4bfdf40 100644 --- a/packages/kokkos/algorithms/src/sorting/Kokkos_BinOpsPublicAPI.hpp +++ b/packages/kokkos/algorithms/src/sorting/Kokkos_BinOpsPublicAPI.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_BIN_OPS_PUBLIC_API_HPP_ #define KOKKOS_BIN_OPS_PUBLIC_API_HPP_ @@ -28,11 +15,7 @@ struct BinOp1D { double mul_ = {}; double min_ = {}; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED BinOp1D() = default; -#else BinOp1D() = delete; -#endif // Construct BinOp with number of bins, minimum value and maximum value BinOp1D(int max_bins, typename KeyViewType::const_value_type min, @@ -76,11 +59,7 @@ struct BinOp3D { double mul_[3] = {}; double min_[3] = {}; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED BinOp3D() = default; -#else BinOp3D() = delete; -#endif BinOp3D(int max_bins[], typename KeyViewType::const_value_type min[], typename KeyViewType::const_value_type max[]) { diff --git a/packages/kokkos/algorithms/src/sorting/Kokkos_BinSortPublicAPI.hpp b/packages/kokkos/algorithms/src/sorting/Kokkos_BinSortPublicAPI.hpp index f417b6b13b3c..0c0747fbce0f 100644 --- a/packages/kokkos/algorithms/src/sorting/Kokkos_BinSortPublicAPI.hpp +++ b/packages/kokkos/algorithms/src/sorting/Kokkos_BinSortPublicAPI.hpp @@ -1,25 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_BIN_SORT_PUBLIC_API_HPP_ #define KOKKOS_BIN_SORT_PUBLIC_API_HPP_ #include "Kokkos_BinOpsPublicAPI.hpp" #include "impl/Kokkos_CopyOpsForBinSortImpl.hpp" +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include namespace Kokkos { @@ -144,11 +136,7 @@ class BinSort { bool sort_within_bins; public: -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED BinSort() = default; -#else BinSort() = delete; -#endif //---------------------------------------- // Constructor: takes the keys, the binning_operator and optionally whether to diff --git a/packages/kokkos/algorithms/src/sorting/Kokkos_NestedSortPublicAPI.hpp b/packages/kokkos/algorithms/src/sorting/Kokkos_NestedSortPublicAPI.hpp index dd468e07342c..afa9743fc21e 100644 --- a/packages/kokkos/algorithms/src/sorting/Kokkos_NestedSortPublicAPI.hpp +++ b/packages/kokkos/algorithms/src/sorting/Kokkos_NestedSortPublicAPI.hpp @@ -1,24 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_NESTED_SORT_PUBLIC_API_HPP_ #define KOKKOS_NESTED_SORT_PUBLIC_API_HPP_ #include "impl/Kokkos_NestedSortImpl.hpp" +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include namespace Kokkos { diff --git a/packages/kokkos/algorithms/src/sorting/Kokkos_SortByKeyPublicAPI.hpp b/packages/kokkos/algorithms/src/sorting/Kokkos_SortByKeyPublicAPI.hpp index fc73eccad68c..056fb6afa5a0 100644 --- a/packages/kokkos/algorithms/src/sorting/Kokkos_SortByKeyPublicAPI.hpp +++ b/packages/kokkos/algorithms/src/sorting/Kokkos_SortByKeyPublicAPI.hpp @@ -1,24 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_SORT_BY_KEY_PUBLIC_API_HPP_ #define KOKKOS_SORT_BY_KEY_PUBLIC_API_HPP_ #include "./impl/Kokkos_SortByKeyImpl.hpp" +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include namespace Kokkos::Experimental { diff --git a/packages/kokkos/algorithms/src/sorting/Kokkos_SortPublicAPI.hpp b/packages/kokkos/algorithms/src/sorting/Kokkos_SortPublicAPI.hpp index 308e9e3a008b..1ba9f2873d55 100644 --- a/packages/kokkos/algorithms/src/sorting/Kokkos_SortPublicAPI.hpp +++ b/packages/kokkos/algorithms/src/sorting/Kokkos_SortPublicAPI.hpp @@ -1,25 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_SORT_PUBLIC_API_HPP_ #define KOKKOS_SORT_PUBLIC_API_HPP_ #include "./impl/Kokkos_SortImpl.hpp" #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include namespace Kokkos { diff --git a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_CopyOpsForBinSortImpl.hpp b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_CopyOpsForBinSortImpl.hpp index 07f5926d82ad..5143c460205b 100644 --- a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_CopyOpsForBinSortImpl.hpp +++ b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_CopyOpsForBinSortImpl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_COPY_OPS_FOR_BINSORT_IMPL_HPP_ #define KOKKOS_COPY_OPS_FOR_BINSORT_IMPL_HPP_ diff --git a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_NestedSortImpl.hpp b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_NestedSortImpl.hpp index 2fe58272d920..7ef52ea3ec4b 100644 --- a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_NestedSortImpl.hpp +++ b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_NestedSortImpl.hpp @@ -1,23 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_NESTED_SORT_IMPL_HPP_ #define KOKKOS_NESTED_SORT_IMPL_HPP_ +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif + +#include namespace Kokkos { namespace Experimental { diff --git a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortByKeyImpl.hpp b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortByKeyImpl.hpp index 736b21ea282d..29ac4cd63f74 100644 --- a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortByKeyImpl.hpp +++ b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortByKeyImpl.hpp @@ -1,23 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_SORT_BY_KEY_FREE_FUNCS_IMPL_HPP_ #define KOKKOS_SORT_BY_KEY_FREE_FUNCS_IMPL_HPP_ +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif + +#include #if defined(KOKKOS_ENABLE_CUDA) @@ -32,38 +26,16 @@ #pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wsuggest-override" -#if defined(KOKKOS_COMPILER_CLANG) -// Some versions of Clang fail to compile Thrust, failing with errors like -// this: -// /thrust/system/cuda/detail/core/agent_launcher.h:557:11: -// error: use of undeclared identifier 'va_printf' -// The exact combination of versions for Clang and Thrust (or CUDA) for this -// failure was not investigated, however even very recent version combination -// (Clang 10.0.0 and Cuda 10.0) demonstrated failure. -// -// Defining _CubLog here locally allows us to avoid that code path, however -// disabling some debugging diagnostics -#pragma push_macro("_CubLog") -#ifdef _CubLog -#undef _CubLog -#endif -// NOLINTNEXTLINE(bugprone-reserved-identifier) -#define _CubLog -#include -#include -#pragma pop_macro("_CubLog") -#else #include #include -#endif #pragma GCC diagnostic pop -#endif +#elif defined(KOKKOS_ENABLE_ROCTHRUST) -#if defined(KOKKOS_ENABLE_ROCTHRUST) #include #include + #endif #ifdef KOKKOS_ENABLE_ONEDPL diff --git a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortImpl.hpp b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortImpl.hpp index bec8649a8e99..71a6a75e360f 100644 --- a/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortImpl.hpp +++ b/packages/kokkos/algorithms/src/sorting/impl/Kokkos_SortImpl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_SORT_FREE_FUNCS_IMPL_HPP_ #define KOKKOS_SORT_FREE_FUNCS_IMPL_HPP_ @@ -21,7 +8,15 @@ #include "../Kokkos_BinSortPublicAPI.hpp" #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif +#include + +#include #if defined(KOKKOS_ENABLE_CUDA) @@ -36,38 +31,16 @@ #pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wsuggest-override" -#if defined(KOKKOS_COMPILER_CLANG) -// Some versions of Clang fail to compile Thrust, failing with errors like -// this: -// /thrust/system/cuda/detail/core/agent_launcher.h:557:11: -// error: use of undeclared identifier 'va_printf' -// The exact combination of versions for Clang and Thrust (or CUDA) for this -// failure was not investigated, however even very recent version combination -// (Clang 10.0.0 and Cuda 10.0) demonstrated failure. -// -// Defining _CubLog here locally allows us to avoid that code path, however -// disabling some debugging diagnostics -#pragma push_macro("_CubLog") -#ifdef _CubLog -#undef _CubLog -#endif -// NOLINTNEXTLINE(bugprone-reserved-identifier) -#define _CubLog -#include -#include -#pragma pop_macro("_CubLog") -#else #include #include -#endif #pragma GCC diagnostic pop -#endif +#elif defined(KOKKOS_ENABLE_ROCTHRUST) -#if defined(KOKKOS_ENABLE_ROCTHRUST) #include #include + #endif #if defined(KOKKOS_ENABLE_ONEDPL) diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp index f254686dbaf0..cc140ef79e6f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp index ac476ca5bfac..bf0529098d69 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp index d6ed4c4a7e0c..8466e76dfc47 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_HPP #define KOKKOS_STD_ALGORITHMS_ALL_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp index 82356e65982e..793fcde04323 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ANY_OF_HPP #define KOKKOS_STD_ALGORITHMS_ANY_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp index 38d6e6c4aa8e..5a46c291e39a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_BEGIN_END_HPP #define KOKKOS_BEGIN_END_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp index c5406c72b0d8..4bd0cfa66e18 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_HPP #define KOKKOS_STD_ALGORITHMS_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp index 82071a9362eb..c7b556804805 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP #define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp index 599fde5737ae..121a06ceb76f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_HPP #define KOKKOS_STD_ALGORITHMS_COPY_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp index 637d8d4cbc51..4a178ee016b8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_N_HPP #define KOKKOS_STD_ALGORITHMS_COPY_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp index f179e88babad..d2254ec7026e 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COUNT_HPP #define KOKKOS_STD_ALGORITHMS_COUNT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp index 967cf75e7a47..07ba8333fd51 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP #define KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp index 8605606307ea..bc3a25dcfd50 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_DISTANCE_HPP #define KOKKOS_STD_ALGORITHMS_DISTANCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp index 593c42f87e13..e32b05cb0ee5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_EQUAL_HPP #define KOKKOS_STD_ALGORITHMS_EQUAL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp index ee3a10512645..b942c9ac2b7b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP @@ -41,9 +28,11 @@ OutputIteratorType exclusive_scan(const ExecutionSpace& ex, ValueType init_value) { static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); - return Impl::exclusive_scan_default_op_exespace_impl( + using binary_op = Impl::StdExclusiveScanDefaultJoinFunctor; + + return Impl::exclusive_scan_exespace_impl( "Kokkos::exclusive_scan_default_functors_iterator_api", ex, first, last, - first_dest, std::move(init_value)); + first_dest, std::move(init_value), binary_op()); } template , "ValueType must be move constructible."); - return Impl::exclusive_scan_default_op_exespace_impl( - label, ex, first, last, first_dest, std::move(init_value)); + using binary_op = Impl::StdExclusiveScanDefaultJoinFunctor; + + return Impl::exclusive_scan_exespace_impl(label, ex, first, last, first_dest, + std::move(init_value), binary_op()); } template < @@ -76,11 +67,13 @@ auto exclusive_scan(const ExecutionSpace& ex, Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); + using binary_op = Impl::StdExclusiveScanDefaultJoinFunctor; + namespace KE = ::Kokkos::Experimental; - return Impl::exclusive_scan_default_op_exespace_impl( + return Impl::exclusive_scan_exespace_impl( "Kokkos::exclusive_scan_default_functors_view_api", ex, KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), - std::move(init_value)); + std::move(init_value), binary_op()); } template < @@ -95,10 +88,12 @@ auto exclusive_scan(const std::string& label, const ExecutionSpace& ex, Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); + using binary_op = Impl::StdExclusiveScanDefaultJoinFunctor; + namespace KE = ::Kokkos::Experimental; - return Impl::exclusive_scan_default_op_exespace_impl( + return Impl::exclusive_scan_exespace_impl( label, ex, KE::cbegin(view_from), KE::cend(view_from), - KE::begin(view_dest), std::move(init_value)); + KE::begin(view_dest), std::move(init_value), binary_op()); } // overload set 2 @@ -114,10 +109,9 @@ OutputIteratorType exclusive_scan(const ExecutionSpace& ex, InputIteratorType last, OutputIteratorType first_dest, ValueType init_value, BinaryOpType bop) { - Impl::static_assert_is_not_openmptarget(ex); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); - return Impl::exclusive_scan_custom_op_exespace_impl( + return Impl::exclusive_scan_exespace_impl( "Kokkos::exclusive_scan_custom_functors_iterator_api", ex, first, last, first_dest, std::move(init_value), bop); } @@ -135,11 +129,10 @@ OutputIteratorType exclusive_scan(const std::string& label, InputIteratorType last, OutputIteratorType first_dest, ValueType init_value, BinaryOpType bop) { - Impl::static_assert_is_not_openmptarget(ex); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); - return Impl::exclusive_scan_custom_op_exespace_impl( - label, ex, first, last, first_dest, std::move(init_value), bop); + return Impl::exclusive_scan_exespace_impl(label, ex, first, last, first_dest, + std::move(init_value), bop); } template < @@ -151,13 +144,12 @@ 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_v, "ValueType must be move constructible."); namespace KE = ::Kokkos::Experimental; - return Impl::exclusive_scan_custom_op_exespace_impl( + return Impl::exclusive_scan_exespace_impl( "Kokkos::exclusive_scan_custom_functors_view_api", ex, KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), std::move(init_value), bop); @@ -172,13 +164,12 @@ 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_v, "ValueType must be move constructible."); namespace KE = ::Kokkos::Experimental; - return Impl::exclusive_scan_custom_op_exespace_impl( + return Impl::exclusive_scan_exespace_impl( label, ex, KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), std::move(init_value), bop); } @@ -236,7 +227,6 @@ KOKKOS_FUNCTION OutputIteratorType exclusive_scan(const TeamHandleType& teamHandle, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, ValueType init_value, BinaryOpType bop) { - Impl::static_assert_is_not_openmptarget(teamHandle); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); return Impl::exclusive_scan_custom_op_team_impl( @@ -252,7 +242,6 @@ KOKKOS_FUNCTION auto exclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, ValueType init_value, BinaryOpType bop) { - Impl::static_assert_is_not_openmptarget(teamHandle); 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_v, diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp index 6d805ba1bed1..4ad4cabd3738 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FILL_HPP #define KOKKOS_STD_ALGORITHMS_FILL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp index 66b8cd66cc5c..abb0ae8bbaa6 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FILL_N_HPP #define KOKKOS_STD_ALGORITHMS_FILL_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp index e5e2b0e2b05e..f0882682fe62 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_HPP #define KOKKOS_STD_ALGORITHMS_FIND_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp index a4ec735fd595..cf31b3e0ba5b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_END_HPP #define KOKKOS_STD_ALGORITHMS_FIND_END_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp index 341a70e2f256..2e44ee265906 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP #define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp index 283fab7617f1..0124d2bb5d1d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_HPP #define KOKKOS_STD_ALGORITHMS_FIND_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp index 5e17a6f539b4..bde0f9424b1b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP #define KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp index 05969be463a5..f9d348069b6d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP #define KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp index e6fbcad891e1..99a5e9b8e754 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP #define KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp index a3295084eeb9..7ad062930e45 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_HPP #define KOKKOS_STD_ALGORITHMS_GENERATE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp index e480062c2368..17c48f336f06 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP #define KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp index a0e540b5e7aa..4bbda929b4e0 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp index 42f20bc4ecb6..10a0e13906ad 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP #define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp index 2c676c3ff34e..9e7fb5ea5bb8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP @@ -72,7 +59,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> bool is_sorted(const ExecutionSpace& ex, IteratorType first, IteratorType last, ComparatorType comp) { - Impl::static_assert_is_not_openmptarget(ex); return Impl::is_sorted_exespace_impl("Kokkos::is_sorted_iterator_api_default", ex, first, last, std::move(comp)); } @@ -82,7 +68,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> 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_exespace_impl(label, ex, first, last, std::move(comp)); } @@ -94,7 +79,6 @@ 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_exespace_impl("Kokkos::is_sorted_view_api_default", ex, @@ -110,7 +94,6 @@ 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_exespace_impl(label, ex, KE::cbegin(view), @@ -147,7 +130,6 @@ template & view, ComparatorType comp) { Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); - Impl::static_assert_is_not_openmptarget(teamHandle); namespace KE = ::Kokkos::Experimental; return Impl::is_sorted_team_impl(teamHandle, KE::cbegin(view), KE::cend(view), diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp index 96a17b67852c..3e17e6f9dc82 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP @@ -73,7 +60,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> 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_exespace_impl( "Kokkos::is_sorted_until_iterator_api_default", ex, first, last, std::move(comp)); @@ -85,8 +71,6 @@ 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_exespace_impl(label, ex, first, last, std::move(comp)); } @@ -99,7 +83,6 @@ 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_exespace_impl( @@ -115,7 +98,6 @@ 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_exespace_impl(label, ex, KE::begin(view), @@ -152,7 +134,6 @@ KOKKOS_FUNCTION IteratorType is_sorted_until(const TeamHandleType& teamHandle, IteratorType first, IteratorType last, ComparatorType comp) { - Impl::static_assert_is_not_openmptarget(teamHandle); return Impl::is_sorted_until_team_impl(teamHandle, first, last, std::move(comp)); } @@ -164,7 +145,6 @@ KOKKOS_FUNCTION auto is_sorted_until( const TeamHandleType& teamHandle, const ::Kokkos::View& view, ComparatorType comp) { Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); - Impl::static_assert_is_not_openmptarget(teamHandle); namespace KE = ::Kokkos::Experimental; return Impl::is_sorted_until_team_impl(teamHandle, KE::begin(view), diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp index fd5180aec901..5e1bb130157b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP #define KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "impl/Kokkos_Constraints.hpp" namespace Kokkos { @@ -58,16 +50,6 @@ void iter_swap(IteratorType1 a, IteratorType2 b) { Impl::iter_swap_impl(a, b); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template -KOKKOS_DEPRECATED_WITH_COMMENT("Use Kokkos::kokkos_swap instead!") -KOKKOS_FUNCTION - void swap(T& a, T& b) noexcept(::Kokkos::kokkos_swap(std::declval(), - std::declval())) { - ::Kokkos::kokkos_swap(a, b); -} -#endif - } // namespace Experimental } // namespace Kokkos diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp index e13479c370b8..6932e4743f93 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP #define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp index d16bac5bfc35..1b79e66ea61c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP @@ -49,8 +36,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> 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_exespace_impl( "Kokkos::max_element_iterator_api_default", ex, first, last, std::move(comp)); @@ -61,8 +46,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> 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_exespace_impl( label, ex, first, last, std::move(comp)); } @@ -97,7 +80,6 @@ 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_exespace_impl( "Kokkos::max_element_view_api_default", ex, begin(v), end(v), @@ -112,7 +94,6 @@ 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_exespace_impl( label, ex, begin(v), end(v), std::move(comp)); @@ -148,7 +129,6 @@ template ( teamHandle, first, last, std::move(comp)); } @@ -160,7 +140,6 @@ KOKKOS_FUNCTION auto max_element( const TeamHandleType& teamHandle, const ::Kokkos::View& v, ComparatorType comp) { Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); - Impl::static_assert_is_not_openmptarget(teamHandle); return Impl::min_or_max_element_team_impl( teamHandle, begin(v), end(v), std::move(comp)); } diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp index 2a53fce3e24e..7f7e7573c8b6 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP @@ -49,8 +36,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> 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_exespace_impl( "Kokkos::min_element_iterator_api_default", ex, first, last, std::move(comp)); @@ -61,8 +46,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> 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_exespace_impl( label, ex, first, last, std::move(comp)); } @@ -86,7 +69,6 @@ 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_exespace_impl( "Kokkos::min_element_view_api_default", ex, begin(v), end(v), @@ -112,7 +94,6 @@ 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_exespace_impl( label, ex, begin(v), end(v), std::move(comp)); @@ -148,7 +129,6 @@ template ( teamHandle, first, last, std::move(comp)); } @@ -159,7 +139,6 @@ template & v, ComparatorType comp) { - Impl::static_assert_is_not_openmptarget(teamHandle); Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); return Impl::min_or_max_element_team_impl( teamHandle, begin(v), end(v), std::move(comp)); diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp index c3a1f73ef69f..29a961df6b92 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP @@ -49,8 +36,6 @@ template < std::enable_if_t<::Kokkos::is_execution_space_v, int> = 0> auto minmax_element(const ExecutionSpace& ex, IteratorType first, IteratorType last, ComparatorType comp) { - Impl::static_assert_is_not_openmptarget(ex); - return Impl::minmax_element_exespace_impl( "Kokkos::minmax_element_iterator_api_default", ex, first, last, std::move(comp)); @@ -62,8 +47,6 @@ 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_exespace_impl( label, ex, first, last, std::move(comp)); } @@ -98,7 +81,6 @@ 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_exespace_impl( "Kokkos::minmax_element_view_api_default", ex, begin(v), end(v), @@ -113,7 +95,6 @@ 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_exespace_impl( label, ex, begin(v), end(v), std::move(comp)); @@ -138,8 +119,6 @@ template ( teamHandle, first, last, std::move(comp)); } @@ -162,7 +141,6 @@ KOKKOS_FUNCTION auto minmax_element( const TeamHandleType& teamHandle, const ::Kokkos::View& v, ComparatorType comp) { Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); - Impl::static_assert_is_not_openmptarget(teamHandle); return Impl::minmax_element_team_impl( teamHandle, begin(v), end(v), std::move(comp)); diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp index 090afe69e377..f2ede075d9c1 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_HPP #define KOKKOS_STD_ALGORITHMS_MISMATCH_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp index ac308ea1845c..e1f81c53024f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MOVE_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp index 2789ab217968..f184d6d459e4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp index f7baab3fc0f9..e1e54a69c4e5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_NONE_OF_HPP #define KOKKOS_STD_ALGORITHMS_NONE_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp index a1feee8d6d7a..2dc855b1e93e 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp index 60cbeeda8754..5f7b15be9b6d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp index ea7e55ca6190..d4c4804501e2 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REDUCE_HPP #define KOKKOS_STD_ALGORITHMS_REDUCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp index 8a429d8d5182..0c9070649986 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp index 4b8fa9fe077c..69ec297311bc 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp index 45e2b54bb6f2..bf96c5b9ecb3 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp index 38461a37f26a..ac3a1f6aea94 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp index 29afc4f0c213..1511a5cf23a5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp index 04d5767e895f..5ebf57fd0b3f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp index b87163f194fb..e208d71cdc9e 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp index 73af1f16f02a..d916e84db393 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp index a0786d3a2ebe..35f9016f658d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp index 66f39c4eaa60..c0415fa380ab 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp index aff04b47d639..ca9751e66cd2 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp index cce37fccfae7..aa97dafc8737 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp index 43258a484eca..4d3f71fe7e37 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp index 0f8aa5f1c132..6c36c1506baa 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp index b3e04a3b974a..d4e930a5e390 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp index 0f7ed5394878..b847b934f933 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp index 99a9c6c8a949..eb8dd39e5681 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP #define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp index 84cbed524d37..7a711950540c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp index 37fc0f860ee4..d45103238578 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP @@ -37,7 +24,6 @@ OutputIteratorType transform_exclusive_scan( const ExecutionSpace& ex, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, ValueType init_value, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(ex); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); return Impl::transform_exclusive_scan_exespace_impl( @@ -56,7 +42,6 @@ OutputIteratorType transform_exclusive_scan( const std::string& label, const ExecutionSpace& ex, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, ValueType init_value, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(ex); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); return Impl::transform_exclusive_scan_exespace_impl( @@ -74,7 +59,6 @@ auto transform_exclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, ValueType init_value, BinaryOpType binary_op, UnaryOpType unary_op) { - 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_v, @@ -96,7 +80,6 @@ auto transform_exclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, ValueType init_value, BinaryOpType binary_op, UnaryOpType unary_op) { - 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_v, @@ -123,7 +106,6 @@ KOKKOS_FUNCTION OutputIteratorType transform_exclusive_scan( const TeamHandleType& teamHandle, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, ValueType init_value, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(teamHandle); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); return Impl::transform_exclusive_scan_team_impl( @@ -140,7 +122,6 @@ KOKKOS_FUNCTION auto transform_exclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, ValueType init_value, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(teamHandle); 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_v, diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp index 5f694dbfd98b..f54e5a2a4fb7 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP @@ -41,8 +28,6 @@ OutputIteratorType transform_inclusive_scan(const ExecutionSpace& ex, OutputIteratorType first_dest, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(ex); - return Impl::transform_inclusive_scan_exespace_impl( "Kokkos::transform_inclusive_scan_custom_functors_iterator_api", ex, first, last, first_dest, binary_op, unary_op); @@ -59,8 +44,6 @@ OutputIteratorType transform_inclusive_scan( const std::string& label, const ExecutionSpace& ex, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(ex); - return Impl::transform_inclusive_scan_exespace_impl( label, ex, first, last, first_dest, binary_op, unary_op); } @@ -75,7 +58,6 @@ auto transform_inclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, BinaryOpType binary_op, UnaryOpType unary_op) { - 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); namespace KE = ::Kokkos::Experimental; @@ -95,7 +77,6 @@ auto transform_inclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, BinaryOpType binary_op, UnaryOpType unary_op) { - 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); namespace KE = ::Kokkos::Experimental; @@ -117,7 +98,6 @@ OutputIteratorType transform_inclusive_scan( const ExecutionSpace& ex, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, BinaryOpType binary_op, UnaryOpType unary_op, ValueType init_value) { - Impl::static_assert_is_not_openmptarget(ex); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); @@ -138,7 +118,6 @@ OutputIteratorType transform_inclusive_scan( const std::string& label, const ExecutionSpace& ex, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, BinaryOpType binary_op, UnaryOpType unary_op, ValueType init_value) { - Impl::static_assert_is_not_openmptarget(ex); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); @@ -157,7 +136,6 @@ auto transform_inclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, BinaryOpType binary_op, UnaryOpType unary_op, ValueType init_value) { - 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_v, @@ -180,7 +158,6 @@ auto transform_inclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, BinaryOpType binary_op, UnaryOpType unary_op, ValueType init_value) { - 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_v, @@ -210,8 +187,6 @@ KOKKOS_FUNCTION OutputIteratorType transform_inclusive_scan( const TeamHandleType& teamHandle, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(teamHandle); - return Impl::transform_inclusive_scan_team_impl( teamHandle, first, last, first_dest, binary_op, unary_op); } @@ -225,7 +200,6 @@ KOKKOS_FUNCTION auto transform_inclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, BinaryOpType binary_op, UnaryOpType unary_op) { - Impl::static_assert_is_not_openmptarget(teamHandle); 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; @@ -246,7 +220,6 @@ KOKKOS_FUNCTION OutputIteratorType transform_inclusive_scan( const TeamHandleType& teamHandle, InputIteratorType first, InputIteratorType last, OutputIteratorType first_dest, BinaryOpType binary_op, UnaryOpType unary_op, ValueType init_value) { - Impl::static_assert_is_not_openmptarget(teamHandle); static_assert(std::is_move_constructible_v, "ValueType must be move constructible."); @@ -264,7 +237,6 @@ KOKKOS_FUNCTION auto transform_inclusive_scan( const ::Kokkos::View& view_from, const ::Kokkos::View& view_dest, BinaryOpType binary_op, UnaryOpType unary_op, ValueType init_value) { - Impl::static_assert_is_not_openmptarget(teamHandle); 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_v, diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp index 89585ddbea0c..2c97e42f5e89 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp index 2d56315f616e..974f4b830db2 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp index 4a32d7e095d2..78510e7b6d9f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp index 9f7fcf94fe0b..6e50e86094ea 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp index f30b7be06a6f..a88df9c19073 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp index bdc050f9c19d..a10c9a62914f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp index 7b3a4fe8762d..519d72d0ad68 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp @@ -1,25 +1,21 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_ #define KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_ +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif +#include + #include +#include + namespace Kokkos { namespace Experimental { namespace Impl { @@ -194,28 +190,6 @@ static_assert_iterators_have_matching_difference_type(IteratorType1 it1, static_assert_iterators_have_matching_difference_type(it2, it3); } -// -// not_openmptarget -// -template -struct not_openmptarget { -#ifndef KOKKOS_ENABLE_OPENMPTARGET - static constexpr bool value = true; -#else - static constexpr bool value = - !std::is_same, - ::Kokkos::Experimental::OpenMPTarget>::value; -#endif -}; - -template -KOKKOS_INLINE_FUNCTION constexpr void static_assert_is_not_openmptarget( - const ExecutionSpaceOrTeamHandleType& /*ex_or_th*/) { - static_assert(not_openmptarget::value, - "Currently, Kokkos standard algorithms do not support custom " - "comparators in OpenMPTarget"); -} - // // valid range // diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp index 0f68c9e97809..5900a17d1259 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp index 86e99ecbd0ce..823a7c58dcea 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp index ef39be6366a4..91e762cb03ff 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_MustUseKokkosSingleInTeam.hpp" @@ -149,11 +141,6 @@ KOKKOS_FUNCTION OutputIterator copy_if_team_impl( // no barrier needed because of the scan accumulating into count return d_first + count; } - -#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \ - !defined(KOKKOS_COMPILER_MSVC) - __builtin_unreachable(); -#endif } } // namespace Impl diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp index 9b6b403aa494..6b962286692c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp index 62b7d226f636..39edd0e585e3 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp index 08e04810f673..3f1ded2a1380 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_ValueWrapperForNoNeutralElement.hpp" @@ -31,67 +23,17 @@ namespace Kokkos { namespace Experimental { namespace Impl { -// -// exespace impl -// -template -OutputIteratorType exclusive_scan_default_op_exespace_impl( - const std::string& label, const ExecutionSpace& ex, - InputIteratorType first_from, InputIteratorType last_from, - OutputIteratorType first_dest, ValueType init_value) { - // 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); - - // does it make sense to do this static_assert too? - // using input_iterator_value_type = typename InputIteratorType::value_type; - // static_assert - // (std::is_convertible, - // ValueType>::value, - // "exclusive_scan: InputIteratorType::value_type not convertible to - // ValueType"); - - // we are unnecessarily duplicating code, but this is on purpose - // so that we can use the default_op for OpenMPTarget. - // Originally, I had this implemented as: - // ''' - // using bop_type = StdExclusiveScanDefaultJoinFunctor; - // call exclusive_scan_custom_op_impl(..., bop_type()); - // ''' - // which avoids duplicating the functors, but for OpenMPTarget - // I cannot use a custom binary op. - // This is the same problem that occurs for reductions. - - // aliases - using index_type = typename InputIteratorType::difference_type; - using func_type = std::conditional_t< - ::Kokkos::is_detected::value, - ExclusiveScanDefaultFunctorForKnownNeutralElement< - ExecutionSpace, index_type, ValueType, InputIteratorType, - OutputIteratorType>, - ExclusiveScanDefaultFunctorWithValueWrapper>; - - // run - const auto num_elements = - Kokkos::Experimental::distance(first_from, last_from); - ::Kokkos::parallel_scan( - label, RangePolicy(ex, 0, num_elements), - func_type(std::move(init_value), first_from, first_dest)); - - ex.fence("Kokkos::exclusive_scan_default_op: fence after operation"); - - return first_dest + num_elements; -} +template +struct StdExclusiveScanDefaultJoinFunctor { + KOKKOS_FUNCTION + constexpr ValueType operator()(const ValueType& a, const ValueType& b) const { + return a + b; + } +}; template -OutputIteratorType exclusive_scan_custom_op_exespace_impl( +OutputIteratorType exclusive_scan_exespace_impl( const std::string& label, const ExecutionSpace& ex, InputIteratorType first_from, InputIteratorType last_from, OutputIteratorType first_dest, ValueType init_value, BinaryOpType bop) { @@ -115,7 +57,7 @@ OutputIteratorType exclusive_scan_custom_op_exespace_impl( RangePolicy(ex, 0, num_elements), func_type(std::move(init_value), first_from, first_dest, bop, unary_op_type())); - ex.fence("Kokkos::exclusive_scan_custom_op: fence after operation"); + ex.fence("Kokkos::exclusive_scan: fence after operation"); // return return first_dest + num_elements; diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp index 972e57f2ccbe..a598362673f8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp index 1f1ec5e54f64..ef8b5733285c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp index 145e235b9ddf..8660ec557490 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp index 8fffb59094a0..e7780796c0ec 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp index 99cc4a1cf3a6..d1a978e4ec25 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FunctorsForExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FunctorsForExclusiveScan.hpp index 5a7fe16984a2..a16bbdf8d6d3 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FunctorsForExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FunctorsForExclusiveScan.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_FUNCTORS_FOR_EXCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FUNCTORS_FOR_EXCLUSIVE_SCAN_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_ValueWrapperForNoNeutralElement.hpp" namespace Kokkos { diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp index 157de1125ee3..7a32e2fe3187 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp index db0def6f227b..b9dc9cc4e177 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP #define KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp index 928508fdfb35..98d983aed5fd 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP #define KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp index 867d0b02667f..4d747ac6015b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" @@ -38,38 +30,18 @@ #pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wsuggest-override" -#if defined(KOKKOS_COMPILER_CLANG) -// Some versions of Clang fail to compile Thrust, failing with errors like -// this: -// /thrust/system/cuda/detail/core/agent_launcher.h:557:11: -// error: use of undeclared identifier 'va_printf' -// The exact combination of versions for Clang and Thrust (or CUDA) for this -// failure was not investigated, however even very recent version combination -// (Clang 10.0.0 and Cuda 10.0) demonstrated failure. -// -// Defining _CubLog here locally allows us to avoid that code path, however -// disabling some debugging diagnostics -#pragma push_macro("_CubLog") -#ifdef _CubLog -#undef _CubLog -#endif -// NOLINTNEXTLINE(bugprone-reserved-identifier) -#define _CubLog -#include -#include -#pragma pop_macro("_CubLog") +#if CUDA_VERSION >= 13010 +#include #else #include -#include #endif +#include -#pragma GCC diagnostic pop +#elif defined(KOKKOS_ENABLE_ROCTHRUST) -#endif - -#if defined(KOKKOS_ENABLE_ROCTHRUST) #include #include + #endif namespace Kokkos { @@ -166,7 +138,11 @@ OutputIteratorType inclusive_scan_default_op_exespace_impl( Kokkos::Profiling::popRegion(); +#if CUDA_VERSION >= 13010 + const auto num_elements = cuda::std::distance(first_from, last_from); +#else const auto num_elements = thrust::distance(first_from, last_from); +#endif return first_dest + num_elements; } @@ -252,7 +228,11 @@ OutputIteratorType inclusive_scan_custom_binary_op_exespace_impl( Kokkos::Profiling::popRegion(); +#if CUDA_VERSION >= 13010 + const auto num_elements = cuda::std::distance(first_from, last_from); +#else const auto num_elements = thrust::distance(first_from, last_from); +#endif return first_dest + num_elements; } diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp index 17a1eff2962d..55fd8cba2ac0 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp index b2c912848a3b..609de85ae45a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp index d33580ca5372..e12781a84c0a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp index b95a66c3bd9b..67a3dd75c5c7 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp index 2f51db03b462..ea1bd1e93174 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp index dfe96aaf586b..edc825547bcb 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MISMATCH_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp index 5110c51d4142..ff04e1d03c68 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MOVE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp index dc910861d507..3a33fc374783 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MustUseKokkosSingleInTeam.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MustUseKokkosSingleInTeam.hpp index 162c72c2db79..a3c78ba63bb2 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MustUseKokkosSingleInTeam.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MustUseKokkosSingleInTeam.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_MUSTUSEKOKKOSSINGLEINTEAM_HPP #define KOKKOS_STD_ALGORITHMS_MUSTUSEKOKKOSSINGLEINTEAM_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif namespace Kokkos { namespace Experimental { diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp index 35e9cfa53e2d..6333bcc950ba 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp index 7ec7061e3166..635f1bb20994 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp index ee788378f430..5e6851ced8ed 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_RANDOM_ACCESS_ITERATOR_IMPL_HPP #define KOKKOS_RANDOM_ACCESS_ITERATOR_IMPL_HPP @@ -29,27 +16,6 @@ namespace Impl { template class RandomAccessIterator; -namespace { - -template -struct is_always_strided { - static_assert(is_view_v); - - constexpr static bool value = -#ifdef KOKKOS_ENABLE_IMPL_MDSPAN - decltype(std::declval().to_mdspan())::is_always_strided(); -#else - (std::is_same_v || - std::is_same_v || - std::is_same_v); -#endif -}; - -} // namespace - template class RandomAccessIterator<::Kokkos::View> { public: @@ -69,41 +35,36 @@ class RandomAccessIterator<::Kokkos::View> { using is_passed_directly = std::true_type; #endif - static_assert(view_type::rank == 1 && - is_always_strided<::Kokkos::View>::value); + private: + static constexpr bool view_is_always_strided = +#ifdef KOKKOS_ENABLE_IMPL_MDSPAN + decltype(std::declval().to_mdspan())::is_always_strided(); +#else + (std::is_same_v || + std::is_same_v || + std::is_same_v); +#endif + + static_assert(view_type::rank == 1 && view_is_always_strided); + public: KOKKOS_DEFAULTED_FUNCTION RandomAccessIterator() = default; explicit KOKKOS_FUNCTION RandomAccessIterator(const view_type view) - : m_data(view.data()), m_stride(view.stride_0()) {} + : m_data(view.data()), m_stride(view.stride(0)) {} explicit KOKKOS_FUNCTION RandomAccessIterator(const view_type view, ptrdiff_t current_index) - : m_data(view.data() + current_index * view.stride_0()), - m_stride(view.stride_0()) {} + : m_data(view.data() + current_index * view.stride(0)), + m_stride(view.stride(0)) {} -#ifndef KOKKOS_ENABLE_CXX17 // C++20 and beyond template requires(std::is_constructible_v) KOKKOS_FUNCTION explicit(!std::is_convertible_v) RandomAccessIterator(const RandomAccessIterator& other) : m_data(other.m_data), m_stride(other.m_stride) {} -#else - template < - class OtherViewType, - std::enable_if_t && - !std::is_convertible_v, - int> = 0> - KOKKOS_FUNCTION explicit RandomAccessIterator( - const RandomAccessIterator& other) - : m_data(other.m_data), m_stride(other.m_stride) {} - - template , - int> = 0> - KOKKOS_FUNCTION RandomAccessIterator( - const RandomAccessIterator& other) - : m_data(other.m_data), m_stride(other.m_stride) {} -#endif KOKKOS_FUNCTION iterator_type& operator++() { diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp index ab01cdd80485..7da583841af3 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REDUCE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REDUCE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp" @@ -90,7 +82,6 @@ ValueType reduce_custom_functors_exespace_impl( IteratorType last, ValueType init_reduction_value, JoinerType joiner) { // checks Impl::static_assert_random_access_and_accessible(ex, first); - Impl::static_assert_is_not_openmptarget(ex); Impl::expect_valid_range(first, last); if (first == last) { @@ -121,10 +112,9 @@ ValueType reduce_default_functors_exespace_impl( IteratorType last, ValueType init_reduction_value) { // checks Impl::static_assert_random_access_and_accessible(ex, first); - Impl::static_assert_is_not_openmptarget(ex); Impl::expect_valid_range(first, last); - using value_type = Kokkos::Impl::remove_cvref_t; + using value_type = std::remove_cvref_t; if (::Kokkos::is_detected::value) { if (first == last) { @@ -165,7 +155,6 @@ KOKKOS_FUNCTION ValueType reduce_custom_functors_team_impl( ValueType init_reduction_value, JoinerType joiner) { // checks Impl::static_assert_random_access_and_accessible(teamHandle, first); - Impl::static_assert_is_not_openmptarget(teamHandle); Impl::expect_valid_range(first, last); if (first == last) { @@ -196,10 +185,9 @@ KOKKOS_FUNCTION ValueType reduce_default_functors_team_impl( ValueType init_reduction_value) { // checks Impl::static_assert_random_access_and_accessible(teamHandle, first); - Impl::static_assert_is_not_openmptarget(teamHandle); Impl::expect_valid_range(first, last); - using value_type = Kokkos::Impl::remove_cvref_t; + using value_type = std::remove_cvref_t; if (::Kokkos::is_detected::value) { if (first == last) { diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp index b460982d3348..674c7427b78a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REDUCER_WITH_ARBITRARY_JOINER_NONEUTRAL_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_REDUCER_WITH_ARBITRARY_JOINER_NONEUTRAL_ELEMENT_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_ValueWrapperForNoNeutralElement.hpp" namespace Kokkos { diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp index 2c29570e99cd..2001bc2c306a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp index 5b5e4147d6b1..d950169f1b62 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp index 61ffa9fd93d8..b038a5d556a5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp index 2cc38d1d0e72..bb6305145b1d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp index 61e8abf44cb4..e106d6536b93 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_IF_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp index e6caa0728805..3951cb54dbad 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp index 7aa0e4fc44c8..194ab1bf06d1 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp index 7a4cb8e3253b..d13e10bef466 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_Reverse.hpp" diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp index f22dae2de482..cdd4084c65e0 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp index fa04350eb52b..9faaf5b6a54b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp index 0910f952c0cf..7da2f5d806ff 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp @@ -1,23 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_N_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif +#include #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_AllOfAnyOfNoneOf.hpp" diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp index 94147485071a..36eb66659653 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp index 0414e6f1c251..f88c1b98401f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp index 930a14ac48c3..5a995150c818 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp index c7e057332437..5eac7c913423 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp index d832f8849d1c..abef3d8e64a5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_EXCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_EXCLUSIVE_SCAN_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_ValueWrapperForNoNeutralElement.hpp" diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp index dc432573ee35..6ce5bf2a0ce9 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_ValueWrapperForNoNeutralElement.hpp" diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp index 79bdf98915b2..9c5128639290 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include @@ -122,7 +114,6 @@ ValueType transform_reduce_custom_functors_exespace_impl( UnaryTransformerType transformer) { // checks Impl::static_assert_random_access_and_accessible(ex, first); - Impl::static_assert_is_not_openmptarget(ex); Impl::expect_valid_range(first, last); if (first == last) { @@ -161,7 +152,6 @@ ValueType transform_reduce_custom_functors_exespace_impl( JoinerType joiner, BinaryTransformerType transformer) { // checks Impl::static_assert_random_access_and_accessible(ex, first1, first2); - Impl::static_assert_is_not_openmptarget(ex); Impl::static_assert_iterators_have_matching_difference_type(first1, first2); Impl::expect_valid_range(first1, last1); @@ -200,7 +190,6 @@ ValueType transform_reduce_default_functors_exespace_impl( IteratorType1 last1, IteratorType2 first2, ValueType init_reduction_value) { // checks Impl::static_assert_random_access_and_accessible(ex, first1, first2); - Impl::static_assert_is_not_openmptarget(ex); Impl::static_assert_iterators_have_matching_difference_type(first1, first2); Impl::expect_valid_range(first1, last1); @@ -226,7 +215,6 @@ KOKKOS_FUNCTION ValueType transform_reduce_custom_functors_team_impl( UnaryTransformerType transformer) { // checks Impl::static_assert_random_access_and_accessible(teamHandle, first); - Impl::static_assert_is_not_openmptarget(teamHandle); Impl::expect_valid_range(first, last); if (first == last) { @@ -264,7 +252,6 @@ KOKKOS_FUNCTION ValueType transform_reduce_custom_functors_team_impl( BinaryTransformerType transformer) { // checks Impl::static_assert_random_access_and_accessible(teamHandle, first1, first2); - Impl::static_assert_is_not_openmptarget(teamHandle); Impl::static_assert_iterators_have_matching_difference_type(first1, first2); Impl::expect_valid_range(first1, last1); @@ -304,7 +291,6 @@ KOKKOS_FUNCTION ValueType transform_reduce_default_functors_team_impl( IteratorType2 first2, ValueType init_reduction_value) { // checks Impl::static_assert_random_access_and_accessible(teamHandle, first1, first2); - Impl::static_assert_is_not_openmptarget(teamHandle); Impl::static_assert_iterators_have_matching_difference_type(first1, first2); Impl::expect_valid_range(first1, last1); diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp index 75f331547310..6c955922de8d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp index 226fd49d1691..7d8d38e2ad97 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "Kokkos_Constraints.hpp" #include "Kokkos_HelperPredicates.hpp" #include "Kokkos_MustUseKokkosSingleInTeam.hpp" @@ -174,11 +166,6 @@ KOKKOS_FUNCTION OutputIterator unique_copy_team_impl( return Impl::copy_team_impl(teamHandle, first + scan_size, last, d_first + count); } - -#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \ - !defined(KOKKOS_COMPILER_MSVC) - __builtin_unreachable(); -#endif } } diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp index 8a73b8e0f1d7..108da7b30bca 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_STD_ALGORITHMS_VALUE_WRAPPER_FOR_NO_NEUTRAL_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_VALUE_WRAPPER_FOR_NO_NEUTRAL_ELEMENT_HPP diff --git a/packages/kokkos/algorithms/unit_tests/CMakeLists.txt b/packages/kokkos/algorithms/unit_tests/CMakeLists.txt index cca6899594d6..d9288bdbd264 100644 --- a/packages/kokkos/algorithms/unit_tests/CMakeLists.txt +++ b/packages/kokkos/algorithms/unit_tests/CMakeLists.txt @@ -6,7 +6,7 @@ kokkos_include_directories(${KOKKOS_SOURCE_DIR}/core/unit_test/category_files) set(ALGORITHM UnitTestMain.cpp) -foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget) +foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL) string(TOUPPER ${Tag} DEVICE) string(TOLOWER ${Tag} dir) @@ -150,11 +150,6 @@ set(STDALGO_TEAM_SOURCES_P) foreach(Name StdAlgorithmsCommon StdAlgorithmsTeamExclusiveScan StdAlgorithmsTeamTransformExclusiveScan) list(APPEND STDALGO_TEAM_SOURCES_P Test${Name}.cpp) endforeach() -if(KOKKOS_ENABLE_OPENMPTARGET) # FIXME_OPENMPTARGET - list(REMOVE_ITEM STDALGO_TEAM_SOURCES_P TestStdAlgorithmsTeamExclusiveScan.cpp - TestStdAlgorithmsTeamTransformExclusiveScan.cpp - ) -endif() # ------------------------------------------ # std team M @@ -206,12 +201,6 @@ foreach( list(APPEND STDALGO_TEAM_SOURCES_H Test${Name}.cpp) endforeach() -if(KOKKOS_ENABLE_OPENMPTARGET) # FIXME_OPENMPTARGET - list(REMOVE_ITEM STDALGO_TEAM_SOURCES_H TestStdAlgorithmsTeamCopyIf.cpp TestStdAlgorithmsTeamUniqueCopy.cpp - TestStdAlgorithmsTeamRemoveCopy.cpp TestStdAlgorithmsTeamRemoveCopyIf.cpp - ) -endif() - # ------------------------------------------ # std team G # ------------------------------------------ @@ -303,61 +292,10 @@ foreach( list(APPEND STDALGO_TEAM_SOURCES_A Test${Name}.cpp) endforeach() -# FIXME_OPENMPTARGET - remove sort test as it leads to ICE with clang/16 and above at compile time. -if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL "Clang" AND KOKKOS_CXX_COMPILER_VERSION - VERSION_GREATER_EQUAL 16.0.0 -) - list(REMOVE_ITEM ALGO_SORT_SOURCES TestSort.cpp) -endif() - -# FIXME_OPENMPTARGET remove tests for OpenMPTarget because in these cases -# the impl needs to use either Kokkos or tailored reducers -# which results in runtime memory errors. -if(KOKKOS_ENABLE_OPENMPTARGET) - list(REMOVE_ITEM STDALGO_TEAM_SOURCES_L TestStdAlgorithmsTeamIsPartitioned.cpp - TestStdAlgorithmsTeamPartitionPoint.cpp TestStdAlgorithmsTeamPartitionCopy.cpp - ) -endif() - -# FIXME_OPENMPTARGET need to remove tests for OpenMPTarget because -# in these cases the impl needs to use either Kokkos or -# tailored reducers which results in runtime memory errors. -if(KOKKOS_ENABLE_OPENMPTARGET) - list( - REMOVE_ITEM - STDALGO_TEAM_SOURCES_C - TestStdAlgorithmsTeamFind.cpp - TestStdAlgorithmsTeamFindIf.cpp - TestStdAlgorithmsTeamFindIfNot.cpp - TestStdAlgorithmsTeamAllOf.cpp - TestStdAlgorithmsTeamAnyOf.cpp - TestStdAlgorithmsTeamNoneOf.cpp - TestStdAlgorithmsTeamSearchN.cpp - ) -endif() - kokkos_add_executable_and_test(UnitTest_Sort SOURCES UnitTestMain.cpp TestStdAlgorithmsCommon.cpp ${ALGO_SORT_SOURCES}) kokkos_add_executable_and_test(UnitTest_Random SOURCES UnitTestMain.cpp ${ALGO_RANDOM_SOURCES}) -# FIXME_OPENMPTARGET remove tests for OpenMPTarget -# causing failures for various reasons -if(KOKKOS_ENABLE_OPENMPTARGET) - # the following use either Kokkos or tailored reducers - # which results in runtime memory errors. - list(REMOVE_ITEM STDALGO_TEAM_SOURCES_B TestStdAlgorithmsTeamFindEnd.cpp TestStdAlgorithmsTeamFindFirstOf.cpp - TestStdAlgorithmsTeamSearch.cpp - ) - - list(REMOVE_ITEM STDALGO_TEAM_SOURCES_A TestStdAlgorithmsTeamAdjacentFind.cpp - TestStdAlgorithmsTeamLexicographicalCompare.cpp TestStdAlgorithmsTeamMismatch.cpp - ) - - # this causes an illegal memory access if team_members_have_matching_result - # is called - list(REMOVE_ITEM STDALGO_TEAM_SOURCES_M TestStdAlgorithmsTeamTransformBinaryOp.cpp) -endif() - foreach(ID A;B;C;D;E) kokkos_add_executable_and_test(AlgorithmsUnitTest_StdSet_${ID} SOURCES UnitTestMain.cpp ${STDALGO_SOURCES_${ID}}) endforeach() diff --git a/packages/kokkos/algorithms/unit_tests/Makefile b/packages/kokkos/algorithms/unit_tests/Makefile deleted file mode 100644 index eaf616c5d62c..000000000000 --- a/packages/kokkos/algorithms/unit_tests/Makefile +++ /dev/null @@ -1,127 +0,0 @@ -KOKKOS_PATH = ../.. - -GTEST_PATH = ../../TPL/gtest - -vpath %.cpp ${KOKKOS_PATH}/algorithms/unit_tests - -default: build_all - echo "End Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) - CXX = $(KOKKOS_PATH)/bin/nvcc_wrapper -else - CXX = g++ -endif - -CXXFLAGS = -O3 -LINK ?= $(CXX) -LDFLAGS ?= -override LDFLAGS += -lpthread - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -include $(KOKKOS_PATH)/Makefile.kokkos - -KOKKOS_CXXFLAGS += -I$(GTEST_PATH) -I${KOKKOS_PATH}/algorithms/unit_tests -I${KOKKOS_PATH}/core/unit_test/category_files - -TEST_TARGETS = -TARGETS = - -tmp := $(foreach device, $(KOKKOS_DEVICELIST), \ - $(if $(filter Test$(device).cpp, $(shell ls Test$(device).cpp 2>/dev/null)),,\ - $(shell echo "$(H)include " > Test$(device).cpp); \ - $(shell echo "$(H)include " >> Test$(device).cpp); \ - $(shell echo "$(H)include " >> Test$(device).cpp); \ - $(shell echo "$(H)include " >> Test$(device).cpp); \ - $(shell echo "$(H)include " >> Test$(device).cpp); \ - $(shell echo "$(H)include " >> Test$(device).cpp); \ - $(shell echo "$(H)include " >> Test$(device).cpp); \ - ) \ -) - -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - OBJ_CUDA = TestCuda.o TestStdAlgorithmsCommon.o UnitTestMain.o gtest-all.o - TARGETS += KokkosAlgorithms_UnitTest_Cuda - TEST_TARGETS += test-cuda -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - OBJ_HIP = TestHIP.o TestStdAlgorithmsCommon.o UnitTestMain.o gtest-all.o - TARGETS += KokkosAlgorithms_UnitTest_HIP - TEST_TARGETS += test-hip -endif - -ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) - OBJ_THREADS = TestThreads.o TestStdAlgorithmsCommon.o UnitTestMain.o gtest-all.o - TARGETS += KokkosAlgorithms_UnitTest_Threads - TEST_TARGETS += test-threads -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) - OBJ_OPENMP = TestOpenMP.o TestStdAlgorithmsCommon.o UnitTestMain.o gtest-all.o - TARGETS += KokkosAlgorithms_UnitTest_OpenMP - TEST_TARGETS += test-openmp -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) - OBJ_HPX = TestHPX.o TestStdAlgorithmsCommon.o UnitTestMain.o gtest-all.o - TARGETS += KokkosAlgorithms_UnitTest_HPX - TEST_TARGETS += test-hpx -endif - -ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) - OBJ_SERIAL = TestSerial.o TestStdAlgorithmsCommon.o UnitTestMain.o gtest-all.o - TARGETS += KokkosAlgorithms_UnitTest_Serial - TEST_TARGETS += test-serial -endif - -KokkosAlgorithms_UnitTest_Cuda: $(OBJ_CUDA) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_CUDA) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosAlgorithms_UnitTest_Cuda - -KokkosAlgorithms_UnitTest_HIP: $(OBJ_HIP) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_HIP) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosAlgorithms_UnitTest_HIP - -KokkosAlgorithms_UnitTest_Threads: $(OBJ_THREADS) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_THREADS) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosAlgorithms_UnitTest_Threads - -KokkosAlgorithms_UnitTest_OpenMP: $(OBJ_OPENMP) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_OPENMP) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosAlgorithms_UnitTest_OpenMP - -KokkosAlgorithms_UnitTest_HPX: $(OBJ_HPX) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_HPX) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosAlgorithms_UnitTest_HPX - -KokkosAlgorithms_UnitTest_Serial: $(OBJ_SERIAL) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_SERIAL) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosAlgorithms_UnitTest_Serial - -test-cuda: KokkosAlgorithms_UnitTest_Cuda - ./KokkosAlgorithms_UnitTest_Cuda - -test-hip: KokkosAlgorithms_UnitTest_HIP - ./KokkosAlgorithms_UnitTest_HIP - -test-threads: KokkosAlgorithms_UnitTest_Threads - ./KokkosAlgorithms_UnitTest_Threads - -test-openmp: KokkosAlgorithms_UnitTest_OpenMP - ./KokkosAlgorithms_UnitTest_OpenMP - -test-hpx: KokkosAlgorithms_UnitTest_HPX - ./KokkosAlgorithms_UnitTest_HPX - -test-serial: KokkosAlgorithms_UnitTest_Serial - ./KokkosAlgorithms_UnitTest_Serial - -build_all: $(TARGETS) - -test: $(TEST_TARGETS) - -clean: kokkos-clean - rm -f *.o $(TARGETS) - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< - -gtest-all.o:$(GTEST_PATH)/gtest/gtest-all.cc - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $(GTEST_PATH)/gtest/gtest-all.cc diff --git a/packages/kokkos/algorithms/unit_tests/TestBinSortA.hpp b/packages/kokkos/algorithms/unit_tests/TestBinSortA.hpp index 6200b48d5aaf..7ae61535de01 100644 --- a/packages/kokkos/algorithms/unit_tests/TestBinSortA.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestBinSortA.hpp @@ -1,33 +1,23 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_BINSORTA_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_BINSORTA_HPP #include -#include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.random; import kokkos.sort; #else +#include #include #include #endif + #include +#include namespace Test { namespace BinSortSetA { @@ -227,10 +217,6 @@ void test_sort_integer_overflow() { } // namespace BinSortSetA TEST(TEST_CATEGORY, BinSortGenericTests) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif using ExecutionSpace = TEST_EXECSPACE; using key_type = unsigned; constexpr int N = 171; diff --git a/packages/kokkos/algorithms/unit_tests/TestBinSortB.hpp b/packages/kokkos/algorithms/unit_tests/TestBinSortB.hpp index 5645c0284136..5fe41473f565 100644 --- a/packages/kokkos/algorithms/unit_tests/TestBinSortB.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestBinSortB.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_BINSORTB_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_BINSORTB_HPP @@ -191,10 +178,6 @@ void run_for_rank2() { } // namespace BinSortSetB TEST(TEST_CATEGORY, BinSortUnsignedKeyLayoutStrideValues) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif using ExeSpace = TEST_EXECSPACE; using key_type = unsigned; BinSortSetB::run_for_rank1(); diff --git a/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp b/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp index 8ea393952281..734e5f931121 100644 --- a/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp @@ -1,23 +1,11 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_NESTED_SORT_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_NESTED_SORT_HPP #include +#include #include #include #include @@ -391,11 +379,6 @@ void test_nested_sort_by_key(unsigned int N, KeyType minKey, KeyType maxKey, } // namespace NestedSortImpl TEST(TEST_CATEGORY, NestedSort) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif - using ExecutionSpace = TEST_EXECSPACE; NestedSortImpl::test_nested_sort(171, 0U, UINT_MAX); NestedSortImpl::test_nested_sort(42, -1e6f, 1e6f); @@ -404,11 +387,6 @@ TEST(TEST_CATEGORY, NestedSort) { } TEST(TEST_CATEGORY, NestedSortByKey) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif - using ExecutionSpace = TEST_EXECSPACE; // Second/third template arguments are key and value respectively. diff --git a/packages/kokkos/algorithms/unit_tests/TestRandom.hpp b/packages/kokkos/algorithms/unit_tests/TestRandom.hpp index 7ee7403ce9ea..0057a389c407 100644 --- a/packages/kokkos/algorithms/unit_tests/TestRandom.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestRandom.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_RANDOM_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_RANDOM_HPP @@ -21,15 +8,18 @@ #include #include #include -#include #include -#include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dyn_rank_view; import kokkos.random; #else +#include +#include #include #endif +#include #include #include #include @@ -81,16 +71,6 @@ struct RandomProperties { } }; -// FIXME_OPENMPTARGET: Need this for OpenMPTarget because contra to the standard -// llvm requires the binary operator defined not just the += -KOKKOS_INLINE_FUNCTION -RandomProperties operator+(const RandomProperties& org, - const RandomProperties& add) { - RandomProperties val = org; - val += add; - return val; -} - template struct test_random_functor { using rnd_type = typename GeneratorPool::generator_type; @@ -615,11 +595,6 @@ void test_async_initialization(Args... args) { } // namespace AlgoRandomImpl TEST(TEST_CATEGORY, Random_XorShift64) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif - using ExecutionSpace = TEST_EXECSPACE; #if defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_CUDA) || \ @@ -640,10 +615,6 @@ TEST(TEST_CATEGORY, Random_XorShift64) { TEST(TEST_CATEGORY, Random_XorShift1024_0) { using ExecutionSpace = TEST_EXECSPACE; - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif #if defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_CUDA) || \ defined(KOKKOS_ENABLE_HIP) @@ -663,13 +634,6 @@ TEST(TEST_CATEGORY, Random_XorShift1024_0) { TEST(TEST_CATEGORY, Multi_streams) { using ExecutionSpace = TEST_EXECSPACE; -#ifdef KOKKOS_ENABLE_OPENMPTARGET - if constexpr (std::is_same_v) { - GTEST_SKIP() << "Libomptarget error"; // FIXME_OPENMPTARGET - } -#endif - #if defined(KOKKOS_ENABLE_SYCL) && defined(KOKKOS_IMPL_ARCH_NVIDIA_GPU) if constexpr (std::is_same_v) { GTEST_SKIP() << "Failing on NVIDIA GPUs"; // FIXME_SYCL diff --git a/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp b/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp index 7023772831b7..8c15262971c1 100644 --- a/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES diff --git a/packages/kokkos/algorithms/unit_tests/TestSort.hpp b/packages/kokkos/algorithms/unit_tests/TestSort.hpp index ed267044d31e..4d39fa7fccb4 100644 --- a/packages/kokkos/algorithms/unit_tests/TestSort.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestSort.hpp @@ -1,34 +1,25 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_SORT_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_SORT_HPP #include -#include -#include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dynamic_view; import kokkos.random; import kokkos.sort; #else +#include +#include #include #include #endif +#include + namespace Test { namespace SortImpl { @@ -216,29 +207,18 @@ void test_sort_integer_overflow() { } // namespace SortImpl TEST(TEST_CATEGORY, SortUnsignedValueType) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif using ExecutionSpace = TEST_EXECSPACE; using key_type = unsigned; constexpr int N = 171; SortImpl::test_1D_sort_impl(N * N * N); -#ifndef KOKKOS_ENABLE_OPENMPTARGET - // FIXME_OPENMPTARGET: OpenMPTarget doesn't support DynamicView yet. SortImpl::test_dynamic_view_sort_impl(N * N); -#endif SortImpl::test_issue_4978_impl(); } TEST(TEST_CATEGORY, SortEmptyView) { - // FIXME_OPENMPTARGET - causes runtime failure with CrayClang compiler -#if defined(KOKKOS_COMPILER_CRAY_LLVM) && defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "known to fail with OpenMPTarget+Cray LLVM"; -#endif using ExecutionSpace = TEST_EXECSPACE; // does not matter if we use int or something else diff --git a/packages/kokkos/algorithms/unit_tests/TestSortByKey.hpp b/packages/kokkos/algorithms/unit_tests/TestSortByKey.hpp index 5e9590c9bbb6..f55b372116d0 100644 --- a/packages/kokkos/algorithms/unit_tests/TestSortByKey.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestSortByKey.hpp @@ -1,29 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_SORT_BY_KEY_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_SORT_BY_KEY_HPP #include -#include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.random; import kokkos.sort; #else +#include #include #include #endif diff --git a/packages/kokkos/algorithms/unit_tests/TestSortCustomComp.hpp b/packages/kokkos/algorithms/unit_tests/TestSortCustomComp.hpp index 3ab2cb52cb88..16cc1c031251 100644 --- a/packages/kokkos/algorithms/unit_tests/TestSortCustomComp.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestSortCustomComp.hpp @@ -1,29 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_SORT_CUSTOM_COMP_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_SORT_CUSTOM_COMP_HPP #include -#include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.random; import kokkos.sort; #else +#include #include #include #endif @@ -155,7 +143,7 @@ TEST(TEST_CATEGORY, SortWithCustomComparator) { } // namespace SortWithComp } // namespace anonym - + #undef KOKKOS_IMPL_ONEDPL_VERSION #undef KOKKOS_IMPL_ONEDPL_VERSION_GREATER_EQUAL diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp index 208b46b15f27..9c7124c04a4a 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp index d8b80675c9d8..f2bb9da821cd 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -25,33 +12,6 @@ namespace AdjacentFind { namespace KE = Kokkos::Experimental; -// impl is here for std because it is only avail from c++>=17 -template -auto my_unique_copy(InputIterator first, InputIterator last, - OutputIterator result, BinaryPredicate pred) { - if (first != last) { - typename OutputIterator::value_type t(*first); - *result = t; - ++result; - while (++first != last) { - if (!pred(t, *first)) { - t = *first; - *result = t; - ++result; - } - } - } - return result; -} - -template -auto my_unique_copy(InputIterator first, InputIterator last, - OutputIterator result) { - using value_type = typename OutputIterator::value_type; - using func_t = IsEqualFunctor; - return my_unique_copy(first, last, result, func_t()); -} - template struct UnifDist; @@ -181,28 +141,6 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -template -IteratorType my_std_adjacent_find(IteratorType first, IteratorType last, - BinaryPredicate p) { - if (first == last) { - return last; - } - IteratorType next = first; - ++next; - for (; next != last; ++next, ++first) { - if (p(*first, *next)) { - return first; - } - } - return last; -} - -template -IteratorType my_std_adjacent_find(IteratorType first, IteratorType last) { - using value_type = typename IteratorType::value_type; - return my_std_adjacent_find(first, last, IsEqualFunctor()); -} - std::string value_type_to_string(int) { return "int"; } std::string value_type_to_string(double) { return "double"; } @@ -226,7 +164,7 @@ void verify(DiffType my_diff, ViewType view, Args... args) { auto view_dc = create_deep_copyable_compatible_clone(view); auto view_h = create_mirror_view_and_copy(Kokkos::HostSpace(), view_dc); auto std_r = - my_std_adjacent_find(KE::cbegin(view_h), KE::cend(view_h), args...); + std::adjacent_find(KE::cbegin(view_h), KE::cend(view_h), args...); const auto std_diff = std_r - KE::cbegin(view_h); ASSERT_EQ(my_diff, std_diff); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp index cccc0f6c18b4..9434f3bdb5f7 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp index 833145bdb464..28184a7867c5 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp index b799243c417a..63c64513af2c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_COMMON_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_COMMON_HPP @@ -20,17 +7,19 @@ #include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.random; import kokkos.std_algorithms; #else +#include #include #include #endif -#include #include -#include +#include #include #include +#include namespace Test { namespace stdalgos { @@ -204,10 +193,6 @@ auto create_deep_copyable_compatible_view_with_same_extent(ViewType view) { // this is needed for intel to avoid // error #1011: missing return statement at end of non-void function -#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \ - !defined(KOKKOS_COMPILER_MSVC) - __builtin_unreachable(); -#endif } template @@ -253,245 +238,6 @@ auto make_bounds(const ValueType1& lower, const ValueType2 upper) { return Kokkos::pair{lower, upper}; } -// libstdc++ as provided by GCC 8 does not have reduce, transform_reduce, -// exclusive_scan, inclusive_scan, transform_exclusive_scan, -// transform_inclusive_scan and for GCC 9.1, 9.2 fails to compile them for -// missing overload not accepting policy so use here simplified versions of -// them, only for testing purpose -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) - -template -ValueType testing_reduce(InputIterator first, InputIterator last, - ValueType initIn, BinaryOp binOp) { - using value_type = std::remove_const_t; - value_type init = initIn; - - while (last - first >= 4) { - ValueType v1 = binOp(first[0], first[1]); - ValueType v2 = binOp(first[2], first[3]); - ValueType v3 = binOp(v1, v2); - init = binOp(init, v3); - first += 4; - } - - for (; first != last; ++first) { - init = binOp(init, *first); - } - - return init; -} - -template -ValueType testing_reduce(InputIterator first, InputIterator last, - ValueType init) { - return testing_reduce( - first, last, init, - [](const ValueType& lhs, const ValueType& rhs) { return lhs + rhs; }); -} - -template -auto testing_reduce(InputIterator first, InputIterator last) { - using ValueType = typename InputIterator::value_type; - return testing_reduce( - first, last, ValueType{}, - [](const ValueType& lhs, const ValueType& rhs) { return lhs + rhs; }); -} - -template -ValueType testing_transform_reduce(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, ValueType initIn, - BinaryJoiner binJoiner, - BinaryTransform binTransform) { - using value_type = std::remove_const_t; - value_type init = initIn; - - while (last1 - first1 >= 4) { - ValueType v1 = binJoiner(binTransform(first1[0], first2[0]), - binTransform(first1[1], first2[1])); - - ValueType v2 = binJoiner(binTransform(first1[2], first2[2]), - binTransform(first1[3], first2[3])); - - ValueType v3 = binJoiner(v1, v2); - init = binJoiner(init, v3); - - first1 += 4; - first2 += 4; - } - - for (; first1 != last1; ++first1, ++first2) { - init = binJoiner(init, binTransform(*first1, *first2)); - } - - return init; -} - -template -ValueType testing_transform_reduce(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, ValueType init) { - return testing_transform_reduce( - first1, last1, first2, init, - [](const ValueType& lhs, const ValueType& rhs) { return lhs + rhs; }, - [](const ValueType& lhs, const ValueType& rhs) { return lhs * rhs; }); -} - -template -ValueType testing_transform_reduce(InputIterator first, InputIterator last, - ValueType initIn, BinaryJoiner binJoiner, - UnaryTransform unaryTransform) { - using value_type = std::remove_const_t; - value_type init = initIn; - - while (last - first >= 4) { - ValueType v1 = - binJoiner(unaryTransform(first[0]), unaryTransform(first[1])); - ValueType v2 = - binJoiner(unaryTransform(first[2]), unaryTransform(first[3])); - ValueType v3 = binJoiner(v1, v2); - init = binJoiner(init, v3); - first += 4; - } - - for (; first != last; ++first) { - init = binJoiner(init, unaryTransform(*first)); - } - - return init; -} - -/* - EXCLUSIVE_SCAN - */ -template -OutputIterator testing_exclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, ValueType initIn, - BinaryOp binOp) { - using value_type = std::remove_const_t; - value_type init = initIn; - - while (first != last) { - auto v = init; - init = binOp(init, *first); - ++first; - *result++ = v; - } - - return result; -} - -template -OutputIterator testing_exclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, ValueType init) { - return testing_exclusive_scan( - first, last, result, init, - [](const ValueType& lhs, const ValueType& rhs) { return lhs + rhs; }); -} - -/* - INCLUSIVE_SCAN - */ -template -OutputIterator testing_inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, BinaryOp binOp, - ValueType initIn) { - using value_type = std::remove_const_t; - value_type init = initIn; - for (; first != last; ++first) { - init = binOp(init, *first); - *result++ = init; - } - - return result; -} - -template -OutputIterator testing_inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result, BinaryOp bop) { - if (first != last) { - auto init = *first; - *result++ = init; - ++first; - if (first != last) { - result = testing_inclusive_scan(first, last, result, bop, init); - } - } - return result; -} - -template -OutputIterator testing_inclusive_scan(InputIterator first, InputIterator last, - OutputIterator result) { - using ValueType = typename InputIterator::value_type; - return testing_inclusive_scan( - first, last, result, - [](const ValueType& lhs, const ValueType& rhs) { return lhs + rhs; }); -} - -/* - TRANSFORM_EXCLUSIVE_SCAN - */ -template -OutputIterator testing_transform_exclusive_scan( - InputIterator first, InputIterator last, OutputIterator result, - ValueType initIn, BinaryOp binOp, UnaryOp unaryOp) { - using value_type = std::remove_const_t; - value_type init = initIn; - - while (first != last) { - auto v = init; - init = binOp(init, unaryOp(*first)); - ++first; - *result++ = v; - } - - return result; -} - -template -OutputIterator testing_transform_inclusive_scan(InputIterator first, - InputIterator last, - OutputIterator result, - BinaryOp binOp, UnaryOp unaryOp, - ValueType initIn) { - using value_type = std::remove_const_t; - value_type init = initIn; - - for (; first != last; ++first) { - init = binOp(init, unaryOp(*first)); - *result++ = init; - } - - return result; -} - -template -OutputIterator testing_transform_inclusive_scan(InputIterator first, - InputIterator last, - OutputIterator result, - BinaryOp binOp, - UnaryOp unaryOp) { - if (first != last) { - auto init = unaryOp(*first); - *result++ = init; - ++first; - if (first != last) { - result = testing_transform_inclusive_scan(first, last, result, binOp, - unaryOp, init); - } - } - - return result; -} - -#endif - template auto create_random_view_and_host_clone( LayoutTagType LayoutTag, std::size_t numRows, std::size_t numCols, @@ -690,9 +436,6 @@ struct CustomValueType { KOKKOS_INLINE_FUNCTION CustomValueType(value_type val) : value(val) {} - KOKKOS_INLINE_FUNCTION - CustomValueType(const CustomValueType& other) { this->value = other.value; } - KOKKOS_INLINE_FUNCTION explicit operator value_type() const { return value; } @@ -708,12 +451,6 @@ struct CustomValueType { return *this; } - KOKKOS_INLINE_FUNCTION - CustomValueType& operator=(const CustomValueType& other) { - this->value = other.value; - return *this; - } - KOKKOS_INLINE_FUNCTION CustomValueType operator+(const CustomValueType& other) const { CustomValueType result; diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp index c80fbfcef3c0..bf3b4b6b28ce 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp @@ -1,26 +1,14 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.std_algorithms; #else +#include #include #endif -#include #include namespace Test { @@ -399,18 +387,14 @@ struct TestStruct { TEST_ALGO_MACRO_B1E1(is_sorted_until); TEST_ALGO_MACRO_V1(is_sorted_until); -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted_until, TrivialComparator()); TEST_ALGO_MACRO_V1_VARIAD(is_sorted_until, TrivialComparator()); -#endif TEST_ALGO_MACRO_B1E1(is_sorted); TEST_ALGO_MACRO_V1(is_sorted); -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted, TrivialComparator()); TEST_ALGO_MACRO_V1_VARIAD(is_sorted, TrivialComparator()); -#endif } void minmax_ops() { @@ -421,14 +405,12 @@ struct TestStruct { TEST_ALGO_MACRO_B1E1(minmax_element); TEST_ALGO_MACRO_V1(minmax_element); -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST_ALGO_MACRO_B1E1_VARIAD(min_element, TrivialComparator()); TEST_ALGO_MACRO_V1_VARIAD(min_element, TrivialComparator()); TEST_ALGO_MACRO_B1E1_VARIAD(max_element, TrivialComparator()); TEST_ALGO_MACRO_V1_VARIAD(max_element, TrivialComparator()); TEST_ALGO_MACRO_B1E1_VARIAD(minmax_element, TrivialComparator()); TEST_ALGO_MACRO_V1_VARIAD(minmax_element, TrivialComparator()); -#endif } void partitionig_ops() { @@ -451,7 +433,6 @@ struct TestStruct { TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}); TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}); -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor()); TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor()); @@ -462,11 +443,9 @@ struct TestStruct { TEST_ALGO_MACRO_V1V2_VARIAD(transform_exclusive_scan, T{}, TrivialBinaryFunctor(), TrivialUnaryFunctor()); -#endif TEST_ALGO_MACRO_B1E1B2(inclusive_scan); TEST_ALGO_MACRO_V1V2(inclusive_scan); -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor()); TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor()); TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor(), @@ -485,9 +464,7 @@ struct TestStruct { TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan, TrivialBinaryFunctor(), TrivialUnaryFunctor(), T{}); -#endif -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST_ALGO_MACRO_B1E1(reduce); TEST_ALGO_MACRO_V1(reduce); TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}); @@ -510,11 +487,9 @@ struct TestStruct { TEST_ALGO_MACRO_V1_VARIAD(transform_reduce, T{}, TrivialReduceJoinFunctor(), TrivialTransformReduceUnaryTransformer()); -#endif } }; -#ifndef KOKKOS_ENABLE_CXX17 template constexpr bool test_kokkos_iterator_satify_std_random_access_iterator_concept() { @@ -526,7 +501,6 @@ static_assert(test_kokkos_iterator_satify_std_random_access_iterator_concept< Kokkos::View>()); static_assert(test_kokkos_iterator_satify_std_random_access_iterator_concept< Kokkos::View>()); -#endif } // namespace compileonly } // namespace stdalgos diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp index 7ab7fba3de10..90cde4dc4ac0 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp @@ -1,28 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include -#include #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.std_algorithms; -#include #else +#include #include #endif +#include namespace Test { namespace stdalgos { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp index 7c9e8f84bfa4..91e2aaf20b39 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp index 32e988370909..6e3b85c1ee02 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp index ef0209b34592..7623d3f21ef7 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp index 4482c62c0400..eae7b19086ea 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES @@ -121,21 +108,6 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -// I had to write my own because std::exclusive_scan is ONLY found with -// std=c++17 -template -void my_host_exclusive_scan(it1 first, it1 last, it2 dest, ValType init, - BopType bop) { - const auto num_elements = last - first; - if (num_elements > 0) { - while (first < last - 1) { - *(dest++) = init; - init = bop(*first++, init); - } - *dest = init; - } -} - template struct MultiplyFunctor { KOKKOS_INLINE_FUNCTION @@ -166,8 +138,8 @@ struct VerifyData { using gold_view_value_type = typename ViewType2::value_type; Kokkos::View gold_h( "goldh", data_view.extent(0)); - my_host_exclusive_scan(KE::cbegin(data_view_h), KE::cend(data_view_h), - KE::begin(gold_h), init_value, bop); + std::exclusive_scan(KE::cbegin(data_view_h), KE::cend(data_view_h), + KE::begin(gold_h), init_value, bop); auto test_view_dc = create_deep_copyable_compatible_clone(test_view); auto test_view_h = @@ -320,7 +292,6 @@ void run_exclusive_scan_all_scenarios() { run_single_scenario_inplace(it, ValueType{0}); run_single_scenario_inplace(it, ValueType{-2}); -#if !defined KOKKOS_ENABLE_OPENMPTARGET // custom multiply op is only run for small views otherwise it overflows if (it.first == "small-a" || it.first == "small-b") { using custom_bop_t = MultiplyFunctor; @@ -345,7 +316,6 @@ void run_exclusive_scan_all_scenarios() { custom_bop_t()); run_single_scenario_inplace(it, ValueType{-2}, custom_bop_t()); -#endif } } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp index 2692df698219..3041d5e34943 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp index 5a5359b0b234..c666cc2b3213 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -184,59 +171,6 @@ auto create_seq(ViewType data_view, std::size_t seq_extent) { return seq_view; } -// search is only avai from c++17, so I have to put it here -template -ForwardIt1 my_std_search(ForwardIt1 first, ForwardIt1 last, ForwardIt2 s_first, - ForwardIt2 s_last, BinaryPredicate p) { - for (;; ++first) { - ForwardIt1 it = first; - for (ForwardIt2 s_it = s_first;; ++it, ++s_it) { - if (s_it == s_last) { - return first; - } - if (it == last) { - return last; - } - if (!p(*it, *s_it)) { - break; - } - } - } -} - -// only avai from c++17, so I have to put it here -template -ForwardIt1 my_std_find_end(ForwardIt1 first, ForwardIt1 last, - ForwardIt2 s_first, ForwardIt2 s_last, - BinaryPredicate p) { - if (s_first == s_last) { - return last; - } - - ForwardIt1 result = last; - while (true) { - ForwardIt1 new_result = my_std_search(first, last, s_first, s_last, p); - if (new_result == last) { - break; - } else { - result = new_result; - first = result; - ++first; - } - } - return result; -} - -template -ForwardIt1 my_std_find_end(ForwardIt1 first, ForwardIt1 last, - ForwardIt2 s_first, ForwardIt2 s_last) { - using value_type1 = typename ForwardIt1::value_type; - using value_type2 = typename ForwardIt2::value_type; - - using pred_t = IsEqualFunctor; - return my_std_find_end(first, last, s_first, s_last, pred_t()); -} - std::string value_type_to_string(int) { return "int"; } std::string value_type_to_string(double) { return "double"; } @@ -273,8 +207,8 @@ void run_single_scenario(const InfoType& scenario_info, std::size_t seq_ext, auto view_h = create_host_space_copy(view); auto s_view_h = create_host_space_copy(s_view); auto stdrit = - my_std_find_end(KE::cbegin(view_h), KE::cend(view_h), - KE::cbegin(s_view_h), KE::cend(s_view_h), args...); + std::find_end(KE::cbegin(view_h), KE::cend(view_h), KE::cbegin(s_view_h), + KE::cend(s_view_h), args...); { auto myrit = KE::find_end(exespace(), KE::cbegin(view), KE::cend(view), diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp index d77edb5fed3e..8939e7f55416 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp index b24730ff0094..7ffdc829b07f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp index 2b3361743e4d..9e35c7fa5727 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_HELPERS_FUNCTORS_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_HELPERS_FUNCTORS_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include namespace Test { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp index d27c33f7643a..e982e09eaaec 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES @@ -121,32 +108,6 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -// my own because std::inclusive_scan is ONLY found with std=c++17 -template -void my_host_inclusive_scan(it1 first, it1 last, it2 dest, BinOp bop) { - if (first != last) { - auto init = *first; - *dest = init; - while (++first < last) { - init = bop(*first, init); - *(++dest) = init; - } - } -} - -template -void my_host_inclusive_scan(it1 first, it1 last, it2 dest, BinOp bop, - ValType init) { - if (first != last) { - init = bop(*first, init); - *dest = init; - while (++first < last) { - init = bop(*first, init); - *(++dest) = init; - } - } -} - template struct MultiplyFunctor { KOKKOS_INLINE_FUNCTION @@ -177,8 +138,8 @@ struct VerifyData { using gold_view_value_type = typename ViewType2::value_type; Kokkos::View gold_h( "goldh", data_view.extent(0)); - my_host_inclusive_scan(KE::cbegin(data_view_h), KE::cend(data_view_h), - KE::begin(gold_h), bop, args...); + std::inclusive_scan(KE::cbegin(data_view_h), KE::cend(data_view_h), + KE::begin(gold_h), bop, args...); auto test_view_dc = create_deep_copyable_compatible_clone(test_view); auto test_view_h = @@ -324,7 +285,6 @@ void run_inclusive_scan_all_scenarios() { run_single_scenario(it); run_single_scenario_inplace(it); -#if !defined KOKKOS_ENABLE_OPENMPTARGET // the sum custom op is always run using sum_binary_op = SumFunctor; sum_binary_op sbop; @@ -351,7 +311,6 @@ void run_inclusive_scan_all_scenarios() { run_single_scenario_inplace(it, mbop, ValueType{0}); run_single_scenario_inplace(it, mbop, ValueType{-2}); } -#endif } } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp index f5d7e34b85f7..9bf30e8073c9 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -151,7 +138,6 @@ void run_single_scenario(const InfoType& scenario_info) { [=](bool v) { return v == gold; }); EXPECT_TRUE(allA) << name << ", " << view_tag_to_string(Tag{}); -#if !defined KOKKOS_ENABLE_OPENMPTARGET CustomLessThanComparator comp; std::vector resultsB(4); resultsB[0] = @@ -163,7 +149,6 @@ void run_single_scenario(const InfoType& scenario_info) { const auto allB = std::all_of(resultsB.cbegin(), resultsB.cend(), [=](bool v) { return v == gold; }); EXPECT_TRUE(allB) << name << ", " << view_tag_to_string(Tag{}); -#endif Kokkos::fence(); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp index c6ace67788ca..d46d54b23d1f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -153,7 +140,6 @@ void run_single_scenario(const InfoType& scenario_info) { ASSERT_EQ(r3, gold) << name << ", " << view_tag_to_string(Tag{}); ASSERT_EQ(r4, gold) << name << ", " << view_tag_to_string(Tag{}); -#if !defined KOKKOS_ENABLE_OPENMPTARGET CustomLessThanComparator comp; [[maybe_unused]] auto r5 = KE::is_sorted_until(exespace(), KE::cbegin(view), KE::cend(view), comp); @@ -162,7 +148,6 @@ void run_single_scenario(const InfoType& scenario_info) { [[maybe_unused]] auto r7 = KE::is_sorted_until(exespace(), view, comp); [[maybe_unused]] auto r8 = KE::is_sorted_until("label", exespace(), view, comp); -#endif ASSERT_EQ(r1, gold) << name << ", " << view_tag_to_string(Tag{}); ASSERT_EQ(r2, gold) << name << ", " << view_tag_to_string(Tag{}); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp index 5d9e7db803c5..e5c56c6cf710 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -140,12 +127,9 @@ void run_all_scenarios() { } TEST(std_algorithms_lexicographical_compare_test, test) { -// FIXME: should this disable only custom comparator tests? -#if !defined KOKKOS_ENABLE_OPENMPTARGET run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); -#endif } } // namespace LexicographicalCompare diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp index 4d678b241be4..0af6662eed92 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include @@ -310,7 +297,6 @@ void std_algorithms_min_max_element_test::test_minmax_element_non_trivial_data( } } -#if !defined KOKKOS_ENABLE_OPENMPTARGET template void std_algorithms_min_max_element_test:: test_max_element_non_trivial_data_custom_comp(ViewType view) { @@ -391,7 +377,6 @@ void std_algorithms_min_max_element_test:: } } } -#endif // trivial case TEST_F(std_algorithms_min_max_element_test, min_element_empty_range) { @@ -419,7 +404,6 @@ TEST_F(std_algorithms_min_max_element_test, max_element_non_trivial_data) { test_max_element_non_trivial_data(m_strided_view); } -#if !defined KOKKOS_ENABLE_OPENMPTARGET // non-trivial data, custom comp TEST_F(std_algorithms_min_max_element_test, min_element_non_trivial_data_custom_comp) { @@ -434,10 +418,7 @@ TEST_F(std_algorithms_min_max_element_test, test_max_element_non_trivial_data_custom_comp(m_dynamic_view); test_max_element_non_trivial_data_custom_comp(m_strided_view); } -#endif -#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_COMPILER_CLANG) && \ - (KOKKOS_COMPILER_CLANG >= 1300) TEST_F(std_algorithms_min_max_element_test, minmax_element_empty_range) { test_minmax_element_empty_range(m_static_view); test_minmax_element_empty_range(m_dynamic_view); @@ -449,17 +430,13 @@ TEST_F(std_algorithms_min_max_element_test, minmax_element_non_trivial_data) { test_minmax_element_non_trivial_data(m_dynamic_view); test_minmax_element_non_trivial_data(m_strided_view); } -#endif -#if !defined KOKKOS_ENABLE_OPENMPTARGET -// OpenMPTarget does not yet support custom comparator TEST_F(std_algorithms_min_max_element_test, minmax_element_non_trivial_data_custom_comp) { test_minmax_element_non_trivial_data_custom_comp(m_static_view); test_minmax_element_non_trivial_data_custom_comp(m_dynamic_view); test_minmax_element_non_trivial_data_custom_comp(m_strided_view); } -#endif } // namespace stdalgos } // namespace Test diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp index df5df756d2ae..825e01e3c479 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp index 1fbeab3d9d7f..3cb5827dc361 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include @@ -29,6 +16,9 @@ struct MyMovableType { int m_value = 11; MyMovableType() = default; + + MyMovableType(const MyMovableType&) = delete; + MyMovableType(MyMovableType&& other) { if (this != &other) { m_value = other.m_value; @@ -36,6 +26,8 @@ struct MyMovableType { } } + MyMovableType& operator=(const MyMovableType&) = delete; + MyMovableType& operator=(MyMovableType&& other) { if (this != &other) { m_value = other.m_value; @@ -43,6 +35,8 @@ struct MyMovableType { } return *this; } + + ~MyMovableType() = default; }; TEST(std_algorithms_mod_ops_test, move) { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp index 42a17d737796..d3f0ac91506e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp index 8b91b72366ff..9ca5fc52dc9e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp index a3d7df533b40..9c7b343d76f4 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include @@ -130,8 +117,6 @@ struct std_algorithms_numerics_test : public ::testing::Test { } }; -#if !defined KOKKOS_ENABLE_OPENMPTARGET - // ------------------------------------------------------------------- // test default case of transform_reduce // @@ -596,7 +581,5 @@ TEST_F(std_algorithms_numerics_test, joiner_type()); } -#endif // not defined KOKKOS_ENABLE_OPENMPTARGET - } // namespace stdalgos } // namespace Test diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp index e47cacdd7d9c..644394730be9 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp index fafc36d3dfa8..839bb3597459 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp index f897e9b65749..6e3c368a9574 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp index 3137880ea813..e13f2687d29b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp index d88ab5473de6..2c6dc37f9dfa 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp index e42788799e47..e42af52b875e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp index 4596726cf3ce..6d3df0e38593 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp index b18c859af593..07d03f178326 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp index 82f859bac124..a07231253502 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp index 5ae2ff427853..1540c606f301 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -104,17 +91,6 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -// my own because std::replace_if is ONLY found with std=c++20 -template -void my_host_replace_if(ForwardIt first, ForwardIt last, UnaryPredicate p, - const T& new_value) { - for (; first != last; ++first) { - if (p(*first)) { - *first = new_value; - } - } -} - template void verify_data(ViewType1 data_view, // contains data @@ -125,8 +101,8 @@ void verify_data(ViewType1 data_view, // contains data auto data_view_dc = create_deep_copyable_compatible_clone(data_view); auto data_view_h = create_mirror_view_and_copy(Kokkos::HostSpace(), data_view_dc); - my_host_replace_if(KE::begin(data_view_h), KE::end(data_view_h), pred, - new_value); + std::replace_if(KE::begin(data_view_h), KE::end(data_view_h), pred, + new_value); auto test_view_dc = create_deep_copyable_compatible_clone(test_view); auto test_view_h = diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp index 3c934d64850c..e1f667c6132e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp index b9545e8b2e14..28165e2641b0 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp index 1a860c58cee8..2df5db5cb3ec 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp index 195f88a0b737..b36b785bb5d1 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -184,37 +171,6 @@ auto create_seq_to_search(ViewType data_view, std::size_t seq_extent) { return seq_view; } -// search is only avai from c++17, so I have to put it here -template -ForwardIt1 my_std_search(ForwardIt1 first, ForwardIt1 last, ForwardIt2 s_first, - ForwardIt2 s_last, BinaryPredicate p) { - for (;; ++first) { - ForwardIt1 it = first; - for (ForwardIt2 s_it = s_first;; ++it, ++s_it) { - if (s_it == s_last) { - return first; - } - if (it == last) { - return last; - } - if (!p(*it, *s_it)) { - break; - } - } - } -} - -// search is only avai from c++17, so I have to put it here -template -ForwardIt1 my_std_search(ForwardIt1 first, ForwardIt1 last, ForwardIt2 s_first, - ForwardIt2 s_last) { - using value_type1 = typename ForwardIt1::value_type; - using value_type2 = typename ForwardIt2::value_type; - - using pred_t = IsEqualFunctor; - return my_std_search(first, last, s_first, s_last, pred_t()); -} - std::string value_type_to_string(int) { return "int"; } std::string value_type_to_string(double) { return "double"; } @@ -250,9 +206,8 @@ void run_single_scenario(const InfoType& scenario_info, std::size_t seq_ext, // run std auto view_h = create_host_space_copy(view); auto s_view_h = create_host_space_copy(s_view); - auto stdrit = - my_std_search(KE::cbegin(view_h), KE::cend(view_h), KE::cbegin(s_view_h), - KE::cend(s_view_h), args...); + auto stdrit = std::search(KE::cbegin(view_h), KE::cend(view_h), + KE::cbegin(s_view_h), KE::cend(s_view_h), args...); { auto myrit = KE::search(exespace(), KE::cbegin(view), KE::cend(view), diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp index 79d88bec23f7..c75cf5d8d417 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -23,50 +10,6 @@ namespace Search_n { namespace KE = Kokkos::Experimental; -// search_n is only available from c++20, so I have to put it here -template -ForwardIt my_std_search_n(ForwardIt first, ForwardIt last, Size count, - const T& value, BinaryPredicate p) { - if (count <= 0) { - return first; - } - for (; first != last; ++first) { - if (!p(*first, value)) { - continue; - } - - ForwardIt candidate = first; - Size cur_count = 0; - - while (true) { - ++cur_count; - if (cur_count >= count) { - // success - return candidate; - } - ++first; - if (first == last) { - // exhausted the list - return last; - } - if (!p(*first, value)) { - // too few in a row - break; - } - } - } - - return last; -} - -template -ForwardIt my_std_search_n(ForwardIt first, ForwardIt last, Size count, - const T& value) { - using iter_value_type = typename ForwardIt::value_type; - using p_type = IsEqualFunctor; - return my_std_search_n(first, last, count, value, p_type()); -} - std::string value_type_to_string(int) { return "int"; } std::string value_type_to_string(double) { return "double"; } @@ -195,8 +138,8 @@ void run_single_scenario(const InfoType& scenario_info, std::size_t count, // run std auto view_h = create_host_space_copy(view); - auto stdrit = my_std_search_n(KE::cbegin(view_h), KE::cend(view_h), count, - value, args...); + auto stdrit = std::search_n(KE::cbegin(view_h), KE::cend(view_h), count, + value, args...); const auto stddiff = stdrit - KE::cbegin(view_h); { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp index 12835d5a2f7c..5611dda800fc 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -73,32 +60,11 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -template -ForwardIterator my_std_shift_left( - ForwardIterator first, ForwardIterator last, - typename std::iterator_traits::difference_type n) { - // copied from - // https://github.com/llvm/llvm-project/blob/main/libcxx/include/__algorithm/shift_left.h - - if (n == 0) { - return last; - } - - ForwardIterator m = first; - for (; n > 0; --n) { - if (m == last) { - return first; - } - ++m; - } - return std::move(m, last, first); -} - template void verify_data(ResultIt result_it, ViewType view, ViewHostType data_view_host, std::size_t shift_value) { - auto std_rit = my_std_shift_left(KE::begin(data_view_host), - KE::end(data_view_host), shift_value); + auto std_rit = std::shift_left(KE::begin(data_view_host), + KE::end(data_view_host), shift_value); // make sure results match const auto my_diff = result_it - KE::begin(view); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp index 3e350cf3b384..fcd7945f8ea8 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -73,30 +60,11 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -template -ForwardIterator my_std_shift_right( - ForwardIterator first, ForwardIterator last, - typename std::iterator_traits::difference_type n) { - // copied from - // https://github.com/llvm/llvm-project/blob/main/libcxx/include/__algorithm/shift_right.h - - if (n == 0) { - return first; - } - - decltype(n) d = last - first; - if (n >= d) { - return last; - } - ForwardIterator m = first + (d - n); - return std::move_backward(first, m, last); -} - template void verify_data(ResultIt result_it, ViewType view, ViewHostType data_view_host, std::size_t shift_value) { - auto std_rit = my_std_shift_right(KE::begin(data_view_host), - KE::end(data_view_host), shift_value); + auto std_rit = std::shift_right(KE::begin(data_view_host), + KE::end(data_view_host), shift_value); // make sure results match const auto my_diff = KE::end(view) - result_it; diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentDifference.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentDifference.cpp index 1dfdcfd56872..f680f5799780 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentDifference.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentDifference.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentFind.cpp index 88fc649a9b4b..c8e4bb6b5b76 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentFind.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentFind.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAllOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAllOf.cpp index 7b3dca330af4..db86e8325ba5 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAllOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAllOf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAnyOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAnyOf.cpp index f99617008eec..b408c828447e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAnyOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamAnyOf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy.cpp index 071ecd5a9a80..d4c37f8d92bc 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyBackward.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyBackward.cpp index c17c1810deaa..21e053665990 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyBackward.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyBackward.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyIf.cpp index 65c55ed7f791..fab8e9a4ac9f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopyIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy_n.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy_n.cpp index 9b509af55bf2..aa54e35f2bec 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy_n.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCopy_n.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCount.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCount.cpp index 23edf82e6e99..b6bdbc1d6624 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCount.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCount.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCountIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCountIf.cpp index 5a9be4cd111d..061745a3c443 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCountIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamCountIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamEqual.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamEqual.cpp index 592bb4c864d7..ee676d829535 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamEqual.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamEqual.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamExclusiveScan.cpp index 22affa9c37a3..8ae53df86b25 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamExclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamExclusiveScan.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include @@ -85,8 +72,6 @@ struct TestFunctorA { break; } -#ifndef KOKKOS_ENABLE_OPENMPTARGET - case 2: { auto it = KE::exclusive_scan( member, KE::cbegin(rowViewSrc), KE::cend(rowViewSrc), @@ -107,7 +92,6 @@ struct TestFunctorA { break; } -#endif } // store result of checking if all members have their local @@ -196,38 +180,27 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { ASSERT_TRUE(intraTeamSentinelView_h(i)); -// libstdc++ as provided by GCC 8 does not have exclusive_scan and -// for GCC 9.1, 9.2 fails to compile for missing overload not accepting policy -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) -#define exclusive_scan testing_exclusive_scan -#else -#define exclusive_scan std::exclusive_scan -#endif switch (apiId) { case 0: case 1: { - auto it = exclusive_scan(KE::cbegin(rowFrom), KE::cend(rowFrom), - KE::begin(rowDest), initValue); + auto it = std::exclusive_scan(KE::cbegin(rowFrom), KE::cend(rowFrom), + KE::begin(rowDest), initValue); const std::size_t stdDistance = KE::distance(KE::begin(rowDest), it); ASSERT_EQ(stdDistance, distancesView_h(i)); break; } -#ifndef KOKKOS_ENABLE_OPENMPTARGET case 2: case 3: { - auto it = exclusive_scan(KE::cbegin(rowFrom), KE::cend(rowFrom), - KE::begin(rowDest), initValue, binaryOp); + auto it = std::exclusive_scan(KE::cbegin(rowFrom), KE::cend(rowFrom), + KE::begin(rowDest), initValue, binaryOp); const std::size_t stdDistance = KE::distance(KE::begin(rowDest), it); ASSERT_EQ(stdDistance, distancesView_h(i)); break; } -#endif default: Kokkos::abort("unreachable"); } - -#undef exclusive_scan } if constexpr (std::is_same_v) { @@ -243,11 +216,7 @@ template void run_all_scenarios() { for (int numTeams : teamSizesToTest) { for (const auto& numCols : {0, 1, 2, 13, 101, 1444, 8153}) { -#ifndef KOKKOS_ENABLE_OPENMPTARGET for (int apiId : {0, 1, 2, 3}) { -#else - for (int apiId : {0, 1}) { -#endif test_A(numTeams, numCols, apiId); } } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill.cpp index bd3ef3bd67fb..f7a8c9e1cc70 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill_n.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill_n.cpp index 0a97f15c176f..35df1c9c6213 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill_n.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFill_n.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFind.cpp index 88c5e21f312f..5692491ced85 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFind.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFind.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindEnd.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindEnd.cpp index 21a905be56c9..0c02a4c2052a 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindEnd.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindEnd.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindFirstOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindFirstOf.cpp index ad1043362e4e..01857e75d25e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindFirstOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindFirstOf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIf.cpp index f21f947e9771..2e557bbd549b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIfNot.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIfNot.cpp index 0794dc0a7906..8d601678b924 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIfNot.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamFindIfNot.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEach.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEach.cpp index 26e00c21e530..7ed0cab6c992 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEach.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEach.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEachN.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEachN.cpp index 0f4793490f2a..919251ad669d 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEachN.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamForEachN.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate.cpp index 28c10c95d2f8..92588792760a 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate_n.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate_n.cpp index 265cdf474616..cd9f9d7464ad 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate_n.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamGenerate_n.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamInclusiveScan.cpp index 96009b5fd07c..36b76b83fd4f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamInclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamInclusiveScan.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include "std_algorithms/Kokkos_BeginEnd.hpp" @@ -218,18 +205,10 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { ASSERT_TRUE(intraTeamSentinelView_h(i)); -// libstdc++ as provided by GCC 8 does not have inclusive_scan and -// for GCC 9.1, 9.2 fails to compile for missing overload not accepting policy -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) -#define inclusive_scan testing_inclusive_scan -#else -#define inclusive_scan std::inclusive_scan -#endif - switch (apiId) { case 0: case 1: { - auto it = inclusive_scan(first, last, firstDest); + auto it = std::inclusive_scan(first, last, firstDest); const std::size_t stdDistance = KE::distance(firstDest, it); ASSERT_EQ(stdDistance, distancesView_h(i)); @@ -238,7 +217,7 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 2: case 3: { - auto it = inclusive_scan(first, last, firstDest, binaryOp); + auto it = std::inclusive_scan(first, last, firstDest, binaryOp); const std::size_t stdDistance = KE::distance(firstDest, it); ASSERT_EQ(stdDistance, distancesView_h(i)); @@ -247,7 +226,8 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 4: case 5: { - auto it = inclusive_scan(first, last, firstDest, binaryOp, initValue); + auto it = + std::inclusive_scan(first, last, firstDest, binaryOp, initValue); const std::size_t stdDistance = KE::distance(firstDest, it); ASSERT_EQ(stdDistance, distancesView_h(i)); @@ -255,8 +235,6 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { } default: Kokkos::abort("unreachable"); } - -#undef inclusive_scan } if constexpr (std::is_same_v) { @@ -280,10 +258,6 @@ void run_all_scenarios() { } TEST(std_algorithms_inclusive_scan_team_test, test) { -// FIXME_OPENMPTARGET -#if defined(KOKKOS_ENABLE_OPENMPTARGET) - GTEST_SKIP() << "the test is known to fail with OpenMPTarget"; -#endif run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsPartitioned.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsPartitioned.cpp index 21da333e75de..b3bc1aa78fdc 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsPartitioned.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsPartitioned.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSorted.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSorted.cpp index f76a595b3f42..b7a1e415929c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSorted.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSorted.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include @@ -51,9 +38,7 @@ struct TestFunctorA { result = KE::is_sorted(member, myRowView); Kokkos::single(Kokkos::PerTeam(member), [=, *this]() { m_returnsView(myRowIndex) = result; }); - } -#ifndef KOKKOS_ENABLE_OPENMPTARGET - else if (m_apiPick == 2) { + } else if (m_apiPick == 2) { using value_type = typename ViewType::value_type; result = KE::is_sorted(member, KE::cbegin(myRowView), KE::cend(myRowView), CustomLessThanComparator{}); @@ -66,7 +51,6 @@ struct TestFunctorA { Kokkos::single(Kokkos::PerTeam(member), [=, *this]() { m_returnsView(myRowIndex) = result; }); } -#endif // store result of checking if all members have their local // values matching the one stored in m_distancesView @@ -179,11 +163,7 @@ template void run_all_scenarios(bool makeDataSortedOnPurpose) { for (int numTeams : teamSizesToTest) { for (const auto& numCols : {0, 1, 2, 13, 101, 1444, 5153}) { -#ifndef KOKKOS_ENABLE_OPENMPTARGET for (int apiId : {0, 1, 2, 3}) { -#else - for (int apiId : {0, 1}) { -#endif test_A(numTeams, numCols, apiId, makeDataSortedOnPurpose); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSortedUntil.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSortedUntil.cpp index 024d17a31224..cbecaa57cee4 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSortedUntil.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamIsSortedUntil.cpp @@ -1,20 +1,8 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include namespace Test { namespace stdalgos { @@ -72,9 +60,7 @@ struct TestFunctorA { Kokkos::single(Kokkos::PerTeam(member), [=, *this]() { m_distancesView(myRowIndex) = resultDist; }); - } -#ifndef KOKKOS_ENABLE_OPENMPTARGET - else if (m_apiPick == 2) { + } else if (m_apiPick == 2) { using value_type = typename ViewType::value_type; auto it = KE::is_sorted_until(member, KE::cbegin(myRowView), KE::cend(myRowView), @@ -94,7 +80,6 @@ struct TestFunctorA { m_distancesView(myRowIndex) = resultDist; }); } -#endif // store result of checking if all members have their local // values matching the one stored in m_distancesView @@ -226,11 +211,7 @@ template void run_all_scenarios(const std::string& name, const std::vector& cols) { for (int numTeams : teamSizesToTest) { for (const auto& numCols : cols) { -#ifndef KOKKOS_ENABLE_OPENMPTARGET for (int apiId : {0, 1, 2, 3}) { -#else - for (int apiId : {0, 1}) { -#endif test_A(numTeams, numCols, apiId, name); } } @@ -255,10 +236,6 @@ TEST(std_algorithms_is_sorted_until_team_test, test_trivialB) { } TEST(std_algorithms_is_sorted_until_team_test, test_nontrivialA) { -#ifdef KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET Failing with clang 17 - GTEST_SKIP() << "Known to fail with OpenMPTarget and clang 17"; -#endif - const std::string name = "nontrivialUntilLast"; const std::vector cols = {13, 101, 1444, 5153}; run_all_scenarios(name, cols); @@ -267,10 +244,6 @@ TEST(std_algorithms_is_sorted_until_team_test, test_nontrivialA) { } TEST(std_algorithms_is_sorted_until_team_test, test_nontrivialB) { -#ifdef KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET Failing with clang 17 - GTEST_SKIP() << "Known to fail with OpenMPTarget and clang 17"; -#endif - const std::string name = "nontrivialRandom"; const std::vector cols = {13, 101, 1444, 5153}; run_all_scenarios(name, cols); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamLexicographicalCompare.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamLexicographicalCompare.cpp index 9d2d2721c64d..7c7405caf6e3 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamLexicographicalCompare.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamLexicographicalCompare.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMaxElement.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMaxElement.cpp index 452a48df2161..c2cf5b70635f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMaxElement.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMaxElement.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -58,9 +45,7 @@ struct TestFunctorA { Kokkos::single(Kokkos::PerTeam(member), [=, *this]() { m_distancesView(myRowIndex) = resultDist; }); - } -#ifndef KOKKOS_ENABLE_OPENMPTARGET - else if (m_apiPick == 2) { + } else if (m_apiPick == 2) { using value_type = typename ViewType::value_type; auto it = KE::max_element(member, KE::cbegin(myRowView), KE::cend(myRowView), @@ -80,7 +65,6 @@ struct TestFunctorA { m_distancesView(myRowIndex) = resultDist; }); } -#endif // store result of checking if all members have their local // values matching the one stored in m_distancesView @@ -160,8 +144,6 @@ template void run_all_scenarios() { for (int numTeams : teamSizesToTest) { for (const auto& numCols : {0, 1, 2, 13, 101, 1444, 5113}) { - // for OpenMPTarget we need to avod api accepting a custom - // comparator because it is not supported for (int apiId : {0, 1, 2, 3}) { test_A(numTeams, numCols, apiId); } @@ -170,11 +152,9 @@ void run_all_scenarios() { } TEST(std_algorithms_max_element_team_test, test) { -#ifndef KOKKOS_ENABLE_OPENMPTARGET run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); -#endif } } // namespace TeamMaxElement diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinElement.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinElement.cpp index 2c79370b926e..6a9b9256d9ff 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinElement.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinElement.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -58,9 +45,7 @@ struct TestFunctorA { Kokkos::single(Kokkos::PerTeam(member), [=, *this]() { m_distancesView(myRowIndex) = resultDist; }); - } -#ifndef KOKKOS_ENABLE_OPENMPTARGET - else if (m_apiPick == 2) { + } else if (m_apiPick == 2) { using value_type = typename ViewType::value_type; auto it = KE::min_element(member, KE::cbegin(myRowView), KE::cend(myRowView), @@ -80,7 +65,6 @@ struct TestFunctorA { m_distancesView(myRowIndex) = resultDist; }); } -#endif // store result of checking if all members have their local // values matching the one stored in m_distancesView @@ -159,8 +143,6 @@ template void run_all_scenarios() { for (int numTeams : teamSizesToTest) { for (const auto& numCols : {0, 1, 2, 13, 101, 1444, 5113}) { - // for OpenMPTarget we need to avod api accepting a custom - // comparator because it is not supported for (int apiId : {0, 1, 2, 3}) { test_A(numTeams, numCols, apiId); } @@ -169,11 +151,9 @@ void run_all_scenarios() { } TEST(std_algorithms_min_element_team_test, test) { -#ifndef KOKKOS_ENABLE_OPENMPTARGET run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); -#endif } } // namespace TeamMinElement diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinMaxElement.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinMaxElement.cpp index 25a4487855b6..c747fc758cfa 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinMaxElement.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMinMaxElement.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -65,9 +52,7 @@ struct TestFunctorA { m_distancesView(myRowIndex, 0) = resultDist1; m_distancesView(myRowIndex, 1) = resultDist2; }); - } -#ifndef KOKKOS_ENABLE_OPENMPTARGET - else if (m_apiPick == 2) { + } else if (m_apiPick == 2) { using value_type = typename ViewType::value_type; auto itPair = KE::minmax_element(member, KE::cbegin(myRowView), KE::cend(myRowView), @@ -93,7 +78,6 @@ struct TestFunctorA { m_distancesView(myRowIndex, 1) = resultDist2; }); } -#endif // store result of checking if all members have their local // values matching the one stored in m_distancesView @@ -178,8 +162,6 @@ template void run_all_scenarios() { for (int numTeams : teamSizesToTest) { for (const auto& numCols : {0, 1, 2, 13, 101, 1444, 5113}) { - // for OpenMPTarget we need to avod api accepting a custom - // comparator because it is not supported for (int apiId : {0, 1, 2, 3}) { test_A(numTeams, numCols, apiId); } @@ -188,11 +170,9 @@ void run_all_scenarios() { } TEST(std_algorithms_minmax_element_team_test, test) { -#ifndef KOKKOS_ENABLE_OPENMPTARGET run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); -#endif } } // namespace TeamMinMaxElement diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMismatch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMismatch.cpp index 9b245508e38c..5158be246341 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMismatch.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMismatch.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMove.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMove.cpp index 2c445dacf8e7..41adbf06b019 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMove.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMove.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMoveBackward.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMoveBackward.cpp index eb46f0301f81..3bda36893f71 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMoveBackward.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamMoveBackward.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamNoneOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamNoneOf.cpp index 373c6c662b9d..55051bac9b92 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamNoneOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamNoneOf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionCopy.cpp index 78ab6bf1f8d1..661b584cb6a5 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionPoint.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionPoint.cpp index 370e91cc1ff1..3c40ecb1000c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionPoint.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamPartitionPoint.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReduce.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReduce.cpp index 88264b45c053..e2b1da60fc99 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReduce.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReduce.cpp @@ -1,23 +1,8 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include -#ifndef KOKKOS_ENABLE_OPENMPTARGET - namespace Test { namespace stdalgos { namespace TeamReduce { @@ -194,21 +179,10 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { ASSERT_TRUE(intraTeamSentinelView_h(i)); - // libstdc++ as provided by GCC 8 does not have reduce, transform_reduce, - // exclusive_scan, inclusive_scan, transform_exclusive_scan, - // transform_inclusive_scan and for GCC 9.1, 9.2 fails to compile them for - // missing overload not accepting policy - -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) -#define reduce testing_reduce -#else -#define reduce std::reduce -#endif - switch (apiId) { case 0: case 1: { - const ValueType result = reduce(rowFromBegin, rowFromEnd); + const ValueType result = std::reduce(rowFromBegin, rowFromEnd); if constexpr (std::is_floating_point_v) { EXPECT_FLOAT_EQ(result, reduceResultsView_h(i)); } else { @@ -220,7 +194,7 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 2: case 3: { - const ValueType result = reduce(rowFromBegin, rowFromEnd, initVal); + const ValueType result = std::reduce(rowFromBegin, rowFromEnd, initVal); if constexpr (std::is_floating_point_v) { EXPECT_FLOAT_EQ(result, reduceResultsView_h(i)); } else { @@ -233,7 +207,7 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 4: case 5: { const ValueType result = - reduce(rowFromBegin, rowFromEnd, initVal, binaryPred); + std::reduce(rowFromBegin, rowFromEnd, initVal, binaryPred); if constexpr (std::is_floating_point_v) { EXPECT_FLOAT_EQ(result, reduceResultsView_h(i)); } else { @@ -244,8 +218,6 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { } default: Kokkos::abort("unreachable"); } - -#undef reduce } } @@ -269,5 +241,3 @@ TEST(std_algorithms_reduce_team_test, test) { } // namespace TeamReduce } // namespace stdalgos } // namespace Test - -#endif diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemove.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemove.cpp index 2defa1dc6fc8..77be2c5dae7b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemove.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemove.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopy.cpp index cde57021d6d6..a76aa0be7ded 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopyIf.cpp index faeeb47a8762..b71504b2da37 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveCopyIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveIf.cpp index 3dd7cb764c61..83427a5c24c2 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRemoveIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplace.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplace.cpp index fddc0f3b5bc3..358e7a7d4a28 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplace.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplace.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopy.cpp index 64f172e401cc..2cc0a5653995 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopyIf.cpp index 9c3699320d8c..833a9690dadb 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceCopyIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceIf.cpp index d79b53d35514..e43002960bea 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReplaceIf.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverse.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverse.cpp index 46d27aa16b0f..ea028bed003c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverse.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverse.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverseCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverseCopy.cpp index a06ae839e1fb..4e896fdfbede 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverseCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamReverseCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotate.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotate.cpp index 3188e029103b..98b849eb98f2 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotate.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotate.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotateCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotateCopy.cpp index 51f600fabad6..d812dd3a16f2 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotateCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamRotateCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearch.cpp index 1f0f4b6c1b90..747290e6242f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearch.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearch.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearchN.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearchN.cpp index 6d8a34e842d9..110e4e82f3b3 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearchN.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSearchN.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftLeft.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftLeft.cpp index 60edb377d026..5cc99544767f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftLeft.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftLeft.cpp @@ -1,20 +1,8 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include namespace Test { namespace stdalgos { @@ -71,27 +59,6 @@ struct TestFunctorA { } }; -// shift_left is only supported starting from C++20, -// so put here a working version of the std algo copied from -// https://github.com/llvm/llvm-project/blob/main/libcxx/include/__algorithm/shift_left.h -template -ForwardIterator my_std_shift_left( - ForwardIterator first, ForwardIterator last, - typename std::iterator_traits::difference_type n) { - if (n == 0) { - return last; - } - - ForwardIterator m = first; - for (; n > 0; --n) { - if (m == last) { - return first; - } - ++m; - } - return std::move(m, last, first); -} - template void test_A(std::size_t numTeams, std::size_t numCols, std::size_t shift, int apiId) { @@ -138,7 +105,7 @@ void test_A(std::size_t numTeams, std::size_t numCols, std::size_t shift, auto intraTeamSentinelView_h = create_host_space_copy(intraTeamSentinelView); for (std::size_t i = 0; i < cloneOfDataViewBeforeOp_h.extent(0); ++i) { auto myRow = Kokkos::subview(cloneOfDataViewBeforeOp_h, i, Kokkos::ALL()); - auto it = my_std_shift_left(KE::begin(myRow), KE::end(myRow), shift); + auto it = std::shift_left(KE::begin(myRow), KE::end(myRow), shift); const std::size_t stdDistance = KE::distance(KE::begin(myRow), it); ASSERT_EQ(stdDistance, distancesView_h(i)); ASSERT_TRUE(intraTeamSentinelView_h(i)); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftRight.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftRight.cpp index 08ff8fbbca62..b347998efaee 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftRight.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamShiftRight.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include @@ -71,25 +58,6 @@ struct TestFunctorA { } }; -// shift_right is only supported starting from C++20, -// so put here a working version of the std algo copied from -// https://github.com/llvm/llvm-project/blob/main/libcxx/include/__algorithm/shift_right.h -template -ForwardIterator my_std_shift_right( - ForwardIterator first, ForwardIterator last, - typename std::iterator_traits::difference_type n) { - if (n == 0) { - return first; - } - - decltype(n) d = last - first; - if (n >= d) { - return last; - } - ForwardIterator m = first + (d - n); - return std::move_backward(first, m, last); -} - template void test_A(std::size_t numTeams, std::size_t numCols, std::size_t shift, int apiId) { @@ -136,7 +104,7 @@ void test_A(std::size_t numTeams, std::size_t numCols, std::size_t shift, auto intraTeamSentinelView_h = create_host_space_copy(intraTeamSentinelView); for (std::size_t i = 0; i < cloneOfDataViewBeforeOp_h.extent(0); ++i) { auto myRow = Kokkos::subview(cloneOfDataViewBeforeOp_h, i, Kokkos::ALL()); - auto it = my_std_shift_right(KE::begin(myRow), KE::end(myRow), shift); + auto it = std::shift_right(KE::begin(myRow), KE::end(myRow), shift); const std::size_t stdDistance = KE::distance(KE::begin(myRow), it); ASSERT_EQ(stdDistance, distancesView_h(i)); ASSERT_TRUE(intraTeamSentinelView_h(i)); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSwapRanges.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSwapRanges.cpp index 60cb3f083779..018ebeeee30e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSwapRanges.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamSwapRanges.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformBinaryOp.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformBinaryOp.cpp index b3557d8afb38..2ac467cac9cb 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformBinaryOp.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformBinaryOp.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformExclusiveScan.cpp index 60e199a350eb..cae1a3e5aa7b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformExclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformExclusiveScan.cpp @@ -1,23 +1,8 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include -#ifndef KOKKOS_ENABLE_OPENMPTARGET - namespace Test { namespace stdalgos { namespace TeamTransformExclusiveScan { @@ -185,18 +170,10 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { auto initValue = initValuesView_h(i); ASSERT_TRUE(intraTeamSentinelView_h(i)); -// libstdc++ as provided by GCC 8 does not have transform_exclusive_scan and -// for GCC 9.1, 9.2 fails to compile for missing overload not accepting policy -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) -#define transform_exclusive_scan testing_transform_exclusive_scan -#else -#define transform_exclusive_scan std::transform_exclusive_scan -#endif - switch (apiId) { case 0: case 1: { - auto it = transform_exclusive_scan( + auto it = std::transform_exclusive_scan( KE::cbegin(rowFrom), KE::cend(rowFrom), KE::begin(rowDest), initValue, binaryOp, unaryOp); const std::size_t stdDistance = KE::distance(KE::begin(rowDest), it); @@ -205,8 +182,6 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { } default: Kokkos::abort("unreachable"); } - -#undef transform_exclusive_scan } if constexpr (std::is_same_v) { @@ -242,5 +217,3 @@ TEST(std_algorithms_transform_exclusive_scan_team_test, test) { } // namespace TeamTransformExclusiveScan } // namespace stdalgos } // namespace Test - -#endif diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformInclusiveScan.cpp index 0dc3e68b1d69..0792e0dd7377 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformInclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformInclusiveScan.cpp @@ -1,23 +1,8 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include -#ifndef KOKKOS_ENABLE_OPENMPTARGET - namespace Test { namespace stdalgos { namespace TeamTransformInclusiveScan { @@ -212,19 +197,11 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { ASSERT_TRUE(intraTeamSentinelView_h(i)); -// libstdc++ as provided by GCC 8 does not have transform_inclusive_scan and -// for GCC 9.1, 9.2 fails to compile for missing overload not accepting policy -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) -#define transform_inclusive_scan testing_transform_inclusive_scan -#else -#define transform_inclusive_scan std::transform_inclusive_scan -#endif - switch (apiId) { case 0: case 1: { - const auto it = - transform_inclusive_scan(first, last, firstDest, binaryOp, unaryOp); + const auto it = std::transform_inclusive_scan(first, last, firstDest, + binaryOp, unaryOp); const std::size_t stdDistance = KE::distance(firstDest, it); ASSERT_EQ(stdDistance, distancesView_h(i)); @@ -233,8 +210,8 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 2: case 3: { - const auto it = transform_inclusive_scan(first, last, firstDest, - binaryOp, unaryOp, initValue); + const auto it = std::transform_inclusive_scan( + first, last, firstDest, binaryOp, unaryOp, initValue); const std::size_t stdDistance = KE::distance(firstDest, it); ASSERT_EQ(stdDistance, distancesView_h(i)); @@ -243,7 +220,6 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { default: Kokkos::abort("unreachable"); } } -#undef transform_inclusive_scan if constexpr (std::is_same_v) { auto dataViewAfterOp_h = create_host_space_copy(sourceView); @@ -278,5 +254,3 @@ TEST(std_algorithms_transform_inclusive_scan_team_test, test) { } // namespace TeamTransformInclusiveScan } // namespace stdalgos } // namespace Test - -#endif diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformReduce.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformReduce.cpp index 69c38342dfaa..7829d2806078 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformReduce.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformReduce.cpp @@ -1,23 +1,8 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include -#ifndef KOKKOS_ENABLE_OPENMPTARGET - namespace Test { namespace stdalgos { namespace TeamTransformReduce { @@ -239,21 +224,11 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { ASSERT_TRUE(intraTeamSentinelView_h(i)); -// libstdc++ as provided by GCC 8 does not have reduce, transform_reduce, -// exclusive_scan, inclusive_scan, transform_exclusive_scan, -// transform_inclusive_scan and for GCC 9.1, 9.2 fails to compile them for -// missing overload not accepting policy -#if defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE <= 9) -#define transform_reduce testing_transform_reduce -#else -#define transform_reduce std::transform_reduce -#endif - switch (apiId) { case 0: case 1: { - const auto result = transform_reduce(firstDataRowBegin, firstDataRowEnd, - secondDataRowBegin, initVal); + const auto result = std::transform_reduce( + firstDataRowBegin, firstDataRowEnd, secondDataRowBegin, initVal); if constexpr (std::is_floating_point_v) { EXPECT_FLOAT_EQ(result, resultsView_h(i)); @@ -266,7 +241,7 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 2: case 3: { - const ValueType result = transform_reduce( + const ValueType result = std::transform_reduce( firstDataRowBegin, firstDataRowEnd, secondDataRowBegin, initVal, binaryJoiner, binaryTransform); @@ -282,8 +257,8 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { case 4: case 5: { const ValueType result = - transform_reduce(firstDataRowBegin, firstDataRowEnd, initVal, - binaryJoiner, unaryTransform); + std::transform_reduce(firstDataRowBegin, firstDataRowEnd, initVal, + binaryJoiner, unaryTransform); if constexpr (std::is_floating_point_v) { EXPECT_FLOAT_EQ(result, resultsView_h(i)); @@ -295,8 +270,6 @@ void test_A(std::size_t numTeams, std::size_t numCols, int apiId) { } default: Kokkos::abort("unreachable"); } - -#undef transform_reduce } } @@ -320,5 +293,3 @@ TEST(std_algorithms_transform_reduce_team_test, test) { } // namespace TeamTransformReduce } // namespace stdalgos } // namespace Test - -#endif diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformUnaryOp.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformUnaryOp.cpp index 0fbb040020e7..b13d8a29ed36 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformUnaryOp.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamTransformUnaryOp.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUnique.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUnique.cpp index cef0f7c13d07..757ec8c7c449 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUnique.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUnique.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUniqueCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUniqueCopy.cpp index 6773797097e9..a00f0153a90a 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUniqueCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTeamUniqueCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp index 3f87d569678e..a99134917643 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp @@ -1,24 +1,13 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES #include #include #endif +#include + #include #include @@ -127,21 +116,6 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -// I had to write my own because std::transform_exclusive_scan is ONLY found -// with std=c++17 -template -void my_host_transform_exclusive_scan(it1 first, it1 last, it2 dest, - ValType init, BopType bop, UopType uop) { - const auto num_elements = last - first; - if (num_elements > 0) { - while (first < last - 1) { - *(dest++) = init; - init = bop(uop(*(first++)), init); - } - *dest = init; - } -} - template void verify_data(ViewType1 data_view, // contains data @@ -156,9 +130,8 @@ void verify_data(ViewType1 data_view, // contains data using gold_view_value_type = typename ViewType2::value_type; Kokkos::View gold_h( "goldh", data_view.extent(0)); - my_host_transform_exclusive_scan(KE::cbegin(data_view_h), - KE::cend(data_view_h), KE::begin(gold_h), - init_value, bop, uop); + std::transform_exclusive_scan(KE::cbegin(data_view_h), KE::cend(data_view_h), + KE::begin(gold_h), init_value, bop, uop); auto test_view_dc = create_deep_copyable_compatible_clone(test_view); auto test_view_h = @@ -326,14 +299,12 @@ void run_all_scenarios() { } } -#if !defined KOKKOS_ENABLE_OPENMPTARGET TEST(std_algorithms_numeric_ops_test, transform_exclusive_scan) { run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); run_all_scenarios(); } -#endif template struct MultiplyFunctor { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp index ca9eca48ceb7..b47af3802538 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES @@ -128,34 +115,6 @@ void fill_view(ViewType dest_view, const std::string& name) { Kokkos::parallel_for("copy", dest_view.extent(0), F1); } -// I had to write my own because std::transform_inclusive_scan is ONLY found -// with std=c++17 -template -void my_host_transform_inclusive_scan(it1 first, it1 last, it2 dest, - BopType bop, UopType uop) { - if (first != last) { - auto init = uop(*first); - *dest = init; - while (++first < last) { - init = bop(uop(*first), init); - *(++dest) = init; - } - } -} - -template -void my_host_transform_inclusive_scan(it1 first, it1 last, it2 dest, - BopType bop, UopType uop, ValType init) { - if (first != last) { - init = bop(uop(*first), init); - *dest = init; - while (++first < last) { - init = bop(uop(*first), init); - *(++dest) = init; - } - } -} - template void verify_data(ViewType1 data_view, // contains data ViewType2 test_view, // the view to test @@ -169,9 +128,8 @@ void verify_data(ViewType1 data_view, // contains data using gold_view_value_type = typename ViewType2::value_type; Kokkos::View gold_h( "goldh", data_view.extent(0)); - my_host_transform_inclusive_scan(KE::cbegin(data_view_h), - KE::cend(data_view_h), KE::begin(gold_h), - args...); + std::transform_inclusive_scan(KE::cbegin(data_view_h), KE::cend(data_view_h), + KE::begin(gold_h), args...); auto test_view_dc = create_deep_copyable_compatible_clone(test_view); auto test_view_h = @@ -340,7 +298,6 @@ void run_all_scenarios() { } } -#if !defined KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET TEST(std_algorithms_numeric_ops_test, transform_inclusive_scan) { run_all_scenarios(); run_all_scenarios(); @@ -415,7 +372,6 @@ TEST(std_algorithms_numeric_ops_test, transform_inclusive_scan_functor) { test_lambda(functor); } } -#endif } // namespace TransformIncScan } // namespace stdalgos diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp index 6070c1a60d36..482fdfa9823b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp index 6ee93e3d5fa0..5ff48981d452 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp index e3e969645839..430534d59f57 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -23,33 +10,6 @@ namespace UniqueCopy { namespace KE = Kokkos::Experimental; -// impl is here for std because it is only avail from c++>=17 -template -auto my_unique_copy(InputIterator first, InputIterator last, - OutputIterator result, BinaryPredicate pred) { - if (first != last) { - typename OutputIterator::value_type t(*first); - *result = t; - ++result; - while (++first != last) { - if (!pred(t, *first)) { - t = *first; - *result = t; - ++result; - } - } - } - return result; -} - -template -auto my_unique_copy(InputIterator first, InputIterator last, - OutputIterator result) { - using value_type = typename OutputIterator::value_type; - using func_t = IsEqualFunctor; - return my_unique_copy(first, last, result, func_t()); -} - template struct UnifDist; @@ -141,7 +101,7 @@ std::size_t fill_view(ViewType dest_view, const std::string& name) { std::fill(tmp.begin(), tmp.end(), static_cast(0)); using func_t = IsEqualFunctor; auto std_r = - my_unique_copy(KE::cbegin(v_h), KE::cend(v_h), tmp.begin(), func_t()); + std::unique_copy(KE::cbegin(v_h), KE::cend(v_h), tmp.begin(), func_t()); count = (std::size_t)(std_r - tmp.begin()); } @@ -225,8 +185,8 @@ void verify_data(const std::string& name, ViewTypeFrom view_from, std::vector tmp(view_test_h.extent(0)); std::fill(tmp.begin(), tmp.end(), static_cast(0)); - auto std_r = my_unique_copy(KE::cbegin(view_from_h), KE::cend(view_from_h), - tmp.begin(), args...); + auto std_r = std::unique_copy(KE::cbegin(view_from_h), + KE::cend(view_from_h), tmp.begin(), args...); (void)std_r; for (std::size_t i = 0; i < view_from_h.extent(0); ++i) { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp b/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp index 0044b935587f..575fcd6cbd86 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include // purpose of this test is to check that the reducers used diff --git a/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp b/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp index 11a1cb717a34..cc9e67194709 100644 --- a/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp +++ b/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp @@ -1,21 +1,13 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif int main(int argc, char *argv[]) { Kokkos::initialize(argc, argv); diff --git a/packages/kokkos/benchmarks/.clang-tidy b/packages/kokkos/benchmarks/.clang-tidy new file mode 100644 index 000000000000..4175cb3a4e2a --- /dev/null +++ b/packages/kokkos/benchmarks/.clang-tidy @@ -0,0 +1,4 @@ +Checks: > + -bugprone-exception-escape + +InheritParentConfig: true diff --git a/packages/kokkos/benchmarks/CMakeLists.txt b/packages/kokkos/benchmarks/CMakeLists.txt index 968c8ae3bf59..4b49d55a2176 100644 --- a/packages/kokkos/benchmarks/CMakeLists.txt +++ b/packages/kokkos/benchmarks/CMakeLists.txt @@ -1,12 +1,8 @@ -#FIXME_OPENMPTARGET - compiling in debug mode causes ICE. kokkos_add_benchmark_directories(atomic) kokkos_add_benchmark_directories(gather) kokkos_add_benchmark_directories(gups) kokkos_add_benchmark_directories(launch_latency) kokkos_add_benchmark_directories(stream) kokkos_add_benchmark_directories(view_copy_constructor) -#FIXME_OPENMPTARGET - These two benchmarks cause ICE. Commenting them for now but a deeper analysis on the cause and a possible fix will follow. -if(NOT Kokkos_ENABLE_OPENMPTARGET) - kokkos_add_benchmark_directories(policy_performance) - kokkos_add_benchmark_directories(bytes_and_flops) -endif() +kokkos_add_benchmark_directories(policy_performance) +kokkos_add_benchmark_directories(bytes_and_flops) diff --git a/packages/kokkos/benchmarks/atomic/Makefile b/packages/kokkos/benchmarks/atomic/Makefile deleted file mode 100644 index c59de75ce8e5..000000000000 --- a/packages/kokkos/benchmarks/atomic/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -KOKKOS_DEVICES=Cuda -KOKKOS_CUDA_OPTIONS=enable_lambda -KOKKOS_ARCH = "SNB,Volta70" - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -ifndef KOKKOS_PATH - KOKKOS_PATH = $(MAKEFILE_PATH)../.. -endif - -SRC = $(wildcard $(MAKEFILE_PATH)*.cpp) -HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp) - -vpath %.cpp $(sort $(dir $(SRC))) - -default: build - echo "Start Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) -CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper -EXE = atomic_perf.cuda -else -CXX = g++ -EXE = atomic_perf.exe -endif - -CXXFLAGS ?= -O3 -g -override CXXFLAGS += -I$(MAKEFILE_PATH) - -DEPFLAGS = -M -LINK = ${CXX} -LINKFLAGS = - -OBJ = $(notdir $(SRC:.cpp=.o)) -LIB = - -include $(KOKKOS_PATH)/Makefile.kokkos - -build: $(EXE) - -$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE) - -clean: kokkos-clean - rm -f *.o atomic_perf.cuda atomic_perf.exe - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@) diff --git a/packages/kokkos/benchmarks/atomic/main.cpp b/packages/kokkos/benchmarks/atomic/main.cpp index aa9076ff5973..4c7c022015ef 100644 --- a/packages/kokkos/benchmarks/atomic/main.cpp +++ b/packages/kokkos/benchmarks/atomic/main.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include diff --git a/packages/kokkos/benchmarks/benchmark_suite/scripts/build_code.bash b/packages/kokkos/benchmarks/benchmark_suite/scripts/build_code.bash index 0b885293e27a..1cc5810e20eb 100755 --- a/packages/kokkos/benchmarks/benchmark_suite/scripts/build_code.bash +++ b/packages/kokkos/benchmarks/benchmark_suite/scripts/build_code.bash @@ -80,5 +80,3 @@ cd build/miniFE make KOKKOS_ARCH=${KOKKOS_ARCH} KOKKOS_DEVICES=${KOKKOS_DEVICES} CXX=${CXX} KOKKOS_PATH=${KOKKOS_PATH} \ CXXFLAGS=${OPT_FLAG} -f ${MINIFE_PATH}/src/Makefile -j 16 cd ../../ - - diff --git a/packages/kokkos/benchmarks/benchmark_suite/scripts/checkout_repos.bash b/packages/kokkos/benchmarks/benchmark_suite/scripts/checkout_repos.bash index 9b52a36d89ac..35ed7d8099b5 100755 --- a/packages/kokkos/benchmarks/benchmark_suite/scripts/checkout_repos.bash +++ b/packages/kokkos/benchmarks/benchmark_suite/scripts/checkout_repos.bash @@ -32,6 +32,3 @@ fi cd miniFE git pull cd .. - - - diff --git a/packages/kokkos/benchmarks/benchmark_suite/scripts/run_benchmark.bash b/packages/kokkos/benchmarks/benchmark_suite/scripts/run_benchmark.bash index 6afa05f5fcfb..2abb9b9cfa4c 100755 --- a/packages/kokkos/benchmarks/benchmark_suite/scripts/run_benchmark.bash +++ b/packages/kokkos/benchmarks/benchmark_suite/scripts/run_benchmark.bash @@ -11,4 +11,4 @@ ${SCRIPT_PATH}/checkout_repos.bash ${SCRIPT_PATH}/build_code.bash --arch=${KOKKOS_ARCH} --device-list=${KOKKOS_DEVICES} --compiler=${COMPILER} ${SCRIPT_PATH}/run_tests.bash -fi \ No newline at end of file +fi diff --git a/packages/kokkos/benchmarks/bytes_and_flops/Makefile b/packages/kokkos/benchmarks/bytes_and_flops/Makefile deleted file mode 100644 index 4b6f084d20ea..000000000000 --- a/packages/kokkos/benchmarks/bytes_and_flops/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -KOKKOS_DEVICES=Cuda -KOKKOS_CUDA_OPTIONS=enable_lambda -KOKKOS_ARCH = "SNB,Volta70" - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -ifndef KOKKOS_PATH - KOKKOS_PATH = $(MAKEFILE_PATH)../.. -endif - -SRC = $(wildcard $(MAKEFILE_PATH)*.cpp) -HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp) - -vpath %.cpp $(sort $(dir $(SRC))) - -default: build - echo "Start Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) -CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper -EXE = bytes_and_flops.cuda -else -CXX = g++ -EXE = bytes_and_flops.exe -endif - -CXXFLAGS ?= -O3 -g -override CXXFLAGS += -I$(MAKEFILE_PATH) - -DEPFLAGS = -M -LINK = ${CXX} -LINKFLAGS = - -OBJ = $(notdir $(SRC:.cpp=.o)) -LIB = - -include $(KOKKOS_PATH)/Makefile.kokkos - -build: $(EXE) - -$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE) - -clean: kokkos-clean - rm -f *.o *.cuda *.host - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@) diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp index 88830af624b6..af7c29504fe7 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include template diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp index 2fda1ae3d427..2c3d9138b204 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "bench.hpp" diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp index 3210116a9ee7..2a2369c47817 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "bench.hpp" diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp index 24a5dcd38997..fb50428068b8 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "bench.hpp" diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp index 0634700c31e1..2b33e9774140 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "bench.hpp" diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp index 80f017fbe8fc..ad65f4dcb331 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #define UNROLL 1 #include "bench_unroll_stride.hpp" diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp index 762cc988f14e..fda6aefb4e11 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project template struct Run { diff --git a/packages/kokkos/benchmarks/bytes_and_flops/main.cpp b/packages/kokkos/benchmarks/bytes_and_flops/main.cpp index fdfcc4ea64ff..e25146cc6259 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/main.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/main.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "bench.hpp" #include diff --git a/packages/kokkos/benchmarks/gather/Makefile b/packages/kokkos/benchmarks/gather/Makefile deleted file mode 100644 index e1bfce21a62a..000000000000 --- a/packages/kokkos/benchmarks/gather/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -KOKKOS_DEVICES=Cuda -KOKKOS_CUDA_OPTIONS=enable_lambda -KOKKOS_ARCH = "SNB,Volta70" - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -ifndef KOKKOS_PATH - KOKKOS_PATH = $(MAKEFILE_PATH)../.. -endif - -SRC = $(wildcard $(MAKEFILE_PATH)*.cpp) -HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp) - -vpath %.cpp $(sort $(dir $(SRC))) - -default: build - echo "Start Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) -CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper -EXE = gather.cuda -else -CXX = g++ -EXE = gather.exe -endif - -CXXFLAGS ?= -O3 -g -override CXXFLAGS += -I$(MAKEFILE_PATH) - -DEPFLAGS = -M -LINK = ${CXX} -LINKFLAGS = - -OBJ = $(notdir $(SRC:.cpp=.o)) -LIB = - -include $(KOKKOS_PATH)/Makefile.kokkos - -build: $(EXE) - -$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE) - -clean: kokkos-clean - rm -f *.o gather.cuda gather.exe - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@) diff --git a/packages/kokkos/benchmarks/gather/gather.hpp b/packages/kokkos/benchmarks/gather/gather.hpp index 90b1101c1d5e..d5e8b4dc6f13 100644 --- a/packages/kokkos/benchmarks/gather/gather.hpp +++ b/packages/kokkos/benchmarks/gather/gather.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project template struct RunGather { diff --git a/packages/kokkos/benchmarks/gather/gather_unroll.hpp b/packages/kokkos/benchmarks/gather/gather_unroll.hpp index 1aa73091bc5a..6278a5d74f48 100644 --- a/packages/kokkos/benchmarks/gather/gather_unroll.hpp +++ b/packages/kokkos/benchmarks/gather/gather_unroll.hpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include template diff --git a/packages/kokkos/benchmarks/gather/main.cpp b/packages/kokkos/benchmarks/gather/main.cpp index 7b44c7af4032..f118462699ba 100644 --- a/packages/kokkos/benchmarks/gather/main.cpp +++ b/packages/kokkos/benchmarks/gather/main.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "gather.hpp" #include diff --git a/packages/kokkos/benchmarks/gups/gups.cpp b/packages/kokkos/benchmarks/gups/gups.cpp index 251f572207df..3ce7afcfe606 100644 --- a/packages/kokkos/benchmarks/gups/gups.cpp +++ b/packages/kokkos/benchmarks/gups/gups.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*! \brief file gups.cpp diff --git a/packages/kokkos/benchmarks/launch_latency/launch_latency.cpp b/packages/kokkos/benchmarks/launch_latency/launch_latency.cpp index 0935706ee87d..f3fe45d586d0 100644 --- a/packages/kokkos/benchmarks/launch_latency/launch_latency.cpp +++ b/packages/kokkos/benchmarks/launch_latency/launch_latency.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*! \file launch_latency.cpp @@ -33,7 +20,15 @@ 3. Avg functor completion latency: (M (launch + sync)) / M */ +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif + +#include +#include template struct TestFunctor { diff --git a/packages/kokkos/benchmarks/policy_performance/Makefile b/packages/kokkos/benchmarks/policy_performance/Makefile deleted file mode 100644 index 21365f36c6ad..000000000000 --- a/packages/kokkos/benchmarks/policy_performance/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -KOKKOS_DEVICES=Cuda -KOKKOS_CUDA_OPTIONS=enable_lambda -KOKKOS_ARCH = "SNB,Volta70" - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -ifndef KOKKOS_PATH - KOKKOS_PATH = $(MAKEFILE_PATH)../.. -endif - -SRC = $(wildcard $(MAKEFILE_PATH)*.cpp) -HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp) - -vpath %.cpp $(sort $(dir $(SRC))) - -default: build - echo "Start Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) -CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper -EXE = policy_perf.cuda -else -CXX = g++ -EXE = policy_perf.exe -endif - -CXXFLAGS ?= -O3 -g -override CXXFLAGS += -I$(MAKEFILE_PATH) - -DEPFLAGS = -M -LINK = ${CXX} -LINKFLAGS = - -OBJ = $(notdir $(SRC:.cpp=.o)) -LIB = - -include $(KOKKOS_PATH)/Makefile.kokkos - -build: $(EXE) - -$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE) - -clean: kokkos-clean - rm -f *.o policy_perf.cuda policy_perf.exe - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@) diff --git a/packages/kokkos/benchmarks/policy_performance/main.cpp b/packages/kokkos/benchmarks/policy_performance/main.cpp index dd61ba65020c..9b3327e2b1b1 100644 --- a/packages/kokkos/benchmarks/policy_performance/main.cpp +++ b/packages/kokkos/benchmarks/policy_performance/main.cpp @@ -1,22 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "policy_perf_test.hpp" +#include + int main(int argc, char* argv[]) { Kokkos::initialize(argc, argv); diff --git a/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp b/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp index 8a874e0139a8..2a8c0f963f5f 100644 --- a/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp +++ b/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp @@ -1,20 +1,14 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif + +#include template struct ParallelScanFunctor { diff --git a/packages/kokkos/benchmarks/policy_performance/script_sample_usage.sh b/packages/kokkos/benchmarks/policy_performance/script_sample_usage.sh index 1c2db56648cc..dccdfdf62ebc 100755 --- a/packages/kokkos/benchmarks/policy_performance/script_sample_usage.sh +++ b/packages/kokkos/benchmarks/policy_performance/script_sample_usage.sh @@ -1,9 +1,9 @@ #!/bin/bash -# Sample script for benchmarking policy performance +# Sample script for benchmarking policy performance # Suggested environment variables to export prior to executing script: -# KNL: +# KNL: # OMP_NUM_THREADS=256 KMP_AFFINITY=compact # Power: # OMP_NUM_THREADS=64 OMP_PROC_BIND=true @@ -27,7 +27,7 @@ # Tier 7: 'outer' parallel_for with TeamPolicy (nested parallelism) 1XY # Tier 8: 'outer' parallel_reduce with TeamPolicy (nested parallelism) 2XY -# Results grouped by: +# Results grouped by: # 0) SCHEDULE 1) CODE (test) 2) TEAMRANGE 3) TEAMSIZE 4) THREADRANGE EXECUTABLE=policy_performance diff --git a/packages/kokkos/benchmarks/stream/Makefile b/packages/kokkos/benchmarks/stream/Makefile deleted file mode 100644 index 529e7892475f..000000000000 --- a/packages/kokkos/benchmarks/stream/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -KOKKOS_DEVICES=Cuda -KOKKOS_CUDA_OPTIONS=enable_lambda -KOKKOS_ARCH = "SNB,Volta70" - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -ifndef KOKKOS_PATH - KOKKOS_PATH = $(MAKEFILE_PATH)../.. -endif - -SRC = $(wildcard $(MAKEFILE_PATH)*.cpp) -HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp) - -vpath %.cpp $(sort $(dir $(SRC))) - -default: build - echo "Start Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) -CXX = ${KOKKOS_PATH}/bin/nvcc_wrapper -EXE = stream.cuda -else -CXX = g++ -EXE = stream.exe -endif - -CXXFLAGS ?= -O3 -g -override CXXFLAGS += -I$(MAKEFILE_PATH) - -DEPFLAGS = -M -LINK = ${CXX} -LINKFLAGS = - -OBJ = $(notdir $(SRC:.cpp=.o)) -LIB = - -include $(KOKKOS_PATH)/Makefile.kokkos - -build: $(EXE) - -$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE) - -clean: kokkos-clean - rm -f *.o stream.cuda stream.exe - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@) diff --git a/packages/kokkos/benchmarks/stream/stream-kokkos.cpp b/packages/kokkos/benchmarks/stream/stream-kokkos.cpp index 65523b0e7365..a10de4e96a6f 100644 --- a/packages/kokkos/benchmarks/stream/stream-kokkos.cpp +++ b/packages/kokkos/benchmarks/stream/stream-kokkos.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "Kokkos_Core.hpp" #include @@ -28,7 +15,7 @@ using StreamDeviceArray = Kokkos::View>; -using StreamHostArray = typename StreamDeviceArray::HostMirror; +using StreamHostArray = typename StreamDeviceArray::host_mirror_type; using StreamIndex = int; using Policy = Kokkos::RangePolicy>; diff --git a/packages/kokkos/benchmarks/view_copy_constructor/Makefile b/packages/kokkos/benchmarks/view_copy_constructor/Makefile deleted file mode 100644 index 77845a22b1e7..000000000000 --- a/packages/kokkos/benchmarks/view_copy_constructor/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -KOKKOS_DEVICES=Serial -KOKKOS_ARCH = "" - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -MAKEFILE_PATH := $(subst Makefile,,$(abspath $(lastword $(MAKEFILE_LIST)))) - -ifndef KOKKOS_PATH - KOKKOS_PATH = $(MAKEFILE_PATH)../.. -endif - -SRC = $(wildcard $(MAKEFILE_PATH)*.cpp) -HEADERS = $(wildcard $(MAKEFILE_PATH)*.hpp) - -vpath %.cpp $(sort $(dir $(SRC))) - -default: build - echo "Start Build" - -CXX = clang++ -EXE = view_copy_constructor.exe - -CXXFLAGS ?= -Ofast -override CXXFLAGS += -I$(MAKEFILE_PATH) - -DEPFLAGS = -M -LINK = ${CXX} -LINKFLAGS = -Ofast -KOKKOS_CXX_STANDARD=c++20 - -OBJ = $(notdir $(SRC:.cpp=.o)) -LIB = - -include $(KOKKOS_PATH)/Makefile.kokkos - -build: $(EXE) - -$(EXE): $(OBJ) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(KOKKOS_LIBS) $(LIB) -o $(EXE) - -clean: kokkos-clean - rm -f *.o view_copy_constructor.cuda view_copy_constructor.exe - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) $(HEADERS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< -o $(notdir $@) diff --git a/packages/kokkos/benchmarks/view_copy_constructor/view_copy_constructor.cpp b/packages/kokkos/benchmarks/view_copy_constructor/view_copy_constructor.cpp index 63c49f09c01e..7d4431b27405 100644 --- a/packages/kokkos/benchmarks/view_copy_constructor/view_copy_constructor.cpp +++ b/packages/kokkos/benchmarks/view_copy_constructor/view_copy_constructor.cpp @@ -1,29 +1,22 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project // The function "test_view_collection" exposes the copy constructor // and destructor overheads in Kokkos View objects // Please see the lines marked by "NOTE". #include +#include #include #include #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include // NVIEWS is the number of Kokkos View objects in our ViewCollection object diff --git a/packages/kokkos/bin/nvcc_wrapper b/packages/kokkos/bin/nvcc_wrapper index f8e49e20ce5c..ffb6fd8293e1 100755 --- a/packages/kokkos/bin/nvcc_wrapper +++ b/packages/kokkos/bin/nvcc_wrapper @@ -11,11 +11,10 @@ # example, you may have have two different wrappers with either icpc # or g++ as their back-end compiler. The defaults can be overwritten # by using the usual arguments (e.g., -arch=sm_80 -ccbin icpc). -# sm_70 is supported by every CUDA version from 9-12 and is thus +# sm_80 is supported by every CUDA version from 11-13 and is thus # chosen as default -default_arch="sm_70" -#default_arch="sm_80" +default_arch="sm_80" # # The default C++ compiler. @@ -151,7 +150,15 @@ do *.cpp|*.cxx|*.cc|*.C|*.c++|*.cu) cpp_files="$cpp_files $1" ;; - # Ensure we only have one optimization flag because NVCC doesn't allow multiple + #fast-compile level for device code, tradeoff between compilation speed and runtime performance + -Ofc=*|--Ofast-compile=*) + cuda_args="$cuda_args $1" + ;; + -Ofc|--Ofast-compile) + cuda_args="$cuda_args $1 $2" + shift + ;; + # Ensure we only have one optimization flag because NVCC doesn't allow multiple -O*) if [ -n "$optimization_flag" ]; then if [ "$1" = "$optimization_flag" ]; then @@ -237,10 +244,10 @@ do cuda_args="$cuda_args $1" ;; #Handle known nvcc args that have an argument - -maxrregcount=*|--maxrregcount=*|-time=*|-Xptxas=*) + -maxrregcount=*|--maxrregcount=*|-time=*|-Xptxas=*|--fdevice-time-trace=*|-fdevice-time-trace=*) cuda_args="$cuda_args $1" ;; - -maxrregcount|--default-stream|-Xnvlink|--ftz|--prec-div|--prec-sqrt|--fmad|-cudart|--cudart|-include|-time|-Xptxas) + -maxrregcount|--default-stream|-Xnvlink|--ftz|--prec-div|--prec-sqrt|--fmad|-cudart|--cudart|-include|-time|-Xptxas|--fdevice-time-trace|-fdevice-time-trace) cuda_args="$cuda_args $1 $2" shift ;; @@ -316,11 +323,11 @@ do ;; # End of Werror handling #Handle unsupported standard flags - --std=c++1y|-std=c++1y|--std=gnu++1y|-std=gnu++1y|--std=c++1z|-std=c++1z|--std=gnu++1z|-std=gnu++1z|--std=c++2a|-std=c++2a) - fallback_std_flag="-std=c++17" + --std=c++1y|-std=c++1y|--std=gnu++1y|-std=gnu++1y|--std=c++1z|-std=c++1z|--std=gnu++1z|-std=gnu++1z|--std=c++2a|-std=c++2a|--std=c++2b|-std=c++2b|--std=c++2c|-std=c++2c) + fallback_std_flag="-std=c++20" # this is hopefully just occurring in a downstream project during CMake feature tests # we really have no choice here but to accept the flag and change to an accepted C++ standard - echo "nvcc_wrapper does not accept standard flags $1 since partial standard flags and standards after C++17 are not supported. nvcc_wrapper will use $fallback_std_flag instead. It is undefined behavior to use this flag. This should only be occurring during CMake configuration." + echo "nvcc_wrapper does not accept standard flags $1 since partial standard flags and standards after C++20 are not supported. nvcc_wrapper will use $fallback_std_flag instead. It is undefined behavior to use this flag. This should only be occurring during CMake configuration." if [ -n "$std_flag" ]; then warn_std_flag shared_args=${shared_args/ $std_flag/} @@ -338,25 +345,7 @@ do std_flag=$corrected_std_flag shared_args="$shared_args $std_flag" ;; - --std=c++20|-std=c++20) - if [ -n "$std_flag" ]; then - warn_std_flag - shared_args=${shared_args/ $std_flag/} - fi - # NVCC only has C++20 from version 12 on - cuda_main_version=$([[ $(${nvcc_compiler} --version) =~ V([0-9]+) ]] && echo ${BASH_REMATCH[1]}) - if [ ${cuda_main_version} -lt 12 ]; then - fallback_std_flag="-std=c++17" - # this is hopefully just occurring in a downstream project during CMake feature tests - # we really have no choice here but to accept the flag and change to an accepted C++ standard - echo "nvcc_wrapper does not accept standard flags $1 since partial standard flags and standards after C++17 are not supported. nvcc_wrapper will use $fallback_std_flag instead. It is undefined behavior to use this flag. This should only be occurring during CMake configuration." - std_flag=$fallback_std_flag - else - std_flag=$1 - fi - shared_args="$shared_args $std_flag" - ;; - --std=c++11|-std=c++11|--std=c++14|-std=c++14|--std=c++17|-std=c++17) + --std=c++11|-std=c++11|--std=c++14|-std=c++14|--std=c++17|-std=c++17|--std=c++20|-std=c++20) if [ -n "$std_flag" ]; then warn_std_flag shared_args=${shared_args/ $std_flag/} @@ -366,7 +355,7 @@ do ;; #convert PGI standard flags to something nvcc can handle - --c++11|--c++14|--c++17) + --c++11|--c++14|--c++17|--c++20) if [ -n "$std_flag" ]; then warn_std_flag shared_args=${shared_args/ $std_flag/} diff --git a/packages/kokkos/bin/runtest b/packages/kokkos/bin/runtest deleted file mode 100755 index 92411fe5badf..000000000000 --- a/packages/kokkos/bin/runtest +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env bash - -function get_path() { - cd "$(dirname "$0")" - cd .. - echo "$(pwd -P)" -} - -KOKKOS_PATH="$(get_path "$0")" - -function show_help() { - local cmd=$(basename "$0") - echo "Usage: ${cmd} " - echo " Build and run the tests" - echo "" - echo "Options:" - echo " -j=N|--make-j=N Build the tests in parallel" - echo " -c|--clean Clean build and regenerate make files" - echo " --clean-on-pass Clean build when runtest passes" - echo " --output-prefix=
  Prefix of log files  Default: runtest"
-  echo "  --build-only           Only build the tests"
-  echo "  -v|--verbose           Tee STDOUT and STDERR to screen and files"
-  echo "  -h|--help              Show this message"
-  echo ""
-  ${KOKKOS_PATH}/generate_makefile.bash --help
-  return 0
-}
-
-
-declare -a GENERATE_ARGS=()
-declare -i VERBOSE=0
-declare -i CLEAN=0
-declare -i CLEAN_ON_PASS=0
-declare -i BUILD_ONLY=0
-OUTPUT="runtest"
-
-declare -i MAKE_J=${HPCBIND_NUM_PUS:-1}
-
-for i in $@; do
-  case $i in
-    -j=*|--make-j=*)
-      MAKE_J=${i#*=}
-      shift
-      ;;
-    -c|--clean)
-      CLEAN=1
-      shift
-      ;;
-    --clean-on-pass)
-      CLEAN_ON_PASS=1
-      shift
-      ;;
-    --output-prefix=*)
-      OUTPUT=${i#*=}
-      shift
-      ;;
-    --build-only)
-      BUILD_ONLY=1
-      shift
-      ;;
-    -v|--verbose)
-      VERBOSE=1
-      shift
-      ;;
-    -h|--help)
-      show_help
-      exit 0
-      ;;
-    *)
-      GENERATE_ARGS+=("$i")
-      shift
-      ;;
-  esac
-done
-
-if [[ "$(pwd -P)" == ${KOKKOS_PATH} ]]; then
-  echo "Cannot call $0 from root repository path ${KOKKOS_PATH}"
-  exit 1
-fi
-
-# Some makefile dependencies are incorrect, so clean needs to force
-# a new call to generate_makefiles.bash
-if [[ ${CLEAN} -eq 1 ]]; then
-  START=${SECONDS}
-  echo "Cleaning"
-  /bin/rm -rf algorithms containers core example install Makefile >/dev/null 2>&1
-  END=${SECONDS}
-  echo "    $((END-START)) seconds"
-  if [[ ${VERBOSE} -eq 1 ]]; then
-    echo ""
-    echo ""
-  fi
-fi
-
-declare -i START=${SECONDS}
-echo "Generating Makefile"
-echo "    ${KOKKOS_PATH}/generate_makefile.bash --kokkos-path=${KOKKOS_PATH} ${GENERATE_ARGS[@]}"
-
-if [[ ${VERBOSE} -eq 0 ]]; then
-  "${KOKKOS_PATH}"/generate_makefile.bash --kokkos-path="${KOKKOS_PATH}" "${GENERATE_ARGS[@]}" > ${OUTPUT}.out 2> >(tee ${OUTPUT}.err >&2)
-else
-  "${KOKKOS_PATH}"/generate_makefile.bash --kokkos-path="${KOKKOS_PATH}" "${GENERATE_ARGS[@]}" > >(tee ${OUTPUT}.out) 2> >(tee ${OUTPUT}.err >&2)
-fi
-declare -i RESULT=$?
-declare -i END=${SECONDS}
-if [[ ${RESULT} -eq 0 ]]; then
-  echo "    PASS:  $((END-START)) seconds"
-  if [[ ${VERBOSE} -eq 1 ]]; then
-    echo ""
-    echo ""
-  fi
-else
-  cat ${OUTPUT}.out | grep "FAIL"
-  cat ${OUTPUT}.err | grep "FAIL"
-  echo "    FAIL:  $((END-START)) seconds"
-  exit 1
-fi
-
-START=${SECONDS}
-echo "Building"
-if [[ ${VERBOSE} -eq 0 ]]; then
-  make --keep-going -j ${MAKE_J} build-test >> ${OUTPUT}.out 2> >(tee -a ${OUTPUT}.err >&2)
-else
-  make --keep-going -j ${MAKE_J} build-test > >(tee -a ${OUTPUT}.out) 2> >(tee -a ${OUTPUT}.err >&2)
-fi
-RESULT=$?
-END=${SECONDS}
-if [[ ${RESULT} -eq 0 ]]; then
-  echo "    PASS:  $((END-START)) seconds"
-  if [[ ${VERBOSE} -eq 1 ]]; then
-    echo ""
-    echo ""
-  fi
-else
-  cat ${OUTPUT}.out | grep -E "[[:space:]]error:[[:space:]]"
-  cat ${OUTPUT}.err | grep -E "[[:space:]]error:[[:space:]]"
-  echo "    FAIL:  $((END-START)) seconds"
-  exit 1
-fi
-
-if [[ ${BUILD_ONLY} -eq 0 ]]; then
-  START=${SECONDS}
-  echo "Testing"
-  if [[ ${VERBOSE} -eq 0 ]]; then
-    make --keep-going test >> ${OUTPUT}.out 2> >(tee -a ${OUTPUT}.err >&2)
-  else
-    make --keep-going test > >(tee -a ${OUTPUT}.out) 2> >(tee -a ${OUTPUT}.err >&2)
-  fi
-  RESULT=$?
-  END=${SECONDS}
-  if [[ ${RESULT} -eq 0 ]]; then
-    echo "    PASS:  $((END-START)) seconds"
-    if [[ ${CLEAN_ON_PASS} -eq 1 ]]; then
-      make clean
-    fi
-  else
-    cat ${OUTPUT}.out | grep "FAIL"
-    cat ${OUTPUT}.err | grep "FAIL"
-    echo "    FAIL:  $((END-START)) seconds"
-    exit 1
-  fi
-fi
-
-exit ${RESULT}
-
diff --git a/packages/kokkos/cmake/KokkosConfig.cmake.in b/packages/kokkos/cmake/KokkosConfig.cmake.in
index aed9f1060ca0..c62dc0a90057 100644
--- a/packages/kokkos/cmake/KokkosConfig.cmake.in
+++ b/packages/kokkos/cmake/KokkosConfig.cmake.in
@@ -42,8 +42,8 @@ if("launch_compiler" IN_LIST Kokkos_FIND_COMPONENTS)
   )
   kokkos_compilation(GLOBAL CHECK_CUDA_COMPILES)
 
-elseif(@Kokkos_ENABLE_CUDA@ AND NOT @KOKKOS_COMPILE_LANGUAGE@ STREQUAL CUDA AND NOT "separable_compilation" IN_LIST
-                                                                                Kokkos_FIND_COMPONENTS
+elseif(@Kokkos_ENABLE_CUDA@ AND (NOT @KOKKOS_COMPILE_LANGUAGE@ STREQUAL CUDA OR Kokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES)
+       AND NOT "separable_compilation" IN_LIST Kokkos_FIND_COMPONENTS
 )
   #
   # if CUDA was enabled, the compilation language was not set to CUDA, and separable compilation was not
diff --git a/packages/kokkos/cmake/KokkosConfigCommon.cmake.in b/packages/kokkos/cmake/KokkosConfigCommon.cmake.in
index 769dff6b1091..c798608ded2e 100644
--- a/packages/kokkos/cmake/KokkosConfigCommon.cmake.in
+++ b/packages/kokkos/cmake/KokkosConfigCommon.cmake.in
@@ -9,12 +9,6 @@ set(Kokkos_CXX_STANDARD @KOKKOS_CXX_STANDARD@)
 
 # Required to be a TriBITS-compliant external package
 if(NOT TARGET Kokkos::all_libs)
-  # CMake Error at /lib/cmake/Kokkos/KokkosConfigCommon.cmake:10 (ADD_LIBRARY):
-  #   ADD_LIBRARY cannot create ALIAS target "Kokkos::all_libs" because target
-  #   "Kokkos::kokkos" is imported but not globally visible.
-  if(CMAKE_VERSION VERSION_LESS "3.18")
-    set_target_properties(Kokkos::kokkos PROPERTIES IMPORTED_GLOBAL ON)
-  endif()
   add_library(Kokkos::all_libs ALIAS Kokkos::kokkos)
 endif()
 
@@ -30,6 +24,7 @@ endforeach()
 foreach(OPT ${Kokkos_OPTIONS})
   set(Kokkos_ENABLE_${OPT} ON)
 endforeach()
+set(_kokkos_removed_OPTIONS CUDA_LAMBDA)
 
 if(Kokkos_ENABLE_CUDA)
   set(Kokkos_CUDA_ARCHITECTURES @KOKKOS_CUDA_ARCHITECTURES@)
@@ -37,6 +32,21 @@ endif()
 
 if(Kokkos_ENABLE_HIP)
   set(Kokkos_HIP_ARCHITECTURES @KOKKOS_HIP_ARCHITECTURES@)
+  # check if the GPU_TARGETS are the same as the arch in Kokkos
+  foreach(arch IN LISTS GPU_TARGETS)
+    if(NOT (arch STREQUAL @KOKKOS_HIP_ARCHITECTURES@))
+      if(@KOKKOS_ENABLE_DEPRECATED_CODE_5@)
+        set(MESSAGE_TYPE WARNING)
+      else()
+        set(MESSAGE_TYPE FATAL_ERROR)
+      endif()
+      message(
+        ${MESSAGE_TYPE}
+        "AMD GPU architectures given via GPU_TARGETS=\"${GPU_TARGETS}\" are not compatible with the architecture enabled in Kokkos which is @KOKKOS_HIP_ARCHITECTURES@. Kokkos allows only one device architecture to be active. To resolve this, configure with -DGPU_TARGETS=\"@KOKKOS_HIP_ARCHITECTURES@\" to prevent it from being set implicitly by find_package calls."
+      )
+      break()
+    endif()
+  endforeach()
 endif()
 
 if(NOT Kokkos_FIND_QUIETLY)
@@ -90,20 +100,29 @@ function(kokkos_check)
   set(KOKKOS_CHECK_SUCCESS TRUE)
   foreach(arg ${REQUESTED_ARGS})
     set(MISSING_OPTIONS "")
+    set(_found_removed_options)
     foreach(requested ${KOKKOS_CHECK_${arg}})
       set(FOUND_MATCHING_OPTION FALSE)
+      string(TOUPPER ${requested} REQUESTED_UC)
       foreach(provided ${Kokkos_${arg}})
-        string(TOUPPER ${requested} REQUESTED_UC)
         string(TOUPPER ${provided} PROVIDED_UC)
         if(PROVIDED_UC STREQUAL REQUESTED_UC)
           set(FOUND_MATCHING_OPTION TRUE)
         endif()
       endforeach()
       if(NOT FOUND_MATCHING_OPTION)
-        list(APPEND MISSING_OPTIONS ${requested})
-        set(KOKKOS_CHECK_SUCCESS FALSE)
+        if(REQUESTED_UC IN_LIST _kokkos_removed_${arg})
+          list(APPEND _found_removed_options ${requested})
+        else()
+          list(APPEND MISSING_OPTIONS ${requested})
+          set(KOKKOS_CHECK_SUCCESS FALSE)
+        endif()
       endif()
+
     endforeach()
+    if(_found_removed_options)
+      message(DEPRECATION "The following options have been removed from Kokkos_${arg}: ${_found_removed_options}")
+    endif()
     if(NOT KOKKOS_CHECK_SUCCESS AND NOT KOKKOS_CHECK_RETURN_VALUE)
       message(STATUS "Could NOT find Kokkos_${arg} (missing: ${MISSING_OPTIONS})")
     endif()
@@ -187,11 +206,11 @@ int main()
   if(NOT _RET EQUAL 0)
     # save the command for debugging
     set(_COMMANDS
-        "${_COMMAND}\n${_COMPILER} --cuda-gpu-arch=sm_35 ${ARGN} -c ${PROJECT_BINARY_DIR}/compile_tests/compiles_cuda.cu"
+        "${_COMMAND}\n${_COMPILER} --cuda-gpu-arch=sm_50 ${ARGN} -c ${PROJECT_BINARY_DIR}/compile_tests/compiles_cuda.cu"
     )
     # try the compile test again with clang arguments
     execute_process(
-      COMMAND ${_COMPILER} --cuda-gpu-arch=sm_35 -c ${PROJECT_BINARY_DIR}/compile_tests/compiles_cuda.cu
+      COMMAND ${_COMPILER} --cuda-gpu-arch=sm_50 -c ${PROJECT_BINARY_DIR}/compile_tests/compiles_cuda.cu
       RESULT_VARIABLE _RET
       WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/compile_tests
       TIMEOUT 15
@@ -226,12 +245,8 @@ function(kokkos_compilation)
   # if built w/o CUDA support, we want to basically make this a no-op
   set(_Kokkos_ENABLE_CUDA @Kokkos_ENABLE_CUDA@)
 
-  if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
-    set(MAYBE_CURRENT_INSTALLATION_ROOT "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../..")
-  endif()
-
   # search relative first and then absolute
-  set(_HINTS "${MAYBE_CURRENT_INSTALLATION_ROOT}" "@CMAKE_INSTALL_PREFIX@")
+  set(_HINTS "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../.." "@CMAKE_INSTALL_PREFIX@")
 
   # find kokkos_launch_compiler
   find_program(
diff --git a/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in b/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in
index 73fa0b736c6d..2f31957e6a09 100644
--- a/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in
+++ b/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in
@@ -1,20 +1,5 @@
-/*
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-//
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
-*/
 
 #ifndef @HEADER_GUARD_TAG@
 #define @HEADER_GUARD_TAG@
diff --git a/packages/kokkos/cmake/KokkosCore_config.h.in b/packages/kokkos/cmake/KokkosCore_config.h.in
index fcc40214817c..3da41d629696 100644
--- a/packages/kokkos/cmake/KokkosCore_config.h.in
+++ b/packages/kokkos/cmake/KokkosCore_config.h.in
@@ -16,26 +16,25 @@
 #define KOKKOS_VERSION_MINOR @KOKKOS_VERSION_MINOR@
 #define KOKKOS_VERSION_PATCH @KOKKOS_VERSION_PATCH@
 
+#cmakedefine KOKKOS_IMPL_BUILD_SHARED_LIBS
+
 /* Execution Spaces */
 #cmakedefine KOKKOS_ENABLE_SERIAL
 #cmakedefine KOKKOS_ENABLE_OPENMP
 #cmakedefine KOKKOS_ENABLE_OPENACC
-#cmakedefine KOKKOS_ENABLE_OPENMPTARGET
 #cmakedefine KOKKOS_ENABLE_THREADS
 #cmakedefine KOKKOS_ENABLE_CUDA
 #cmakedefine KOKKOS_ENABLE_HIP
 #cmakedefine KOKKOS_ENABLE_HPX
 #cmakedefine KOKKOS_ENABLE_SYCL
+#cmakedefine KOKKOS_ENABLE_NEXTSILICON
 
 /* General Settings */
-#cmakedefine KOKKOS_ENABLE_CXX17
 #cmakedefine KOKKOS_ENABLE_CXX20
 #cmakedefine KOKKOS_ENABLE_CXX23
 #cmakedefine KOKKOS_ENABLE_CXX26
 
 #cmakedefine KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE
-#cmakedefine KOKKOS_ENABLE_CUDA_UVM
-#cmakedefine KOKKOS_ENABLE_CUDA_LAMBDA  // deprecated
 #cmakedefine KOKKOS_ENABLE_CUDA_CONSTEXPR
 #cmakedefine KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC
 #cmakedefine KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY
@@ -48,10 +47,10 @@
 #cmakedefine KOKKOS_ENABLE_OPENACC_FORCE_HOST_AS_DEVICE
 #cmakedefine KOKKOS_ENABLE_IMPL_HPX_ASYNC_DISPATCH
 #cmakedefine KOKKOS_ENABLE_DEBUG
-#cmakedefine KOKKOS_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK
 #cmakedefine KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK
 #cmakedefine KOKKOS_ENABLE_TUNING
 #cmakedefine KOKKOS_ENABLE_DEPRECATED_CODE_4
+#cmakedefine KOKKOS_ENABLE_DEPRECATED_CODE_5
 #cmakedefine KOKKOS_ENABLE_DEPRECATION_WARNINGS
 #cmakedefine KOKKOS_ENABLE_LARGE_MEM_TESTS
 #cmakedefine KOKKOS_ENABLE_COMPLEX_ALIGN
@@ -64,6 +63,7 @@
 #cmakedefine KOKKOS_ENABLE_IMPL_VIEW_OF_VIEWS_DESTRUCTOR_PRECONDITION_VIOLATION_WORKAROUND
 #cmakedefine KOKKOS_ENABLE_ATOMICS_BYPASS
 #cmakedefine KOKKOS_ENABLE_IMPL_CHECK_POSSIBLY_BREAKING_LAYOUTS
+#cmakedefine KOKKOS_ENABLE_BENCHMARKS_HEAVY
 
 /* TPL Settings */
 #cmakedefine KOKKOS_ENABLE_HWLOC
@@ -72,6 +72,10 @@
 #cmakedefine KOKKOS_ENABLE_ONEDPL
 #cmakedefine KOKKOS_ENABLE_ROCTHRUST
 
+/* Embedded dependencies */
+#define KOKKOS_IMPL_DESUL_VERSION "@KOKKOS_DESUL_VERSION@"
+#define KOKKOS_IMPL_MDSPAN_VERSION "@KOKKOS_MDSPAN_VERSION@"
+
 #cmakedefine KOKKOS_ARCH_ARMV80
 #cmakedefine KOKKOS_ARCH_ARMV8_THUNDERX
 #cmakedefine KOKKOS_ARCH_ARMV81
@@ -127,7 +131,9 @@
 #cmakedefine KOKKOS_ARCH_HOPPER90
 #cmakedefine KOKKOS_ARCH_BLACKWELL
 #cmakedefine KOKKOS_ARCH_BLACKWELL100
+#cmakedefine KOKKOS_ARCH_BLACKWELL103
 #cmakedefine KOKKOS_ARCH_BLACKWELL120
+#cmakedefine KOKKOS_ARCH_BLACKWELL121
 #cmakedefine KOKKOS_ARCH_AMD_ZEN
 #cmakedefine KOKKOS_ARCH_AMD_ZEN2
 #cmakedefine KOKKOS_ARCH_AMD_ZEN3
@@ -139,9 +145,11 @@
 #cmakedefine KOKKOS_ARCH_AMD_GFX940
 #cmakedefine KOKKOS_ARCH_AMD_GFX942
 #cmakedefine KOKKOS_ARCH_AMD_GFX942_APU
+#cmakedefine KOKKOS_ARCH_AMD_GFX950
 #cmakedefine KOKKOS_ARCH_AMD_GFX1030
 #cmakedefine KOKKOS_ARCH_AMD_GFX1100
 #cmakedefine KOKKOS_ARCH_AMD_GFX1103
+#cmakedefine KOKKOS_ARCH_AMD_GFX1201
 #cmakedefine KOKKOS_ARCH_AMD_GPU "@KOKKOS_ARCH_AMD_GPU@"
 #cmakedefine KOKKOS_ARCH_VEGA // deprecated
 #cmakedefine KOKKOS_ARCH_VEGA906 // deprecated
diff --git a/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in b/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in
index 3665282e7b69..78831ca9dda8 100644
--- a/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in
+++ b/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include "Kokkos_Version_Info.hpp"
 
diff --git a/packages/kokkos/cmake/Kokkos_Version_Info.hpp b/packages/kokkos/cmake/Kokkos_Version_Info.hpp
index 831247115e27..db065673d344 100644
--- a/packages/kokkos/cmake/Kokkos_Version_Info.hpp
+++ b/packages/kokkos/cmake/Kokkos_Version_Info.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_GIT_VERSION_INFO_H
 #define KOKKOS_GIT_VERSION_INFO_H
diff --git a/packages/kokkos/cmake/Modules/CudaToolkit.cmake b/packages/kokkos/cmake/Modules/CudaToolkit.cmake
deleted file mode 100644
index b8ac2048b5fc..000000000000
--- a/packages/kokkos/cmake/Modules/CudaToolkit.cmake
+++ /dev/null
@@ -1,880 +0,0 @@
-# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
-# file Copyright.txt or https://cmake.org/licensing for details.
-
-#[=======================================================================[.rst:
-FindCUDAToolkit
----------------
-
-This script locates the NVIDIA CUDA toolkit and the associated libraries, but
-does not require the ``CUDA`` language be enabled for a given project. This
-module does not search for the NVIDIA CUDA Samples.
-
-Search Behavior
-^^^^^^^^^^^^^^^
-
-Finding the CUDA Toolkit requires finding the ``nvcc`` executable, which is
-searched for in the following order:
-
-1. If the ``CUDA`` language has been enabled we will use the directory
-   containing the compiler as the first search location for ``nvcc``.
-
-2. If the ``CUDAToolkit_ROOT`` cmake configuration variable (e.g.,
-   ``-DCUDAToolkit_ROOT=/some/path``) *or* environment variable is defined, it
-   will be searched.  If both an environment variable **and** a
-   configuration variable are specified, the *configuration* variable takes
-   precedence.
-
-   The directory specified here must be such that the executable ``nvcc`` can be
-   found underneath the directory specified by ``CUDAToolkit_ROOT``.  If
-   ``CUDAToolkit_ROOT`` is specified, but no ``nvcc`` is found underneath, this
-   package is marked as **not** found.  No subsequent search attempts are
-   performed.
-
-3. If the CUDA_PATH environment variable is defined, it will be searched.
-
-4. The user's path is searched for ``nvcc`` using :command:`find_program`.  If
-   this is found, no subsequent search attempts are performed.  Users are
-   responsible for ensuring that the first ``nvcc`` to show up in the path is
-   the desired path in the event that multiple CUDA Toolkits are installed.
-
-5. On Unix systems, if the symbolic link ``/usr/local/cuda`` exists, this is
-   used.  No subsequent search attempts are performed.  No default symbolic link
-   location exists for the Windows platform.
-
-6. The platform specific default install locations are searched.  If exactly one
-   candidate is found, this is used.  The default CUDA Toolkit install locations
-   searched are:
-
-   +-------------+-------------------------------------------------------------+
-   | Platform    | Search Pattern                                              |
-   +=============+=============================================================+
-   | macOS       | ``/Developer/NVIDIA/CUDA-X.Y``                              |
-   +-------------+-------------------------------------------------------------+
-   | Other Unix  | ``/usr/local/cuda-X.Y``                                     |
-   +-------------+-------------------------------------------------------------+
-   | Windows     | ``C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y`` |
-   +-------------+-------------------------------------------------------------+
-
-   Where ``X.Y`` would be a specific version of the CUDA Toolkit, such as
-   ``/usr/local/cuda-9.0`` or
-   ``C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0``
-
-   .. note::
-
-       When multiple CUDA Toolkits are installed in the default location of a
-       system (e.g., both ``/usr/local/cuda-9.0`` and ``/usr/local/cuda-10.0``
-       exist but the ``/usr/local/cuda`` symbolic link does **not** exist), this
-       package is marked as **not** found.
-
-       There are too many factors involved in making an automatic decision in
-       the presence of multiple CUDA Toolkits being installed.  In this
-       situation, users are encouraged to either (1) set ``CUDAToolkit_ROOT`` or
-       (2) ensure that the correct ``nvcc`` executable shows up in ``$PATH`` for
-       :command:`find_program` to find.
-
-Options
-^^^^^^^
-
-``VERSION``
-    If specified, describes the version of the CUDA Toolkit to search for.
-
-``REQUIRED``
-    If specified, configuration will error if a suitable CUDA Toolkit is not
-    found.
-
-``QUIET``
-    If specified, the search for a suitable CUDA Toolkit will not produce any
-    messages.
-
-``EXACT``
-    If specified, the CUDA Toolkit is considered found only if the exact
-    ``VERSION`` specified is recovered.
-
-Imported targets
-^^^^^^^^^^^^^^^^
-
-An :ref:`imported target ` named ``CUDA::toolkit`` is provided.
-
-This module defines :prop_tgt:`IMPORTED` targets for each
-of the following libraries that are part of the CUDAToolkit:
-
-- :ref:`CUDA Runtime Library`
-- :ref:`CUDA Driver Library`
-- :ref:`cuBLAS`
-- :ref:`cuFFT`
-- :ref:`cuRAND`
-- :ref:`cuSOLVER`
-- :ref:`cuSPARSE`
-- :ref:`cuPTI`
-- :ref:`NPP`
-- :ref:`nvBLAS`
-- :ref:`nvGRAPH`
-- :ref:`nvJPEG`
-- :ref:`nvidia-ML`
-- :ref:`nvRTC`
-- :ref:`nvToolsExt`
-- :ref:`OpenCL`
-- :ref:`cuLIBOS`
-
-.. _`cuda_toolkit_rt_lib`:
-
-CUDA Runtime Library
-""""""""""""""""""""
-
-The CUDA Runtime library (cudart) are what most applications will typically
-need to link against to make any calls such as `cudaMalloc`, and `cudaFree`.
-
-Targets Created:
-
-- ``CUDA::cudart``
-- ``CUDA::cudart_static``
-
-.. _`cuda_toolkit_driver_lib`:
-
-CUDA Driver Library
-""""""""""""""""""""
-
-The CUDA Driver library (cuda) are used by applications that use calls
-such as `cuMemAlloc`, and `cuMemFree`. This is generally used by advanced
-
-
-Targets Created:
-
-- ``CUDA::cuda_driver``
-- ``CUDA::cuda_driver``
-
-.. _`cuda_toolkit_cuBLAS`:
-
-cuBLAS
-""""""
-
-The `cuBLAS `_ library.
-
-Targets Created:
-
-- ``CUDA::cublas``
-- ``CUDA::cublas_static``
-
-.. _`cuda_toolkit_cuFFT`:
-
-cuFFT
-"""""
-
-The `cuFFT `_ library.
-
-Targets Created:
-
-- ``CUDA::cufft``
-- ``CUDA::cufftw``
-- ``CUDA::cufft_static``
-- ``CUDA::cufftw_static``
-
-cuRAND
-""""""
-
-The `cuRAND `_ library.
-
-Targets Created:
-
-- ``CUDA::curand``
-- ``CUDA::curand_static``
-
-.. _`cuda_toolkit_cuSOLVER`:
-
-cuSOLVER
-""""""""
-
-The `cuSOLVER `_ library.
-
-Targets Created:
-
-- ``CUDA::cusolver``
-- ``CUDA::cusolver_static``
-
-.. _`cuda_toolkit_cuSPARSE`:
-
-cuSPARSE
-""""""""
-
-The `cuSPARSE `_ library.
-
-Targets Created:
-
-- ``CUDA::cusparse``
-- ``CUDA::cusparse_static``
-
-.. _`cuda_toolkit_cupti`:
-
-cupti
-"""""
-
-The `NVIDIA CUDA Profiling Tools Interface `_.
-
-Targets Created:
-
-- ``CUDA::cupti``
-- ``CUDA::cupti_static``
-
-.. _`cuda_toolkit_NPP`:
-
-NPP
-"""
-
-The `NPP `_ libraries.
-
-Targets Created:
-
-- `nppc`:
-
-  - ``CUDA::nppc``
-  - ``CUDA::nppc_static``
-
-- `nppial`: Arithmetic and logical operation functions in `nppi_arithmetic_and_logical_operations.h`
-
-  - ``CUDA::nppial``
-  - ``CUDA::nppial_static``
-
-- `nppicc`: Color conversion and sampling functions in `nppi_color_conversion.h`
-
-  - ``CUDA::nppicc``
-  - ``CUDA::nppicc_static``
-
-- `nppicom`: JPEG compression and decompression functions in `nppi_compression_functions.h`
-
-  - ``CUDA::nppicom``
-  - ``CUDA::nppicom_static``
-
-- `nppidei`: Data exchange and initialization functions in `nppi_data_exchange_and_initialization.h`
-
-  - ``CUDA::nppidei``
-  - ``CUDA::nppidei_static``
-
-- `nppif`: Filtering and computer vision functions in `nppi_filter_functions.h`
-
-  - ``CUDA::nppif``
-  - ``CUDA::nppif_static``
-
-- `nppig`: Geometry transformation functions found in `nppi_geometry_transforms.h`
-
-  - ``CUDA::nppig``
-  - ``CUDA::nppig_static``
-
-- `nppim`: Morphological operation functions found in `nppi_morphological_operations.h`
-
-  - ``CUDA::nppim``
-  - ``CUDA::nppim_static``
-
-- `nppist`: Statistics and linear transform in `nppi_statistics_functions.h` and `nppi_linear_transforms.h`
-
-  - ``CUDA::nppist``
-  - ``CUDA::nppist_static``
-
-- `nppisu`: Memory support functions in `nppi_support_functions.h`
-
-  - ``CUDA::nppisu``
-  - ``CUDA::nppisu_static``
-
-- `nppitc`: Threshold and compare operation functions in `nppi_threshold_and_compare_operations.h`
-
-  - ``CUDA::nppitc``
-  - ``CUDA::nppitc_static``
-
-- `npps`:
-
-  - ``CUDA::npps``
-  - ``CUDA::npps_static``
-
-.. _`cuda_toolkit_nvBLAS`:
-
-nvBLAS
-""""""
-
-The `nvBLAS `_ libraries.
-This is a shared library only.
-
-Targets Created:
-
-- ``CUDA::nvblas``
-
-.. _`cuda_toolkit_nvGRAPH`:
-
-nvGRAPH
-"""""""
-
-The `nvGRAPH `_ library.
-
-Targets Created:
-
-- ``CUDA::nvgraph``
-- ``CUDA::nvgraph_static``
-
-
-.. _`cuda_toolkit_nvJPEG`:
-
-nvJPEG
-""""""
-
-The `nvJPEG `_ library.
-Introduced in CUDA 10.
-
-Targets Created:
-
-- ``CUDA::nvjpeg``
-- ``CUDA::nvjpeg_static``
-
-.. _`cuda_toolkit_nvRTC`:
-
-nvRTC
-"""""
-
-The `nvRTC `_ (Runtime Compilation) library.
-This is a shared library only.
-
-Targets Created:
-
-- ``CUDA::nvrtc``
-
-.. _`cuda_toolkit_nvml`:
-
-nvidia-ML
-"""""""""
-
-The `NVIDIA Management Library `_.
-This is a shared library only.
-
-Targets Created:
-
-- ``CUDA::nvml``
-
-.. _`cuda_toolkit_nvToolsExt`:
-
-nvToolsExt
-""""""""""
-
-The `NVIDIA Tools Extension `_.
-This is a shared library only.
-
-Targets Created:
-
-- ``CUDA::nvToolsExt``
-
-.. _`cuda_toolkit_opencl`:
-
-OpenCL
-""""""
-
-The `NVIDIA OpenCL Library `_.
-This is a shared library only.
-
-Targets Created:
-
-- ``CUDA::OpenCL``
-
-.. _`cuda_toolkit_cuLIBOS`:
-
-cuLIBOS
-"""""""
-
-The cuLIBOS library is a backend thread abstraction layer library which is
-static only.  The ``CUDA::cublas_static``, ``CUDA::cusparse_static``,
-``CUDA::cufft_static``, ``CUDA::curand_static``, and (when implemented) NPP
-libraries all automatically have this dependency linked.
-
-Target Created:
-
-- ``CUDA::culibos``
-
-**Note**: direct usage of this target by consumers should not be necessary.
-
-.. _`cuda_toolkit_cuRAND`:
-
-
-
-Result variables
-^^^^^^^^^^^^^^^^
-
-``CUDAToolkit_FOUND``
-    A boolean specifying whether or not the CUDA Toolkit was found.
-
-``CUDAToolkit_VERSION``
-    The exact version of the CUDA Toolkit found (as reported by
-    ``nvcc --version``).
-
-``CUDAToolkit_VERSION_MAJOR``
-    The major version of the CUDA Toolkit.
-
-``CUDAToolkit_VERSION_MAJOR``
-    The minor version of the CUDA Toolkit.
-
-``CUDAToolkit_VERSION_PATCH``
-    The patch version of the CUDA Toolkit.
-
-``CUDAToolkit_BIN_DIR``
-    The path to the CUDA Toolkit library directory that contains the CUDA
-    executable ``nvcc``.
-
-``CUDAToolkit_INCLUDE_DIRS``
-    The path to the CUDA Toolkit ``include`` folder containing the header files
-    required to compile a project linking against CUDA.
-
-``CUDAToolkit_LIBRARY_DIR``
-    The path to the CUDA Toolkit library directory that contains the CUDA
-    Runtime library ``cudart``.
-
-``CUDAToolkit_TARGET_DIR``
-    The path to the CUDA Toolkit directory including the target architecture
-    when cross-compiling. When not cross-compiling this will be equivalant to
-    ``CUDAToolkit_ROOT_DIR``.
-
-``CUDAToolkit_NVCC_EXECUTABLE``
-    The path to the NVIDIA CUDA compiler ``nvcc``.  Note that this path may
-    **not** be the same as
-    :variable:`CMAKE_CUDA_COMPILER _COMPILER>`.  ``nvcc`` must be
-    found to determine the CUDA Toolkit version as well as determining other
-    features of the Toolkit.  This variable is set for the convenience of
-    modules that depend on this one.
-
-
-#]=======================================================================]
-
-# NOTE: much of this was simply extracted from FindCUDA.cmake.
-
-#   James Bigler, NVIDIA Corp (nvidia.com - jbigler)
-#   Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
-#
-#   Copyright (c) 2008 - 2009 NVIDIA Corporation.  All rights reserved.
-#
-#   Copyright (c) 2007-2009
-#   Scientific Computing and Imaging Institute, University of Utah
-#
-#   This code is licensed under the MIT License.  See the FindCUDA.cmake script
-#   for the text of the license.
-
-# The MIT License
-#
-# License for the specific language governing rights and limitations under
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-###############################################################################
-
-# For NVCC we can easily deduce the SDK binary directory from the compiler path.
-if(CMAKE_CUDA_COMPILER_LOADED AND NOT CUDAToolkit_BIN_DIR AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
-  get_filename_component(cuda_dir "${CMAKE_CUDA_COMPILER}" DIRECTORY)
-  set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "")
-  mark_as_advanced(CUDAToolkit_BIN_DIR)
-  unset(cuda_dir)
-endif()
-
-# Try language- or user-provided path first.
-if(CUDAToolkit_BIN_DIR)
-  find_program(
-    CUDAToolkit_NVCC_EXECUTABLE
-    NAMES nvcc nvcc.exe
-    PATHS ${CUDAToolkit_BIN_DIR}
-    NO_DEFAULT_PATH
-  )
-endif()
-
-# Search using CUDAToolkit_ROOT
-find_program(
-  CUDAToolkit_NVCC_EXECUTABLE
-  NAMES nvcc nvcc.exe
-  PATHS ENV CUDA_PATH
-  PATH_SUFFIXES bin
-)
-
-# If the user specified CUDAToolkit_ROOT but nvcc could not be found, this is an error.
-if(NOT CUDAToolkit_NVCC_EXECUTABLE AND (DEFINED CUDAToolkit_ROOT OR DEFINED ENV{CUDAToolkit_ROOT}))
-  # Declare error messages now, print later depending on find_package args.
-  set(fail_base "Could not find nvcc executable in path specified by")
-  set(cuda_root_fail "${fail_base} CUDAToolkit_ROOT=${CUDAToolkit_ROOT}")
-  set(env_cuda_root_fail "${fail_base} environment variable CUDAToolkit_ROOT=$ENV{CUDAToolkit_ROOT}")
-
-  if(CUDAToolkit_FIND_REQUIRED)
-    if(DEFINED CUDAToolkit_ROOT)
-      message(FATAL_ERROR ${cuda_root_fail})
-    elseif(DEFINED ENV{CUDAToolkit_ROOT})
-      message(FATAL_ERROR ${env_cuda_root_fail})
-    endif()
-  else()
-    if(NOT CUDAToolkit_FIND_QUIETLY)
-      if(DEFINED CUDAToolkit_ROOT)
-        message(STATUS ${cuda_root_fail})
-      elseif(DEFINED ENV{CUDAToolkit_ROOT})
-        message(STATUS ${env_cuda_root_fail})
-      endif()
-    endif()
-    set(CUDAToolkit_FOUND FALSE)
-    unset(fail_base)
-    unset(cuda_root_fail)
-    unset(env_cuda_root_fail)
-    return()
-  endif()
-endif()
-
-# CUDAToolkit_ROOT cmake / env variable not specified, try platform defaults.
-#
-# - Linux: /usr/local/cuda-X.Y
-# - macOS: /Developer/NVIDIA/CUDA-X.Y
-# - Windows: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y
-#
-# We will also search the default symlink location /usr/local/cuda first since
-# if CUDAToolkit_ROOT is not specified, it is assumed that the symlinked
-# directory is the desired location.
-if(NOT CUDAToolkit_NVCC_EXECUTABLE)
-  if(UNIX)
-    if(NOT APPLE)
-      set(platform_base "/usr/local/cuda-")
-    else()
-      set(platform_base "/Developer/NVIDIA/CUDA-")
-    endif()
-  else()
-    set(platform_base "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v")
-  endif()
-
-  # Build out a descending list of possible cuda installations, e.g.
-  file(GLOB possible_paths "${platform_base}*")
-  # Iterate the glob results and create a descending list.
-  set(possible_versions)
-  foreach(p ${possible_paths})
-    # Extract version number from end of string
-    string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p})
-    if(IS_DIRECTORY ${p} AND p_version)
-      list(APPEND possible_versions ${p_version})
-    endif()
-  endforeach()
-
-  # Cannot use list(SORT) because that is alphabetical, we need numerical.
-  # NOTE: this is not an efficient sorting strategy.  But even if a user had
-  # every possible version of CUDA installed, this wouldn't create any
-  # significant overhead.
-  set(versions)
-  foreach(v ${possible_versions})
-    list(LENGTH versions num_versions)
-    # First version, nothing to compare with so just append.
-    if(num_versions EQUAL 0)
-      list(APPEND versions ${v})
-    else()
-      # Loop through list.  Insert at an index when comparison is
-      # VERSION_GREATER since we want a descending list.  Duplicates will not
-      # happen since this came from a glob list of directories.
-      set(i 0)
-      set(early_terminate FALSE)
-      while(i LESS num_versions)
-        list(GET versions ${i} curr)
-        if(v VERSION_GREATER curr)
-          list(INSERT versions ${i} ${v})
-          set(early_terminate TRUE)
-          break()
-        endif()
-        math(EXPR i "${i} + 1")
-      endwhile()
-      # If it did not get inserted, place it at the end.
-      if(NOT early_terminate)
-        list(APPEND versions ${v})
-      endif()
-    endif()
-  endforeach()
-
-  # With a descending list of versions, populate possible paths to search.
-  set(search_paths)
-  foreach(v ${versions})
-    list(APPEND search_paths "${platform_base}${v}")
-  endforeach()
-
-  # Force the global default /usr/local/cuda to the front on Unix.
-  if(UNIX)
-    list(INSERT search_paths 0 "/usr/local/cuda")
-  endif()
-
-  # Now search for nvcc again using the platform default search paths.
-  find_program(
-    CUDAToolkit_NVCC_EXECUTABLE
-    NAMES nvcc nvcc.exe
-    PATHS ${search_paths}
-    PATH_SUFFIXES bin
-  )
-
-  # We are done with these variables now, cleanup for caller.
-  unset(platform_base)
-  unset(possible_paths)
-  unset(possible_versions)
-  unset(versions)
-  unset(i)
-  unset(early_terminate)
-  unset(search_paths)
-
-  if(NOT CUDAToolkit_NVCC_EXECUTABLE)
-    if(CUDAToolkit_FIND_REQUIRED)
-      message(FATAL_ERROR "Could not find nvcc, please set CUDAToolkit_ROOT.")
-    elseif(NOT CUDAToolkit_FIND_QUIETLY)
-      message(STATUS "Could not find nvcc, please set CUDAToolkit_ROOT.")
-    endif()
-
-    set(CUDAToolkit_FOUND FALSE)
-    return()
-  endif()
-endif()
-
-if(NOT CUDAToolkit_BIN_DIR AND CUDAToolkit_NVCC_EXECUTABLE)
-  get_filename_component(cuda_dir "${CUDAToolkit_NVCC_EXECUTABLE}" DIRECTORY)
-  set(CUDAToolkit_BIN_DIR "${cuda_dir}" CACHE PATH "" FORCE)
-  mark_as_advanced(CUDAToolkit_BIN_DIR)
-  unset(cuda_dir)
-endif()
-
-if(CUDAToolkit_NVCC_EXECUTABLE AND CUDAToolkit_NVCC_EXECUTABLE STREQUAL CMAKE_CUDA_COMPILER)
-  # Need to set these based off the already computed CMAKE_CUDA_COMPILER_VERSION value
-  # This if statement will always match, but is used to provide variables for MATCH 1,2,3...
-  if(CMAKE_CUDA_COMPILER_VERSION MATCHES [=[([0-9]+)\.([0-9]+)\.([0-9]+)]=])
-    set(CUDAToolkit_VERSION_MAJOR "${CMAKE_MATCH_1}")
-    set(CUDAToolkit_VERSION_MINOR "${CMAKE_MATCH_2}")
-    set(CUDAToolkit_VERSION_PATCH "${CMAKE_MATCH_3}")
-    set(CUDAToolkit_VERSION "${CMAKE_CUDA_COMPILER_VERSION}")
-  endif()
-else()
-  # Compute the version by invoking nvcc
-  execute_process(COMMAND ${CUDAToolkit_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
-  if(NVCC_OUT MATCHES [=[ V([0-9]+)\.([0-9]+)\.([0-9]+)]=])
-    set(CUDAToolkit_VERSION_MAJOR "${CMAKE_MATCH_1}")
-    set(CUDAToolkit_VERSION_MINOR "${CMAKE_MATCH_2}")
-    set(CUDAToolkit_VERSION_PATCH "${CMAKE_MATCH_3}")
-    set(CUDAToolkit_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
-  endif()
-  unset(NVCC_OUT)
-endif()
-
-get_filename_component(CUDAToolkit_ROOT_DIR ${CUDAToolkit_BIN_DIR} DIRECTORY ABSOLUTE)
-
-# Handle cross compilation
-if(CMAKE_CROSSCOMPILING)
-  if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
-    # Support for NVPACK
-    set(CUDAToolkit_TARGET_NAME "armv7-linux-androideabi")
-  elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
-    # Support for arm cross compilation
-    set(CUDAToolkit_TARGET_NAME "armv7-linux-gnueabihf")
-  elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
-    # Support for aarch64 cross compilation
-    if(ANDROID_ARCH_NAME STREQUAL "arm64")
-      set(CUDAToolkit_TARGET_NAME "aarch64-linux-androideabi")
-    else()
-      set(CUDAToolkit_TARGET_NAME "aarch64-linux")
-    endif(ANDROID_ARCH_NAME STREQUAL "arm64")
-  elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
-    set(CUDAToolkit_TARGET_NAME "x86_64-linux")
-  endif()
-
-  if(EXISTS "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}")
-    set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}/targets/${CUDAToolkit_TARGET_NAME}")
-    # add known CUDA target root path to the set of directories we search for programs, libraries and headers
-    list(PREPEND CMAKE_FIND_ROOT_PATH "${CUDAToolkit_TARGET_DIR}")
-
-    # Mark that we need to pop the root search path changes after we have
-    # found all cuda libraries so that searches for our cross-compilation
-    # libraries work when another cuda sdk is in CMAKE_PREFIX_PATH or
-    # PATh
-    set(_CUDAToolkit_Pop_ROOT_PATH True)
-  endif()
-else()
-  # Not cross compiling
-  set(CUDAToolkit_TARGET_DIR "${CUDAToolkit_ROOT_DIR}")
-  # Now that we have the real ROOT_DIR, find components inside it.
-  list(APPEND CMAKE_PREFIX_PATH ${CUDAToolkit_ROOT_DIR})
-
-  # Mark that we need to pop the prefix path changes after we have
-  # found the cudart library.
-  set(_CUDAToolkit_Pop_Prefix True)
-endif()
-
-# Find the include/ directory
-find_path(CUDAToolkit_INCLUDE_DIR NAMES cuda_runtime.h)
-
-# And find the CUDA Runtime Library libcudart
-find_library(CUDA_CUDART NAMES cudart PATH_SUFFIXES lib64 lib/x64)
-if(NOT CUDA_CUDART)
-  find_library(CUDA_CUDART NAMES cudart PATH_SUFFIXES lib64/stubs lib/x64/stubs)
-endif()
-
-if(NOT CUDA_CUDART AND NOT CUDAToolkit_FIND_QUIETLY)
-  message(STATUS "Unable to find cudart library.")
-endif()
-
-unset(CUDAToolkit_ROOT_DIR)
-if(_CUDAToolkit_Pop_Prefix)
-  list(REMOVE_AT CMAKE_PREFIX_PATH -1)
-  unset(_CUDAToolkit_Pop_Prefix)
-endif()
-
-#-----------------------------------------------------------------------------
-# Perform version comparison and validate all required variables are set.
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(
-  CUDAToolkit REQUIRED_VARS CUDAToolkit_INCLUDE_DIR CUDA_CUDART CUDAToolkit_NVCC_EXECUTABLE
-  VERSION_VAR CUDAToolkit_VERSION
-)
-mark_as_advanced(CUDA_CUDART CUDAToolkit_INCLUDE_DIR CUDAToolkit_NVCC_EXECUTABLE)
-
-#-----------------------------------------------------------------------------
-# Construct result variables
-if(CUDAToolkit_FOUND)
-  set(CUDAToolkit_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIR})
-  get_filename_component(CUDAToolkit_LIBRARY_DIR ${CUDA_CUDART} DIRECTORY ABSOLUTE)
-endif()
-
-#-----------------------------------------------------------------------------
-# Construct import targets
-if(CUDAToolkit_FOUND)
-
-  function(_CUDAToolkit_find_and_add_import_lib lib_name)
-    cmake_parse_arguments(arg "" "" "ALT;DEPS;EXTRA_PATH_SUFFIXES" ${ARGN})
-
-    set(search_names ${lib_name} ${arg_ALT})
-
-    find_library(
-      CUDA_${lib_name}_LIBRARY
-      NAMES ${search_names}
-      HINTS ${CUDAToolkit_LIBRARY_DIR} ENV CUDA_PATH
-      PATH_SUFFIXES nvidia/current lib64 lib/x64 lib ${arg_EXTRA_PATH_SUFFIXES}
-    )
-    # Don't try any stub directories intil we have exhausted all other
-    # search locations.
-    if(NOT CUDA_${lib_name}_LIBRARY)
-      find_library(
-        CUDA_${lib_name}_LIBRARY
-        NAMES ${search_names}
-        HINTS ${CUDAToolkit_LIBRARY_DIR} ENV CUDA_PATH
-        PATH_SUFFIXES lib64/stubs lib/x64/stubs lib/stubs stubs
-      )
-    endif()
-
-    mark_as_advanced(CUDA_${lib_name}_LIBRARY)
-
-    if(NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY)
-      add_library(CUDA::${lib_name} IMPORTED INTERFACE)
-      target_include_directories(CUDA::${lib_name} SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}")
-      target_link_libraries(CUDA::${lib_name} INTERFACE "${CUDA_${lib_name}_LIBRARY}")
-      foreach(dep ${arg_DEPS})
-        if(TARGET CUDA::${dep})
-          target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dep})
-        endif()
-      endforeach()
-    endif()
-  endfunction()
-
-  if(NOT TARGET CUDA::toolkit)
-    add_library(CUDA::toolkit IMPORTED INTERFACE)
-    target_include_directories(CUDA::toolkit SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}")
-    target_link_directories(CUDA::toolkit INTERFACE "${CUDAToolkit_LIBRARY_DIR}")
-  endif()
-
-  _cudatoolkit_find_and_add_import_lib(cuda_driver ALT cuda)
-
-  _cudatoolkit_find_and_add_import_lib(cudart)
-  _cudatoolkit_find_and_add_import_lib(cudart_static)
-
-  # setup dependencies that are required for cudart_static when building
-  # on linux. These are generally only required when using the CUDA toolkit
-  # when CUDA language is disabled
-  if(NOT TARGET CUDA::cudart_static_deps AND TARGET CUDA::cudart_static)
-
-    add_library(CUDA::cudart_static_deps IMPORTED INTERFACE)
-    target_link_libraries(CUDA::cudart_static INTERFACE CUDA::cudart_static_deps)
-
-    if(UNIX AND (CMAKE_C_COMPILER OR CMAKE_CXX_COMPILER))
-      find_package(Threads REQUIRED)
-      target_link_libraries(CUDA::cudart_static_deps INTERFACE Threads::Threads ${CMAKE_DL_LIBS})
-    endif()
-
-    if(UNIX AND NOT APPLE)
-      # On Linux, you must link against librt when using the static cuda runtime.
-      find_library(CUDAToolkit_rt_LIBRARY rt)
-      mark_as_advanced(CUDAToolkit_rt_LIBRARY)
-      if(NOT CUDAToolkit_rt_LIBRARY)
-        message(WARNING "Could not find librt library, needed by CUDA::cudart_static")
-      else()
-        target_link_libraries(CUDA::cudart_static_deps INTERFACE ${CUDAToolkit_rt_LIBRARY})
-      endif()
-    endif()
-  endif()
-
-  _cudatoolkit_find_and_add_import_lib(culibos) # it's a static library
-  foreach(cuda_lib cublas cufft curand cusparse nppc nvjpeg)
-    _cudatoolkit_find_and_add_import_lib(${cuda_lib})
-    _cudatoolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos)
-  endforeach()
-
-  # cuFFTW depends on cuFFT
-  _cudatoolkit_find_and_add_import_lib(cufftw DEPS cufft)
-  _cudatoolkit_find_and_add_import_lib(cufftw DEPS cufft_static)
-
-  # cuSOLVER depends on cuBLAS, and cuSPARSE
-  _cudatoolkit_find_and_add_import_lib(cusolver DEPS cublas cusparse)
-  _cudatoolkit_find_and_add_import_lib(cusolver_static DEPS cublas_static cusparse_static culibos)
-
-  # nvGRAPH depends on cuRAND, and cuSOLVER.
-  _cudatoolkit_find_and_add_import_lib(nvgraph DEPS curand cusolver)
-  _cudatoolkit_find_and_add_import_lib(nvgraph_static DEPS curand_static cusolver_static)
-
-  # Process the majority of the NPP libraries.
-  foreach(
-    cuda_lib
-    nppial
-    nppicc
-    nppidei
-    nppif
-    nppig
-    nppim
-    nppist
-    nppitc
-    npps
-    nppicom
-    nppisu
-  )
-    _cudatoolkit_find_and_add_import_lib(${cuda_lib} DEPS nppc)
-    _cudatoolkit_find_and_add_import_lib(${cuda_lib}_static DEPS nppc_static)
-  endforeach()
-
-  _cudatoolkit_find_and_add_import_lib(cupti EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ ../extras/CUPTI/lib/)
-  _cudatoolkit_find_and_add_import_lib(cupti_static EXTRA_PATH_SUFFIXES ../extras/CUPTI/lib64/ ../extras/CUPTI/lib/)
-
-  _cudatoolkit_find_and_add_import_lib(nvrtc DEPS cuda_driver)
-
-  _cudatoolkit_find_and_add_import_lib(nvml ALT nvidia-ml nvml)
-
-  if(WIN32)
-    # nvtools can be installed outside the CUDA toolkit directory
-    # so prefer the NVTOOLSEXT_PATH windows only environment variable
-    # In addition on windows the most common name is nvToolsExt64_1
-    find_library(
-      CUDA_nvToolsExt_LIBRARY
-      NAMES nvToolsExt64_1 nvToolsExt64 nvToolsExt
-      PATHS ENV NVTOOLSEXT_PATH ENV CUDA_PATH
-      PATH_SUFFIXES lib/x64 lib
-    )
-  endif()
-  _cudatoolkit_find_and_add_import_lib(nvToolsExt ALT nvToolsExt64)
-
-  _cudatoolkit_find_and_add_import_lib(OpenCL)
-endif()
-
-if(_CUDAToolkit_Pop_ROOT_PATH)
-  list(REMOVE_AT CMAKE_FIND_ROOT_PATH 0)
-  unset(_CUDAToolkit_Pop_ROOT_PATH)
-endif()
diff --git a/packages/kokkos/cmake/Modules/FindTPLCUDA.cmake b/packages/kokkos/cmake/Modules/FindTPLCUDA.cmake
index 89e704377f9a..db4ff90e7da8 100644
--- a/packages/kokkos/cmake/Modules/FindTPLCUDA.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLCUDA.cmake
@@ -7,10 +7,6 @@ if(NOT CUDAToolkit_ROOT)
   endif()
 endif()
 
-if(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL NVHPC AND CMAKE_VERSION VERSION_LESS "3.20.1")
-  message(FATAL_ERROR "Using NVHPC as host compiler requires at least CMake 3.20.1")
-endif()
-
 set(TPL_CUDA_LIBRARIES "")
 if(KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
   set(TPL_CUDA_LIBRARIES CUDA::cuda_driver)
@@ -18,30 +14,6 @@ else()
   set(TPL_CUDA_LIBRARIES CUDA::cuda_driver CUDA::cudart)
 endif()
 
-if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17.0")
-  find_package(CUDAToolkit REQUIRED)
-  kokkos_create_imported_tpl(CUDA INTERFACE LINK_LIBRARIES ${TPL_CUDA_LIBRARIES})
-  kokkos_export_cmake_tpl(CUDAToolkit REQUIRED)
-else()
-  include(${CMAKE_CURRENT_LIST_DIR}/CudaToolkit.cmake)
-
-  if(TARGET CUDA::cudart)
-    set(FOUND_CUDART TRUE)
-    kokkos_export_imported_tpl(CUDA::cudart)
-  else()
-    set(FOUND_CUDART FALSE)
-  endif()
-
-  if(TARGET CUDA::cuda_driver)
-    set(FOUND_CUDA_DRIVER TRUE)
-    kokkos_export_imported_tpl(CUDA::cuda_driver)
-  else()
-    set(FOUND_CUDA_DRIVER FALSE)
-  endif()
-
-  include(FindPackageHandleStandardArgs)
-  find_package_handle_standard_args(TPLCUDA ${DEFAULT_MSG} FOUND_CUDA_DRIVER FOUND_CUDART)
-  if(FOUND_CUDA_DRIVER AND FOUND_CUDART)
-    kokkos_create_imported_tpl(CUDA INTERFACE LINK_LIBRARIES ${TPL_CUDA_LIBRARIES})
-  endif()
-endif()
+find_package(CUDAToolkit REQUIRED)
+kokkos_create_imported_tpl(CUDA INTERFACE LINK_LIBRARIES ${TPL_CUDA_LIBRARIES})
+kokkos_export_cmake_tpl(CUDAToolkit REQUIRED)
diff --git a/packages/kokkos/cmake/Modules/FindTPLLIBDL.cmake b/packages/kokkos/cmake/Modules/FindTPLLIBDL.cmake
deleted file mode 100644
index 85ae0b82244c..000000000000
--- a/packages/kokkos/cmake/Modules/FindTPLLIBDL.cmake
+++ /dev/null
@@ -1 +0,0 @@
-kokkos_find_imported(LIBDL HEADER dlfcn.h INTERFACE LIBRARIES ${CMAKE_DL_LIBS})
diff --git a/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake b/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake
index ce428b0aeec6..1fa930c7a2e2 100644
--- a/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake
@@ -13,6 +13,8 @@ check_cxx_source_compiles(
   }"
   KOKKOS_QUADMATH_COMPILER_SUPPORT
 )
+unset(CMAKE_REQUIRED_LIBRARIES)
+
 if(KOKKOS_QUADMATH_COMPILER_SUPPORT)
   kokkos_create_imported_tpl(LIBQUADMATH INTERFACE LINK_LIBRARIES quadmath)
 else()
diff --git a/packages/kokkos/cmake/Modules/FindTPLNEXTAPI.cmake b/packages/kokkos/cmake/Modules/FindTPLNEXTAPI.cmake
new file mode 100644
index 000000000000..2a8fd17b8680
--- /dev/null
+++ b/packages/kokkos/cmake/Modules/FindTPLNEXTAPI.cmake
@@ -0,0 +1,22 @@
+# Nextapi shared object and header both reside under NEXT_HOME directory
+# Library under ${NEXT_HOME}/lib
+# Headers under ${NEXT_HOME}/include
+
+# FIXME_NEXTSILICON: See NextSilicon ticket CS-682
+
+if(DEFINED ENV{NEXT_HOME})
+  set(NEXT_HOME_PATH $ENV{NEXT_HOME})
+else()
+  # Give a default path in case env is not define.
+  set(NEXT_HOME_PATH /opt/nextsilicon)
+endif()
+
+kokkos_find_imported(
+  NEXTAPI
+  LIBRARY
+  nextapi
+  LIBRARY_PATHS
+  ${NEXT_HOME_PATH}
+  HEADER_PATHS
+  ${NEXT_HOME_PATH}
+)
diff --git a/packages/kokkos/cmake/Modules/FindTPLROCM.cmake b/packages/kokkos/cmake/Modules/FindTPLROCM.cmake
index 9673af0b9d90..c273ebe0b353 100644
--- a/packages/kokkos/cmake/Modules/FindTPLROCM.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLROCM.cmake
@@ -1,39 +1,4 @@
-include(FindPackageHandleStandardArgs)
+find_package(hip REQUIRED PATHS ${ROCM_PATH} $ENV{ROCM_PATH})
 
-find_library(AMD_HIP_LIBRARY amdhip64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib)
-find_library(HSA_RUNTIME_LIBRARY hsa-runtime64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib)
-
-# FIXME_HIP Starting with ROCm 5.5 it is not necessary to link againt clang_rt.
-# We keep the code as is for now because it is hard to find the version of ROCM
-# found.
-# clang_rt.builtins is necessary to use half precision. The following code to
-# find clang_rt.buitins is based on
-# https://github.com/ROCm-Developer-Tools/hipamd/blob/d1e0ee98a0f3d79f7bf43295f82d0053a69ec742/hip-config.cmake.in#L241
-# NOTE: Per the above, we still search for the clang-rt library,
-# but use the user's specified compiler to find the library to avoid use of
-# environment variables / relative paths.
-execute_process(
-  COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name --rtlib=compiler-rt
-  OUTPUT_VARIABLE CLANG_RT_LIBRARY
-  OUTPUT_STRIP_TRAILING_WHITESPACE
-  RESULT_VARIABLE CLANG_RT_CHECK
-)
-
-if(NOT "${CLANG_RT_CHECK}" STREQUAL "0")
-  # if the above failed, we delete CLANG_RT_LIBRARY to make the args check
-  # below fail
-  unset(CLANG_RT_LIBRARY)
-endif()
-
-find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY CLANG_RT_LIBRARY)
-
-kokkos_create_imported_tpl(
-  ROCM
-  INTERFACE
-  LINK_LIBRARIES
-  ${HSA_RUNTIME_LIBRARY}
-  ${AMD_HIP_LIBRARY}
-  ${CLANG_RT_LIBRARY}
-  COMPILE_DEFINITIONS
-  __HIP_ROCclr__
-)
+kokkos_create_imported_tpl(ROCM INTERFACE LINK_LIBRARIES hip::device)
+kokkos_export_cmake_tpl(hip REQUIRED)
diff --git a/packages/kokkos/cmake/Modules/FindTPLROCTHRUST.cmake b/packages/kokkos/cmake/Modules/FindTPLROCTHRUST.cmake
index b4b905795dd0..b56b36e1f7c8 100644
--- a/packages/kokkos/cmake/Modules/FindTPLROCTHRUST.cmake
+++ b/packages/kokkos/cmake/Modules/FindTPLROCTHRUST.cmake
@@ -1,13 +1,3 @@
-# ROCm 5.6 and earlier set AMDGPU_TARGETS and GPU_TARGETS to all the supported
-# architectures. Therefore, we end up compiling Kokkos for all the supported
-# architecture. Starting with ROCm 5.7 AMDGPU_TARGETS and GPU_TARGETS are empty.
-# It is the user's job to set the variables. Since we are injecting the
-# architecture flag ourselves, we can let the variables empty. To replicate the
-# behavior of ROCm 5.7 and later for earlier version of ROCm we set
-# AMDGPU_TARGETS and GPU_TARGETS to empty and set the values in the cache. If
-# the values are not cached, FIND_PACKAGE(rocthrust) will overwrite them.
-set(AMDGPU_TARGETS "" CACHE STRING "AMD GPU targets to compile for")
-set(GPU_TARGETS "" CACHE STRING "GPU targets to compile for")
 find_package(rocthrust REQUIRED)
 kokkos_create_imported_tpl(ROCTHRUST INTERFACE LINK_LIBRARIES roc::rocthrust)
 
diff --git a/packages/kokkos/cmake/compile_tests/amd_apu.cc b/packages/kokkos/cmake/compile_tests/amd_apu.cc
index a9c1edbd57b0..bc78f189c1cb 100644
--- a/packages/kokkos/cmake/compile_tests/amd_apu.cc
+++ b/packages/kokkos/cmake/compile_tests/amd_apu.cc
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 #include 
diff --git a/packages/kokkos/cmake/compile_tests/clang_omp.cpp b/packages/kokkos/cmake/compile_tests/clang_omp.cpp
index 153130f968ed..349b951aad15 100644
--- a/packages/kokkos/cmake/compile_tests/clang_omp.cpp
+++ b/packages/kokkos/cmake/compile_tests/clang_omp.cpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 
diff --git a/packages/kokkos/cmake/compile_tests/cplusplus17.cpp b/packages/kokkos/cmake/compile_tests/cplusplus17.cpp
deleted file mode 100644
index b425d23adf81..000000000000
--- a/packages/kokkos/cmake/compile_tests/cplusplus17.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
-
-#include 
-
-int main() {
-  // _v versions of type traits were added in C++17
-  if constexpr (std::is_same_v)
-    return 0;
-  else
-    return 1;
-}
diff --git a/packages/kokkos/cmake/compile_tests/cplusplus20.cpp b/packages/kokkos/cmake/compile_tests/cplusplus20.cpp
new file mode 100644
index 000000000000..80e24e898467
--- /dev/null
+++ b/packages/kokkos/cmake/compile_tests/cplusplus20.cpp
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+#include 
+
+// consteval specifier
+consteval int sqr(int n) { return n * n; }
+static_assert(sqr(100) == 10000);
+
+// conditional explicit
+struct S {
+  explicit(sizeof(int) > 0) S(int) {}
+};
+
+// concepts library
+constexpr std::floating_point auto x2(std::floating_point auto x) {
+  return x + x;
+}
+constexpr std::integral auto x2(std::integral auto x) { return x << 1; }
+
+int main() { return 0; }
diff --git a/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc b/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc
index f74bc0f6ca5a..8f05ab5b38a6 100644
--- a/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc
+++ b/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 #include 
@@ -32,10 +19,6 @@ int main() {
 #else
   switch (compute_capability) {
       // clang-format off
-    case 30:  std::cout << "Set -DKokkos_ARCH_KEPLER30=ON ." << std::endl; break;
-    case 32:  std::cout << "Set -DKokkos_ARCH_KEPLER32=ON ." << std::endl; break;
-    case 35:  std::cout << "Set -DKokkos_ARCH_KEPLER35=ON ." << std::endl; break;
-    case 37:  std::cout << "Set -DKokkos_ARCH_KEPLER37=ON ." << std::endl; break;
     case 50:  std::cout << "Set -DKokkos_ARCH_MAXWELL50=ON ." << std::endl; break;
     case 52:  std::cout << "Set -DKokkos_ARCH_MAXWELL52=ON ." << std::endl; break;
     case 53:  std::cout << "Set -DKokkos_ARCH_MAXWELL53=ON ." << std::endl; break;
@@ -50,7 +33,9 @@ int main() {
     case 89:  std::cout << "Set -DKokkos_ARCH_ADA89=ON ." << std::endl; break;
     case 90:  std::cout << "Set -DKokkos_ARCH_HOPPER90=ON ." << std::endl; break;
     case 100: std::cout << "Set -DKokkos_ARCH_BLACKWELL100=ON ." << std::endl; break;
+    case 103: std::cout << "Set -DKokkos_ARCH_BLACKWELL103=ON ." << std::endl; break;
     case 120: std::cout << "Set -DKokkos_ARCH_BLACKWELL120=ON ." << std::endl; break;
+    case 121: std::cout << "Set -DKokkos_ARCH_BLACKWELL121=ON ." << std::endl; break;
     default:
       std::cout << "Compute capability " << compute_capability
                 << " is not supported" << std::endl;
diff --git a/packages/kokkos/cmake/compile_tests/get_sve_hw_vl.cpp b/packages/kokkos/cmake/compile_tests/get_sve_hw_vl.cpp
index 14ff76c2fd9a..5e661c3468bc 100644
--- a/packages/kokkos/cmake/compile_tests/get_sve_hw_vl.cpp
+++ b/packages/kokkos/cmake/compile_tests/get_sve_hw_vl.cpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 #include 
diff --git a/packages/kokkos/cmake/deps/CUDA.cmake b/packages/kokkos/cmake/deps/CUDA.cmake
index 49eaf883a46f..d7556425c1ff 100644
--- a/packages/kokkos/cmake/deps/CUDA.cmake
+++ b/packages/kokkos/cmake/deps/CUDA.cmake
@@ -1,19 +1,5 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 # Check for CUDA support
 
diff --git a/packages/kokkos/cmake/deps/HWLOC.cmake b/packages/kokkos/cmake/deps/HWLOC.cmake
index 52d8368d0419..71a790ead076 100644
--- a/packages/kokkos/cmake/deps/HWLOC.cmake
+++ b/packages/kokkos/cmake/deps/HWLOC.cmake
@@ -1,19 +1,5 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 #-----------------------------------------------------------------------------
 #  Hardware locality detection and control library.
diff --git a/packages/kokkos/cmake/deps/Pthread.cmake b/packages/kokkos/cmake/deps/Pthread.cmake
index b811f850841d..fcfac9a0ec0a 100644
--- a/packages/kokkos/cmake/deps/Pthread.cmake
+++ b/packages/kokkos/cmake/deps/Pthread.cmake
@@ -1,19 +1,5 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 set(USE_THREADS FALSE)
 
diff --git a/packages/kokkos/cmake/deps/quadmath.cmake b/packages/kokkos/cmake/deps/quadmath.cmake
index 9006d0cb9efb..faeff6969306 100644
--- a/packages/kokkos/cmake/deps/quadmath.cmake
+++ b/packages/kokkos/cmake/deps/quadmath.cmake
@@ -1,18 +1,4 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 kokkos_tpl_find_include_dirs_and_libraries(quadmath REQUIRED_HEADERS quadmath.h REQUIRED_LIBS_NAMES quadmath)
diff --git a/packages/kokkos/cmake/fake_tribits.cmake b/packages/kokkos/cmake/fake_tribits.cmake
index d3fe1e6e2f62..f0323d98cadd 100644
--- a/packages/kokkos/cmake/fake_tribits.cmake
+++ b/packages/kokkos/cmake/fake_tribits.cmake
@@ -84,9 +84,7 @@ function(KOKKOS_ADD_TEST)
   endif()
   if(TEST_TOOL)
     add_dependencies(${EXE} ${TEST_TOOL}) #make sure the exe has to build the tool
-    set_property(
-      TEST ${TEST_NAME} APPEND_STRING PROPERTY ENVIRONMENT "KOKKOS_PROFILE_LIBRARY=$"
-    )
+    set_property(TEST ${TEST_NAME} APPEND_STRING PROPERTY ENVIRONMENT "KOKKOS_TOOLS_LIBS=$")
   endif()
   verify_empty(KOKKOS_ADD_TEST ${TEST_UNPARSED_ARGUMENTS})
 endfunction()
diff --git a/packages/kokkos/cmake/kokkos_arch.cmake b/packages/kokkos/cmake/kokkos_arch.cmake
index 474160313a5e..b3e58b0f1aa2 100644
--- a/packages/kokkos/cmake/kokkos_arch.cmake
+++ b/packages/kokkos/cmake/kokkos_arch.cmake
@@ -27,6 +27,7 @@ kokkos_check_deprecated_options(
 set(KOKKOS_ARCH_LIST)
 
 include(CheckCXXCompilerFlag)
+include(CheckSourceCompiles)
 
 kokkos_deprecated_list(ARCH ARCH)
 
@@ -75,18 +76,10 @@ declare_and_check_host_arch(RISCV_SG2042 "SG2042 (RISC-V) CPUs")
 declare_and_check_host_arch(RISCV_RVA22V "RVA22V (RISC-V) CPUs")
 declare_and_check_host_arch(RISCV_U74MC "U74MC (RISC-V) CPUs")
 
-if(Kokkos_ENABLE_CUDA
-   OR Kokkos_ENABLE_OPENMPTARGET
-   OR Kokkos_ENABLE_OPENACC
-   OR Kokkos_ENABLE_SYCL
-)
+if(Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_OPENACC OR Kokkos_ENABLE_SYCL)
   set(KOKKOS_SHOW_CUDA_ARCHS ON)
 endif()
 
-kokkos_arch_option(KEPLER30 GPU "NVIDIA Kepler generation CC 3.0" "KOKKOS_SHOW_CUDA_ARCHS")
-kokkos_arch_option(KEPLER32 GPU "NVIDIA Kepler generation CC 3.2" "KOKKOS_SHOW_CUDA_ARCHS")
-kokkos_arch_option(KEPLER35 GPU "NVIDIA Kepler generation CC 3.5" "KOKKOS_SHOW_CUDA_ARCHS")
-kokkos_arch_option(KEPLER37 GPU "NVIDIA Kepler generation CC 3.7" "KOKKOS_SHOW_CUDA_ARCHS")
 kokkos_arch_option(MAXWELL50 GPU "NVIDIA Maxwell generation CC 5.0" "KOKKOS_SHOW_CUDA_ARCHS")
 kokkos_arch_option(MAXWELL52 GPU "NVIDIA Maxwell generation CC 5.2" "KOKKOS_SHOW_CUDA_ARCHS")
 kokkos_arch_option(MAXWELL53 GPU "NVIDIA Maxwell generation CC 5.3" "KOKKOS_SHOW_CUDA_ARCHS")
@@ -101,29 +94,30 @@ kokkos_arch_option(AMPERE87 GPU "NVIDIA Ampere generation CC 8.7" "KOKKOS_SHOW_C
 kokkos_arch_option(ADA89 GPU "NVIDIA Ada generation CC 8.9" "KOKKOS_SHOW_CUDA_ARCHS")
 kokkos_arch_option(HOPPER90 GPU "NVIDIA Hopper generation CC 9.0" "KOKKOS_SHOW_CUDA_ARCHS")
 kokkos_arch_option(BLACKWELL100 GPU "NVIDIA Blackwell generation CC 10.0" "KOKKOS_SHOW_CUDA_ARCHS")
+kokkos_arch_option(BLACKWELL103 GPU "NVIDIA Blackwell generation CC 10.3" "KOKKOS_SHOW_CUDA_ARCHS")
 kokkos_arch_option(BLACKWELL120 GPU "NVIDIA Blackwell generation CC 12.0" "KOKKOS_SHOW_CUDA_ARCHS")
+kokkos_arch_option(BLACKWELL121 GPU "NVIDIA Blackwell generation CC 12.1" "KOKKOS_SHOW_CUDA_ARCHS")
 
-if(Kokkos_ENABLE_HIP
-   OR Kokkos_ENABLE_OPENMPTARGET
-   OR Kokkos_ENABLE_OPENACC
-   OR Kokkos_ENABLE_SYCL
-)
+if(Kokkos_ENABLE_HIP OR Kokkos_ENABLE_OPENACC OR Kokkos_ENABLE_SYCL)
   set(KOKKOS_SHOW_HIP_ARCHS ON)
 endif()
 
 # AMD archs ordered in decreasing priority of autodetection
-list(APPEND SUPPORTED_AMD_GPUS MI300 MI300A MI300)
-list(APPEND SUPPORTED_AMD_ARCHS AMD_GFX942 AMD_GFX942_APU AMD_GFX940)
-list(APPEND CORRESPONDING_AMD_FLAGS gfx942 gfx942 gfx940)
+list(APPEND SUPPORTED_AMD_GPUS MI300 MI300A MI300 MI350)
+list(APPEND SUPPORTED_AMD_ARCHS AMD_GFX942 AMD_GFX942_APU AMD_GFX940 AMD_GFX950)
+list(APPEND CORRESPONDING_AMD_FLAGS gfx942 gfx942 gfx940 gfx950)
 list(APPEND SUPPORTED_AMD_GPUS MI200 MI200 MI100 MI100)
 list(APPEND SUPPORTED_AMD_ARCHS VEGA90A AMD_GFX90A VEGA908 AMD_GFX908)
 list(APPEND CORRESPONDING_AMD_FLAGS gfx90a gfx90a gfx908 gfx908)
 list(APPEND SUPPORTED_AMD_GPUS MI50/60 MI50/60)
 list(APPEND SUPPORTED_AMD_ARCHS VEGA906 AMD_GFX906)
 list(APPEND CORRESPONDING_AMD_FLAGS gfx906 gfx906)
-list(APPEND SUPPORTED_AMD_GPUS PHOENIX RX7900XTX V620/W6800 V620/W6800)
-list(APPEND SUPPORTED_AMD_ARCHS AMD_GFX1103 AMD_GFX1100 NAVI1030 AMD_GFX1030)
-list(APPEND CORRESPONDING_AMD_FLAGS gfx1103 gfx1100 gfx1030 gfx1030)
+list(APPEND SUPPORTED_AMD_GPUS RX9070XT RX7900XTX V620/W6800 V620/W6800)
+list(APPEND SUPPORTED_AMD_ARCHS AMD_GFX1201 AMD_GFX1100 NAVI1030 AMD_GFX1030)
+list(APPEND CORRESPONDING_AMD_FLAGS gfx1201 gfx1100 gfx1030 gfx1030)
+list(APPEND SUPPORTED_AMD_GPUS PHOENIX)
+list(APPEND SUPPORTED_AMD_ARCHS AMD_GFX1103)
+list(APPEND CORRESPONDING_AMD_FLAGS gfx1103)
 
 #FIXME CAN BE REPLACED WITH LIST_ZIP IN CMAKE 3.17
 foreach(ARCH IN LISTS SUPPORTED_AMD_ARCHS)
@@ -243,12 +237,9 @@ mark_as_advanced(Kokkos_IMPL_AMDGPU_LINK)
 #clear anything that might be in the cache
 global_set(KOKKOS_AMDGPU_OPTIONS)
 if(KOKKOS_ENABLE_HIP)
+  global_append(KOKKOS_AMDGPU_OPTIONS -xhip)
   set(AMDGPU_ARCH_FLAG "--offload-arch")
   if(NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC)
-    if(NOT CMAKE_CXX_STANDARD)
-      message(FATAL_ERROR "Kokkos requires CMAKE_CXX_STANDARD to set to 17 or higher")
-    endif()
-    global_append(KOKKOS_AMDGPU_OPTIONS -xhip)
     if(DEFINED ENV{ROCM_PATH})
       global_append(KOKKOS_AMDGPU_OPTIONS --rocm-path=$ENV{ROCM_PATH})
     endif()
@@ -274,6 +265,79 @@ if(KOKKOS_ARCH_NATIVE)
   compiler_specific_flags(COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID DEFAULT ${KOKKOS_NATIVE_FLAGS})
 endif()
 
+#------------------------------- KOKKOS NEON and SVE detection ---------------------------
+function(kokkos_use_neon_if_compiler_allows_it)
+  cmake_parse_arguments(ARG "" "" "COMPILER_FLAGS" ${ARGN})
+  if(ARG_UNPARSED_ARGUMENTS)
+    message(FATAL_ERROR "'kokkos_use_neon_if_compiler_allows_it' has unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
+  endif()
+
+  if(ARG_COMPILER_FLAGS)
+    set(CMAKE_REQUIRED_FLAGS ${ARG_COMPILER_FLAGS})
+  endif()
+
+  unset(KOKKOS_COMPILER_HAS_ARM_NEON CACHE)
+  #FIXME_Kokkos_launch_compiler
+  get_property(kokkos_global_rule_compile GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
+  if("${kokkos_global_rule_compile}" MATCHES "kokkos_launch_compiler")
+    message(WARNING "The use of 'kokkos_launch_compiler' prevents reliable NEON detection. Disabling NEON.\n"
+                    "You can force the use of NEON by using the Kokkos_ARCH_* flag specific to your target "
+                    "processor instead of Kokkos_ARCH_NATIVE."
+    )
+  else()
+    check_source_compiles(
+      ${KOKKOS_COMPILE_LANGUAGE}
+      "
+      #include 
+      int main() {
+          float32x2_t a;
+          a = vadd_f32(a, a);
+      }
+      "
+      KOKKOS_COMPILER_HAS_ARM_NEON
+    )
+  endif()
+endfunction()
+
+function(kokkos_use_sve_if_compiler_allows_it)
+  cmake_parse_arguments(ARG "" "" "COMPILER_FLAGS" ${ARGN})
+  if(ARG_UNPARSED_ARGUMENTS)
+    message(FATAL_ERROR "'kokkos_use_sve_if_compiler_allows_it' has unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
+  endif()
+
+  if(ARG_COMPILER_FLAGS)
+    set(CMAKE_REQUIRED_FLAGS ${ARG_COMPILER_FLAGS})
+  endif()
+
+  unset(KOKKOS_COMPILER_HAS_ARM_SVE CACHE)
+  #FIXME_Kokkos_launch_compiler
+  get_property(kokkos_global_rule_compile GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
+  if("${kokkos_global_rule_compile}" MATCHES "kokkos_launch_compiler")
+    message(WARNING "The use of 'kokkos_launch_compiler' prevents reliable SVE detection. Disabling SVE.\n"
+                    "You can force the use of SVE by using the Kokkos_ARCH_* flag specific to your target "
+                    "processor instead of Kokkos_ARCH_NATIVE."
+    )
+  else()
+    check_source_compiles(
+      ${KOKKOS_COMPILE_LANGUAGE}
+      "
+      #include 
+      #include 
+      int main() {
+        svuint64_t z;
+        uint64x2_t res;
+        svbool_t pg0 = svpfirst(svptrue_b64(), svpfalse());
+        svbool_t pg1 = svpnext_b64(pg0, pg0);
+        res[0] = svlastb(pg0, z);
+        res[1] = svlastb(pg1, z);
+        return 0;
+      }
+      "
+      KOKKOS_COMPILER_HAS_ARM_SVE
+    )
+  endif()
+endfunction()
+
 if(KOKKOS_ARCH_ARMV80)
   set(KOKKOS_ARCH_ARM_NEON ON)
   compiler_specific_flags(
@@ -569,19 +633,15 @@ if(KOKKOS_ARCH_HSW)
 endif()
 
 if(KOKKOS_ARCH_RISCV_SG2042)
-  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
-     OR (KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
-  )
-    message(SEND_ERROR "Only gcc >= 12 and clang >= 14 support RISC-V.")
+  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12))
+    message(SEND_ERROR "Only gcc >= 12 support RISC-V.")
   endif()
   compiler_specific_flags(COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID DEFAULT -march=rv64imafdcv)
 endif()
 
 if(KOKKOS_ARCH_RISCV_RVA22V)
-  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
-     OR (KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
-  )
-    message(SEND_ERROR "Only gcc >= 12 and clang >= 14 support RISC-V.")
+  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12))
+    message(SEND_ERROR "Only gcc >= 12 support RISC-V.")
   endif()
   compiler_specific_flags(
     COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID DEFAULT
@@ -590,10 +650,8 @@ if(KOKKOS_ARCH_RISCV_RVA22V)
 endif()
 
 if(KOKKOS_ARCH_RISCV_U74MC)
-  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
-     OR (KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14)
-  )
-    message(SEND_ERROR "Only gcc >= 12 and clang >= 14 support RISC-V.")
+  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12))
+    message(SEND_ERROR "Only gcc >= 12 support RISC-V.")
   endif()
   compiler_specific_flags(COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID DEFAULT -march=rv64imafdc_zicntr_zicsr_zifencei_zihpm)
 endif()
@@ -767,13 +825,10 @@ if(KOKKOS_ARCH_NATIVE)
     check_cxx_symbol_exists(__AVX512F__ "" KOKKOS_COMPILER_HAS_AVX512)
     unset(KOKKOS_COMPILER_HAS_AVX2 CACHE)
     check_cxx_symbol_exists(__AVX2__ "" KOKKOS_COMPILER_HAS_AVX2)
-    unset(KOKKOS_COMPILER_HAS_ARM_SVE CACHE)
-    check_cxx_symbol_exists(__ARM_FEATURE_SVE "" KOKKOS_COMPILER_HAS_ARM_SVE)
-    unset(KOKKOS_COMPILER_HAS_ARM_NEON CACHE)
-    check_cxx_symbol_exists(__ARM_NEON "" KOKKOS_COMPILER_HAS_ARM_NEON)
+    kokkos_use_sve_if_compiler_allows_it(COMPILER_FLAGS "${KOKKOS_NATIVE_FLAGS}")
+    kokkos_use_neon_if_compiler_allows_it(COMPILER_FLAGS "${KOKKOS_NATIVE_FLAGS}")
     unset(KOKKOS_COMPILER_HAS_AVX CACHE)
     check_cxx_symbol_exists(__AVX__ "" KOKKOS_COMPILER_HAS_AVX)
-    set(CMAKE_REQUIRED_FLAGS "${KOKKOS_COMPILE_OPTIONS}")
 
     unset(CMAKE_REQUIRED_QUIET)
     unset(CMAKE_REQUIRED_FLAGS)
@@ -821,11 +876,6 @@ if(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL NVHPC)
   set(KOKKOS_ARCH_AVX512XEON OFF)
 endif()
 
-# FIXME_NVCC nvcc doesn't seem to support Arm Neon.
-if(KOKKOS_ARCH_ARM_NEON AND KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
-  unset(KOKKOS_ARCH_ARM_NEON)
-endif()
-
 if(NOT KOKKOS_COMPILE_LANGUAGE STREQUAL CUDA)
   if(KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE)
     compiler_specific_flags(Clang -fgpu-rdc --offload-new-driver NVIDIA --relocatable-device-code=true)
@@ -842,6 +892,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL
   compiler_specific_defs(Clang _CRT_SECURE_NO_WARNINGS)
 endif()
 
+# MSVC needs another flag to allow using __VA_OPT__
+if(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
+  compiler_specific_options(COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID MSVC -Xcompiler=/Zc:preprocessor)
+else()
+  compiler_specific_options(COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID MSVC /Zc:preprocessor)
+endif()
+
 #Right now we cannot get the compiler ID when cross-compiling, so just check
 #that HIP is enabled
 if(KOKKOS_ENABLE_HIP)
@@ -876,12 +933,17 @@ endif()
 #   implementation. Otherwise, the feature is not supported when building shared
 #   libraries. Thus, we don't even check for support if shared libraries are
 #   requested and SYCL_EXT_ONEAPI_DEVICE_GLOBAL is not defined.
-#   As of oneAPI 2025.0.0, this feature only works well for Intel GPUs.
-#   For simplicity only test for JIT and PVC
+#   As of oneAPI 2025.0.0, the codeplay documentation indicates support
+#   for device_global on Nvidia and AMD GPUs. However, testing suggested
+#   that the feature only works well as of oneAPI 2025.1.1.
+#   Otherwise, for simplicity we only test for JIT and PVC.
 if(KOKKOS_ENABLE_SYCL)
   string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${KOKKOS_COMPILE_OPTIONS}")
   include(CheckCXXSymbolExists)
-  if(Kokkos_ARCH_INTEL_PVC OR Kokkos_ARCH_INTEL_GEN)
+  if(Kokkos_ARCH_INTEL_PVC OR Kokkos_ARCH_INTEL_GEN
+     OR (KOKKOS_ENABLE_UNSUPPORTED_ARCHS AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM
+         AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2025.1.1)
+  )
     check_cxx_symbol_exists(
       SYCL_EXT_ONEAPI_DEVICE_GLOBAL "sycl/sycl.hpp" KOKKOS_IMPL_HAVE_SYCL_EXT_ONEAPI_DEVICE_GLOBAL
     )
@@ -918,6 +980,7 @@ if(KOKKOS_ENABLE_SYCL)
   endif()
 
   check_cxx_symbol_exists(SYCL_EXT_ONEAPI_GRAPH "sycl/sycl.hpp" KOKKOS_IMPL_HAVE_SYCL_EXT_ONEAPI_GRAPH)
+  unset(CMAKE_REQUIRED_FLAGS)
 endif()
 
 set(CUDA_ARCH_ALREADY_SPECIFIED "")
@@ -930,14 +993,10 @@ function(CHECK_CUDA_ARCH ARCH FLAG)
       )
     endif()
     set(CUDA_ARCH_ALREADY_SPECIFIED ${ARCH} PARENT_SCOPE)
-    if(NOT KOKKOS_ENABLE_CUDA
-       AND NOT KOKKOS_ENABLE_OPENMPTARGET
-       AND NOT KOKKOS_ENABLE_SYCL
-       AND NOT KOKKOS_ENABLE_OPENACC
-    )
+    if(NOT KOKKOS_ENABLE_CUDA AND NOT KOKKOS_ENABLE_SYCL AND NOT KOKKOS_ENABLE_OPENACC)
       message(
         WARNING
-          "Given CUDA arch ${ARCH}, but Kokkos_ENABLE_CUDA, Kokkos_ENABLE_SYCL, Kokkos_ENABLE_OPENACC, and Kokkos_ENABLE_OPENMPTARGET are OFF. Option will be ignored."
+          "Given CUDA arch ${ARCH}, but Kokkos_ENABLE_CUDA, Kokkos_ENABLE_SYCL and Kokkos_ENABLE_OPENACC are OFF. Option will be ignored."
       )
       unset(KOKKOS_ARCH_${ARCH} PARENT_SCOPE)
     else()
@@ -965,10 +1024,6 @@ endfunction()
 
 #These will define KOKKOS_CUDA_ARCH_FLAG
 #to the corresponding flag name if ON
-check_cuda_arch(KEPLER30 sm_30)
-check_cuda_arch(KEPLER32 sm_32)
-check_cuda_arch(KEPLER35 sm_35)
-check_cuda_arch(KEPLER37 sm_37)
 check_cuda_arch(MAXWELL50 sm_50)
 check_cuda_arch(MAXWELL52 sm_52)
 check_cuda_arch(MAXWELL53 sm_53)
@@ -983,7 +1038,9 @@ check_cuda_arch(AMPERE87 sm_87)
 check_cuda_arch(ADA89 sm_89)
 check_cuda_arch(HOPPER90 sm_90)
 check_cuda_arch(BLACKWELL100 sm_100)
+check_cuda_arch(BLACKWELL103 sm_103)
 check_cuda_arch(BLACKWELL120 sm_120)
+check_cuda_arch(BLACKWELL121 sm_121)
 
 set(AMDGPU_ARCH_ALREADY_SPECIFIED "")
 function(CHECK_AMDGPU_ARCH ARCH FLAG)
@@ -995,14 +1052,10 @@ function(CHECK_AMDGPU_ARCH ARCH FLAG)
       )
     endif()
     set(AMDGPU_ARCH_ALREADY_SPECIFIED ${ARCH} PARENT_SCOPE)
-    if(NOT KOKKOS_ENABLE_HIP
-       AND NOT KOKKOS_ENABLE_OPENMPTARGET
-       AND NOT KOKKOS_ENABLE_OPENACC
-       AND NOT KOKKOS_ENABLE_SYCL
-    )
+    if(NOT KOKKOS_ENABLE_HIP AND NOT KOKKOS_ENABLE_OPENACC AND NOT KOKKOS_ENABLE_SYCL)
       message(
         WARNING
-          "Given AMD GPU architecture ${ARCH}, but Kokkos_ENABLE_HIP, Kokkos_ENABLE_SYCL, Kokkos_ENABLE_OPENACC, and Kokkos_ENABLE_OPENMPTARGET are OFF. Option will be ignored."
+          "Given AMD GPU architecture ${ARCH}, but Kokkos_ENABLE_HIP, Kokkos_ENABLE_SYCL and Kokkos_ENABLE_OPENACC are OFF. Option will be ignored."
       )
       unset(KOKKOS_ARCH_${ARCH} PARENT_SCOPE)
     else()
@@ -1080,22 +1133,6 @@ if(KOKKOS_ENABLE_OPENMP)
   compiler_specific_link_options(CrayClang -fopenmp)
 endif()
 
-if(KOKKOS_ENABLE_OPENMPTARGET)
-  set(CLANG_CUDA_ARCH ${KOKKOS_CUDA_ARCH_FLAG})
-  if(CLANG_CUDA_ARCH)
-    string(REPLACE "sm_" "cc" NVHPC_CUDA_ARCH ${CLANG_CUDA_ARCH})
-    compiler_specific_flags(
-      Clang -Xopenmp-target -march=${CLANG_CUDA_ARCH} -fopenmp-targets=nvptx64 NVHPC -gpu=${NVHPC_CUDA_ARCH}
-    )
-  endif()
-  set(CLANG_AMDGPU_ARCH ${KOKKOS_AMDGPU_ARCH_FLAG})
-  if(CLANG_AMDGPU_ARCH)
-    compiler_specific_flags(
-      Clang -Xopenmp-target=amdgcn-amd-amdhsa -march=${CLANG_AMDGPU_ARCH} -fopenmp-targets=amdgcn-amd-amdhsa
-    )
-  endif()
-endif()
-
 if(KOKKOS_ENABLE_OPENACC)
   if(KOKKOS_CUDA_ARCH_FLAG)
     if(KOKKOS_ENABLE_OPENACC_FORCE_HOST_AS_DEVICE)
@@ -1265,15 +1302,6 @@ if(KOKKOS_ENABLE_CUDA AND NOT CUDA_ARCH_ALREADY_SPECIFIED)
   endif()
 endif()
 
-#Regardless of version, make sure we define the general architecture name
-if(KOKKOS_ARCH_KEPLER30
-   OR KOKKOS_ARCH_KEPLER32
-   OR KOKKOS_ARCH_KEPLER35
-   OR KOKKOS_ARCH_KEPLER37
-)
-  set(KOKKOS_ARCH_KEPLER ON)
-endif()
-
 #Regardless of version, make sure we define the general architecture name
 if(KOKKOS_ARCH_MAXWELL50 OR KOKKOS_ARCH_MAXWELL52 OR KOKKOS_ARCH_MAXWELL53)
   set(KOKKOS_ARCH_MAXWELL ON)
@@ -1297,7 +1325,11 @@ if(KOKKOS_ARCH_HOPPER90)
   set(KOKKOS_ARCH_HOPPER ON)
 endif()
 
-if(KOKKOS_ARCH_BLACKWELL100 OR KOKKOS_ARCH_BLACKWELL120)
+if(KOKKOS_ARCH_BLACKWELL100
+   OR KOKKOS_ARCH_BLACKWELL103
+   OR KOKKOS_ARCH_BLACKWELL120
+   OR KOKKOS_ARCH_BLACKWELL121
+)
   set(KOKKOS_ARCH_BLACKWELL ON)
 endif()
 
@@ -1416,11 +1448,29 @@ foreach(ARCH IN LISTS SUPPORTED_AMD_ARCHS)
   endif()
 endforeach()
 
+#FIXME_HIP right now we only check if the arch autodetected by hip is the same as the one enabled in Kokkos. If not we warn/error
+if(Kokkos_ENABLE_HIP)
+  foreach(arch IN LISTS GPU_TARGETS)
+    if(NOT (arch STREQUAL KOKKOS_HIP_ARCHITECTURES))
+      if(KOKKOS_ENABLE_DEPRECATED_CODE_5)
+        set(MESSAGE_TYPE WARNING)
+      else()
+        set(MESSAGE_TYPE FATAL_ERROR)
+      endif()
+      message(
+        ${MESSAGE_TYPE}
+        "AMD GPU architectures given via GPU_TARGETS=\"${GPU_TARGETS}\" are not compatible with the architecture enabled in Kokkos which is ${KOKKOS_HIP_ARCHITECTURES}. Kokkos allows only one device architecture to be active. To resolve this, configure with -DGPU_TARGETS=\"${KOKKOS_HIP_ARCHITECTURES}\" to prevent it from being set implicitly by find_package calls."
+      )
+      break()
+    endif()
+  endforeach()
+endif()
+
 #CMake verbose is kind of pointless
 #Let's just always print things
 message(STATUS "Built-in Execution Spaces:")
 
-foreach(_BACKEND Cuda OpenMPTarget HIP SYCL OpenACC)
+foreach(_BACKEND Cuda HIP SYCL OpenACC NextSilicon)
   string(TOUPPER ${_BACKEND} UC_BACKEND)
   if(KOKKOS_ENABLE_${UC_BACKEND})
     if(_DEVICE_PARALLEL)
@@ -1433,15 +1483,6 @@ foreach(_BACKEND Cuda OpenMPTarget HIP SYCL OpenACC)
       )
     endif()
     if(${_BACKEND} STREQUAL "Cuda")
-      if(KOKKOS_ENABLE_CUDA_UVM)
-        message(
-          DEPRECATION
-            "Setting Kokkos_ENABLE_CUDA_UVM is deprecated - use the portable Kokkos::SharedSpace as an explicit memory space in your code instead"
-        )
-        if(NOT KOKKOS_ENABLE_DEPRECATED_CODE_4)
-          message(FATAL_ERROR "Kokkos_ENABLE_DEPRECATED_CODE_4 must be set to use Kokkos_ENABLE_CUDA_UVM")
-        endif()
-      endif()
       set(_DEVICE_PARALLEL "Kokkos::${_BACKEND}")
     elseif(${_BACKEND} STREQUAL "HIP" OR ${_BACKEND} STREQUAL "SYCL")
       set(_DEVICE_PARALLEL "Kokkos::${_BACKEND}")
diff --git a/packages/kokkos/cmake/kokkos_compiler_id.cmake b/packages/kokkos/cmake/kokkos_compiler_id.cmake
index 40e80a750552..d3cd935a9921 100644
--- a/packages/kokkos/cmake/kokkos_compiler_id.cmake
+++ b/packages/kokkos/cmake/kokkos_compiler_id.cmake
@@ -68,12 +68,11 @@ if(INTERNAL_HAVE_COMPILER_NVCC)
   set(KOKKOS_CXX_HOST_COMPILER_ID ${KOKKOS_CXX_COMPILER_ID})
 
   # SET the compiler id to nvcc.  We use the value used by CMake 3.8.
-  set(KOKKOS_CXX_COMPILER_ID NVIDIA CACHE STRING INTERNAL FORCE)
+  set(KOKKOS_CXX_COMPILER_ID NVIDIA)
 
   string(REGEX MATCH "V[0-9]+\\.[0-9]+\\.[0-9]+" TEMP_CXX_COMPILER_VERSION ${INTERNAL_COMPILER_VERSION_ONE_LINE})
   string(SUBSTRING ${TEMP_CXX_COMPILER_VERSION} 1 -1 TEMP_CXX_COMPILER_VERSION)
-  set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION} CACHE STRING INTERNAL FORCE)
-  message(STATUS "Compiler Version: ${KOKKOS_CXX_COMPILER_VERSION}")
+  set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION})
   if(INTERNAL_USE_COMPILER_LAUNCHER)
     message(STATUS "kokkos_launch_compiler (${Kokkos_COMPILE_LAUNCHER}) is enabled...")
     kokkos_compilation(GLOBAL)
@@ -90,41 +89,26 @@ if(Kokkos_ENABLE_HIP)
 
   string(FIND ${INTERNAL_COMPILER_VERSION_ONE_LINE} "HIP version" INTERNAL_COMPILER_VERSION_CONTAINS_HIP)
   if(INTERNAL_COMPILER_VERSION_CONTAINS_HIP GREATER -1)
-    set(KOKKOS_CXX_COMPILER_ID HIPCC CACHE STRING INTERNAL FORCE)
+    set(KOKKOS_CXX_COMPILER_ID HIPCC)
   endif()
 
   string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" TEMP_CXX_COMPILER_VERSION ${INTERNAL_COMPILER_VERSION_ONE_LINE})
-  set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION} CACHE STRING INTERNAL FORCE)
-  message(STATUS "Compiler Version: ${KOKKOS_CXX_COMPILER_VERSION}")
+  set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION})
 endif()
 
 if(KOKKOS_CXX_COMPILER_ID STREQUAL Clang)
-  # The Cray compiler reports as Clang to most versions of CMake
-  execute_process(
-    COMMAND ${CMAKE_CXX_COMPILER} --version
-    COMMAND grep -c Cray
-    OUTPUT_VARIABLE INTERNAL_HAVE_CRAY_COMPILER
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-  )
-  if(INTERNAL_HAVE_CRAY_COMPILER) #not actually Clang
-    set(KOKKOS_CLANG_IS_CRAY TRUE)
-    set(KOKKOS_CXX_COMPILER_ID CrayClang)
-  endif()
-  # The clang based Intel compiler reports as Clang to most versions of CMake
-  execute_process(
-    COMMAND ${CMAKE_CXX_COMPILER} --version
-    COMMAND grep -c "DPC++\\|icpx"
-    OUTPUT_VARIABLE INTERNAL_HAVE_INTEL_COMPILER
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-  )
-  if(INTERNAL_HAVE_INTEL_COMPILER) #not actually Clang
-    set(KOKKOS_CLANG_IS_INTEL TRUE)
-    set(KOKKOS_CXX_COMPILER_ID IntelLLVM CACHE STRING INTERNAL FORCE)
+  if(CMAKE_VERSION VERSION_LESS "3.28")
+    # The Cray compiler reports as Clang on older versions of CMake
     execute_process(
-      COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE INTERNAL_CXX_COMPILER_VERSION
+      COMMAND ${CMAKE_CXX_COMPILER} --version
+      COMMAND grep -c Cray
+      OUTPUT_VARIABLE INTERNAL_HAVE_CRAY_COMPILER
       OUTPUT_STRIP_TRAILING_WHITESPACE
     )
-    string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" KOKKOS_CXX_COMPILER_VERSION ${INTERNAL_CXX_COMPILER_VERSION})
+    if(INTERNAL_HAVE_CRAY_COMPILER) #not actually Clang
+      set(KOKKOS_CLANG_IS_CRAY TRUE)
+      set(KOKKOS_CXX_COMPILER_ID CrayClang)
+    endif()
   endif()
 endif()
 
@@ -139,7 +123,7 @@ if(KOKKOS_CXX_COMPILER_ID STREQUAL Cray OR KOKKOS_CLANG_IS_CRAY)
   if(KOKKOS_CLANG_IS_CRAY)
     set(KOKKOS_CLANG_CRAY_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION})
   else()
-    set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION} CACHE STRING INTERNAL FORCE)
+    set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION})
   endif()
 endif()
 
@@ -151,43 +135,40 @@ if(KOKKOS_CXX_COMPILER_ID STREQUAL Fujitsu)
   )
 
   string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" TEMP_CXX_COMPILER_VERSION ${INTERNAL_CXX_COMPILER_VERSION})
-  set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION} CACHE STRING INTERNAL FORCE)
+  set(KOKKOS_CXX_COMPILER_VERSION ${TEMP_CXX_COMPILER_VERSION})
 endif()
 
-# Enforce the minimum compilers supported by Kokkos.
-if(NOT CMAKE_CXX_STANDARD)
-  set(CMAKE_CXX_STANDARD 17)
-endif()
-if(CMAKE_CXX_STANDARD EQUAL 17)
-  set(KOKKOS_CLANG_CPU_MINIMUM 8.0.0)
-  set(KOKKOS_CLANG_CUDA_MINIMUM 10.0.0)
-  set(KOKKOS_CLANG_OPENMPTARGET_MINIMUM 15.0.0)
-  set(KOKKOS_GCC_MINIMUM 8.2.0)
-  set(KOKKOS_INTEL_LLVM_CPU_MINIMUM 2021.1.1)
-  set(KOKKOS_INTEL_LLVM_SYCL_MINIMUM 2024.2.1)
-  set(KOKKOS_NVCC_MINIMUM 11.0.0)
-  set(KOKKOS_HIPCC_MINIMUM 5.2.0)
-  set(KOKKOS_NVHPC_MINIMUM 22.3)
-  set(KOKKOS_MSVC_MINIMUM 19.29)
-else()
-  set(KOKKOS_CLANG_CPU_MINIMUM 14.0.0)
-  set(KOKKOS_CLANG_CUDA_MINIMUM 14.0.0)
-  set(KOKKOS_CLANG_OPENMPTARGET_MINIMUM 15.0.0)
-  set(KOKKOS_GCC_MINIMUM 10.4.0)
-  set(KOKKOS_INTEL_LLVM_CPU_MINIMUM 2022.0.0)
-  set(KOKKOS_INTEL_LLVM_SYCL_MINIMUM 2024.2.1)
-  set(KOKKOS_NVCC_MINIMUM 12.0.0)
-  set(KOKKOS_HIPCC_MINIMUM 5.2.0)
-  set(KOKKOS_NVHPC_MINIMUM 22.3)
-  set(KOKKOS_MSVC_MINIMUM 19.30)
+set(Kokkos_LANGUAGES "${KOKKOS_COMPILE_LANGUAGE}")
+if(Kokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES)
+  if(Kokkos_ENABLE_HIP)
+    set(Kokkos_LANGUAGES "HIP,CXX")
+  elseif(Kokkos_ENABLE_CUDA)
+    set(Kokkos_LANGUAGES "CUDA,CXX")
+  endif()
 endif()
 
+message(
+  STATUS
+    "Kokkos is configured for CMake languages ${Kokkos_LANGUAGES} compilation (using ${KOKKOS_CXX_COMPILER_ID} version ${KOKKOS_CXX_COMPILER_VERSION})"
+)
+unset(Kokkos_LANGUAGES)
+
+# Enforce the minimum compilers supported by Kokkos.
+set(KOKKOS_CLANG_CPU_MINIMUM 14.0.0)
+set(KOKKOS_CLANG_CUDA_MINIMUM 15.0.0)
+set(KOKKOS_GCC_MINIMUM 10.4.0)
+set(KOKKOS_INTEL_LLVM_CPU_MINIMUM 2022.0.0)
+set(KOKKOS_INTEL_LLVM_SYCL_MINIMUM 2024.2.1)
+set(KOKKOS_NVCC_MINIMUM 12.2.0)
+set(KOKKOS_HIPCC_MINIMUM 6.2.0)
+set(KOKKOS_NVHPC_MINIMUM 22.3)
+set(KOKKOS_MSVC_MINIMUM 19.30)
+
 set(KOKKOS_MESSAGE_TEXT
     "Compiler not supported by Kokkos for C++${CMAKE_CXX_STANDARD}. Required minimum compiler versions:"
 )
 set(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Clang(CPU)          ${KOKKOS_CLANG_CPU_MINIMUM}")
 set(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Clang(CUDA)         ${KOKKOS_CLANG_CUDA_MINIMUM}")
-set(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Clang(OpenMPTarget) ${KOKKOS_CLANG_OPENMPTARGET_MINIMUM}")
 set(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    GCC                 ${KOKKOS_GCC_MINIMUM}")
 set(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    Intel               not supported")
 set(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n    IntelLLVM(CPU)      ${KOKKOS_INTEL_LLVM_CPU_MINIMUM}")
@@ -244,23 +225,19 @@ elseif(KOKKOS_CXX_COMPILER_ID STREQUAL PGI OR KOKKOS_CXX_COMPILER_ID STREQUAL NV
   # Treat PGI internally as NVHPC to simplify handling both compilers.
   # Before CMake 3.20 NVHPC was identified as PGI, nvc++ is
   # backward-compatible to pgc++.
-  set(KOKKOS_CXX_COMPILER_ID NVHPC CACHE STRING INTERNAL FORCE)
+  set(KOKKOS_CXX_COMPILER_ID NVHPC)
 elseif(KOKKOS_CXX_COMPILER_ID STREQUAL "MSVC")
   if(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS ${KOKKOS_MSVC_MINIMUM})
     message(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
   endif()
 elseif(KOKKOS_CXX_COMPILER_ID STREQUAL XL OR KOKKOS_CXX_COMPILER_ID STREQUAL XLClang)
   message(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
-elseif(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND Kokkos_ENABLE_OPENMPTARGET)
-  if(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS KOKKOS_CLANG_OPENMPTARGET_MINIMUM)
-    message(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}")
-  endif()
 endif()
 
 if(NOT DEFINED KOKKOS_CXX_HOST_COMPILER_ID)
   set(KOKKOS_CXX_HOST_COMPILER_ID ${KOKKOS_CXX_COMPILER_ID})
 elseif(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL PGI)
-  set(KOKKOS_CXX_HOST_COMPILER_ID NVHPC CACHE STRING INTERNAL FORCE)
+  set(KOKKOS_CXX_HOST_COMPILER_ID NVHPC)
 endif()
 
 string(REPLACE "." ";" VERSION_LIST ${KOKKOS_CXX_COMPILER_VERSION})
diff --git a/packages/kokkos/cmake/kokkos_configure_trilinos.cmake b/packages/kokkos/cmake/kokkos_configure_trilinos.cmake
index 0209f663dcd3..e014c514e476 100644
--- a/packages/kokkos/cmake/kokkos_configure_trilinos.cmake
+++ b/packages/kokkos/cmake/kokkos_configure_trilinos.cmake
@@ -33,8 +33,33 @@ if(CMAKE_PROJECT_NAME STREQUAL "Trilinos")
 
   set(Kokkos_ENABLE_COMPLEX_ALIGN OFF CACHE BOOL "Whether to align Kokkos::complex to 2*alignof(RealType)")
 
-  set(Kokkos_ENABLE_IMPL_VIEW_LEGACY ON CACHE BOOL "Whether to use the legacy implementation of View" FORCE)
-
   # FIXME_TRILINOS We run into problems when trying to use an external GTest in Trilinos CI
   set(CMAKE_DISABLE_FIND_PACKAGE_GTest ON)
+
+  assert_defined(
+    Kokkos_ENABLE_SERIAL
+    Kokkos_ENABLE_OPENMP
+    Kokkos_ENABLE_THREADS
+    Kokkos_ENABLE_HPX
+    Kokkos_ENABLE_CUDA
+    Kokkos_ENABLE_HIP
+    Kokkos_ENABLE_SYCL
+    Kokkos_ENABLE_OPENACC
+  )
+
+  if(Kokkos_ENABLE_SERIAL
+     AND NOT Kokkos_ENABLE_OPENMP
+     AND NOT Kokkos_ENABLE_THREADS
+     AND NOT Kokkos_ENABLE_HPX
+     AND NOT Kokkos_ENABLE_CUDA
+     AND NOT Kokkos_ENABLE_HIP
+     AND NOT Kokkos_ENABLE_SYCL
+     AND NOT Kokkos_ENABLE_OPENACC
+  )
+    if(NOT DEFINED Kokkos_ENABLE_ATOMICS_BYPASS)
+      set(Kokkos_ENABLE_ATOMICS_BYPASS ON
+          CACHE BOOL "Whether to make atomics non-atomic for non-threaded MPI-only use cases" FORCE
+      )
+    endif()
+  endif()
 endif()
diff --git a/packages/kokkos/cmake/kokkos_corner_cases.cmake b/packages/kokkos/cmake/kokkos_corner_cases.cmake
deleted file mode 100644
index 530e9e8fd8e0..000000000000
--- a/packages/kokkos/cmake/kokkos_corner_cases.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-if(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_ENABLE_CUDA_CONSTEXPR AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS
-                                                                               11.2
-)
-  message(
-    WARNING
-      "You have requested -DKokkos_ENABLE_CUDA_CONSTEXPR=ON for NVCC ${KOKKOS_CXX_COMPILER_VERSION} which is known to trigger compiler bugs before NVCC version 11.2. See https://github.com/kokkos/kokkos/issues/3496"
-  )
-endif()
diff --git a/packages/kokkos/cmake/kokkos_enable_devices.cmake b/packages/kokkos/cmake/kokkos_enable_devices.cmake
index 075e832984bd..186d4f9c7dca 100644
--- a/packages/kokkos/cmake/kokkos_enable_devices.cmake
+++ b/packages/kokkos/cmake/kokkos_enable_devices.cmake
@@ -69,23 +69,6 @@ if(KOKKOS_ENABLE_OPENACC)
     -Wno-unknown-cuda-version
     -Wno-pass-failed
   )
-  compiler_specific_defs(Clang KOKKOS_WORKAROUND_OPENMPTARGET_CLANG)
-endif()
-
-kokkos_device_option(OPENMPTARGET OFF DEVICE "Whether to build the OpenMP target backend")
-if(KOKKOS_ENABLE_OPENMPTARGET)
-  set(ClangOpenMPFlag -fopenmp=libomp)
-
-  compiler_specific_flags(
-    Clang
-    ${ClangOpenMPFlag}
-    -Wno-openmp-mapping
-    -Wno-unknown-cuda-version
-    -Wno-pass-failed
-    DEFAULT
-    -fopenmp
-  )
-  compiler_specific_defs(Clang KOKKOS_WORKAROUND_OPENMPTARGET_CLANG)
 endif()
 
 if(Trilinos_ENABLE_Kokkos AND TPL_ENABLE_CUDA)
@@ -112,8 +95,7 @@ kokkos_device_option(SYCL OFF DEVICE "Whether to build SYCL backend")
 
 ## SYCL has extra setup requirements, turn on Kokkos_Setup_SYCL.hpp in macros
 if(KOKKOS_ENABLE_SYCL)
-  if(KOKKOS_CXX_STANDARD LESS 17)
-    message(FATAL_ERROR "SYCL backend requires C++17 or newer!")
-  endif()
   list(APPEND DEVICE_SETUP_LIST SYCL)
 endif()
+
+kokkos_device_option(NEXTSILICON OFF DEVICE "Whether to build NextSilicon backend")
diff --git a/packages/kokkos/cmake/kokkos_enable_options.cmake b/packages/kokkos/cmake/kokkos_enable_options.cmake
index 541328138993..cf47e246c552 100644
--- a/packages/kokkos/cmake/kokkos_enable_options.cmake
+++ b/packages/kokkos/cmake/kokkos_enable_options.cmake
@@ -23,23 +23,14 @@ kokkos_cfg_depends(OPTIONS COMPILER_ID)
 kokkos_deprecated_list(OPTIONS ENABLE)
 
 kokkos_enable_option(CUDA_RELOCATABLE_DEVICE_CODE OFF "Whether to enable relocatable device code (RDC) for CUDA")
-kokkos_enable_option(CUDA_UVM OFF "Whether to use unified memory (UM) for CUDA by default")
-kokkos_enable_option(CUDA_LDG_INTRINSIC OFF "Whether to use CUDA LDG intrinsics")
-# In contrast to other CUDA-dependent, options CUDA_LAMBDA is ON by default.
-# That is problematic when CUDA is not enabled because this not only yields a
-# bogus warning, but also exports the Kokkos_ENABLE_CUDA_LAMBDA variable and
-# sets it to ON.
-kokkos_enable_option(
-  CUDA_LAMBDA ${KOKKOS_ENABLE_CUDA} "Whether to allow lambda expressions on the device with NVCC **DEPRECATED**"
-)
 
 # As of 09/2024, cudaMallocAsync causes issues with ICP and older version of UCX
 # as MPI communication layer.
 kokkos_enable_option(IMPL_CUDA_MALLOC_ASYNC OFF "Whether to enable CudaMallocAsync (requires CUDA Toolkit 11.2)")
-kokkos_enable_option(IMPL_NVHPC_AS_DEVICE_COMPILER OFF "Whether to allow nvc++ as Cuda device compiler")
 kokkos_enable_option(IMPL_CUDA_UNIFIED_MEMORY OFF "Whether to leverage unified memory architectures for CUDA")
 
-kokkos_enable_option(DEPRECATED_CODE_4 ON "Whether code deprecated in major release 4 is available")
+kokkos_enable_option(DEPRECATED_CODE_4 OFF "Whether code deprecated in major release 4 is available")
+kokkos_enable_option(DEPRECATED_CODE_5 ON "Whether code deprecated in major release 5 is available")
 kokkos_enable_option(DEPRECATION_WARNINGS ON "Whether to emit deprecation warnings")
 kokkos_enable_option(HIP_RELOCATABLE_DEVICE_CODE OFF "Whether to enable relocatable device code (RDC) for HIP")
 
@@ -58,6 +49,9 @@ kokkos_enable_option(IMPL_SYCL_OUT_OF_ORDER_QUEUES OFF "Whether to make Kokkos u
 kokkos_enable_option(TESTS OFF "Whether to build the unit tests")
 kokkos_enable_option(BENCHMARKS OFF "Whether to build the benchmarks")
 kokkos_enable_option(EXAMPLES OFF "Whether to build the examples")
+if(Kokkos_ENABLE_BENCHMARKS)
+  kokkos_enable_option(BENCHMARKS_HEAVY OFF "Whether to build and run the long benchmarks")
+endif()
 string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_CMAKE_BUILD_TYPE)
 if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
   set(DEBUG_DEFAULT ON)
@@ -65,18 +59,6 @@ else()
   set(DEBUG_DEFAULT OFF)
 endif()
 kokkos_enable_option(DEBUG ${DEBUG_DEFAULT} "Whether to activate extra debug features - may increase compile times")
-kokkos_enable_option(DEBUG_DUALVIEW_MODIFY_CHECK ON "Debug check on dual views")
-if(NOT Kokkos_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK)
-  if(KOKKOS_ENABLE_DEPRECATED_CODE_4)
-    message(
-      DEPRECATION
-        "Setting Kokkos_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK is deprecated. DualView modify is always checked. Forcing -DKokkos_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK=ON"
-    )
-    set(Kokkos_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK ON CACHE BOOL "Kokkos turned debug dualview modify check ON!" FORCE)
-  else()
-    message(FATAL_ERROR "Kokkos_ENABLE_DEBUG_DUALVIEW_MODIFY_CHECK has been removed and is always enabled")
-  endif()
-endif()
 
 unset(_UPPERCASE_CMAKE_BUILD_TYPE)
 kokkos_enable_option(LARGE_MEM_TESTS OFF "Whether to perform extra large memory tests")
@@ -85,11 +67,37 @@ kokkos_enable_option(COMPILER_WARNINGS OFF "Whether to print all compiler warnin
 kokkos_enable_option(TUNING OFF "Whether to create bindings for tuning tools")
 kokkos_enable_option(AGGRESSIVE_VECTORIZATION OFF "Whether to aggressively vectorize loops")
 kokkos_enable_option(COMPILE_AS_CMAKE_LANGUAGE OFF "Whether to use native cmake language support")
+kokkos_enable_option(MULTIPLE_CMAKE_LANGUAGES OFF "Whether to allow Kokkos to be used with multiple CMake languages")
+if(Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES)
+  message(
+    FATAL_ERROR
+      "Using both Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE and Kokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES is not allowed."
+  )
+endif()
+if((Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE OR Kokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES) AND Kokkos_ENABLE_CUDA)
+  if(CMAKE_VERSION VERSION_LESS "3.25.2")
+    message(FATAL_ERROR "Building Kokkos with CUDA as language and c++20 requires CMake version 3.25.2 or higher.")
+  endif()
+endif()
 kokkos_enable_option(
   HIP_MULTIPLE_KERNEL_INSTANTIATIONS OFF
   "Whether multiple kernels are instantiated at compile time - improve performance but increase compile time"
 )
-kokkos_enable_option(IMPL_HIP_MALLOC_ASYNC ${KOKKOS_ENABLE_HIP} "Whether to enable hipMallocAsync")
+# FIXME_HIP
+if(KOKKOS_ENABLE_HIP)
+  #here just for the version, can be removed with the fixme as it will be found by our TPL processing
+  find_package(hip REQUIRED PATHS ${ROCM_PATH} $ENV{ROCM_PATH})
+endif()
+if(hip_VERSION VERSION_GREATER_EQUAL 7.0.0)
+  set(HIP_MALLOC_ASYNC_DEFAULT OFF)
+else()
+  set(HIP_MALLOC_ASYNC_DEFAULT ${KOKKOS_ENABLE_HIP})
+endif()
+kokkos_enable_option(IMPL_HIP_MALLOC_ASYNC ${HIP_MALLOC_ASYNC_DEFAULT} "Whether to enable hipMallocAsync")
+if((hip_VERSION VERSION_GREATER_EQUAL 7.0.0) AND Kokkos_ENABLE_IMPL_HIP_MALLOC_ASYNC)
+  message(WARNING "Using Kokkos_ENABLE_IMPL_HIP_MALLOC_ASYNC is problematic with ROCm 7")
+endif()
+
 kokkos_enable_option(OPENACC_FORCE_HOST_AS_DEVICE OFF "Whether to force to use host as a target device for OpenACC")
 
 # This option will go away eventually, but allows fallback to old implementation when needed.
@@ -119,7 +127,7 @@ if(Kokkos_ENABLE_EXPERIMENTAL_CXX20_MODULES)
   endif()
 endif()
 
-kokkos_enable_option(IMPL_MDSPAN ON "Whether to enable experimental mdspan support")
+kokkos_enable_option(IMPL_MDSPAN ON "Whether to enable mdspan support (internal use only)")
 kokkos_enable_option(MDSPAN_EXTERNAL OFF "Whether to use an external version of mdspan")
 kokkos_enable_option(
   IMPL_CHECK_POSSIBLY_BREAKING_LAYOUTS
@@ -131,23 +139,7 @@ mark_as_advanced(Kokkos_ENABLE_MDSPAN_EXTERNAL)
 mark_as_advanced(IMPL_CHECK_POSSIBLY_BREAKING_LAYOUTS)
 
 if(Kokkos_ENABLE_IMPL_MDSPAN)
-  # Older CUDA versions work with mdspan but *not* our mdspan-based view implementation due
-  # to various compiler bugs. So we will disable it here
-  # Similarly GCC 8 and 9 have excessive memory usage so we default to legacy view, though the
-  # user can enable the new implementation if they wish
-  # CUDA 12.9 has a bug that causes it to segfault when mdspan-based view is used:
-  #   see https://github.com/kokkos/kokkos/issues/8126
-  if(KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 9)
-    set(VIEW_LEGACY_DEFAULT ON)
-  elseif(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11.4)
-    set(VIEW_LEGACY_DEFAULT ON)
-  elseif(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.9
-         AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 13
-  )
-    set(VIEW_LEGACY_DEFAULT ON)
-  else()
-    set(VIEW_LEGACY_DEFAULT OFF)
-  endif()
+  set(VIEW_LEGACY_DEFAULT OFF)
 else()
   set(VIEW_LEGACY_DEFAULT ON)
 endif()
@@ -212,11 +204,8 @@ check_device_specific_options(
   DEVICE
   CUDA
   OPTIONS
-  CUDA_UVM
   CUDA_RELOCATABLE_DEVICE_CODE
-  CUDA_LAMBDA
   CUDA_CONSTEXPR
-  CUDA_LDG_INTRINSIC
   IMPL_CUDA_MALLOC_ASYNC
   IMPL_CUDA_UNIFIED_MEMORY
 )
@@ -268,26 +257,6 @@ if((KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE OR KOKKOS_ENABLE_HIP_RELOCATABLE_
   message(FATAL_ERROR "Relocatable device code requires static libraries.")
 endif()
 
-if(Kokkos_ENABLE_CUDA_LDG_INTRINSIC)
-  if(KOKKOS_ENABLE_DEPRECATED_CODE_4)
-    message(DEPRECATION "Setting Kokkos_ENABLE_CUDA_LDG_INTRINSIC is deprecated. LDG intrinsics are always enabled.")
-  else()
-    message(FATAL_ERROR "Kokkos_ENABLE_CUDA_LDG_INTRINSIC has been removed. LDG intrinsics are always enabled.")
-  endif()
-endif()
-if(Kokkos_ENABLE_CUDA AND NOT Kokkos_ENABLE_CUDA_LAMBDA)
-  if(KOKKOS_ENABLE_DEPRECATED_CODE_4)
-    message(
-      DEPRECATION
-        "Setting Kokkos_ENABLE_CUDA_LAMBDA is deprecated. Lambda expressions in device code are always enabled. Forcing -DKokkos_ENABLE_CUDA_LAMBDA=ON"
-    )
-    set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Kokkos turned Cuda lambda support ON!" FORCE)
-    set(KOKKOS_ENABLE_CUDA_LAMBDA ON)
-  else()
-    message(FATAL_ERROR "Kokkos_ENABLE_CUDA_LAMBDA has been removed. Lambda expressions in device code always enabled.")
-  endif()
-endif()
-
 if(DEFINED Kokkos_ENABLE_IMPL_DESUL_ATOMICS)
   message(WARNING "Kokkos_ENABLE_IMPL_DESUL_ATOMICS option has been removed. Desul atomics cannot be disabled.")
 endif()
diff --git a/packages/kokkos/cmake/kokkos_functions.cmake b/packages/kokkos/cmake/kokkos_functions.cmake
index 639fde878907..039965668c7e 100644
--- a/packages/kokkos/cmake/kokkos_functions.cmake
+++ b/packages/kokkos/cmake/kokkos_functions.cmake
@@ -962,7 +962,7 @@ endfunction()
 #       FLAGS       --> flags to check
 #
 function(kokkos_check_flags)
-  cmake_parse_arguments(INP "COMPILER;LINKER" "LANGUAGE" "FLAGS" ${ARGN})
+  cmake_parse_arguments(INP "COMPILER;LINKER" "LANGUAGE" "FLAGS;LINKER_FLAGS" ${ARGN})
 
   # do nothing if no flags are given
   if(NOT INP_FLAGS)
@@ -982,10 +982,15 @@ function(kokkos_check_flags)
     include(CheckCompilerFlag)
     #delete cache so we always do the check
     unset(KOKKOS_COMPILE_OPTIONS_CHECK CACHE)
+    if(INP_LINKER_FLAGS)
+      # icpx adds "-device ..." options that need quotes (which CMake removes). We need to add them here again.
+      string(REGEX REPLACE "(-device [A-Za-z0-9_\\\\.]*)" "\"\\1\"" QUOTED_LINKER_FLAGS "${INP_LINKER_FLAGS}")
+      set(CMAKE_REQUIRED_LINK_OPTIONS "${QUOTED_LINKER_FLAGS}")
+    endif()
     check_compiler_flag(${INP_LANGUAGE} "${QUOTED_FLAGS}" KOKKOS_COMPILE_OPTIONS_CHECK)
     if(NOT KOKKOS_COMPILE_OPTIONS_CHECK)
       message(
-        FATAL_ERROR
+        WARNING
           "The compiler for ${KOKKOS_COMPILE_LANGUAGE} can not consume flag(s) ${QUOTED_FLAGS} in combination with the CMAKE_${KOKKOS_COMPILE_LANGUAGE}_FLAGS=${CMAKE_${KOKKOS_COMPILE_LANGUAGE}_FLAGS}. Please check the given configuration."
       )
     endif()
@@ -1000,7 +1005,7 @@ function(kokkos_check_flags)
     check_linker_flag(${INP_LANGUAGE} "${QUOTED_FLAGS}" KOKKOS_LINK_OPTIONS_CHECK)
     if(NOT KOKKOS_LINK_OPTIONS_CHECK)
       message(
-        FATAL_ERROR
+        WARNING
           "The linker for ${KOKKOS_COMPILE_LANGUAGE} can not consume flag(s) ${QUOTED_FLAGS}. Please check the given configuration."
       )
     endif()
diff --git a/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake b/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake
index 0d31e6d131f7..973597f8089b 100644
--- a/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake
+++ b/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake
@@ -1,27 +1,10 @@
-# From CMake 3.10 documentation
-
-#This can run at any time
-kokkos_option(
-  CXX_STANDARD
-  ""
-  STRING
-  "[[DEPRECATED - USE CMAKE_CXX_STANDARD INSTEAD]] The C++ standard for Kokkos to use: 17 or 20. If empty, this will default to CMAKE_CXX_STANDARD. If both CMAKE_CXX_STANDARD and Kokkos_CXX_STANDARD are empty, this will default to 17"
-)
-
 # Set CXX standard flags
-set(KOKKOS_ENABLE_CXX17 OFF)
 set(KOKKOS_ENABLE_CXX20 OFF)
 set(KOKKOS_ENABLE_CXX23 OFF)
 set(KOKKOS_ENABLE_CXX26 OFF)
-if(KOKKOS_CXX_STANDARD)
-  message(
-    FATAL_ERROR
-      "Setting the variable Kokkos_CXX_STANDARD in configuration is deprecated - set CMAKE_CXX_STANDARD directly instead"
-  )
-endif()
 
 if(NOT CMAKE_CXX_STANDARD)
-  set(KOKKOS_CXX_STANDARD "17")
+  set(KOKKOS_CXX_STANDARD "20")
 else()
   set(KOKKOS_CXX_STANDARD ${CMAKE_CXX_STANDARD})
 endif()
diff --git a/packages/kokkos/cmake/kokkos_test_cxx_std.cmake b/packages/kokkos/cmake/kokkos_test_cxx_std.cmake
index 9d1e2e723ddf..3a10ff3f6eab 100644
--- a/packages/kokkos/cmake/kokkos_test_cxx_std.cmake
+++ b/packages/kokkos/cmake/kokkos_test_cxx_std.cmake
@@ -31,10 +31,10 @@ function(kokkos_set_cxx_standard_feature standard)
     if(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND (KOKKOS_CXX_HOST_COMPILER_ID STREQUAL GNU
                                                    OR KOKKOS_CXX_HOST_COMPILER_ID STREQUAL Clang)
     )
-      if(${KOKKOS_CXX_COMPILER_VERSION} VERSION_LESS 12.0.0)
-        set(SUPPORTED_NVCC_FLAGS "-std=c++17")
+      if(${KOKKOS_CXX_COMPILER_VERSION} VERSION_LESS 13.0.0)
+        set(SUPPORTED_NVCC_FLAGS "-std=c++20")
       else()
-        set(SUPPORTED_NVCC_FLAGS "-std=c++17" "-std=c++20")
+        set(SUPPORTED_NVCC_FLAGS "-std=c++20")
       endif()
       if(NOT ${${STANDARD_NAME}} IN_LIST SUPPORTED_NVCC_FLAGS)
         message(
@@ -73,11 +73,7 @@ function(kokkos_set_cxx_standard_feature standard)
   endif()
 endfunction()
 
-if(KOKKOS_CXX_STANDARD STREQUAL "17")
-  kokkos_set_cxx_standard_feature(17)
-  set(KOKKOS_CXX_INTERMEDIATE_STANDARD "1Z")
-  set(KOKKOS_ENABLE_CXX17 ON)
-elseif(KOKKOS_CXX_STANDARD STREQUAL "20")
+if(KOKKOS_CXX_STANDARD STREQUAL "20")
   kokkos_set_cxx_standard_feature(20)
   set(KOKKOS_CXX_INTERMEDIATE_STANDARD "2A")
   set(KOKKOS_ENABLE_CXX20 ON)
@@ -90,31 +86,31 @@ elseif(KOKKOS_CXX_STANDARD STREQUAL "26")
   set(KOKKOS_CXX_INTERMEDIATE_STANDARD "2C")
   set(KOKKOS_ENABLE_CXX26 ON)
 else()
-  message(FATAL_ERROR "Kokkos requires C++17 or newer but requested ${KOKKOS_CXX_STANDARD}!")
+  message(FATAL_ERROR "Kokkos requires C++20 or newer but requested ${KOKKOS_CXX_STANDARD}!")
 endif()
 
-# Enforce that we can compile a simple C++17 program
+# Enforce that we can compile a simple C++20 program
 
 try_compile(
-  CAN_COMPILE_CPP17 ${KOKKOS_TOP_BUILD_DIR}/corner_cases ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/cplusplus17.cpp
-  OUTPUT_VARIABLE ERROR_MESSAGE CXX_STANDARD 17
+  CAN_COMPILE_CPP20 ${KOKKOS_TOP_BUILD_DIR}/corner_cases ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/cplusplus20.cpp
+  OUTPUT_VARIABLE ERROR_MESSAGE CXX_STANDARD 20
 )
-if(NOT CAN_COMPILE_CPP17)
-  unset(CAN_COMPILE_CPP17 CACHE) #make sure CMake always re-runs this
+if(NOT CAN_COMPILE_CPP20)
+  unset(CAN_COMPILE_CPP20 CACHE) #make sure CMake always re-runs this
   message(
     FATAL_ERROR
-      "C++${KOKKOS_CXX_STANDARD}-compliant compiler detected, but unable to compile C++17 or later program. Verify that ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_VERSION} is set up correctly (e.g., check that correct library headers are being used).\nFailing output:\n ${ERROR_MESSAGE}"
+      "C++${KOKKOS_CXX_STANDARD}-compliant compiler detected, but unable to compile C++20 or later program. Verify that ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_VERSION} is set up correctly (e.g., check that correct library headers are being used).\nFailing output:\n ${ERROR_MESSAGE}"
   )
 endif()
-unset(CAN_COMPILE_CPP17 CACHE) #make sure CMake always re-runs this
+unset(CAN_COMPILE_CPP20 CACHE) #make sure CMake always re-runs this
 
 # Enforce that extensions are turned off for nvcc_wrapper.
 # For compiling CUDA code using nvcc_wrapper, we will use the host compiler's
-# flags for turning on C++17.  Since for compiler ID and versioning purposes
+# flags for turning on C++20.  Since for compiler ID and versioning purposes
 # CMake recognizes the host compiler when calling nvcc_wrapper, this just
-# works.  Both NVCC and nvcc_wrapper only recognize '-std=c++17' which means
+# works.  Both NVCC and nvcc_wrapper only recognize '-std=c++20' which means
 # that we can only use host compilers for CUDA builds that use those flags.
-# It also means that extensions (gnu++17) can't be turned on for CUDA builds.
+# It also means that extensions (gnu++20) can't be turned on for CUDA builds.
 
 if(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
   if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
@@ -127,9 +123,6 @@ endif()
 if(KOKKOS_ENABLE_CUDA)
   # ENFORCE that the compiler can compile CUDA code.
   if(KOKKOS_CXX_COMPILER_ID STREQUAL Clang)
-    if(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 4.0.0)
-      message(FATAL_ERROR "Compiling CUDA code directly with Clang requires version 4.0.0 or higher.")
-    endif()
     if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
       set(CMAKE_CXX_EXTENSIONS OFF)
     elseif(CMAKE_CXX_EXTENSIONS)
diff --git a/packages/kokkos/cmake/kokkos_tpls.cmake b/packages/kokkos/cmake/kokkos_tpls.cmake
index f43aff4d1f08..1312fe50610d 100644
--- a/packages/kokkos/cmake/kokkos_tpls.cmake
+++ b/packages/kokkos/cmake/kokkos_tpls.cmake
@@ -21,31 +21,8 @@ endfunction()
 
 kokkos_tpl_option(HWLOC Off TRIBITS HWLOC)
 kokkos_tpl_option(CUDA ${Kokkos_ENABLE_CUDA} TRIBITS CUDA)
-if(KOKKOS_ENABLE_HIP AND NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC)
-  set(ROCM_DEFAULT ON)
-else()
-  set(ROCM_DEFAULT OFF)
-endif()
-if(KOKKOS_ENABLE_HIP)
-  set(ROCTHRUST_DEFAULT ON)
-else()
-  set(ROCTHRUST_DEFAULT OFF)
-endif()
-kokkos_tpl_option(ROCM ${ROCM_DEFAULT})
-kokkos_tpl_option(ROCTHRUST ${ROCTHRUST_DEFAULT})
-if(Kokkos_ENABLE_ROCTHRUST)
-  include(CheckCXXSourceCompiles)
-  check_cxx_source_compiles(
-    "
-    #include 
-    int main() {
-      static_assert(_GLIBCXX_RELEASE < 9);
-      return 0;
-    }
-    "
-    Kokkos_ENABLE_IMPL_SKIP_NO_RTTI_FLAG
-  )
-endif()
+kokkos_tpl_option(ROCM ${Kokkos_ENABLE_HIP})
+kokkos_tpl_option(ROCTHRUST ${Kokkos_ENABLE_HIP})
 
 if(KOKKOS_ENABLE_SYCL)
   set(ONEDPL_DEFAULT ON)
@@ -59,7 +36,7 @@ if(WIN32)
 else()
   set(LIBDL_DEFAULT On)
 endif()
-kokkos_tpl_option(LIBDL ${LIBDL_DEFAULT} TRIBITS DLlib)
+kokkos_enable_option(LIBDL ${LIBDL_DEFAULT} "Whether to enable the LIBDL library")
 
 if(Trilinos_ENABLE_Kokkos AND TPL_ENABLE_HPX)
   set(HPX_DEFAULT ON)
@@ -77,11 +54,12 @@ else()
 endif()
 kokkos_tpl_option(LIBQUADMATH ${LIBQUADMATH_DEFAULT} TRIBITS quadmath)
 
+kokkos_tpl_option(NEXTAPI ${KOKKOS_ENABLE_NEXTSILICON} TRIBITS NEXTAPI)
+
 #Make sure we use our local FindKokkosCuda.cmake
 kokkos_import_tpl(HPX INTERFACE)
 kokkos_import_tpl(CUDA INTERFACE)
 kokkos_import_tpl(HWLOC)
-kokkos_import_tpl(LIBDL)
 if(NOT WIN32)
   kokkos_import_tpl(THREADS INTERFACE)
 endif()
@@ -91,6 +69,7 @@ endif()
 kokkos_import_tpl(ONEDPL INTERFACE)
 kokkos_import_tpl(LIBQUADMATH)
 kokkos_import_tpl(ROCTHRUST)
+kokkos_import_tpl(NEXTAPI)
 
 if(Kokkos_ENABLE_DESUL_ATOMICS_EXTERNAL)
   find_package(desul REQUIRED COMPONENTS atomics)
@@ -109,7 +88,11 @@ if(Kokkos_ENABLE_OPENMP)
     global_append(KOKKOS_AMDGPU_OPTIONS ${OpenMP_CXX_FLAGS})
   endif()
   if(Kokkos_ENABLE_CUDA AND KOKKOS_COMPILE_LANGUAGE STREQUAL CUDA)
-    global_append(KOKKOS_CUDA_OPTIONS -Xcompiler ${OpenMP_CXX_FLAGS})
+    if(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA)
+      global_append(KOKKOS_CUDA_OPTIONS -Xcompiler ${OpenMP_CXX_FLAGS})
+    else()
+      global_append(KOKKOS_CUDA_OPTIONS ${OpenMP_CXX_FLAGS})
+    endif()
   endif()
 endif()
 
diff --git a/packages/kokkos/cmake/kokkos_tribits.cmake b/packages/kokkos/cmake/kokkos_tribits.cmake
index 9f8fd08892c9..63e3ba00b572 100644
--- a/packages/kokkos/cmake/kokkos_tribits.cmake
+++ b/packages/kokkos/cmake/kokkos_tribits.cmake
@@ -6,12 +6,26 @@ include(GNUInstallDirs)
 
 message(STATUS "The project name is: ${PROJECT_NAME}")
 
-if(GTest_FOUND)
-  set(KOKKOS_GTEST_LIB GTest::gtest)
-  message(STATUS "Using gtest found in ${GTest_DIR}")
-else() # fallback to internal gtest
-  set(KOKKOS_GTEST_LIB kokkos_gtest)
-  message(STATUS "Using internal gtest for testing")
+if(Kokkos_ENABLE_TESTS OR Kokkos_INSTALL_TESTING)
+  find_package(GTest QUIET)
+  if(GTest_FOUND)
+    message(STATUS "Found external GoogleTest: ${GTest_DIR} (version \"${GTest_VERSION}\")")
+  else()
+    message(STATUS "Using bundled GoogleTest version")
+    include(FetchContent)
+    list(APPEND CMAKE_MESSAGE_INDENT "[googletest] ")
+    FetchContent_Declare(googletest SOURCE_DIR ${Kokkos_SOURCE_DIR}/tpls/gtest)
+    FetchContent_MakeAvailable(googletest)
+    list(POP_BACK CMAKE_MESSAGE_INDENT)
+
+    # Suppress clang-tidy diagnostics on code that we do not have control over
+    if(CMAKE_CXX_CLANG_TIDY)
+      set_target_properties(gtest PROPERTIES CXX_CLANG_TIDY "")
+    endif()
+
+    # Suppress compiler warnings. TODO use SYSTEM within the FetchContent_Declare call when CMake 3.25 is required
+    set_target_properties(gtest PROPERTIES COMPILE_OPTIONS -w)
+  endif()
 endif()
 
 function(VERIFY_EMPTY CONTEXT)
@@ -109,8 +123,6 @@ function(KOKKOS_ADD_EXECUTABLE_AND_TEST ROOT_NAME)
       OR Kokkos_ENABLE_EXPERIMENTAL_CXX20_MODULES
       OR Kokkos_ENABLE_SYCL
       OR Kokkos_ENABLE_HPX
-      OR Kokkos_ENABLE_IMPL_SKIP_NO_RTTI_FLAG
-      OR (KOKKOS_CXX_COMPILER_ID STREQUAL "NVIDIA" AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11.3.0)
       OR (KOKKOS_CXX_COMPILER_ID STREQUAL "NVIDIA" AND KOKKOS_CXX_HOST_COMPILER_ID STREQUAL "MSVC"))
   )
     if(MSVC)
@@ -163,7 +175,6 @@ macro(KOKKOS_SETUP_BUILD_ENVIRONMENT)
     include(${KOKKOS_SRC_PATH}/cmake/kokkos_arch.cmake)
     set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${Kokkos_SOURCE_DIR}/cmake/Modules/")
     include(${KOKKOS_SRC_PATH}/cmake/kokkos_tpls.cmake)
-    include(${KOKKOS_SRC_PATH}/cmake/kokkos_corner_cases.cmake)
   endif()
 endmacro()
 
@@ -171,10 +182,17 @@ macro(KOKKOS_ADD_TEST_EXECUTABLE ROOT_NAME)
   cmake_parse_arguments(PARSE "" "" "SOURCES" ${ARGN})
   # Don't do anything if the user disabled the test
   if(NOT ${PACKAGE_NAME}_${ROOT_NAME}_DISABLE)
-    kokkos_add_executable(
-      ${ROOT_NAME} SOURCES ${PARSE_SOURCES} ${PARSE_UNPARSED_ARGUMENTS} TESTONLYLIBS ${KOKKOS_GTEST_LIB}
-    )
+    kokkos_add_executable(${ROOT_NAME} SOURCES ${PARSE_SOURCES} ${PARSE_UNPARSED_ARGUMENTS} TESTONLYLIBS GTest::gtest)
     set(EXE_NAME ${PACKAGE_NAME}_${ROOT_NAME})
+
+    # Suppress compiler warnings when not using an external gtest version.
+    # TODO use SYSTEM within the FetchContent_Declare call when CMake 3.25 is required
+    get_target_property(GTEST_INCLUDES GTest::gtest INCLUDE_DIRECTORIES)
+    if(GTEST_INCLUDES)
+      foreach(dir ${GTEST_INCLUDES})
+        target_include_directories(${EXE_NAME} SYSTEM PRIVATE "${dir}")
+      endforeach()
+    endif()
   endif()
 endmacro()
 
@@ -198,6 +216,9 @@ macro(KOKKOS_CONFIGURE_CORE)
     KokkosCore_Config_HeaderSet.in KokkosCore_Config_DeclareBackend.hpp "KOKKOS_DECLARE" "decl/Kokkos_Declare"
     "${KOKKOS_ENABLED_DEVICES}"
   )
+  if(BUILD_SHARED_LIBS)
+    set(KOKKOS_IMPL_BUILD_SHARED_LIBS ON)
+  endif()
   configure_file(cmake/KokkosCore_config.h.in KokkosCore_config.h @ONLY)
 endmacro()
 
@@ -235,44 +256,47 @@ endmacro()
 function(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
   cmake_parse_arguments(PARSE "PLAIN_STYLE" "" "" ${ARGN})
 
-  if((NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) AND (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18"))
+  #allow multiple languages to be used downstream
+  set(Kokkos_LANGUAGES "${KOKKOS_COMPILE_LANGUAGE}")
+  if(Kokkos_ENABLE_MULTIPLE_CMAKE_LANGUAGES)
+    if(Kokkos_ENABLE_HIP)
+      set(Kokkos_LANGUAGES "HIP,CXX")
+    elseif(Kokkos_ENABLE_CUDA)
+      set(Kokkos_LANGUAGES "CUDA,CXX")
+    endif()
+  endif()
+
+  if(NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE)
     #I can use link options
     #check for CXX linkage using the simple 3.18 way
-    target_link_options(${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_LINK_OPTIONS}>)
+    target_link_options(${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_LINK_OPTIONS}>)
   else()
     #I can use link options
     #just assume CXX linkage
     target_link_options(${LIBRARY_NAME} PUBLIC ${KOKKOS_LINK_OPTIONS})
   endif()
 
-  #required for check_linker_flag
-  if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
-    #exclude case of compiler_launcher. The launcher forwards to nvcc_wrapper and shadow the CXX compiler that CMake sees (compiler_launcher changes the compiler).
-    #The CXX compiler CMake will invoke for the check is not able to consume the cuda flags if it is not nvcc_wrapper or clang+cuda.
-    #FIXME_NVHPC nvc++ is failing the check spuriously with various version numbers.
-    if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
-       AND (NOT (KOKKOS_ENABLE_CUDA) OR ("${CMAKE_CXX_COMPILER}" MATCHES "nvcc_wrapper") OR (${KOKKOS_CXX_COMPILER_ID}
-                                                                                             STREQUAL Clang))
-    )
-      kokkos_check_flags(LINKER LANGUAGE ${KOKKOS_COMPILE_LANGUAGE} FLAGS ${KOKKOS_LINK_OPTIONS})
-    endif()
+  #exclude case of compiler_launcher. The launcher forwards to nvcc_wrapper and shadow the CXX compiler that CMake sees (compiler_launcher changes the compiler).
+  #The CXX compiler CMake will invoke for the check is not able to consume the cuda flags if it is not nvcc_wrapper or clang+cuda.
+  #FIXME_NVHPC nvc++ is failing the check spuriously with various version numbers.
+  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
+     AND (NOT (KOKKOS_ENABLE_CUDA) OR ("${CMAKE_CXX_COMPILER}" MATCHES "nvcc_wrapper") OR (${KOKKOS_CXX_COMPILER_ID}
+                                                                                           STREQUAL Clang))
+  )
+    kokkos_check_flags(LINKER LANGUAGE ${KOKKOS_COMPILE_LANGUAGE} FLAGS ${KOKKOS_LINK_OPTIONS})
   endif()
 
   list(APPEND ALL_KOKKOS_COMPILER_FLAGS ${KOKKOS_COMPILE_OPTIONS})
-  target_compile_options(
-    ${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_COMPILE_OPTIONS}>
-  )
+  target_compile_options(${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_COMPILE_OPTIONS}>)
 
   target_compile_definitions(
-    ${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_COMPILE_DEFINITIONS}>
+    ${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_COMPILE_DEFINITIONS}>
   )
 
   target_link_libraries(${LIBRARY_NAME} PUBLIC ${KOKKOS_LINK_LIBRARIES})
 
   if(KOKKOS_ENABLE_CUDA)
-    target_compile_options(
-      ${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_CUDA_OPTIONS}>
-    )
+    target_compile_options(${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_CUDA_OPTIONS}>)
     set(NODEDUP_CUDAFE_OPTIONS)
     foreach(OPT ${KOKKOS_CUDAFE_OPTIONS})
       list(APPEND NODEDUP_CUDAFE_OPTIONS -Xcudafe ${OPT})
@@ -286,9 +310,7 @@ function(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
   endif()
 
   if(KOKKOS_ENABLE_HIP)
-    target_compile_options(
-      ${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_AMDGPU_OPTIONS}>
-    )
+    target_compile_options(${LIBRARY_NAME} PUBLIC $<$:${KOKKOS_AMDGPU_OPTIONS}>)
     list(APPEND ALL_KOKKOS_COMPILER_FLAGS ${KOKKOS_AMDGPU_OPTIONS})
   endif()
 
@@ -313,17 +335,23 @@ function(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME)
     list(APPEND ALL_KOKKOS_COMPILER_FLAGS ${NODEDUP_XCOMPILER_OPTIONS})
   endif()
 
-  #required for check_compiler_flag
-  if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
-    #exclude case of compiler_launcher. The launcher forwards to nvcc_wrapper and shadow the CXX compiler that CMake sees (compiler_launcher changes the compiler).
-    #The CXX compiler CMake will invoke for the check is not able to consume the cuda flags if it is not nvcc_wrapper or clang+cuda.
-    #FIXME_NVHPC nvc++ is failing the check spuriously with various version numbers.
-    if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
-       AND (NOT (KOKKOS_ENABLE_CUDA) OR ("${CMAKE_CXX_COMPILER}" MATCHES "nvcc_wrapper") OR (${KOKKOS_CXX_COMPILER_ID}
-                                                                                             STREQUAL Clang))
+  #exclude case of compiler_launcher. The launcher forwards to nvcc_wrapper and shadow the CXX compiler that CMake sees (compiler_launcher changes the compiler).
+  #The CXX compiler CMake will invoke for the check is not able to consume the cuda flags if it is not nvcc_wrapper or clang+cuda.
+  #FIXME_NVHPC nvc++ is failing the check spuriously with various version numbers.
+  #FIXME CLANG+RDC with std=c++20 and CMake 3.22+ the runtime is not linked in the CheckCompilerFlag leading to false positives
+  if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)
+     AND (NOT (KOKKOS_ENABLE_CUDA) OR ("${CMAKE_CXX_COMPILER}" MATCHES "nvcc_wrapper")
+          OR (${KOKKOS_CXX_COMPILER_ID} STREQUAL Clang AND NOT KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE))
+  )
+    kokkos_check_flags(
+      COMPILER
+      LANGUAGE
+      ${KOKKOS_COMPILE_LANGUAGE}
+      FLAGS
+      ${ALL_KOKKOS_COMPILER_FLAGS}
+      LINKER_FLAGS
+      ${KOKKOS_LINK_OPTIONS}
     )
-      kokkos_check_flags(COMPILER LANGUAGE ${KOKKOS_COMPILE_LANGUAGE} FLAGS ${ALL_KOKKOS_COMPILER_FLAGS})
-    endif()
   endif()
 
   if(KOKKOS_CXX_STANDARD_FEATURE)
@@ -364,6 +392,10 @@ function(KOKKOS_ADD_LIBRARY LIBRARY_NAME)
 
   # MSVC and other platforms want to have the headers included as source files for better dependency detection
   add_library(${LIBRARY_NAME} ${LINK_TYPE} ${PARSE_HEADERS} ${PARSE_SOURCES})
+  if(PARSE_STATIC)
+    # We want position independent code to be able to link static libraries into shared ones.
+    set_target_properties(${LIBRARY_NAME} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
+  endif()
 
   if(Kokkos_ENABLE_EXPERIMENTAL_CXX20_MODULES)
     if(PARSE_MODULE_INTERFACE)
@@ -376,7 +408,9 @@ function(KOKKOS_ADD_LIBRARY LIBRARY_NAME)
   if(PARSE_SHARED OR BUILD_SHARED_LIBS)
     set_target_properties(
       ${LIBRARY_NAME} PROPERTIES VERSION ${Kokkos_VERSION} SOVERSION ${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}
+                                 WINDOWS_EXPORT_ALL_SYMBOLS ON
     )
+    target_compile_definitions(${LIBRARY_NAME} PRIVATE KOKKOS_IMPL_EXPORT_SYMBOLS)
   endif()
 
   kokkos_internal_add_library_install(${LIBRARY_NAME})
diff --git a/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake b/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake
index 52d8368d0419..71a790ead076 100644
--- a/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake
@@ -1,19 +1,5 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 #-----------------------------------------------------------------------------
 #  Hardware locality detection and control library.
diff --git a/packages/kokkos/cmake/tpls/FindTPLPthread.cmake b/packages/kokkos/cmake/tpls/FindTPLPthread.cmake
index f51bce5d64d7..f27b0a0e106e 100644
--- a/packages/kokkos/cmake/tpls/FindTPLPthread.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLPthread.cmake
@@ -1,19 +1,5 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 set(USE_THREADS FALSE)
 
diff --git a/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake b/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake
index b449f45135aa..a14048cc9f08 100644
--- a/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake
+++ b/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake
@@ -1,18 +1,4 @@
-#@HEADER
-# ************************************************************************
-#
-#                        Kokkos v. 4.0
-#       Copyright (2022) 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.
-#
-# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-#
+# SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-# ************************************************************************
-# @HEADER
 
 tribits_tpl_find_include_dirs_and_libraries(quadmath REQUIRED_HEADERS quadmath.h REQUIRED_LIBS_NAMES quadmath)
diff --git a/packages/kokkos/containers/performance_tests/CMakeLists.txt b/packages/kokkos/containers/performance_tests/CMakeLists.txt
index 8d4d605b0871..9fd426a42296 100644
--- a/packages/kokkos/containers/performance_tests/CMakeLists.txt
+++ b/packages/kokkos/containers/performance_tests/CMakeLists.txt
@@ -7,8 +7,6 @@ foreach(Tag Threads;OpenMP;Cuda;HPX;HIP)
   string(TOLOWER ${Tag} dir)
 
   if(Kokkos_ENABLE_${DEVICE})
-    message(STATUS "Sources Test${Tag}.cpp")
-
     set(SOURCES TestMain.cpp Test${Tag}.cpp)
 
     kokkos_add_executable_and_test(ContainersPerformanceTest_${Tag} SOURCES ${SOURCES})
diff --git a/packages/kokkos/containers/performance_tests/Makefile b/packages/kokkos/containers/performance_tests/Makefile
deleted file mode 100644
index 914193da764f..000000000000
--- a/packages/kokkos/containers/performance_tests/Makefile
+++ /dev/null
@@ -1,103 +0,0 @@
-KOKKOS_PATH = ../..
-
-GTEST_PATH = ../../TPL/gtest
-
-vpath %.cpp ${KOKKOS_PATH}/containers/performance_tests
-
-default: build_all
-	echo "End Build"
-
-ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES)))
-  CXX = $(KOKKOS_PATH)/bin/nvcc_wrapper
-else
-  CXX = g++
-endif
-
-CXXFLAGS = -O3
-LINK ?= $(CXX)
-LDFLAGS ?=
-override LDFLAGS += -lpthread
-
-KOKKOS_USE_DEPRECATED_MAKEFILES=1
-
-include $(KOKKOS_PATH)/Makefile.kokkos
-
-KOKKOS_CXXFLAGS += -I$(GTEST_PATH) -I${KOKKOS_PATH}/containers/performance_tests
-
-TEST_TARGETS =
-TARGETS =
-
-ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1)
-	OBJ_CUDA = TestCuda.o TestMain.o gtest-all.o
-	TARGETS += KokkosContainers_PerformanceTest_Cuda
-	TEST_TARGETS += test-cuda
-endif
-
-ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1)
-	OBJ_HIP = TestHIP.o TestMain.o gtest-all.o
-	TARGETS += KokkosContainers_PerformanceTest_HIP
-	TEST_TARGETS += test-hip
-endif
-
-ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1)
-	OBJ_THREADS = TestThreads.o TestMain.o gtest-all.o
-	TARGETS += KokkosContainers_PerformanceTest_Threads
-	TEST_TARGETS += test-threads
-endif
-
-ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1)
-	OBJ_OPENMP = TestOpenMP.o TestMain.o gtest-all.o
-	TARGETS += KokkosContainers_PerformanceTest_OpenMP
-	TEST_TARGETS += test-openmp
-endif
-
-ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1)
-	OBJ_HPX = TestHPX.o TestMain.o gtest-all.o
-	TARGETS += KokkosContainers_PerformanceTest_HPX
-	TEST_TARGETS += test-hpx
-endif
-
-KokkosContainers_PerformanceTest_Cuda: $(OBJ_CUDA) $(KOKKOS_LINK_DEPENDS)
-	$(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_CUDA) $(KOKKOS_LIBS) $(LIB) -o KokkosContainers_PerformanceTest_Cuda
-
-KokkosContainers_PerformanceTest_HIP: $(OBJ_HIP) $(KOKKOS_LINK_DEPENDS)
-	$(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_HIP) $(KOKKOS_LIBS) $(LIB) -o KokkosContainers_PerformanceTest_HIP
-
-KokkosContainers_PerformanceTest_Threads: $(OBJ_THREADS) $(KOKKOS_LINK_DEPENDS)
-	$(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_THREADS) $(KOKKOS_LIBS) $(LIB) -o KokkosContainers_PerformanceTest_Threads
-
-KokkosContainers_PerformanceTest_OpenMP: $(OBJ_OPENMP) $(KOKKOS_LINK_DEPENDS)
-	$(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_OPENMP) $(KOKKOS_LIBS) $(LIB) -o KokkosContainers_PerformanceTest_OpenMP
-
-KokkosContainers_PerformanceTest_HPX: $(OBJ_HPX) $(KOKKOS_LINK_DEPENDS)
-	$(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_HPX) $(KOKKOS_LIBS) $(LIB) -o KokkosContainers_PerformanceTest_HPX
-
-test-cuda: KokkosContainers_PerformanceTest_Cuda
-	./KokkosContainers_PerformanceTest_Cuda
-
-test-hip: KokkosContainers_PerformanceTest_HIP
-	./KokkosContainers_PerformanceTest_HIP
-
-test-threads: KokkosContainers_PerformanceTest_Threads
-	./KokkosContainers_PerformanceTest_Threads
-
-test-openmp: KokkosContainers_PerformanceTest_OpenMP
-	./KokkosContainers_PerformanceTest_OpenMP
-
-test-hpx: KokkosContainers_PerformanceTest_HPX
-	./KokkosContainers_PerformanceTest_HPX
-
-build_all: $(TARGETS)
-
-test: $(TEST_TARGETS)
-
-clean: kokkos-clean
-	rm -f *.o $(TARGETS)
-
-# Compilation rules
-
-%.o:%.cpp $(KOKKOS_CPP_DEPENDS)
-	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $<
-
-gtest-all.o:$(GTEST_PATH)/gtest/gtest-all.cc
-	$(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $(GTEST_PATH)/gtest/gtest-all.cc
diff --git a/packages/kokkos/containers/performance_tests/TestCuda.cpp b/packages/kokkos/containers/performance_tests/TestCuda.cpp
index 71b1c1d4ee8e..c16a362285a3 100644
--- a/packages/kokkos/containers/performance_tests/TestCuda.cpp
+++ b/packages/kokkos/containers/performance_tests/TestCuda.cpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 
@@ -25,25 +12,36 @@
 
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.unordered_impl;
+#else
 #include 
-
-#include 
-
 #include 
+#endif
 
+#include 
 #include 
-
 #include 
 
+#include 
+
 namespace Performance {
 
-TEST(TEST_CATEGORY, dynrankview_perf) {
+TEST(cuda, dynrankview_perf) {
   std::cout << "Cuda" << std::endl;
   std::cout << " DynRankView vs View: Initialization Only " << std::endl;
   test_dynrankview_op_perf(40960);
 }
 
-TEST(TEST_CATEGORY, global_2_local) {
+TEST(cuda, dualview_perf) {
+  std::cout << "Cuda" << std::endl;
+  std::cout << " DualView Access Performance " << std::endl;
+  test_dualview();
+}
+
+TEST(cuda, global_2_local) {
   std::cout << "Cuda" << std::endl;
   std::cout << "size, create, generate, fill, find" << std::endl;
   for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size;
@@ -51,11 +49,11 @@ TEST(TEST_CATEGORY, global_2_local) {
     test_global_to_local_ids(i);
 }
 
-TEST(TEST_CATEGORY, unordered_map_performance_near) {
+TEST(cuda, unordered_map_performance_near) {
   Perf::run_performance_tests("cuda-near");
 }
 
-TEST(TEST_CATEGORY, unordered_map_performance_far) {
+TEST(cuda, unordered_map_performance_far) {
   Perf::run_performance_tests("cuda-far");
 }
 
diff --git a/packages/kokkos/containers/performance_tests/TestDualView.hpp b/packages/kokkos/containers/performance_tests/TestDualView.hpp
new file mode 100644
index 000000000000..8ac351fa2a9e
--- /dev/null
+++ b/packages/kokkos/containers/performance_tests/TestDualView.hpp
@@ -0,0 +1,226 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+#ifndef KOKKOS_TEST_DUALVIEW_HPP
+#define KOKKOS_TEST_DUALVIEW_HPP
+
+#include 
+#include 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.dual_view;
+#else
+#include 
+#include 
+#include 
+#endif
+#include 
+
+namespace Performance {
+
+namespace Impl {
+
+struct times_t {
+  double t_sync_to_host;
+  double t_compute;
+  double t_sync_to_device;
+};
+
+template 
+struct SumViewEntriesFunctor {
+  using value_type = Scalar;
+  ViewType view;
+  SumViewEntriesFunctor(const ViewType& view_) : view(view_) {}
+
+  template 
+  KOKKOS_INLINE_FUNCTION void operator()(const I i, const J j,
+                                         value_type& sum) const {
+    sum += view(i, j);
+  }
+};
+
+template 
+struct IncrViewEntriesFunctor {
+  using value_type = Scalar;
+  ViewType view;
+  IncrViewEntriesFunctor(const ViewType& view_) : view(view_) {}
+
+  template 
+  KOKKOS_INLINE_FUNCTION void operator()(const I i, const J j) const {
+    view(i, j)++;
+  }
+};
+
+template 
+struct test_dualview_with_datacheck {
+  using scalar_type     = Scalar;
+  using execution_space = Device;
+
+  template 
+  void run(const int n, const int m, times_t& times) {
+    ViewType a, b;
+    a = ViewType("A", n, m);
+    b = ViewType("B", n, m);
+
+    const scalar_type sum_total =
+        static_cast(n) * static_cast(m);
+
+    Kokkos::deep_copy(a.view_device(), 1);
+
+    Kokkos::Timer timer;
+
+    using device_space = typename ViewType::t_dev::execution_space;
+    using host_space   = typename ViewType::t_host::execution_space;
+
+    timer.reset();
+    a.template modify();
+    a.template sync();
+    times.t_sync_to_host = timer.seconds();
+
+    // Check device view is initialized as expected
+    scalar_type a_d_sum = 0;
+
+    timer.reset();
+    Kokkos::parallel_reduce(
+        Kokkos::MDRangePolicy>({{0, 0}},
+                                                             {{n, m}}),
+        SumViewEntriesFunctor(
+            a.view_device()),
+        a_d_sum);
+    times.t_compute = timer.seconds();
+    if (a_d_sum != sum_total)
+      Kokkos::abort("test_dualview_with_datacheck: a_d_sum != sum_total");
+
+    // Use deep_copy
+    Kokkos::deep_copy(b, a);
+    timer.reset();
+    b.template sync();
+    times.t_sync_to_host += timer.seconds();
+
+    // Perform same checks on b as done on a
+    // Check device view is initialized as expected
+    scalar_type b_d_sum = 0;
+    timer.reset();
+    Kokkos::parallel_reduce(
+        Kokkos::MDRangePolicy>({{0, 0}},
+                                                             {{n, m}}),
+        SumViewEntriesFunctor(
+            b.view_device()),
+        b_d_sum);
+    times.t_compute += timer.seconds();
+    if (b_d_sum != sum_total)
+      Kokkos::abort("test_dualview_with_datacheck: b_d_sum != sum_total");
+  }
+  test_dualview_with_datacheck(const int n, const int m) {
+    times_t elapsed_time = {0.0, 0.0, 0.0};
+    run>(n, m,
+                                                                elapsed_time);
+    std::cout << " DualView (test_dualview_with_datacheck) timing (sec): "
+              << "t_sync_to_host: " << elapsed_time.t_sync_to_host
+              << ", t_compute: " << elapsed_time.t_compute
+              << ", t_sync_to_device: " << elapsed_time.t_sync_to_device
+              << ", dim0: " << n << ", dim1: " << m << std::endl;
+  }
+};
+
+template 
+struct test_dualview_sync {
+  using scalar_type     = Scalar;
+  using execution_space = Device;
+
+  template 
+  void run(const int n, const int m, const int iters, times_t& elapsed_time) {
+    ViewType a = ViewType("A", n, m);
+
+    using device_space = typename ViewType::t_dev::execution_space;
+    using host_space   = typename ViewType::t_host::execution_space;
+
+    Kokkos::deep_copy(a.view_device(), 1);
+
+    int i = iters;
+
+    Kokkos::Timer timer;
+    while (i--) {
+      // Sync to host
+      timer.reset();
+      a.template modify();
+      a.template sync();
+      elapsed_time.t_sync_to_host += timer.seconds();
+
+      // Update on host
+      timer.reset();
+      Kokkos::parallel_for(
+          Kokkos::MDRangePolicy<
+              host_space,
+              Kokkos::Rank<2, Kokkos::Iterate::Left, Kokkos::Iterate::Left>>(
+              {{0, 0}}, {{n, m}}),
+          IncrViewEntriesFunctor(
+              a.view_host()));
+      Kokkos::fence();
+      elapsed_time.t_compute += timer.seconds();
+
+      // Sync to device
+      timer.reset();
+      a.template modify();
+      a.template sync();
+      elapsed_time.t_sync_to_device += timer.seconds();
+
+      // Update on device
+      timer.reset();
+      Kokkos::parallel_for(
+          Kokkos::MDRangePolicy<
+              device_space,
+              Kokkos::Rank<2, Kokkos::Iterate::Left, Kokkos::Iterate::Left>>(
+              {{0, 0}}, {{n, m}}),
+          IncrViewEntriesFunctor(
+              a.view_device()));
+      Kokkos::fence();
+      elapsed_time.t_compute += timer.seconds();
+    }
+    Kokkos::fence();
+
+    const scalar_type sum_total =
+        static_cast(n) * static_cast(m);
+    scalar_type a_d_sum = 0;
+    Kokkos::parallel_reduce(
+        Kokkos::MDRangePolicy<
+            device_space,
+            Kokkos::Rank<2, Kokkos::Iterate::Left, Kokkos::Iterate::Left>>(
+            {{0, 0}}, {{n, m}}),
+        SumViewEntriesFunctor(
+            a.view_device()),
+        a_d_sum);
+    if (a_d_sum != sum_total + iters * 2 * sum_total)
+      Kokkos::abort(
+          "test_dualview_sync: a_d_sum != sum_total + iters * 2 * sum_total");
+  }
+  test_dualview_sync(const int n, const int m) {
+    times_t elapsed_time = {0.0, 0.0, 0.0};
+    const int iters      = 10;
+    run>(n, m, iters,
+                                                                elapsed_time);
+    std::cout << " DualView (test_dualview_sync) timing (sec, avg per iter): "
+              << "t_sync_to_host: "
+              << elapsed_time.t_sync_to_host / static_cast(iters)
+              << ", t_compute: "
+              << elapsed_time.t_compute / static_cast(iters)
+              << ", t_sync_to_device: "
+              << elapsed_time.t_sync_to_device / static_cast(iters)
+              << ", dim0: " << n << ", dim1: " << m << std::endl;
+  }
+};
+}  // namespace Impl
+
+template 
+void test_dualview() {
+  Impl::test_dualview_with_datacheck(128, 128);
+  Impl::test_dualview_with_datacheck(512, 512);
+  Impl::test_dualview_with_datacheck(1024, 1024);
+  Impl::test_dualview_sync(128, 128);
+  Impl::test_dualview_sync(512, 512);
+  Impl::test_dualview_sync(1024, 1024);
+}
+}  // namespace Performance
+
+#endif  // KOKKOS_TEST_DUALVIEW_HPP
diff --git a/packages/kokkos/containers/performance_tests/TestDynRankView.hpp b/packages/kokkos/containers/performance_tests/TestDynRankView.hpp
index 18de6c9723ec..674610a49742 100644
--- a/packages/kokkos/containers/performance_tests/TestDynRankView.hpp
+++ b/packages/kokkos/containers/performance_tests/TestDynRankView.hpp
@@ -1,24 +1,17 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_TEST_DYNRANKVIEW_HPP
 #define KOKKOS_TEST_DYNRANKVIEW_HPP
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.dyn_rank_view;
+#else
 #include 
 #include 
+#endif
 #include 
 
 #include 
diff --git a/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp b/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp
index ac11d2493ffd..05df2590cfaa 100644
--- a/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp
+++ b/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp
@@ -1,24 +1,17 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_TEST_GLOBAL_TO_LOCAL_IDS_HPP
 #define KOKKOS_TEST_GLOBAL_TO_LOCAL_IDS_HPP
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.unordered_map;
+#else
 #include 
 #include 
+#endif
 #include 
 #include 
 
diff --git a/packages/kokkos/containers/performance_tests/TestHIP.cpp b/packages/kokkos/containers/performance_tests/TestHIP.cpp
index 56680f7d6489..091ef86458c4 100644
--- a/packages/kokkos/containers/performance_tests/TestHIP.cpp
+++ b/packages/kokkos/containers/performance_tests/TestHIP.cpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 
@@ -25,16 +12,21 @@
 
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.unordered_map;
+#else
 #include 
-
-#include 
-
 #include 
+#endif
 
+#include 
 #include 
-
 #include 
 
+#include 
+
 namespace Performance {
 
 TEST(TEST_CATEGORY, dynrankview_perf) {
@@ -43,6 +35,12 @@ TEST(TEST_CATEGORY, dynrankview_perf) {
   test_dynrankview_op_perf(40960);
 }
 
+TEST(TEST_CATEGORY, dualview_perf) {
+  std::cout << "HIP" << std::endl;
+  std::cout << " DualView Access Performance " << std::endl;
+  test_dualview();
+}
+
 TEST(TEST_CATEGORY, global_2_local) {
   std::cout << "HIP" << std::endl;
   std::cout << "size, create, generate, fill, find" << std::endl;
diff --git a/packages/kokkos/containers/performance_tests/TestHPX.cpp b/packages/kokkos/containers/performance_tests/TestHPX.cpp
index b3bfb2140b2c..6b58227d9797 100644
--- a/packages/kokkos/containers/performance_tests/TestHPX.cpp
+++ b/packages/kokkos/containers/performance_tests/TestHPX.cpp
@@ -1,32 +1,25 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.unordered_map;
+#else
 #include 
-
 #include 
+#endif
 
 #include 
 #include 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -35,13 +28,19 @@
 
 namespace Performance {
 
-TEST(TEST_CATEGORY, dynrankview_perf) {
+TEST(hpx, dynrankview_perf) {
   std::cout << "HPX" << std::endl;
   std::cout << " DynRankView vs View: Initialization Only " << std::endl;
   test_dynrankview_op_perf(8192);
 }
 
-TEST(TEST_CATEGORY, global_2_local) {
+TEST(hpx, dualview_perf) {
+  std::cout << "HPX" << std::endl;
+  std::cout << " DualView Access Performance " << std::endl;
+  test_dualview();
+}
+
+TEST(hpx, global_2_local) {
   std::cout << "HPX" << std::endl;
   std::cout << "size, create, generate, fill, find" << std::endl;
   for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size;
@@ -49,7 +48,7 @@ TEST(TEST_CATEGORY, global_2_local) {
     test_global_to_local_ids(i);
 }
 
-TEST(TEST_CATEGORY, unordered_map_performance_near) {
+TEST(hpx, unordered_map_performance_near) {
   unsigned num_hpx = 4;
   std::ostringstream base_file_name;
   base_file_name << "hpx-" << num_hpx << "-near";
@@ -57,7 +56,7 @@ TEST(TEST_CATEGORY, unordered_map_performance_near) {
       base_file_name.str());
 }
 
-TEST(TEST_CATEGORY, unordered_map_performance_far) {
+TEST(hpx, unordered_map_performance_far) {
   unsigned num_hpx = 4;
   std::ostringstream base_file_name;
   base_file_name << "hpx-" << num_hpx << "-far";
@@ -65,7 +64,7 @@ TEST(TEST_CATEGORY, unordered_map_performance_far) {
       base_file_name.str());
 }
 
-TEST(TEST_CATEGORY, scatter_view) {
+TEST(hpx, scatter_view) {
   std::cout << "ScatterView data-duplicated test:\n";
   Perf::test_scatter_view
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+#else
 #include 
+#endif
 
 int main(int argc, char *argv[]) {
   Kokkos::initialize(argc, argv);
diff --git a/packages/kokkos/containers/performance_tests/TestOpenMP.cpp b/packages/kokkos/containers/performance_tests/TestOpenMP.cpp
index 0e16200961da..a5c1de72c56e 100644
--- a/packages/kokkos/containers/performance_tests/TestOpenMP.cpp
+++ b/packages/kokkos/containers/performance_tests/TestOpenMP.cpp
@@ -1,32 +1,25 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.unordered_map;
+#else
 #include 
-
 #include 
+#endif
 
 #include 
 #include 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -35,13 +28,19 @@
 
 namespace Performance {
 
-TEST(TEST_CATEGORY, dynrankview_perf) {
+TEST(openmp, dynrankview_perf) {
   std::cout << "OpenMP" << std::endl;
   std::cout << " DynRankView vs View: Initialization Only " << std::endl;
   test_dynrankview_op_perf(8192);
 }
 
-TEST(TEST_CATEGORY, global_2_local) {
+TEST(openmp, dualview_perf) {
+  std::cout << "OpenMP" << std::endl;
+  std::cout << " DualView Access Performance " << std::endl;
+  test_dualview();
+}
+
+TEST(openmp, global_2_local) {
   std::cout << "OpenMP" << std::endl;
   std::cout << "size, create, generate, fill, find" << std::endl;
   for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size;
@@ -49,7 +48,7 @@ TEST(TEST_CATEGORY, global_2_local) {
     test_global_to_local_ids(i);
 }
 
-TEST(TEST_CATEGORY, unordered_map_performance_near) {
+TEST(openmp, unordered_map_performance_near) {
   unsigned num_openmp = 4;
   if (Kokkos::hwloc::available()) {
     num_openmp = Kokkos::hwloc::get_available_numa_count() *
@@ -61,7 +60,7 @@ TEST(TEST_CATEGORY, unordered_map_performance_near) {
   Perf::run_performance_tests(base_file_name.str());
 }
 
-TEST(TEST_CATEGORY, unordered_map_performance_far) {
+TEST(openmp, unordered_map_performance_far) {
   unsigned num_openmp = 4;
   if (Kokkos::hwloc::available()) {
     num_openmp = Kokkos::hwloc::get_available_numa_count() *
@@ -73,7 +72,7 @@ TEST(TEST_CATEGORY, unordered_map_performance_far) {
   Perf::run_performance_tests(base_file_name.str());
 }
 
-TEST(TEST_CATEGORY, scatter_view) {
+TEST(openmp, scatter_view) {
   std::cout << "ScatterView data-duplicated test:\n";
   Perf::test_scatter_view
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.scatter_view;
+#else
 #include 
+#endif
 #include 
 
 namespace Perf {
diff --git a/packages/kokkos/containers/performance_tests/TestThreads.cpp b/packages/kokkos/containers/performance_tests/TestThreads.cpp
index d32b09702af6..4219474defee 100644
--- a/packages/kokkos/containers/performance_tests/TestThreads.cpp
+++ b/packages/kokkos/containers/performance_tests/TestThreads.cpp
@@ -1,26 +1,18 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #include 
 
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.unordered_map;
+#else
 #include 
-
 #include 
+#endif
 
 #include 
 
@@ -28,6 +20,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -42,6 +35,12 @@ TEST(threads, dynrankview_perf) {
   test_dynrankview_op_perf(8192);
 }
 
+TEST(threads, dualview_perf) {
+  std::cout << "Threads" << std::endl;
+  std::cout << " DualView Access Performance " << std::endl;
+  test_dualview();
+}
+
 TEST(threads, global_2_local) {
   std::cout << "Threads" << std::endl;
   std::cout << "size, create, generate, fill, find" << std::endl;
diff --git a/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp b/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp
index 6d3764a989d1..ada0f659e215 100644
--- a/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp
+++ b/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_TEST_UNORDERED_MAP_PERFORMANCE_HPP
 #define KOKKOS_TEST_UNORDERED_MAP_PERFORMANCE_HPP
diff --git a/packages/kokkos/containers/src/CMakeLists.txt b/packages/kokkos/containers/src/CMakeLists.txt
index b386fbe67505..2ea2f6a2c648 100644
--- a/packages/kokkos/containers/src/CMakeLists.txt
+++ b/packages/kokkos/containers/src/CMakeLists.txt
@@ -10,6 +10,21 @@ set(KOKKOS_CONTAINER_HEADERS)
 append_glob(KOKKOS_CONTAINERS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.hpp)
 append_glob(KOKKOS_CONTAINERS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
 
+set(KOKKOS_CONTAINERS_MODULES
+    Kokkos_Bitset.cppm
+    Kokkos_DualView.cppm
+    Kokkos_DynamicView.cppm
+    Kokkos_DynRankView.cppm
+    Kokkos_DynRankView_Impl.cppm
+    Kokkos_ErrorReporter.cppm
+    Kokkos_Functional.cppm
+    Kokkos_OffsetView.cppm
+    Kokkos_ScatterView.cppm
+    Kokkos_ScatterView_Impl.cppm
+    Kokkos_UnorderedMap.cppm
+    Kokkos_UnorderedMap_Impl.cppm
+)
+
 install(
   DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
   DESTINATION ${KOKKOS_HEADER_DIR}
@@ -17,7 +32,15 @@ install(
   PATTERN "*.hpp"
 )
 
-kokkos_add_library(kokkoscontainers SOURCES ${KOKKOS_CONTAINERS_SRCS} HEADERS ${KOKKOS_CONTAINERS_HEADERS})
+kokkos_add_library(
+  kokkoscontainers
+  SOURCES
+  ${KOKKOS_CONTAINERS_SRCS}
+  HEADERS
+  ${KOKKOS_CONTAINERS_HEADERS}
+  MODULE_INTERFACE
+  ${KOKKOS_CONTAINERS_MODULES}
+)
 
 kokkos_lib_include_directories(
   kokkoscontainers ${KOKKOS_TOP_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/packages/kokkos/containers/src/Kokkos_Bitset.cppm b/packages/kokkos/containers/src/Kokkos_Bitset.cppm
new file mode 100644
index 000000000000..c5d7d2ee0519
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_Bitset.cppm
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.bitset;
+
+export {
+  namespace Kokkos {
+  using ::Kokkos::Bitset;
+  using ::Kokkos::ConstBitset;
+
+  using ::Kokkos::deep_copy;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_Bitset.hpp b/packages/kokkos/containers/src/Kokkos_Bitset.hpp
index ed1936db1b3f..12b3a53c97c4 100644
--- a/packages/kokkos/containers/src/Kokkos_Bitset.hpp
+++ b/packages/kokkos/containers/src/Kokkos_Bitset.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_BITSET_HPP
 #define KOKKOS_BITSET_HPP
@@ -21,9 +8,14 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_BITSET
 #endif
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.core_impl;
+#else
 #include 
+#endif
 #include 
-#include 
 
 #include 
 
@@ -100,21 +92,6 @@ class Bitset {
     }
   }
 
-  KOKKOS_DEFAULTED_FUNCTION
-  Bitset(const Bitset&) = default;
-
-  KOKKOS_DEFAULTED_FUNCTION
-  Bitset& operator=(const Bitset&) = default;
-
-  KOKKOS_DEFAULTED_FUNCTION
-  Bitset(Bitset&&) = default;
-
-  KOKKOS_DEFAULTED_FUNCTION
-  Bitset& operator=(Bitset&&) = default;
-
-  KOKKOS_DEFAULTED_FUNCTION
-  ~Bitset() = default;
-
   /// number of bits in the set
   /// can be call from the host or the device
   KOKKOS_FORCEINLINE_FUNCTION
@@ -337,10 +314,6 @@ class ConstBitset {
   ConstBitset(Bitset const& rhs)
       : m_size(rhs.m_size), m_blocks(rhs.m_blocks) {}
 
-  KOKKOS_FUNCTION
-  ConstBitset(ConstBitset const& rhs)
-      : m_size(rhs.m_size), m_blocks(rhs.m_blocks) {}
-
   KOKKOS_FUNCTION
   ConstBitset& operator=(Bitset const& rhs) {
     this->m_size   = rhs.m_size;
@@ -349,14 +322,6 @@ class ConstBitset {
     return *this;
   }
 
-  KOKKOS_FUNCTION
-  ConstBitset& operator=(ConstBitset const& rhs) {
-    this->m_size   = rhs.m_size;
-    this->m_blocks = rhs.m_blocks;
-
-    return *this;
-  }
-
   KOKKOS_FORCEINLINE_FUNCTION
   unsigned size() const { return m_size; }
 
diff --git a/packages/kokkos/containers/src/Kokkos_DualView.cppm b/packages/kokkos/containers/src/Kokkos_DualView.cppm
new file mode 100644
index 000000000000..dc8a2abfffe9
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_DualView.cppm
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.dual_view;
+
+export {
+  namespace Kokkos {
+  using ::Kokkos::DualView;
+
+  using ::Kokkos::is_dual_view;
+  using ::Kokkos::is_dual_view_v;
+
+  using ::Kokkos::deep_copy;
+
+  using ::Kokkos::realloc;
+  using ::Kokkos::resize;
+
+  using ::Kokkos::subview;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_DualView.hpp b/packages/kokkos/containers/src/Kokkos_DualView.hpp
index 4ee7140117e3..e8ca89e9495c 100644
--- a/packages/kokkos/containers/src/Kokkos_DualView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_DualView.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 /// \file Kokkos_DualView.hpp
 /// \brief Declaration and definition of Kokkos::DualView.
@@ -27,9 +14,17 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_DUALVIEW
 #endif
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.core_impl;
+#else
 #include 
+#endif
 #include 
 
+#include 
+
 namespace Kokkos {
 
 /* \class DualView
@@ -72,29 +67,25 @@ namespace Impl {
 
 #ifdef KOKKOS_ENABLE_CUDA
 
-inline const Kokkos::Cuda& get_cuda_space(const Kokkos::Cuda& in) { return in; }
+inline cudaStream_t get_cuda_stream(const Kokkos::Cuda& in) {
+  return in.cuda_stream();
+}
 
-inline const Kokkos::Cuda& get_cuda_space() {
-  return *Kokkos::Impl::cuda_get_deep_copy_space();
+inline cudaStream_t get_cuda_stream() {
+  return Kokkos::Impl::cuda_get_deep_copy_stream();
 }
 
 template 
-inline const Kokkos::Cuda& get_cuda_space(const NonCudaExecSpace&) {
-  return get_cuda_space();
+inline cudaStream_t get_cuda_stream(const NonCudaExecSpace&) {
+  return get_cuda_stream();
 }
 
 #endif  // KOKKOS_ENABLE_CUDA
 
 }  // namespace Impl
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
-template 
-class DualView;
-#else
 template 
 class DualView;
-#endif
 
 template 
 struct is_dual_view : public std::false_type {};
@@ -108,52 +99,33 @@ struct is_dual_view> : public std::true_type {};
 template 
 inline constexpr bool is_dual_view_v = is_dual_view::value;
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
-template 
-class DualView : public ViewTraits {
-  template 
-#else
 template 
 class DualView : public ViewTraits {
   template 
-#endif
   friend class DualView;
 
  public:
   //! \name Typedefs for device types and various Kokkos::View specializations.
   //@{
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
-  using traits = ViewTraits;
-#else
-  using traits      = ViewTraits;
-#endif
+  using traits = ViewTraits;
 
   //! The Kokkos Host Device type;
   using host_mirror_space = typename traits::host_mirror_space;
 
   //! The type of a Kokkos::View on the device.
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
-  using t_dev = View;
-#else
-  using t_dev       = View;
-#endif
+  using t_dev = View;
 
   /// \typedef t_host
   /// \brief The type of a Kokkos::View host mirror of \c t_dev.
-  using t_host = typename t_dev::HostMirror;
+  using t_host = typename t_dev::host_mirror_type;
 
   //! The type of a const View on the device.
   //! The type of a Kokkos::View on the device.
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
-  using t_dev_const =
-      View;
-#else
   using t_dev_const = View;
-#endif
 
   /// \typedef t_host_const
   /// \brief The type of a const View host mirror of \c t_dev_const.
-  using t_host_const = typename t_dev_const::HostMirror;
+  using t_host_const = typename t_dev_const::host_mirror_type;
 
   //! The type of a const, random-access View on the device.
   using t_dev_const_randomread =
@@ -164,7 +136,8 @@ class DualView : public ViewTraits {
   /// \typedef t_host_const_randomread
   /// \brief The type of a const, random-access View host mirror of
   ///   \c t_dev_const_randomread.
-  using t_host_const_randomread = typename t_dev_const_randomread::HostMirror;
+  using t_host_const_randomread =
+      typename t_dev_const_randomread::host_mirror_type;
 
   //! The type of an unmanaged View on the device.
   using t_dev_um =
@@ -196,7 +169,7 @@ class DualView : public ViewTraits {
   /// \brief The type of a const, random-access View host mirror of
   ///   \c t_dev_const_randomread.
   using t_host_const_randomread_um =
-      typename t_dev_const_randomread_um::HostMirror;
+      typename t_dev_const_randomread_um::host_mirror_type;
 
   //@}
   //! \name Counters to keep track of changes ("modified" flags)
@@ -214,12 +187,7 @@ class DualView : public ViewTraits {
       std::is_same_v;
   //@}
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
- public:
-#else
  private:
-#endif
-
   // Moved this specifically after modified_flags to resolve an alignment issue
   // on MSVC/NVCC
   //! \name The two View instances.
@@ -332,7 +300,7 @@ class DualView : public ViewTraits {
   /// modify() methods to ensure synchronization of the View objects.
   ///
   /// \param d_view_ Device View
-  /// \param h_view_ Host View (must have type t_host = t_dev::HostMirror)
+  /// \param h_view_ Host View (must have type t_host = t_dev::host_mirror_type)
   DualView(const t_dev& d_view_, const t_host& h_view_)
       : modified_flags(t_modified_flags("DualView::modified_flags")),
         d_view(d_view_),
@@ -421,19 +389,11 @@ class DualView : public ViewTraits {
     }
   }
 
-#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
-  KOKKOS_INLINE_FUNCTION
-  t_host view_host() const { return h_view; }
-
-  KOKKOS_INLINE_FUNCTION
-  t_dev view_device() const { return d_view; }
-#else
   KOKKOS_INLINE_FUNCTION
   const t_host& view_host() const { return h_view; }
 
   KOKKOS_INLINE_FUNCTION
   const t_dev& view_device() const { return d_view; }
-#endif
 
   KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const {
     return (d_view.is_allocated() && h_view.is_allocated());
@@ -556,7 +516,7 @@ class DualView : public ViewTraits {
                          Kokkos::CudaUVMSpace>::value) {
           if (d_view.data() == h_view.data())
             Kokkos::Impl::cuda_prefetch_pointer(
-                Impl::get_cuda_space(args...), d_view.data(),
+                Impl::get_cuda_stream(args...), d_view.data(),
                 sizeof(typename t_dev::value_type) * d_view.span(), true);
         }
 #endif
@@ -573,7 +533,7 @@ class DualView : public ViewTraits {
                          Kokkos::CudaUVMSpace>::value) {
           if (d_view.data() == h_view.data())
             Kokkos::Impl::cuda_prefetch_pointer(
-                Impl::get_cuda_space(args...), d_view.data(),
+                Impl::get_cuda_stream(args...), d_view.data(),
                 sizeof(typename t_dev::value_type) * d_view.span(), false);
         }
 #endif
@@ -656,7 +616,7 @@ class DualView : public ViewTraits {
                        Kokkos::CudaUVMSpace>::value) {
         if (d_view.data() == h_view.data())
           Kokkos::Impl::cuda_prefetch_pointer(
-              Impl::get_cuda_space(args...), d_view.data(),
+              Impl::get_cuda_stream(args...), d_view.data(),
               sizeof(typename t_dev::value_type) * d_view.span(), false);
       }
 #endif
@@ -699,7 +659,7 @@ class DualView : public ViewTraits {
                        Kokkos::CudaUVMSpace>::value) {
         if (d_view.data() == h_view.data())
           Kokkos::Impl::cuda_prefetch_pointer(
-              Impl::get_cuda_space(args...), d_view.data(),
+              Impl::get_cuda_stream(args...), d_view.data(),
               sizeof(typename t_dev::value_type) * d_view.span(), true);
       }
 #endif
@@ -1009,7 +969,7 @@ class DualView : public ViewTraits {
         resync_host(properties);
 
         /* Mark Device copy as modified */
-        ++modified_flags(1);
+        if constexpr (!impl_dualview_is_single_device) ++modified_flags(1);
       }
     };
 
@@ -1023,7 +983,7 @@ class DualView : public ViewTraits {
         resync_device(properties);
 
         /* Mark Host copy as modified */
-        ++modified_flags(0);
+        if constexpr (!impl_dualview_is_single_device) ++modified_flags(0);
       }
     };
 
diff --git a/packages/kokkos/containers/src/Kokkos_DynRankView.cppm b/packages/kokkos/containers/src/Kokkos_DynRankView.cppm
new file mode 100644
index 000000000000..488f05f235d5
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_DynRankView.cppm
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.dyn_rank_view;
+
+export {
+  namespace Kokkos {
+  using ::Kokkos::DynRankView;
+
+  using ::Kokkos::is_dyn_rank_view;
+  using ::Kokkos::is_dyn_rank_view_v;
+
+  using ::Kokkos::Subdynrankview;
+  using ::Kokkos::subdynrankview;
+  using ::Kokkos::subview;
+
+  using ::Kokkos::rank;
+
+  using ::Kokkos::deep_copy;
+  using ::Kokkos::realloc;
+  using ::Kokkos::resize;
+
+  using ::Kokkos::create_mirror;
+  using ::Kokkos::create_mirror_view;
+  using ::Kokkos::create_mirror_view_and_copy;
+
+  using ::Kokkos::operator!=;
+  using ::Kokkos::operator==;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_DynRankView.hpp b/packages/kokkos/containers/src/Kokkos_DynRankView.hpp
index 6d320f3243f8..10c5cdafc5c3 100644
--- a/packages/kokkos/containers/src/Kokkos_DynRankView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_DynRankView.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 /// \file Kokkos_DynRankView.hpp
 /// \brief Declaration and definition of Kokkos::DynRankView.
@@ -27,7 +14,13 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_DYNRANKVIEW
 #endif
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.core_impl;
+#else
 #include 
+#endif
 #include 
 #include 
 #include 
@@ -65,31 +58,10 @@ struct DynRankDimTraits {
   KOKKOS_INLINE_FUNCTION
   static size_t computeRank(const size_t N0, const size_t N1, const size_t N2,
                             const size_t N3, const size_t N4, const size_t N5,
-                            const size_t N6, const size_t /* N7 */) {
-    return (
-        (N6 == unspecified && N5 == unspecified && N4 == unspecified &&
-         N3 == unspecified && N2 == unspecified && N1 == unspecified &&
-         N0 == unspecified)
-            ? 0
-            : ((N6 == unspecified && N5 == unspecified && N4 == unspecified &&
-                N3 == unspecified && N2 == unspecified && N1 == unspecified)
-                   ? 1
-                   : ((N6 == unspecified && N5 == unspecified &&
-                       N4 == unspecified && N3 == unspecified &&
-                       N2 == unspecified)
-                          ? 2
-                          : ((N6 == unspecified && N5 == unspecified &&
-                              N4 == unspecified && N3 == unspecified)
-                                 ? 3
-                                 : ((N6 == unspecified && N5 == unspecified &&
-                                     N4 == unspecified)
-                                        ? 4
-                                        : ((N6 == unspecified &&
-                                            N5 == unspecified)
-                                               ? 5
-                                               : ((N6 == unspecified)
-                                                      ? 6
-                                                      : 7)))))));
+                            const size_t N6, const size_t N7) {
+    return (N0 != unspecified) + (N1 != unspecified) + (N2 != unspecified) +
+           (N3 != unspecified) + (N4 != unspecified) + (N5 != unspecified) +
+           (N6 != unspecified) + (N7 != unspecified);
   }
 
   // Compute the rank of the view from the nonzero layout arguments.
@@ -119,7 +91,8 @@ struct DynRankDimTraits {
       (std::is_same_v ||
        std::is_same_v),
       Layout>
-  createLayout(const Layout& layout) {
+  createLayout(const Layout& layout,
+               [[maybe_unused]] size_t new_rank = unspecified) {
     Layout new_layout(
         layout.dimension[0] != unspecified ? layout.dimension[0] : 1,
         layout.dimension[1] != unspecified ? layout.dimension[1] : 1,
@@ -131,13 +104,10 @@ struct DynRankDimTraits {
         layout.dimension[7] != unspecified ? layout.dimension[7] : unspecified);
 
 #ifndef KOKKOS_ENABLE_IMPL_VIEW_LEGACY
-    // In order to have a valid LayoutRight stride when Sacado passes through
-    // extra integer arguments, we need to set it to the dimension[6] for the
-    // rank-7 view coming out of here. Only if the original layout was already
-    // rank-7 we can preserve the stride.
-    // FIXME_SACADO
-    if constexpr (!std::is_same_v &&
-                  std::is_same_v) {
+    // In order to have a valid LayoutRight stride we need to set it to the
+    // dimension[6] for the rank-7 view coming out of here. Only if the original
+    // layout was already rank-7 we can preserve the stride.
+    if constexpr (std::is_same_v) {
       if (layout.dimension[6] == unspecified) {
         new_layout.stride = unspecified;
       } else {
@@ -146,6 +116,11 @@ struct DynRankDimTraits {
     } else
 #endif
       new_layout.stride = layout.stride;
+    if constexpr (std::is_same_v) {
+      if (new_rank != unspecified && new_rank > 0 &&
+          layout.dimension[new_rank - 1] == layout.stride)
+        new_layout.stride = unspecified;
+    }
     return new_layout;
   }
 
@@ -153,7 +128,8 @@ struct DynRankDimTraits {
   template 
   KOKKOS_INLINE_FUNCTION static std::enable_if_t<
       (std::is_same_v), Layout>
-  createLayout(const Layout& layout) {
+  createLayout(const Layout& layout,
+               [[maybe_unused]] size_t new_rank = unspecified) {
     return Layout(
         layout.dimension[0] != unspecified ? layout.dimension[0] : 1,
         layout.stride[0],
@@ -394,7 +370,8 @@ class ViewMapping<
         src.layout());  // Check this for integer input1 for padding, etc
     dst.m_map.m_impl_handle = Kokkos::Impl::ViewDataHandle::assign(
         src.m_map.m_impl_handle, src.m_track.m_tracker);
-    dst.m_track.m_tracker.assign(src.m_track.m_tracker, DstTraits::is_managed);
+    dst.m_track.m_tracker.assign(src.m_track.m_tracker,
+                                 !DstTraits::memory_traits::is_unmanaged);
     dst.m_rank = Kokkos::View::rank();
   }
 };
@@ -479,9 +456,14 @@ class DynRankView : private View {
   using reference_type = typename view_type::reference_type;
   using pointer_type   = typename view_type::pointer_type;
 
-  using scalar_array_type           = value_type;
-  using const_scalar_array_type     = const_value_type;
-  using non_const_scalar_array_type = non_const_value_type;
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_5
+  using scalar_array_type KOKKOS_DEPRECATED_WITH_COMMENT(
+      "Use data_type instead.") = data_type;
+  using const_scalar_array_type KOKKOS_DEPRECATED_WITH_COMMENT(
+      "Use const_data_type instead.") = const_data_type;
+  using non_const_scalar_array_type KOKKOS_DEPRECATED_WITH_COMMENT(
+      "Use non_const_data_type instead.") = non_const_data_type;
+#endif
 #ifndef KOKKOS_ENABLE_IMPL_VIEW_LEGACY
 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   using specialize KOKKOS_DEPRECATED = void;
@@ -499,6 +481,11 @@ class DynRankView : private View {
   using reference        = reference_type;
   using data_handle_type = pointer_type;
 
+#ifndef KOKKOS_ENABLE_IMPL_VIEW_LEGACY
+  using accessor_type = typename view_type::accessor_type;
+  using mapping_type  = typename view_type::mapping_type;
+#endif
+
   KOKKOS_FUNCTION
   view_type& DownCast() const { return (view_type&)(*this); }
 
@@ -511,14 +498,19 @@ class DynRankView : private View {
   // KOKKOS_FUNCTION
   // view_type to_view() const { return *this; }
 
-  // Types below - at least the HostMirror requires the value_type, NOT the rank
-  // 7 data_type of the traits
+  // Types below - at least host_mirror_type requires the value_type, NOT the
+  // rank 7 data_type of the traits
 
   /** \brief  Compatible view of array of scalar types */
-  using array_type = DynRankView<
-      typename drvtraits::scalar_array_type, typename drvtraits::array_layout,
+  using type = DynRankView<
+      typename drvtraits::data_type, typename drvtraits::array_layout,
       typename drvtraits::device_type, typename drvtraits::memory_traits>;
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_5
+  /** \brief  Compatible view of array of scalar types */
+  using array_type KOKKOS_DEPRECATED_WITH_COMMENT("Use type instead.") = type;
+#endif
+
   /** \brief  Compatible view of const data type */
   using const_type = DynRankView<
       typename drvtraits::const_data_type, typename drvtraits::array_layout,
@@ -529,12 +521,16 @@ class DynRankView : private View {
       typename drvtraits::non_const_data_type, typename drvtraits::array_layout,
       typename drvtraits::device_type, typename drvtraits::memory_traits>;
 
-  /** \brief  Compatible HostMirror view */
-  using HostMirror = DynRankView;
+  /** \brief  Compatible host mirror view */
+  using host_mirror_type = DynRankView;
 
-  using host_mirror_type = HostMirror;
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  /** \brief  Compatible HostMirror view */
+  using HostMirror KOKKOS_DEPRECATED_WITH_COMMENT(
+      "Use host_mirror_type instead.") = host_mirror_type;
+#endif
   //----------------------------------------
   // Domain rank and extents
 
@@ -607,14 +603,6 @@ class DynRankView : private View {
   using view_type::span;
   using view_type::span_is_contiguous;  // FIXME: not tested
   using view_type::stride;              // FIXME: not tested
-  using view_type::stride_0;            // FIXME: not tested
-  using view_type::stride_1;            // FIXME: not tested
-  using view_type::stride_2;            // FIXME: not tested
-  using view_type::stride_3;            // FIXME: not tested
-  using view_type::stride_4;            // FIXME: not tested
-  using view_type::stride_5;            // FIXME: not tested
-  using view_type::stride_6;            // FIXME: not tested
-  using view_type::stride_7;            // FIXME: not tested
   using view_type::use_count;
 
 #ifdef KOKKOS_ENABLE_CUDA
@@ -670,10 +658,6 @@ class DynRankView : private View {
     {
       return view_type::operator()(i0, 0, 0, 0, 0, 0, 0);
     }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-    __builtin_unreachable();
-#endif
   }
 
   KOKKOS_FUNCTION reference_type operator()(index_type i0,
@@ -701,10 +685,6 @@ class DynRankView : private View {
     {
       return view_type::operator()(i0, i1, 0, 0, 0, 0, 0);
     }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-    __builtin_unreachable();
-#endif
   }
 
   KOKKOS_FUNCTION reference_type operator()(index_type i0, index_type i1,
@@ -736,10 +716,6 @@ class DynRankView : private View {
     {
       return view_type::operator()(i0, i1, i2, 0, 0, 0, 0);
     }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-    __builtin_unreachable();
-#endif
   }
 
   KOKKOS_FUNCTION reference_type operator()(index_type i0, index_type i1,
@@ -756,7 +732,7 @@ class DynRankView : private View {
 #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   KOKKOS_FUNCTION reference_type operator[](index_type i0) const {
     if constexpr (std::is_same_v) {
+                                 typename drvtraits::data_type>) {
       return view_type::data()[i0];
     } else {
       const size_t dim_scalar = view_type::impl_map().dimension_scalar();
@@ -791,9 +767,6 @@ class DynRankView : private View {
   //----------------------------------------
   // Standard constructor, destructor, and assignment operators...
 
-  KOKKOS_DEFAULTED_FUNCTION
-  ~DynRankView() = default;
-
   KOKKOS_DEFAULTED_FUNCTION DynRankView() = default;
 
   //----------------------------------------
@@ -804,6 +777,23 @@ class DynRankView : private View {
   KOKKOS_FUNCTION DynRankView(const DynRankView& rhs)
       : view_type(rhs), m_rank(rhs.m_rank) {}
 
+  KOKKOS_INLINE_FUNCTION DynRankView(view_type rhs, size_t new_rank)
+      : view_type(rhs), m_rank(new_rank) {
+    if (new_rank > view_type::rank())
+      Kokkos::abort(
+          "Attempting to construct DynRankView from View and new rank, with "
+          "the new rank being too large.");
+
+    bool invalid_extent = false;
+    for (size_t r = new_rank; r < view_type::rank(); r++)
+      if (rhs.extent(r) != 1) invalid_extent = true;
+    if (invalid_extent)
+      Kokkos::abort(
+          "Attempting to construct DynRankView from View with incompatible "
+          "extents. (Extents for dimensions larger than the provided rank are "
+          "not equal to 1).");
+  }
+
   template 
   KOKKOS_FUNCTION DynRankView& operator=(const DynRankView& rhs) {
     view_type::operator=(rhs);
@@ -831,7 +821,7 @@ class DynRankView : private View {
       : view_type(rhs.data_handle(),
                   Impl::mapping_from_array_layout<
                       typename view_type::mdspan_type::mapping_type>(
-                      drdtraits::createLayout(rhs.layout())),
+                      drdtraits::createLayout(rhs.layout(), new_rank)),
                   rhs.accessor()),
         m_rank(new_rank) {
     if (new_rank > View::rank())
@@ -846,7 +836,7 @@ class DynRankView : private View {
         view_type(rhs.data_handle(),
                   Impl::mapping_from_array_layout<
                       typename view_type::mdspan_type::mapping_type>(
-                      drdtraits::createLayout(rhs.layout())),
+                      drdtraits::createLayout(rhs.layout(), rhs.rank())),
                   rhs.accessor()));
     m_rank = rhs.rank();
     return *this;
@@ -905,9 +895,10 @@ class DynRankView : private View {
       std::enable_if_t<((!std::is_same_v)&&...),
                        const typename traits::array_layout&>
           layout) {
-    if constexpr (traits::impl_is_customized) {
+    if constexpr (traits::impl_is_customized &&
+                  !Impl::ViewCtorProp::has_accessor_arg) {
       int r = 0;
-      while (r < 7 && layout.dimension[r] != KOKKOS_INVALID_INDEX) r++;
+      while (r < 8 && layout.dimension[r] != KOKKOS_INVALID_INDEX) r++;
 
       // Can't use with_properties_if_unset since its a host only function!
       return view_wrap(
@@ -926,7 +917,7 @@ class DynRankView : private View {
     if constexpr (traits::impl_is_customized &&
                   !Impl::ViewCtorProp::has_accessor_arg) {
       int r = 0;
-      while (r < 7 && layout.dimension[r] != KOKKOS_INVALID_INDEX) r++;
+      while (r < 8 && layout.dimension[r] != KOKKOS_INVALID_INDEX) r++;
       // Could use with_properties_if_unset, but rather keep same as above.
       return view_alloc(
           static_cast&>(arg_prop).value...,
@@ -939,23 +930,6 @@ class DynRankView : private View {
  public:
 #endif
 
-  // With NVCC 11.0 and 11.2 (and others likely) using GCC 8.5 a DynRankView
-  // test fails at runtime where construction from layout drops some extents.
-  // The bug goes away with O1.
-  // FIXME: NVCC GCC8 optimization bug DynRankView
-#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_COMPILER_GNU)
-#if KOKKOS_COMPILER_GNU < 900
-#define KOKKOS_IMPL_SKIP_OPTIMIZATION
-#endif
-#endif
-
-#ifdef KOKKOS_IMPL_SKIP_OPTIMIZATION
-// Also need to suppress warning about unrecognized GCC optimize pragma
-#pragma push
-#pragma diag_suppress = unrecognized_gcc_pragma
-#pragma GCC push_options
-#pragma GCC optimize("O1")
-#endif
   template 
   explicit KOKKOS_FUNCTION DynRankView(
       const Kokkos::Impl::ViewCtorProp& arg_prop,
@@ -997,12 +971,6 @@ class DynRankView : private View {
   }
 #endif
 
-#ifdef KOKKOS_IMPL_SKIP_OPTIMIZATION
-#pragma GCC pop_options
-#pragma pop
-#undef KOKKOS_IMPL_SKIP_OPTIMIZATION
-#endif
-
         //----------------------------------------
         // Constructor(s)
 
@@ -1602,28 +1570,17 @@ namespace Impl {
 template 
 inline auto create_mirror(const DynRankView& src,
                           const Impl::ViewCtorProp& arg_prop) {
-  check_view_ctor_args_create_mirror();
-
-  auto prop_copy = Impl::with_properties_if_unset(
-      arg_prop, std::string(src.label()).append("_mirror"));
-
   if constexpr (Impl::ViewCtorProp::has_memory_space) {
     using dst_type = typename Impl::MirrorDRViewType<
         typename Impl::ViewCtorProp::memory_space, T,
         P...>::dest_view_type;
-    return dst_type(prop_copy,
-                    Impl::reconstructLayout(src.layout(), src.rank()));
+    return dst_type(create_mirror(arg_prop, src.DownCast()), src.rank());
   } else {
     using src_type = DynRankView;
-    using dst_type = typename src_type::HostMirror;
+    using dst_type = typename src_type::host_mirror_type;
 
-    return dst_type(prop_copy,
-                    Impl::reconstructLayout(src.layout(), src.rank()));
+    return dst_type(create_mirror(arg_prop, src.DownCast()), src.rank());
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 }  // namespace Impl
@@ -1689,12 +1646,12 @@ inline auto create_mirror_view(
         arg_prop) {
   if constexpr (!Impl::ViewCtorProp::has_memory_space) {
     if constexpr (std::is_same_v::memory_space,
+                                 typename DynRankView::
+                                     host_mirror_type::memory_space> &&
+                  std::is_same_v::data_type,
                                  typename DynRankView<
-                                     T, P...>::HostMirror::memory_space> &&
-                  std::is_same_v<
-                      typename DynRankView::data_type,
-                      typename DynRankView::HostMirror::data_type>) {
-      return typename DynRankView::HostMirror(src);
+                                     T, P...>::host_mirror_type::data_type>) {
+      return typename DynRankView::host_mirror_type(src);
     } else {
       return Kokkos::Impl::choose_create_mirror(src, arg_prop);
     }
@@ -1709,10 +1666,6 @@ inline auto create_mirror_view(
       return Kokkos::Impl::choose_create_mirror(src, arg_prop);
     }
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 }  // namespace Impl
@@ -1799,10 +1752,6 @@ auto create_mirror_view_and_copy(
       deep_copy(mirror, src);
     return mirror;
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 template 
@@ -1830,7 +1779,7 @@ inline void impl_resize(const Impl::ViewCtorProp& arg_prop,
   using drview_type      = DynRankView;
   using alloc_prop_input = Impl::ViewCtorProp;
 
-  static_assert(Kokkos::ViewTraits::is_managed,
+  static_assert(!Kokkos::ViewTraits::memory_traits::is_unmanaged,
                 "Can only resize managed views");
   static_assert(!alloc_prop_input::has_label,
                 "The view constructor arguments passed to Kokkos::resize "
@@ -1910,7 +1859,7 @@ inline void impl_realloc(DynRankView& v, const size_t n0,
   using drview_type      = DynRankView;
   using alloc_prop_input = Impl::ViewCtorProp;
 
-  static_assert(Kokkos::ViewTraits::is_managed,
+  static_assert(!Kokkos::ViewTraits::memory_traits::is_unmanaged,
                 "Can only realloc managed views");
   static_assert(!alloc_prop_input::has_label,
                 "The view constructor arguments passed to Kokkos::realloc must "
@@ -1973,7 +1922,7 @@ namespace Experimental {
 template 
 struct python_view_type> {
   using type = Kokkos::Impl::python_view_type_impl_t<
-      typename DynRankView::array_type>;
+      typename DynRankView::type>;
 };
 }  // namespace Experimental
 
diff --git a/packages/kokkos/containers/src/Kokkos_DynRankView_Impl.cppm b/packages/kokkos/containers/src/Kokkos_DynRankView_Impl.cppm
new file mode 100644
index 000000000000..9308420fd8aa
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_DynRankView_Impl.cppm
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.dyn_rank_view_impl;
+
+export {
+  namespace Kokkos::Impl {
+  using ::Kokkos::Impl::ApplyToViewOfStaticRank;
+  using ::Kokkos::Impl::as_view_of_rank_n;
+  }  // namespace Kokkos::Impl
+}
diff --git a/packages/kokkos/containers/src/Kokkos_DynamicView.cppm b/packages/kokkos/containers/src/Kokkos_DynamicView.cppm
new file mode 100644
index 000000000000..e0259b49a31b
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_DynamicView.cppm
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.dynamic_view;
+
+export {
+  namespace Kokkos {
+  namespace Experimental {
+  using ::Kokkos::Experimental::DynamicView;
+  }
+
+  using ::Kokkos::is_dynamic_view;
+  using ::Kokkos::is_dynamic_view_v;
+
+  using ::Kokkos::create_mirror;
+  using ::Kokkos::create_mirror_view;
+  using ::Kokkos::create_mirror_view_and_copy;
+
+  using ::Kokkos::deep_copy;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_DynamicView.hpp b/packages/kokkos/containers/src/Kokkos_DynamicView.hpp
index e436e8f9f28d..6bd0da126709 100644
--- a/packages/kokkos/containers/src/Kokkos_DynamicView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_DynamicView.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_DYNAMIC_VIEW_HPP
 #define KOKKOS_DYNAMIC_VIEW_HPP
@@ -23,9 +10,17 @@
 
 #include 
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.core_impl;
+#else
 #include 
+#endif
 #include 
 
+#include 
+
 namespace Kokkos {
 namespace Experimental {
 
@@ -40,15 +35,11 @@ struct ChunkedArrayManager {
   using pointer_type = ValueType*;
   using track_type   = Kokkos::Impl::SharedAllocationTracker;
 
-  ChunkedArrayManager()                                      = default;
-  ChunkedArrayManager(ChunkedArrayManager const&)            = default;
-  ChunkedArrayManager(ChunkedArrayManager&&)                 = default;
-  ChunkedArrayManager& operator=(ChunkedArrayManager&&)      = default;
-  ChunkedArrayManager& operator=(const ChunkedArrayManager&) = default;
-
   template 
   friend struct ChunkedArrayManager;
 
+  ChunkedArrayManager() = default;
+
   template 
   inline ChunkedArrayManager(const ChunkedArrayManager& rhs)
       : m_valid(rhs.m_valid),
@@ -129,11 +120,7 @@ struct ChunkedArrayManager {
   /// allocation
   template 
   struct Destroy {
-    Destroy()                          = default;
-    Destroy(Destroy&&)                 = default;
-    Destroy(const Destroy&)            = default;
-    Destroy& operator=(Destroy&&)      = default;
-    Destroy& operator=(const Destroy&) = default;
+    Destroy() = default;
 
     Destroy(std::string label, value_type** arg_chunk,
             const unsigned arg_chunk_max, const unsigned arg_chunk_size,
@@ -267,10 +254,15 @@ class DynamicView : public Kokkos::ViewTraits {
 
  public:
   //----------------------------------------------------------------------
+  /** \brief  Compatible view of data type */
+  using uniform_type =
+      DynamicView;
 
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_5
   /** \brief  Compatible view of array of scalar types */
-  using array_type =
-      DynamicView;
+  using array_type KOKKOS_DEPRECATED_WITH_COMMENT("Use uniform_type instead.") =
+      uniform_type;
+#endif
 
   /** \brief  Compatible view of const data type */
   using const_type = DynamicView {
                                      typename traits::device_type>;
 
   /** \brief  Must be accessible everywhere */
-  using HostMirror = DynamicView;
+  using host_mirror_type = DynamicView;
+
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
+  /** \brief  Compatible HostMirror view */
+  using HostMirror KOKKOS_DEPRECATED_WITH_COMMENT(
+      "Use host_mirror_type instead.") = host_mirror_type;
+#endif
 
   /** \brief Unified types */
   using uniform_device =
       Kokkos::Device;
-  using uniform_type               = array_type;
   using uniform_const_type         = const_type;
-  using uniform_runtime_type       = array_type;
+  using uniform_runtime_type       = uniform_type;
   using uniform_runtime_const_type = const_type;
   using uniform_nomemspace_type =
       DynamicView;
@@ -334,15 +331,6 @@ class DynamicView : public Kokkos::ViewTraits {
     return r == 0 ? size() : 1;
   }
 
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const { return 0; }
-  KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const { return 0; }
-
   template 
   KOKKOS_INLINE_FUNCTION void stride(iType* const s) const {
     *s = 0;
@@ -466,12 +454,7 @@ class DynamicView : public Kokkos::ViewTraits {
 
   //----------------------------------------------------------------------
 
-  ~DynamicView()                             = default;
-  DynamicView()                              = default;
-  DynamicView(DynamicView&&)                 = default;
-  DynamicView(const DynamicView&)            = default;
-  DynamicView& operator=(DynamicView&&)      = default;
-  DynamicView& operator=(const DynamicView&) = default;
+  DynamicView() = default;
 
   template 
   DynamicView(const DynamicView& rhs)
@@ -506,7 +489,7 @@ class DynamicView : public Kokkos::ViewTraits {
         m_chunk_max((max_extent + m_chunk_mask) >>
                     m_chunk_shift)  // max num pointers-to-chunks in array
         ,
-        m_chunk_size(2 << (m_chunk_shift - 1)) {
+        m_chunk_size(1 << m_chunk_shift) {
     m_chunks = device_accessor(m_chunk_max, m_chunk_size);
 
     const std::string& label =
@@ -617,17 +600,14 @@ inline auto create_mirror(const Kokkos::Experimental::DynamicView& src,
 
     return ret;
   } else {
-    auto ret = typename Kokkos::Experimental::DynamicView::HostMirror(
-        prop_copy, src.chunk_size(), src.chunk_max() * src.chunk_size());
+    auto ret =
+        typename Kokkos::Experimental::DynamicView::host_mirror_type(
+            prop_copy, src.chunk_size(), src.chunk_max() * src.chunk_size());
 
     ret.resize_serial(src.extent(0));
 
     return ret;
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 }  // namespace Impl
@@ -695,16 +675,18 @@ inline auto create_mirror_view(
     const Kokkos::Experimental::DynamicView& src,
     [[maybe_unused]] const Impl::ViewCtorProp& arg_prop) {
   if constexpr (!Impl::ViewCtorProp::has_memory_space) {
-    if constexpr (std::is_same_v::memory_space,
-                                 typename Kokkos::Experimental::DynamicView<
-                                     T, P...>::HostMirror::memory_space> &&
+    if constexpr (std::is_same_v<
+                      typename Kokkos::Experimental::DynamicView<
+                          T, P...>::memory_space,
+                      typename Kokkos::Experimental::DynamicView<
+                          T, P...>::host_mirror_type::memory_space> &&
                   std::is_same_v::data_type,
                                  typename Kokkos::Experimental::DynamicView<
-                                     T, P...>::HostMirror::data_type>) {
+                                     T, P...>::host_mirror_type::data_type>) {
       return
-          typename Kokkos::Experimental::DynamicView::HostMirror(src);
+          typename Kokkos::Experimental::DynamicView::host_mirror_type(
+              src);
     } else {
       return Kokkos::Impl::choose_create_mirror(src, arg_prop);
     }
@@ -720,10 +702,6 @@ inline auto create_mirror_view(
       return Kokkos::Impl::choose_create_mirror(src, arg_prop);
     }
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 }  // namespace Impl
@@ -989,10 +967,6 @@ auto create_mirror_view_and_copy(
       deep_copy(mirror, src);
     return mirror;
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 template 
+
+export module kokkos.error_reporter;
+
+export {
+  namespace Kokkos {
+  namespace Experimental {
+  using ::Kokkos::Experimental::ErrorReporter;
+  }
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp b/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp
index 5d5d0965a0ac..e13b45f04418 100644
--- a/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp
+++ b/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_EXPERIMENTAL_ERROR_REPORTER_HPP
 #define KOKKOS_EXPERIMENTAL_ERROR_REPORTER_HPP
@@ -21,58 +8,94 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_ERRORREPORTER
 #endif
 
-#include 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+#else
 #include 
-#include 
-#include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
 
 namespace Kokkos {
 namespace Experimental {
-
-template 
+template 
 class ErrorReporter {
  public:
   using report_type     = ReportType;
   using device_type     = DeviceType;
   using execution_space = typename device_type::execution_space;
 
-  ErrorReporter(int max_results)
-      : m_numReportsAttempted(""),
-        m_reports("", max_results),
-        m_reporters("", max_results) {
+  ErrorReporter(const std::string &label, int max_results)
+      : m_numReportsAttempted(label + "::m_numReportsAttempted"),
+        m_reports(label + "::m_reports", max_results),
+        m_reporters(label + "::m_reporters", max_results) {
     clear();
   }
 
-  int getCapacity() const { return m_reports.view_host().extent(0); }
+  ErrorReporter(int max_results)
+      : ErrorReporter("ErrorReporter", max_results) {}
 
-  int getNumReports();
+  int capacity() const { return m_reports.extent(0); }
 
-  int getNumReportAttempts();
+  int num_reports() const {
+    return std::clamp(num_report_attempts(), 0, capacity());
+  }
 
-  void getReports(std::vector &reporters_out,
-                  std::vector &reports_out);
-  void getReports(
-      typename Kokkos::View::HostMirror
-          &reporters_out,
-      typename Kokkos::View::HostMirror
-          &reports_out);
+  int num_report_attempts() const {
+    int value;
+    Kokkos::deep_copy(value, m_numReportsAttempted);
+    return value;
+  }
 
-  void clear();
+  auto get_reports() const {
+    int num_reps = num_reports();
+    std::vector reporters_out(num_reps);
+    std::vector reports_out(num_reps);
+
+    if (num_reps > 0) {
+      Kokkos::View h_reporters(reporters_out.data(),
+                                                         num_reps);
+      Kokkos::View h_reports(
+          reports_out.data(), num_reps);
+
+      Kokkos::deep_copy(
+          h_reporters, Kokkos::subview(m_reporters, Kokkos::pair{0, num_reps}));
+      Kokkos::deep_copy(h_reports,
+                        Kokkos::subview(m_reports, Kokkos::pair{0, num_reps}));
+    }
+    return std::pair{std::move(reporters_out), std::move(reports_out)};
+  }
 
-  void resize(const size_t new_size);
+  bool full() const { return (num_report_attempts() >= capacity()); }
 
-  bool full() { return (getNumReportAttempts() >= getCapacity()); }
+  void clear() const { Kokkos::deep_copy(m_numReportsAttempted, 0); }
+
+  // This function keeps reports up to new_size alive
+  // It may lose the information on attempted reports
+  void resize(const size_t new_size) {
+    // We have to reset the attempts so we don't accidently
+    // report more stored reports than there actually are
+    // after growing capacity.
+    int num_reps = num_report_attempts();
+    if (new_size > static_cast(capacity()) && num_reps > capacity())
+      Kokkos::deep_copy(m_numReportsAttempted, num_reports());
+
+    Kokkos::resize(m_reports, new_size);
+    Kokkos::resize(m_reporters, new_size);
+  }
 
   KOKKOS_INLINE_FUNCTION
   bool add_report(int reporter_id, report_type report) const {
-    int idx = Kokkos::atomic_fetch_add(&m_numReportsAttempted(), 1);
+    int idx = Kokkos::atomic_fetch_inc(&m_numReportsAttempted());
 
-    if (idx >= 0 &&
-        (idx < static_cast(m_reports.view_device().extent(0)))) {
-      m_reporters.view_device()(idx) = reporter_id;
-      m_reports.view_device()(idx)   = report;
+    if (idx >= 0 && (idx < m_reports.extent_int(0))) {
+      m_reporters(idx) = reporter_id;
+      m_reports(idx)   = report;
       return true;
     } else {
       return false;
@@ -80,92 +103,11 @@ class ErrorReporter {
   }
 
  private:
-  using reports_view_t     = Kokkos::View;
-  using reports_dualview_t = Kokkos::DualView;
-
-  using host_mirror_space = typename reports_dualview_t::host_mirror_space;
   Kokkos::View m_numReportsAttempted;
-  reports_dualview_t m_reports;
-  Kokkos::DualView m_reporters;
+  Kokkos::View m_reports;
+  Kokkos::View m_reporters;
 };
 
-template 
-inline int ErrorReporter::getNumReports() {
-  int num_reports = 0;
-  Kokkos::deep_copy(num_reports, m_numReportsAttempted);
-  if (num_reports > static_cast(m_reports.view_host().extent(0))) {
-    num_reports = m_reports.view_host().extent(0);
-  }
-  return num_reports;
-}
-
-template 
-inline int ErrorReporter::getNumReportAttempts() {
-  int num_reports = 0;
-  Kokkos::deep_copy(num_reports, m_numReportsAttempted);
-  return num_reports;
-}
-
-template 
-void ErrorReporter::getReports(
-    std::vector &reporters_out, std::vector &reports_out) {
-  int num_reports = getNumReports();
-  reporters_out.clear();
-  reporters_out.reserve(num_reports);
-  reports_out.clear();
-  reports_out.reserve(num_reports);
-
-  if (num_reports > 0) {
-    m_reports.template sync();
-    m_reporters.template sync();
-
-    for (int i = 0; i < num_reports; ++i) {
-      reporters_out.push_back(m_reporters.view_host()(i));
-      reports_out.push_back(m_reports.view_host()(i));
-    }
-  }
-}
-
-template 
-void ErrorReporter::getReports(
-    typename Kokkos::View<
-        int *, typename DeviceType::execution_space>::HostMirror &reporters_out,
-    typename Kokkos::View::HostMirror
-        &reports_out) {
-  int num_reports = getNumReports();
-  reporters_out   = typename Kokkos::View::HostMirror(
-      "ErrorReport::reporters_out", num_reports);
-  reports_out = typename Kokkos::View::HostMirror(
-      "ErrorReport::reports_out", num_reports);
-
-  if (num_reports > 0) {
-    m_reports.template sync();
-    m_reporters.template sync();
-
-    for (int i = 0; i < num_reports; ++i) {
-      reporters_out(i) = m_reporters.view_host()(i);
-      reports_out(i)   = m_reports.view_host()(i);
-    }
-  }
-}
-
-template 
-void ErrorReporter::clear() {
-  int num_reports = 0;
-  Kokkos::deep_copy(m_numReportsAttempted, num_reports);
-  m_reports.template modify();
-  m_reporters.template modify();
-}
-
-template 
-void ErrorReporter::resize(const size_t new_size) {
-  m_reports.resize(new_size);
-  m_reporters.resize(new_size);
-  typename DeviceType::execution_space().fence(
-      "Kokkos::Experimental::ErrorReporter::resize: fence after resizing");
-}
-
 }  // namespace Experimental
 }  // namespace Kokkos
 
diff --git a/packages/kokkos/containers/src/Kokkos_Functional.cppm b/packages/kokkos/containers/src/Kokkos_Functional.cppm
new file mode 100644
index 000000000000..9a6039fd0ce9
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_Functional.cppm
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.functional;
+
+export {
+  namespace Kokkos {
+  using ::Kokkos::equal_to;
+  using ::Kokkos::greater;
+  using ::Kokkos::greater_equal;
+  using ::Kokkos::less;
+  using ::Kokkos::less_equal;
+  using ::Kokkos::not_equal_to;
+  using ::Kokkos::pod_equal_to;
+  using ::Kokkos::pod_hash;
+  using ::Kokkos::pod_not_equal_to;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_Functional.hpp b/packages/kokkos/containers/src/Kokkos_Functional.hpp
index 4d39716cc3f1..2064d604566e 100644
--- a/packages/kokkos/containers/src/Kokkos_Functional.hpp
+++ b/packages/kokkos/containers/src/Kokkos_Functional.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_FUNCTIONAL_HPP
 #define KOKKOS_FUNCTIONAL_HPP
diff --git a/packages/kokkos/containers/src/Kokkos_OffsetView.cppm b/packages/kokkos/containers/src/Kokkos_OffsetView.cppm
new file mode 100644
index 000000000000..9df204b0b734
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_OffsetView.cppm
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.offset_view;
+
+export {
+  namespace Kokkos {
+  namespace Experimental {
+  using ::Kokkos::Experimental::OffsetView;
+
+  using ::Kokkos::Experimental::is_offset_view;
+  using ::Kokkos::Experimental::is_offset_view_v;
+
+  using ::Kokkos::Experimental::index_list_type;
+  using ::Kokkos::Experimental::IndexRange;
+
+  using ::Kokkos::Experimental::operator==;
+  using ::Kokkos::Experimental::operator!=;
+  }  // namespace Experimental
+
+  using ::Kokkos::create_mirror;
+  using ::Kokkos::create_mirror_view;
+  using ::Kokkos::create_mirror_view_and_copy;
+
+  using ::Kokkos::deep_copy;
+
+  using ::Kokkos::subview;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_OffsetView.hpp b/packages/kokkos/containers/src/Kokkos_OffsetView.hpp
index 03af9fe7fbdd..22dd0df621c0 100644
--- a/packages/kokkos/containers/src/Kokkos_OffsetView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_OffsetView.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 #ifndef KOKKOS_OFFSETVIEW_HPP_
 #define KOKKOS_OFFSETVIEW_HPP_
@@ -21,7 +8,13 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_OFFSETVIEW
 #endif
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.core_impl;
+#else
 #include 
+#endif
 
 #include 
 
@@ -218,11 +211,15 @@ class OffsetView : public View {
 
  public:
   //----------------------------------------
+  /** \brief  Compatible view of data type */
+  using type =
+      OffsetView;
+
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_5
   /** \brief  Compatible view of array of scalar types */
-  using array_type =
-      OffsetView;
+  using array_type KOKKOS_DEPRECATED_WITH_COMMENT("Use type instead.") = type;
+#endif
 
   /** \brief  Compatible view of const data type */
   using const_type =
@@ -236,10 +233,16 @@ class OffsetView : public View {
                  typename traits::array_layout, typename traits::device_type,
                  typename traits::memory_traits>;
 
+  /** \brief  Compatible host mirror view */
+  using host_mirror_type = OffsetView;
+
+#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4
   /** \brief  Compatible HostMirror view */
-  using HostMirror = OffsetView;
+  using HostMirror KOKKOS_DEPRECATED_WITH_COMMENT(
+      "Use host_mirror_type instead.") = host_mirror_type;
+#endif
 
   template 
   KOKKOS_FUNCTION typename base_t::reference_type offset_operator(
@@ -248,36 +251,21 @@ class OffsetView : public View {
   }
 
   template 
-#ifndef KOKKOS_ENABLE_CXX17
     requires(std::is_convertible_v &&
              std::is_nothrow_constructible_v &&
              (base_t::rank() == 1))
-#endif
   KOKKOS_FUNCTION constexpr typename base_t::reference_type operator[](
       const OtherIndexType& idx) const {
-#ifdef KOKKOS_ENABLE_CXX17
-    static_assert(std::is_convertible_v &&
-                  std::is_nothrow_constructible_v &&
-                  (base_t::rank() == 1));
-#endif
     return base_t::operator[](idx - m_begins[0]);
   }
 
   template 
-#ifndef KOKKOS_ENABLE_CXX17
     requires((std::is_convertible_v && ...) &&
              (std::is_nothrow_constructible_v &&
               ...) &&
              (sizeof...(OtherIndexTypes) == base_t::rank()))
-#endif
   KOKKOS_FUNCTION constexpr typename base_t::reference_type operator()(
       OtherIndexTypes... indices) const {
-#ifdef KOKKOS_ENABLE_CXX17
-    static_assert(
-        (std::is_convertible_v && ...) &&
-        (std::is_nothrow_constructible_v && ...) &&
-        (sizeof...(OtherIndexTypes) == base_t::rank()));
-#endif
     return offset_operator(std::make_index_sequence(),
                            indices...);
   }
@@ -300,7 +288,7 @@ class OffsetView : public View {
   // interoperability with View
  private:
   using view_type =
-      View;
 
  public:
@@ -1109,6 +1097,7 @@ KOKKOS_INLINE_FUNCTION
   return offsetView;
 }
 }  // namespace Impl
+}  // namespace Experimental
 
 template 
 KOKKOS_INLINE_FUNCTION
@@ -1117,15 +1106,15 @@ KOKKOS_INLINE_FUNCTION
             void /* deduce subview type from source view traits */
             ,
             ViewTraits, Args...>::type>::type
-    subview(const OffsetView& src, Args... args) {
+    subview(const Kokkos::Experimental::OffsetView& src,
+            Args... args) {
   static_assert(
-      OffsetView::rank() == sizeof...(Args),
+      Kokkos::Experimental::OffsetView::rank() == sizeof...(Args),
       "subview requires one argument for each source OffsetView rank");
 
   return Kokkos::Experimental::Impl::subview_offset(src, args...);
 }
 
-}  // namespace Experimental
 }  // namespace Kokkos
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
@@ -1309,13 +1298,9 @@ inline auto create_mirror(const Kokkos::Experimental::OffsetView& src,
                                          src.begin(4), src.begin(5),
                                          src.begin(6), src.begin(7)});
   } else {
-    return typename Kokkos::Experimental::OffsetView::HostMirror(
+    return typename Kokkos::Experimental::OffsetView::host_mirror_type(
         Kokkos::create_mirror(arg_prop, src.view()), src.begins());
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 }  // namespace Impl
@@ -1383,16 +1368,18 @@ inline auto create_mirror_view(
     const Kokkos::Experimental::OffsetView& src,
     [[maybe_unused]] const Impl::ViewCtorProp& arg_prop) {
   if constexpr (!Impl::ViewCtorProp::has_memory_space) {
-    if constexpr (std::is_same_v::memory_space,
-                                 typename Kokkos::Experimental::OffsetView<
-                                     T, P...>::HostMirror::memory_space> &&
+    if constexpr (std::is_same_v<
+                      typename Kokkos::Experimental::OffsetView<
+                          T, P...>::memory_space,
+                      typename Kokkos::Experimental::OffsetView<
+                          T, P...>::host_mirror_type::memory_space> &&
                   std::is_same_v::data_type,
                                  typename Kokkos::Experimental::OffsetView<
-                                     T, P...>::HostMirror::data_type>) {
+                                     T, P...>::host_mirror_type::data_type>) {
       return
-          typename Kokkos::Experimental::OffsetView::HostMirror(src);
+          typename Kokkos::Experimental::OffsetView::host_mirror_type(
+              src);
     } else {
       return Kokkos::Impl::choose_create_mirror(src, arg_prop);
     }
@@ -1407,10 +1394,6 @@ inline auto create_mirror_view(
       return Kokkos::Impl::choose_create_mirror(src, arg_prop);
     }
   }
-#if defined(KOKKOS_COMPILER_NVCC) && KOKKOS_COMPILER_NVCC >= 1130 && \
-    !defined(KOKKOS_COMPILER_MSVC)
-  __builtin_unreachable();
-#endif
 }
 
 }  // namespace Impl
diff --git a/packages/kokkos/containers/src/Kokkos_ScatterView.cppm b/packages/kokkos/containers/src/Kokkos_ScatterView.cppm
new file mode 100644
index 000000000000..8d90c9a0eea4
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_ScatterView.cppm
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.scatter_view;
+
+export {
+  namespace Kokkos {
+
+  namespace Experimental {
+  using ::Kokkos::Experimental::ScatterView;
+
+  using ::Kokkos::Experimental::contribute;
+  using ::Kokkos::Experimental::create_scatter_view;
+
+  using ::Kokkos::Experimental::is_scatter_view;
+  using ::Kokkos::Experimental::is_scatter_view_v;
+
+  using ::Kokkos::Experimental::ScatterDuplicated;
+  using ::Kokkos::Experimental::ScatterNonDuplicated;
+
+  using ::Kokkos::Experimental::ScatterAccess;
+
+  using ::Kokkos::Experimental::ScatterAtomic;
+  using ::Kokkos::Experimental::ScatterNonAtomic;
+
+  using ::Kokkos::Experimental::ScatterMax;
+  using ::Kokkos::Experimental::ScatterMin;
+  using ::Kokkos::Experimental::ScatterProd;
+  using ::Kokkos::Experimental::ScatterSum;
+  }  // namespace Experimental
+
+  using ::Kokkos::realloc;
+  using ::Kokkos::resize;
+  }  // namespace Kokkos
+}
diff --git a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp
index e68efe567826..4b5599dd3f2a 100644
--- a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp
+++ b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp
@@ -1,18 +1,5 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
 
 /// \file Kokkos_ScatterView.hpp
 /// \brief Declaration and definition of Kokkos::ScatterView.
@@ -27,8 +14,16 @@
 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SCATTERVIEW
 #endif
 
+#include 
+#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
+import kokkos.core;
+import kokkos.core_impl;
+#else
 #include 
+#endif
 #include 
+#include 
+#include 
 
 namespace Kokkos {
 namespace Experimental {
@@ -97,23 +92,6 @@ struct DefaultContribution
-struct DefaultDuplication {
-  using type = Kokkos::Experimental::ScatterNonDuplicated;
-};
-template <>
-struct DefaultContribution {
-  using type = Kokkos::Experimental::ScatterAtomic;
-};
-template <>
-struct DefaultContribution {
-  using type = Kokkos::Experimental::ScatterNonAtomic;
-};
-#endif
-
 #ifdef KOKKOS_ENABLE_HPX
 template <>
 struct DefaultDuplication {
@@ -200,20 +178,14 @@ struct DefaultContribution
 struct ScatterValue;
 
 /* ScatterValue  is
-   the object returned by the access operator() of ScatterAccess. This class
-   inherits from the Sum<> reducer and it wraps join(dest, src) with convenient
-   operator+=, etc. Note the addition of update(ValueType const& rhs) and
-   reset()  so that all reducers can have common functions See ReduceDuplicates
-   and ResetDuplicates ) */
+   the object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -222,8 +194,9 @@ struct ScatterValue is the
- object returned by the access operator() of ScatterAccess. This class inherits
- from the Sum<> reducer, and similar to that returned by an Atomic View, it
- wraps Kokkos::atomic_add with convenient operator+=, etc. This version also has
- the update(rhs) and reset() functions. */
+ object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -255,29 +225,26 @@ struct ScatterValuejoin(value, rhs);
+    Kokkos::atomic_add(&value, rhs);
   }
-  KOKKOS_FORCEINLINE_FUNCTION void operator++() { this->join(value, 1); }
-  KOKKOS_FORCEINLINE_FUNCTION void operator++(int) { this->join(value, 1); }
-  KOKKOS_FORCEINLINE_FUNCTION void operator-=(ValueType const& rhs) {
-    this->join(value, ValueType(-rhs));
+  KOKKOS_FORCEINLINE_FUNCTION void operator++() { Kokkos::atomic_inc(&value); }
+  KOKKOS_FORCEINLINE_FUNCTION void operator++(int) {
+    Kokkos::atomic_inc(&value);
   }
-  KOKKOS_FORCEINLINE_FUNCTION void operator--() {
-    this->join(value, ValueType(-1));
+  KOKKOS_FORCEINLINE_FUNCTION void operator-=(ValueType const& rhs) {
+    Kokkos::atomic_sub(&value, rhs);
   }
+  KOKKOS_FORCEINLINE_FUNCTION void operator--() { Kokkos::atomic_dec(&value); }
   KOKKOS_FORCEINLINE_FUNCTION void operator--(int) {
-    this->join(value, ValueType(-1));
-  }
-
-  KOKKOS_INLINE_FUNCTION
-  void join(ValueType& dest, const ValueType& src) const {
-    Kokkos::atomic_add(&dest, src);
+    Kokkos::atomic_dec(&value);
   }
 
   KOKKOS_FORCEINLINE_FUNCTION void update(ValueType const& rhs) {
-    this->join(value, rhs);
+    Kokkos::atomic_add(&value, rhs);
   }
 
   KOKKOS_FORCEINLINE_FUNCTION void reset() {
@@ -286,11 +253,7 @@ struct ScatterValue is
-   the object returned by the access operator() of ScatterAccess.  This class
-   inherits from the Prod<> reducer, and it wraps join(dest, src) with
-   convenient operator*=, etc. Note the addition of update(ValueType const& rhs)
-   and reset()  so that all reducers can have common functions See
-   ReduceDuplicates and ResetDuplicates ) */
+   the object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -299,8 +262,11 @@ struct ScatterValue is the
- object returned by the access operator() of ScatterAccess.  This class
- inherits from the Prod<> reducer, and similar to that returned by an Atomic
- View, it wraps and atomic_prod with convenient operator*=, etc. atomic_prod
- uses the atomic_compare_exchange. This version also has the update(rhs)
- and reset() functions. */
+ object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -330,8 +292,10 @@ struct ScatterValue::prod();
@@ -354,21 +313,18 @@ struct ScatterValue is
-   the object returned by the access operator() of ScatterAccess. This class
-   inherits from the Min<> reducer and it wraps join(dest, src) with convenient
-   update(rhs). Note the addition of update(ValueType const& rhs) and reset()
-   are so that all reducers can have a common update function See
-   ReduceDuplicates and ResetDuplicates ) */
+   the object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
   ValueType& value;
   KOKKOS_FORCEINLINE_FUNCTION ScatterValue(ValueType& value_in)
       : value(value_in) {}
-  KOKKOS_FORCEINLINE_FUNCTION ScatterValue(ScatterValue&& other)
-      : value(other.value) {}
 
- public:
+  KOKKOS_FUNCTION ScatterValue(const ScatterValue&)            = delete;
+  KOKKOS_FUNCTION ScatterValue& operator=(const ScatterValue&) = delete;
+  KOKKOS_DEFAULTED_FUNCTION ~ScatterValue()                    = default;
+
   KOKKOS_FORCEINLINE_FUNCTION void update(ValueType const& rhs) {
     value = rhs < value ? rhs : value;
   }
@@ -378,11 +334,7 @@ struct ScatterValue is the
-   object returned by the access operator() of ScatterAccess. This class
-   inherits from the Min<> reducer, and similar to that returned by an Atomic
-   View, it wraps atomic_min with join(), etc. atomic_min uses the
-   atomic_compare_exchange. This version also has the update(rhs) and reset()
-   functions. */
+   object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -391,16 +343,12 @@ struct ScatterValuejoin(value, rhs);
+    Kokkos::atomic_min(&value, rhs);
   }
   KOKKOS_FORCEINLINE_FUNCTION void reset() {
     value = reduction_identity::min();
@@ -408,11 +356,7 @@ struct ScatterValue is
-   the object returned by the access operator() of ScatterAccess. This class
-   inherits from the Max<> reducer and it wraps join(dest, src) with convenient
-   update(rhs). Note the addition of update(ValueType const& rhs) and reset()
-   are so that all reducers can have a common update function See
-   ReduceDuplicates and ResetDuplicates ) */
+   the object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -421,8 +365,11 @@ struct ScatterValue value ? rhs : value;
   }
@@ -432,11 +379,7 @@ struct ScatterValue is the
-   object returned by the access operator() of ScatterAccess. This class
-   inherits from the Max<> reducer, and similar to that returned by an Atomic
-   View, it wraps atomic_max with join(), etc. atomic_max uses the
-   atomic_compare_exchange. This version also has the update(rhs) and reset()
-   functions. */
+   object returned by the access operator() of ScatterAccess. */
 template 
 struct ScatterValue {
@@ -445,16 +388,12 @@ struct ScatterValuejoin(value, rhs);
+    Kokkos::atomic_max(&value, rhs);
   }
   KOKKOS_FORCEINLINE_FUNCTION void reset() {
     value = reduction_identity::max();
@@ -919,8 +858,6 @@ class ScatterAccess
   KOKKOS_FORCEINLINE_FUNCTION value_type operator()(Args... args) const {
@@ -1566,7 +1503,8 @@ namespace Experimental {
 template 
 void contribute(
-    typename ES::execution_space const& exec_space, View& dest,
+    typename ES::execution_space const& exec_space,
+    View const& dest,
     Kokkos::Experimental::ScatterView const& src) {
   src.contribute_into(exec_space, dest);
 }
@@ -1574,7 +1512,7 @@ void contribute(
 template 
 void contribute(
-    View& dest,
+    View const& dest,
     Kokkos::Experimental::ScatterView const& src) {
   using execution_space = typename ES::execution_space;
   contribute(execution_space{}, dest, src);
diff --git a/packages/kokkos/containers/src/Kokkos_ScatterView_Impl.cppm b/packages/kokkos/containers/src/Kokkos_ScatterView_Impl.cppm
new file mode 100644
index 000000000000..6fe02d068d26
--- /dev/null
+++ b/packages/kokkos/containers/src/Kokkos_ScatterView_Impl.cppm
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project
+
+module;
+
+#include 
+
+export module kokkos.scatter_view_impl;
+
+export {
+  namespace Kokkos::Impl::Experimental {
+  using ::Kokkos::Impl::Experimental::DefaultContribution;
+  using ::Kokkos::Impl::Experimental::DefaultDuplication;
+  }  // namespace Kokkos::Impl::Experimental
+}
diff --git a/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp b/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp
deleted file mode 100644
index e1f31c6f9101..000000000000
--- a/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp
+++ /dev/null
@@ -1,476 +0,0 @@
-//@HEADER
-// ************************************************************************
-//
-//                        Kokkos v. 4.0
-//       Copyright (2022) 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.
-//
-// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
-// See https://kokkos.org/LICENSE for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//@HEADER
-
-#ifndef KOKKOS_STATICCRSGRAPH_HPP
-#define KOKKOS_STATICCRSGRAPH_HPP
-#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
-#define KOKKOS_IMPL_PUBLIC_INCLUDE
-#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STATICCRSGRAPH
-#endif
-
-#include 
-
-#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_4)
-#if defined(KOKKOS_ENABLE_DEPRECATION_WARNINGS) && \
-    !defined(KOKKOS_IMPL_DO_NOT_WARN_INCLUDE_STATIC_CRS_GRAPH)
-namespace {
-[[deprecated("Deprecated  header is included")]] int
-emit_warning_kokkos_static_crs_graph_deprecated() {
-  return 0;
-}
-static auto do_not_include = emit_warning_kokkos_static_crs_graph_deprecated();
-}  // namespace
-#endif
-#else
-#error "Deprecated  header is included"
-#endif
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-namespace Kokkos {
-
-namespace Impl {
-template 
-struct StaticCrsGraphBalancerFunctor {
-  using int_type = typename RowOffsetsType::non_const_value_type;
-  RowOffsetsType row_offsets;
-  RowBlockOffsetsType row_block_offsets;
-
-  int_type cost_per_row, num_blocks;
-
-  StaticCrsGraphBalancerFunctor(RowOffsetsType row_offsets_,
-                                RowBlockOffsetsType row_block_offsets_,
-                                int_type cost_per_row_, int_type num_blocks_)
-      : row_offsets(row_offsets_),
-        row_block_offsets(row_block_offsets_),
-        cost_per_row(cost_per_row_),
-        num_blocks(num_blocks_) {}
-
-  KOKKOS_INLINE_FUNCTION
-  void operator()(const int_type& iRow) const {
-    const int_type num_rows    = row_offsets.extent(0) - 1;
-    const int_type num_entries = row_offsets(num_rows);
-    const int_type total_cost  = num_entries + num_rows * cost_per_row;
-
-    const double cost_per_workset = 1.0 * total_cost / num_blocks;
-
-    const int_type row_cost =
-        row_offsets(iRow + 1) - row_offsets(iRow) + cost_per_row;
-
-    int_type count = row_offsets(iRow + 1) + cost_per_row * iRow;
-
-    if (iRow == num_rows - 1) row_block_offsets(num_blocks) = num_rows;
-
-    if (true) {
-      int_type current_block =
-          (count - row_cost - cost_per_row) / cost_per_workset;
-      int_type end_block = count / cost_per_workset;
-
-      // Handle some corner cases for the last two blocks.
-      if (current_block >= num_blocks - 2) {
-        if ((current_block == num_blocks - 2) &&
-            (count >= (current_block + 1) * cost_per_workset)) {
-          int_type row   = iRow;
-          int_type cc    = count - row_cost - cost_per_row;
-          int_type block = cc / cost_per_workset;
-          while ((block > 0) && (block == current_block)) {
-            cc    = row_offsets(row) + row * cost_per_row;
-            block = cc / cost_per_workset;
-            row--;
-          }
-          if ((count - cc - row_cost - cost_per_row) <
-              num_entries - row_offsets(iRow + 1)) {
-            row_block_offsets(current_block + 1) = iRow + 1;
-          } else {
-            row_block_offsets(current_block + 1) = iRow;
-          }
-        }
-      } else {
-        if ((count >= (current_block + 1) * cost_per_workset) ||
-            (iRow + 2 == int_type(row_offsets.extent(0)))) {
-          if (end_block > current_block + 1) {
-            int_type num_block                   = end_block - current_block;
-            row_block_offsets(current_block + 1) = iRow;
-            for (int_type block = current_block + 2; block <= end_block;
-                 block++)
-              if ((block < current_block + 2 + (num_block - 1) / 2))
-                row_block_offsets(block) = iRow;
-              else
-                row_block_offsets(block) = iRow + 1;
-          } else {
-            row_block_offsets(current_block + 1) = iRow + 1;
-          }
-        }
-      }
-    }
-  }
-};
-}  // namespace Impl
-
-/// \class GraphRowViewConst
-/// \brief View of a row of a sparse graph.
-/// \tparam GraphType Sparse graph type, such as (but not limited to)
-/// StaticCrsGraph.
-///
-/// This class provides a generic view of a row of a sparse graph.
-/// We intended this class to view a row of a StaticCrsGraph, but
-/// GraphType need not necessarily be CrsMatrix.
-///
-/// The row view is suited for computational kernels like sparse
-/// matrix-vector multiply, as well as for modifying entries in the
-/// sparse matrix.  The view is always const as it does not allow graph
-/// modification.
-///
-/// Here is an example loop over the entries in the row:
-/// \code
-/// using ordinal_type = typename GraphRowViewConst::ordinal_type;
-///
-/// GraphRowView G_i = ...;
-/// const ordinal_type numEntries = G_i.length;
-/// for (ordinal_type k = 0; k < numEntries; ++k) {
-///   ordinal_type j = G_i.colidx (k);
-///   // ... do something with A_ij and j ...
-/// }
-/// \endcode
-///
-/// GraphType must provide the \c data_type
-/// aliases. In addition, it must make sense to use GraphRowViewConst to
-/// view a row of GraphType. In particular, column
-/// indices of a row must be accessible using the entries
-/// resp. colidx arrays given to the constructor of this
-/// class, with a constant stride between successive entries.
-/// The stride is one for the compressed sparse row storage format (as
-/// is used by CrsMatrix), but may be greater than one for other
-/// sparse matrix storage formats (e.g., ELLPACK or jagged diagonal).
-template 
-struct GraphRowViewConst {
-  //! The type of the column indices in the row.
-  using ordinal_type = const typename GraphType::data_type;
-
- private:
-  //! Array of (local) column indices in the row.
-  ordinal_type* colidx_;
-  /// \brief Stride between successive entries in the row.
-  ///
-  /// For compressed sparse row (CSR) storage, this is always one.
-  /// This might be greater than one for storage formats like ELLPACK
-  /// or Jagged Diagonal.  Nevertheless, the stride can never be
-  /// greater than the number of rows or columns in the matrix.  Thus,
-  /// \c ordinal_type is the correct type.
-  const ordinal_type stride_;
-
- public:
-  /// \brief Constructor
-  ///
-  /// \param values [in] Array of the row's values.
-  /// \param colidx [in] Array of the row's column indices.
-  /// \param stride [in] (Constant) stride between matrix entries in
-  ///   each of the above arrays.
-  /// \param count [in] Number of entries in the row.
-  KOKKOS_INLINE_FUNCTION
-  GraphRowViewConst(ordinal_type* const colidx_in, const ordinal_type& stride,
-                    const ordinal_type& count)
-      : colidx_(colidx_in), stride_(stride), length(count) {}
-
-  /// \brief Constructor with offset into \c colidx array
-  ///
-  /// \param colidx [in] Array of the row's column indices.
-  /// \param stride [in] (Constant) stride between matrix entries in
-  ///   each of the above arrays.
-  /// \param count [in] Number of entries in the row.
-  /// \param idx [in] Start offset into \c colidx array
-  ///
-  /// \tparam OffsetType The type of \c idx (see above).  Must be a
-  ///   built-in integer type.  This may differ from ordinal_type.
-  ///   For example, the matrix may have dimensions that fit in int,
-  ///   but a number of entries that does not fit in int.
-  template 
-  KOKKOS_INLINE_FUNCTION GraphRowViewConst(
-      const typename GraphType::entries_type& colidx_in,
-      const ordinal_type& stride, const ordinal_type& count,
-      const OffsetType& idx,
-      const std::enable_if_t, int>& = 0)
-      : colidx_(&colidx_in(idx)), stride_(stride), length(count) {}
-
-  /// \brief Number of entries in the row.
-  ///
-  /// This is a public const field rather than a public const method,
-  /// in order to avoid possible overhead of a method call if the
-  /// compiler is unable to inline that method call.
-  ///
-  /// We assume that rows contain no duplicate entries (i.e., entries
-  /// with the same column index).  Thus, a row may have up to
-  /// A.numCols() entries.  This means that the correct type of
-  /// 'length' is ordinal_type.
-  const ordinal_type length;
-
-  /// \brief (Const) reference to the column index of entry i in this
-  ///   row of the sparse matrix.
-  ///
-  /// "Entry i" is not necessarily the entry with column index i, nor
-  /// does i necessarily correspond to the (local) row index.
-  KOKKOS_INLINE_FUNCTION
-  ordinal_type& colidx(const ordinal_type& i) const {
-    return colidx_[i * stride_];
-  }
-
-  /// \brief An alias for colidx
-  KOKKOS_INLINE_FUNCTION
-  ordinal_type& operator()(const ordinal_type& i) const { return colidx(i); }
-};
-
-/// \class StaticCrsGraph
-/// \brief Compressed row storage array.
-///
-/// \tparam DataType The type of stored entries.  If a StaticCrsGraph is
-///   used as the graph of a sparse matrix, then this is usually an
-///   integer type, the type of the column indices in the sparse
-///   matrix.
-///
-/// \tparam Arg1Type The second template parameter, corresponding
-///   either to the Device type (if there are no more template
-///   parameters) or to the Layout type (if there is at least one more
-///   template parameter).
-///
-/// \tparam Arg2Type The third template parameter, which if provided
-///   corresponds to the Device type.
-///
-/// \tparam Arg3Type The third template parameter, which if provided
-///   corresponds to the MemoryTraits.
-///
-/// \tparam SizeType The type of row offsets.  Usually the default
-///   parameter suffices.  However, setting a nondefault value is
-///   necessary in some cases, for example, if you want to have a
-///   sparse matrices with dimensions (and therefore column indices)
-///   that fit in \c int, but want to store more than INT_MAX
-///   entries in the sparse matrix.
-///
-/// A row has a range of entries:
-/// 
    -///
  • row_map[i0] <= entry < row_map[i0+1]
  • -///
  • 0 <= i1 < row_map[i0+1] - row_map[i0]
  • -///
  • entries( entry , i2 , i3 , ... );
  • -///
  • entries( row_map[i0] + i1 , i2 , i3 , ... );
  • -///
-template ::size_type> -class StaticCrsGraph { - private: - using traits = ViewTraits; - - public: - using data_type = DataType; - using array_layout = typename traits::array_layout; - using execution_space = typename traits::execution_space; - using device_type = typename traits::device_type; - using memory_traits = typename traits::memory_traits; - using size_type = SizeType; - - using staticcrsgraph_type = - StaticCrsGraph; - using HostMirror = StaticCrsGraph; - - using row_map_type = - View; - using entries_type = - View; - using row_block_type = - View; - - entries_type entries; - row_map_type row_map; - row_block_type row_block_offsets; - - KOKKOS_DEFAULTED_FUNCTION - StaticCrsGraph() = default; - - template - KOKKOS_INLINE_FUNCTION StaticCrsGraph(const EntriesType& entries_, - const RowMapType& row_map_) - : entries(entries_), row_map(row_map_) {} - - template - KOKKOS_INLINE_FUNCTION StaticCrsGraph(const StaticCrsGraph& other) - : entries(other.entries), - row_map(other.row_map), - row_block_offsets(other.row_block_offsets) {} - - /** \brief Return number of rows in the graph - */ - KOKKOS_INLINE_FUNCTION - size_type numRows() const { - return (row_map.extent(0) != 0) - ? row_map.extent(0) - static_cast(1) - : static_cast(0); - } - - KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const { - return (row_map.is_allocated() && entries.is_allocated()); - } - - /// \brief Return a const view of row i of the graph. - /// - /// If row i does not belong to the graph, return an empty view. - /// - /// The returned object \c view implements the following interface: - ///
    - ///
  • \c view.length is the number of entries in the row
  • - ///
  • \c view.colidx(k) returns a const reference to the - /// column index of the k-th entry in the row
  • - ///
- /// k is not a column index; it just counts from 0 to - /// view.length - 1. - /// - /// Users should not rely on the return type of this method. They - /// should instead assign to 'auto'. That allows compile-time - /// polymorphism for different kinds of sparse matrix formats (e.g., - /// ELLPACK or Jagged Diagonal) that we may wish to support in the - /// future. - KOKKOS_INLINE_FUNCTION - GraphRowViewConst rowConst(const data_type i) const { - const size_type start = row_map(i); - // count is guaranteed to fit in ordinal_type, as long as no row - // has duplicate entries. - const data_type count = static_cast(row_map(i + 1) - start); - - if (count == 0) { - return GraphRowViewConst(nullptr, 1, 0); - } else { - return GraphRowViewConst(entries, 1, count, start); - } - } - - /** \brief Create a row partitioning into a given number of blocks - * balancing non-zeros + a fixed cost per row. - */ - void create_block_partitioning(size_type num_blocks, - size_type fix_cost_per_row = 4) { - View block_offsets( - "StatisCrsGraph::load_balance_offsets", num_blocks + 1); - - Impl::StaticCrsGraphBalancerFunctor< - row_map_type, View > - partitioner(row_map, block_offsets, fix_cost_per_row, num_blocks); - - Kokkos::parallel_for("Kokkos::StaticCrsGraph::create_block_partitioning", - Kokkos::RangePolicy(0, numRows()), - partitioner); - typename device_type::execution_space().fence( - "Kokkos::StaticCrsGraph::create_block_partitioning:: fence after " - "partition"); - - row_block_offsets = block_offsets; - } -}; - -//---------------------------------------------------------------------------- - -template -typename StaticCrsGraphType::staticcrsgraph_type create_staticcrsgraph( - const std::string& label, const std::vector& input); - -template -typename StaticCrsGraphType::staticcrsgraph_type create_staticcrsgraph( - const std::string& label, - const std::vector >& input); - -//---------------------------------------------------------------------------- - -template -typename StaticCrsGraph::HostMirror -create_mirror_view(const StaticCrsGraph& input); - -template -typename StaticCrsGraph::HostMirror -create_mirror(const StaticCrsGraph& input); - -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#include - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -template -struct StaticCrsGraphMaximumEntry { - using execution_space = typename GraphType::execution_space; - using value_type = typename GraphType::data_type; - - const typename GraphType::entries_type entries; - - StaticCrsGraphMaximumEntry(const GraphType& graph) : entries(graph.entries) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const unsigned i, value_type& update) const { - if (update < entries(i)) update = entries(i); - } - - KOKKOS_INLINE_FUNCTION - void init(value_type& update) const { update = 0; } - - KOKKOS_INLINE_FUNCTION - void join(value_type& update, const value_type& input) const { - if (update < input) update = input; - } -}; - -} // namespace Impl - -template -DataType maximum_entry(const StaticCrsGraph& graph) { - using GraphType = - StaticCrsGraph; - using FunctorType = Impl::StaticCrsGraphMaximumEntry; - - DataType result = 0; - Kokkos::parallel_reduce("Kokkos::maximum_entry", graph.entries.extent(0), - FunctorType(graph), result); - return result; -} - -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STATICCRSGRAPH -#undef KOKKOS_IMPL_PUBLIC_INCLUDE -#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STATICCRSGRAPH -#endif -#endif /* #ifndef KOKKOS_CRSARRAY_HPP */ diff --git a/packages/kokkos/containers/src/Kokkos_UnorderedMap.cppm b/packages/kokkos/containers/src/Kokkos_UnorderedMap.cppm new file mode 100644 index 000000000000..e7e3264ef26f --- /dev/null +++ b/packages/kokkos/containers/src/Kokkos_UnorderedMap.cppm @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +module; + +#include + +export module kokkos.unordered_map; + +export { + namespace Kokkos { + using ::Kokkos::UnorderedMap; + + using ::Kokkos::UnorderedMapInsertOpTypes; + using ::Kokkos::UnorderedMapInsertResult; + + using ::Kokkos::create_mirror; + + using ::Kokkos::deep_copy; + } // namespace Kokkos +} diff --git a/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp b/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp index 12030ba11f17..8688539bb541 100644 --- a/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp +++ b/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /// \file Kokkos_UnorderedMap.hpp /// \brief Declaration and definition of Kokkos::UnorderedMap. @@ -27,18 +14,23 @@ #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_UNORDEREDMAP #endif +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.bitset; +import kokkos.functional; +#else #include -#include - #include - +#include +#endif +#include #include #include #include #include -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_4 #if defined(KOKKOS_COMPILER_GNU) && !defined(__PGIC__) && \ !defined(__CUDA_ARCH__) @@ -53,15 +45,42 @@ #define KOKKOS_IMPL_NONTEMPORAL_PREFETCH_STORE(addr) ((void)0) #endif -#else -#define KOKKOS_IMPL_NONTEMPORAL_PREFETCH_LOAD(addr) \ - KOKKOS_NONTEMPORAL_PREFETCH_LOAD(addr) -#define KOKKOS_IMPL_NONTEMPORAL_PREFETCH_STORE(addr) \ - KOKKOS_NONTEMPORAL_PREFETCH_STORE(addr) -#endif namespace Kokkos { +namespace Impl { + +template +auto allocate_without_initializing_if_possible( + const Impl::ViewCtorProp &alloc_prop, Args &&...args) { + using alloc_prop_t = std::remove_cvref_t; + + // if incompatible we don't add the property + if constexpr (alloc_prop_t::sequential_host_init) + return ViewType(alloc_prop, std::forward(args)...); + // otherwise we add it if unset + else + return ViewType( + Impl::with_properties_if_unset(alloc_prop, WithoutInitializing), + std::forward(args)...); +} + +template +auto allocate_with_sequential_host_init_if_possible( + const Impl::ViewCtorProp &alloc_prop, Args &&...args) { + // if incompatible we don't add the property + if constexpr (!SpaceAccessibility< + typename ViewType::execution_space::memory_space, + HostSpace>::accessible) + return ViewType(alloc_prop, std::forward(args)...); + // otherwise we add it if unset + else + return ViewType( + Impl::with_properties_if_unset(alloc_prop, SequentialHostInit), + std::forward(args)...); +} +} // namespace Impl + enum : unsigned { UnorderedMapInvalidIndex = ~0u }; /// \brief First element of the return value of UnorderedMap::insert(). @@ -278,9 +297,14 @@ class UnorderedMap { using insert_result = UnorderedMapInsertResult; - using HostMirror = + using host_mirror_type = UnorderedMap; +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + using HostMirror KOKKOS_DEPRECATED_WITH_COMMENT( + "Use host_mirror_type instead.") = host_mirror_type; +#endif + using histogram_type = Impl::UnorderedMapHistogram; //@} @@ -331,7 +355,11 @@ class UnorderedMap { UnorderedMap(const Impl::ViewCtorProp &arg_prop, size_type capacity_hint = 0, hasher_type hasher = hasher_type(), equal_to_type equal_to = equal_to_type()) - : m_bounded_insert(true), m_hasher(hasher), m_equal_to(equal_to) { + : m_bounded_insert(true), + m_hasher(hasher), + m_equal_to(equal_to), + m_sequential_host_init( + std::remove_cvref_t::sequential_host_init) { if (!is_insertable_map) { Kokkos::Impl::throw_runtime_exception( "Cannot construct a non-insertable (i.e. const key_type) " @@ -339,7 +367,7 @@ class UnorderedMap { } //! Ensure that allocation properties are consistent. - using alloc_prop_t = std::decay_t; + using alloc_prop_t = std::remove_cvref_t; static_assert(alloc_prop_t::initialize, "Allocation property 'initialize' should be true."); static_assert( @@ -350,8 +378,6 @@ class UnorderedMap { /// properties. const auto prop_copy = Impl::with_properties_if_unset(arg_prop, std::string("UnorderedMap")); - const auto prop_copy_noinit = - Impl::with_properties_if_unset(prop_copy, Kokkos::WithoutInitializing); //! Initialize member views. m_size = shared_size_t(Kokkos::view_alloc( @@ -362,14 +388,16 @@ class UnorderedMap { bitset_type(Kokkos::Impl::append_to_label(prop_copy, " - bitset"), calculate_capacity(capacity_hint)); - m_hash_lists = size_type_view( - Kokkos::Impl::append_to_label(prop_copy_noinit, " - hash list"), - Impl::find_hash_size(capacity())); + m_hash_lists = + Impl::allocate_without_initializing_if_possible( + Kokkos::Impl::append_to_label(prop_copy, " - hash list"), + Impl::find_hash_size(capacity())); - m_next_index = size_type_view( - Kokkos::Impl::append_to_label(prop_copy_noinit, " - next index"), - capacity() + 1); // +1 so that the *_at functions can always return a - // valid reference + m_next_index = + Impl::allocate_without_initializing_if_possible( + Kokkos::Impl::append_to_label(prop_copy, " - next index"), + capacity() + 1); // +1 so that the *_at functions can always return + // a valid reference m_keys = key_type_view(Kokkos::Impl::append_to_label(prop_copy, " - keys"), capacity()); @@ -446,7 +474,12 @@ class UnorderedMap { requested_capacity = (requested_capacity < curr_size) ? curr_size : requested_capacity; - insertable_map_type tmp(requested_capacity, m_hasher, m_equal_to); + auto tmp = + m_sequential_host_init + ? Impl::allocate_with_sequential_host_init_if_possible< + insertable_map_type>(view_alloc(), requested_capacity, + m_hasher, m_equal_to) + : insertable_map_type(requested_capacity, m_hasher, m_equal_to); if (curr_size) { tmp.m_bounded_insert = false; @@ -807,7 +840,8 @@ class UnorderedMap { m_next_index(src.m_next_index), m_keys(src.m_keys), m_values(src.m_values), - m_scalars(src.m_scalars) {} + m_scalars(src.m_scalars), + m_sequential_host_init(src.m_sequential_host_init) {} template std::enable_if_t< @@ -815,16 +849,17 @@ class UnorderedMap { SValue>::value, declared_map_type &> operator=(UnorderedMap const &src) { - m_bounded_insert = src.m_bounded_insert; - m_hasher = src.m_hasher; - m_equal_to = src.m_equal_to; - m_size = src.m_size; - m_available_indexes = src.m_available_indexes; - m_hash_lists = src.m_hash_lists; - m_next_index = src.m_next_index; - m_keys = src.m_keys; - m_values = src.m_values; - m_scalars = src.m_scalars; + m_bounded_insert = src.m_bounded_insert; + m_hasher = src.m_hasher; + m_equal_to = src.m_equal_to; + m_size = src.m_size; + m_available_indexes = src.m_available_indexes; + m_hash_lists = src.m_hash_lists; + m_next_index = src.m_next_index; + m_keys = src.m_keys; + m_values = src.m_values; + m_scalars = src.m_scalars; + m_sequential_host_init = src.m_sequential_host_init; return *this; } @@ -850,12 +885,14 @@ class UnorderedMap { UnorderedMap const &src) { insertable_map_type tmp; - tmp.m_bounded_insert = src.m_bounded_insert; - tmp.m_hasher = src.m_hasher; - tmp.m_equal_to = src.m_equal_to; - tmp.m_size() = src.m_size(); - tmp.m_available_indexes = bitset_type(src.capacity()); - tmp.m_hash_lists = size_type_view( + tmp.m_bounded_insert = src.m_bounded_insert; + tmp.m_hasher = src.m_hasher; + tmp.m_equal_to = src.m_equal_to; + tmp.m_size() = src.m_size(); + tmp.m_sequential_host_init = src.m_sequential_host_init; + tmp.m_available_indexes = bitset_type(src.capacity()); + + tmp.m_hash_lists = size_type_view( view_alloc(WithoutInitializing, "UnorderedMap hash list"), src.m_hash_lists.extent(0)); tmp.m_next_index = size_type_view( @@ -865,8 +902,13 @@ class UnorderedMap { key_type_view(view_alloc(WithoutInitializing, "UnorderedMap keys"), src.m_keys.extent(0)); tmp.m_values = - value_type_view(view_alloc(WithoutInitializing, "UnorderedMap values"), - src.m_values.extent(0)); + src.m_sequential_host_init + ? Impl::allocate_with_sequential_host_init_if_possible< + value_type_view>(view_alloc("UnorderedMap values"), + src.m_values.extent(0)) + : Impl::allocate_without_initializing_if_possible( + view_alloc("UnorderedMap values"), src.m_values.extent(0)); + tmp.m_scalars = scalars_view("UnorderedMap scalars"); *this = tmp; @@ -879,20 +921,8 @@ class UnorderedMap { std::is_same_v, value_type>> deep_copy_view( UnorderedMap const &src) { -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_4 // To deep copy UnorderedMap, capacity must be identical KOKKOS_EXPECTS(capacity() == src.capacity()); -#else - if (capacity() != src.capacity()) { - allocate_view(src); -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS - Kokkos::Impl::log_warning( - "Warning: deep_copy_view() allocating views is deprecated. Must call " - "with UnorderedMaps of identical capacity, or use " - "create_copy_view().\n"); -#endif - } -#endif if (m_hash_lists.data() != src.m_hash_lists.data()) { Kokkos::deep_copy(m_available_indexes, src.m_available_indexes); @@ -966,6 +996,7 @@ class UnorderedMap { key_type_view m_keys; value_type_view m_values; scalars_view m_scalars; + bool m_sequential_host_init = false; template @@ -993,11 +1024,11 @@ inline void deep_copy( // Specialization of create_mirror() for an UnorderedMap object. template -typename UnorderedMap::HostMirror +typename UnorderedMap::host_mirror_type create_mirror( const UnorderedMap &src) { - typename UnorderedMap::HostMirror - dst; + typename UnorderedMap::host_mirror_type dst; dst.allocate_view(src); return dst; } diff --git a/packages/kokkos/containers/src/Kokkos_UnorderedMap_Impl.cppm b/packages/kokkos/containers/src/Kokkos_UnorderedMap_Impl.cppm new file mode 100644 index 000000000000..f365bd191a1a --- /dev/null +++ b/packages/kokkos/containers/src/Kokkos_UnorderedMap_Impl.cppm @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +module; + +#include + +export module kokkos.unordered_map_impl; + +export { + namespace Kokkos::Impl { + using ::Kokkos::Impl::UnorderedMapPrint; + } // namespace Kokkos::Impl +} diff --git a/packages/kokkos/containers/src/Kokkos_Vector.hpp b/packages/kokkos/containers/src/Kokkos_Vector.hpp deleted file mode 100644 index 32b1c36c9bcf..000000000000 --- a/packages/kokkos/containers/src/Kokkos_Vector.hpp +++ /dev/null @@ -1,340 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_VECTOR_HPP -#define KOKKOS_VECTOR_HPP -#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE -#define KOKKOS_IMPL_PUBLIC_INCLUDE -#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_VECTOR -#endif - -#include - -#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_4) -#if defined(KOKKOS_ENABLE_DEPRECATION_WARNINGS) -namespace { -[[deprecated("Deprecated header is included")]] int -emit_warning_kokkos_vector_deprecated() { - return 0; -} -static auto do_not_include = emit_warning_kokkos_vector_deprecated(); -} // namespace -#endif -#else -#error "Deprecated header is included" -#endif - -#include -#include - -/* Drop in replacement for std::vector based on Kokkos::DualView - * Most functions only work on the host (it will not compile if called from - * device kernel) - * - */ -namespace Kokkos { - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template -class KOKKOS_DEPRECATED vector - : public DualView { - public: - using value_type = Scalar; - using pointer = Scalar*; - using const_pointer = const Scalar*; - using reference = Scalar&; - using const_reference = const Scalar&; - using iterator = Scalar*; - using const_iterator = const Scalar*; - using size_type = size_t; - - private: - size_t _size; - float _extra_storage; - using DV = DualView; - - public: -#ifdef KOKKOS_ENABLE_CUDA_UVM - KOKKOS_INLINE_FUNCTION reference operator()(int i) const { - return DV::view_host()(i); - }; - KOKKOS_INLINE_FUNCTION reference operator[](int i) const { - return DV::view_host()(i); - }; -#else - inline reference operator()(int i) const { return DV::view_host()(i); } - inline reference operator[](int i) const { return DV::view_host()(i); } -#endif - - /* Member functions which behave like std::vector functions */ - - vector() : DV() { - _size = 0; - _extra_storage = 1.1; - } - - vector(int n, Scalar val = Scalar()) - : DualView("Vector", size_t(n * (1.1))) { - _size = n; - _extra_storage = 1.1; - DV::modified_flags(0) = 1; - - assign(n, val); - } - - void resize(size_t n) { - if (n >= span()) DV::resize(size_t(n * _extra_storage)); - _size = n; - } - - void resize(size_t n, const Scalar& val) { assign(n, val); } - - void assign(size_t n, const Scalar& val) { - /* Resize if necessary (behavior of std:vector) */ - - if (n > span()) DV::resize(size_t(n * _extra_storage)); - _size = n; - - /* Assign value either on host or on device */ - - if (DV::template need_sync()) { - set_functor_host f(DV::view_host(), val); - parallel_for("Kokkos::vector::assign", n, f); - typename DV::t_host::execution_space().fence( - "Kokkos::vector::assign: fence after assigning values"); - DV::template modify(); - } else { - set_functor f(DV::view_device(), val); - parallel_for("Kokkos::vector::assign", n, f); - typename DV::t_dev::execution_space().fence( - "Kokkos::vector::assign: fence after assigning values"); - DV::template modify(); - } - } - - void reserve(size_t n) { DV::resize(size_t(n * _extra_storage)); } - - void push_back(Scalar val) { - if (_size == span()) { - size_t new_size = _size * _extra_storage; - if (new_size == _size) new_size++; - DV::resize(new_size); - } - - DV::sync_host(); - DV::view_host()(_size) = val; - _size++; - DV::modify_host(); - } - - void pop_back() { _size--; } - - void clear() { _size = 0; } - - iterator insert(iterator it, const value_type& val) { - return insert(it, 1, val); - } - - iterator insert(iterator it, size_type count, const value_type& val) { - if ((size() == 0) && (it == begin())) { - resize(count, val); - DV::sync_host(); - return begin(); - } - DV::sync_host(); - DV::modify_host(); - if (std::less<>()(it, begin()) || std::less<>()(end(), it)) - Kokkos::abort("Kokkos::vector::insert : invalid insert iterator"); - if (count == 0) return it; - ptrdiff_t start = std::distance(begin(), it); - auto org_size = size(); - resize(size() + count); - - std::copy_backward(begin() + start, begin() + org_size, - begin() + org_size + count); - std::fill_n(begin() + start, count, val); - - return begin() + start; - } - - private: - template - struct impl_is_input_iterator : /* TODO replace this */ std::bool_constant< - !std::is_convertible_v> {}; - - public: - // TODO: can use detection idiom to generate better error message here later - template - std::enable_if_t::value, iterator> - insert(iterator it, InputIterator b, InputIterator e) { - ptrdiff_t count = std::distance(b, e); - - DV::sync_host(); - DV::modify_host(); - if (std::less<>()(it, begin()) || std::less<>()(end(), it)) - Kokkos::abort("Kokkos::vector::insert : invalid insert iterator"); - - ptrdiff_t start = std::distance(begin(), it); - auto org_size = size(); - - // Note: resize(...) invalidates it; use begin() + start instead - resize(size() + count); - - std::copy_backward(begin() + start, begin() + org_size, - begin() + org_size + count); - std::copy(b, e, begin() + start); - - return begin() + start; - } - - KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const { - return DV::is_allocated(); - } - - size_type size() const { return _size; } - size_type max_size() const { return 2000000000; } - size_type span() const { return DV::span(); } - bool empty() const { return _size == 0; } - - pointer data() const { return DV::view_host().data(); } - - iterator begin() const { return DV::view_host().data(); } - - const_iterator cbegin() const { return DV::view_host().data(); } - - iterator end() const { - return _size > 0 ? DV::view_host().data() + _size : DV::view_host().data(); - } - - const_iterator cend() const { - return _size > 0 ? DV::view_host().data() + _size : DV::view_host().data(); - } - - reference front() { return DV::view_host()(0); } - - reference back() { return DV::view_host()(_size - 1); } - - const_reference front() const { return DV::view_host()(0); } - - const_reference back() const { return DV::view_host()(_size - 1); } - - /* std::algorithms which work originally with iterators, here they are - * implemented as member functions */ - - size_t lower_bound(const size_t& start, const size_t& theEnd, - const Scalar& comp_val) const { - int lower = start; // FIXME (mfh 24 Apr 2014) narrowing conversion - int upper = - _size > theEnd - ? theEnd - : _size - 1; // FIXME (mfh 24 Apr 2014) narrowing conversion - if (upper <= lower) { - return theEnd; - } - - Scalar lower_val = DV::view_host()(lower); - Scalar upper_val = DV::view_host()(upper); - size_t idx = (upper + lower) / 2; - Scalar val = DV::view_host()(idx); - if (val > upper_val) return upper; - if (val < lower_val) return start; - - while (upper > lower) { - if (comp_val > val) { - lower = ++idx; - } else { - upper = idx; - } - idx = (upper + lower) / 2; - val = DV::view_host()(idx); - } - return idx; - } - - bool is_sorted() { - for (int i = 0; i < _size - 1; i++) { - if (DV::view_host()(i) > DV::view_host()(i + 1)) return false; - } - return true; - } - - iterator find(Scalar val) const { - if (_size == 0) return end(); - - int upper, lower, current; - current = _size / 2; - upper = _size - 1; - lower = 0; - - if ((val < DV::view_host()(0)) || (val > DV::view_host()(_size - 1))) - return end(); - - while (upper > lower) { - if (val > DV::view_host()(current)) - lower = current + 1; - else - upper = current; - current = (upper + lower) / 2; - } - - if (val == DV::view_host()(current)) - return &DV::view_host()(current); - else - return end(); - } - - /* Additional functions for data management */ - - void device_to_host() { deep_copy(DV::view_host(), DV::view_device()); } - void host_to_device() const { deep_copy(DV::view_device(), DV::view_host()); } - - void on_host() { DV::template modify(); } - void on_device() { DV::template modify(); } - - void set_overallocation(float extra) { _extra_storage = 1.0 + extra; } - - public: - struct set_functor { - using execution_space = typename DV::t_dev::execution_space; - typename DV::t_dev _data; - Scalar _val; - - set_functor(typename DV::t_dev data, Scalar val) : _data(data), _val(val) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const int& i) const { _data(i) = _val; } - }; - - struct set_functor_host { - using execution_space = typename DV::t_host::execution_space; - typename DV::t_host _data; - Scalar _val; - - set_functor_host(typename DV::t_host data, Scalar val) - : _data(data), _val(val) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const int& i) const { _data(i) = _val; } - }; -}; -#endif - -} // namespace Kokkos -#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_VECTOR -#undef KOKKOS_IMPL_PUBLIC_INCLUDE -#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_VECTOR -#endif -#endif diff --git a/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp index bc0937fd978f..dbc1dac6c16f 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_BITSET_IMPL_HPP #define KOKKOS_BITSET_IMPL_HPP diff --git a/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp index 76d57ab2aa3d..d2e5987085ac 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_FUNCTIONAL_IMPL_HPP #define KOKKOS_FUNCTIONAL_IMPL_HPP diff --git a/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp b/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp deleted file mode 100644 index 468e617d5065..000000000000 --- a/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp +++ /dev/null @@ -1,182 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_IMPL_STATICCRSGRAPH_FACTORY_HPP -#define KOKKOS_IMPL_STATICCRSGRAPH_FACTORY_HPP - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -#include -#include - -namespace Kokkos { - -template -inline typename StaticCrsGraph::HostMirror -create_mirror_view(const StaticCrsGraph& view, - std::enable_if_t::is_hostspace>* = 0) { - return view; -} - -template -inline typename StaticCrsGraph::HostMirror -create_mirror(const StaticCrsGraph& view) { - // Force copy: - // using alloc = Impl::ViewAssignment; // unused - using staticcrsgraph_type = - StaticCrsGraph; - - typename staticcrsgraph_type::HostMirror tmp; - typename staticcrsgraph_type::row_map_type::HostMirror tmp_row_map = - create_mirror(view.row_map); - typename staticcrsgraph_type::row_block_type::HostMirror - tmp_row_block_offsets = create_mirror(view.row_block_offsets); - - // Allocation to match: - tmp.row_map = tmp_row_map; // Assignment of 'const' from 'non-const' - tmp.entries = create_mirror(view.entries); - tmp.row_block_offsets = - tmp_row_block_offsets; // Assignment of 'const' from 'non-const' - - // Deep copy: - deep_copy(tmp_row_map, view.row_map); - deep_copy(tmp.entries, view.entries); - deep_copy(tmp_row_block_offsets, view.row_block_offsets); - - return tmp; -} - -template -inline typename StaticCrsGraph::HostMirror -create_mirror_view(const StaticCrsGraph& view, - std::enable_if_t::is_hostspace>* = 0) { - return create_mirror(view); -} -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { - -template -inline typename StaticCrsGraphType::staticcrsgraph_type create_staticcrsgraph( - const std::string& label, const std::vector& input) { - using output_type = StaticCrsGraphType; - using entries_type = typename output_type::entries_type; - using work_type = View< - typename output_type::size_type[], typename output_type::array_layout, - typename output_type::device_type, typename output_type::memory_traits>; - - output_type output; - - // Create the row map: - - const size_t length = input.size(); - - { - work_type row_work("tmp", length + 1); - - typename work_type::HostMirror row_work_host = create_mirror_view(row_work); - - size_t sum = 0; - row_work_host[0] = 0; - for (size_t i = 0; i < length; ++i) { - row_work_host[i + 1] = sum += input[i]; - } - - deep_copy(row_work, row_work_host); - - output.entries = entries_type(label, sum); - output.row_map = row_work; - } - - return output; -} - -//---------------------------------------------------------------------------- - -template -inline typename StaticCrsGraphType::staticcrsgraph_type create_staticcrsgraph( - const std::string& label, - const std::vector >& input) { - using output_type = StaticCrsGraphType; - using entries_type = typename output_type::entries_type; - - static_assert(entries_type::rank == 1, "Graph entries view must be rank one"); - - using work_type = View< - typename output_type::size_type[], typename output_type::array_layout, - typename output_type::device_type, typename output_type::memory_traits>; - - output_type output; - - // Create the row map: - - const size_t length = input.size(); - - { - work_type row_work("tmp", length + 1); - - typename work_type::HostMirror row_work_host = create_mirror_view(row_work); - - size_t sum = 0; - row_work_host[0] = 0; - for (size_t i = 0; i < length; ++i) { - row_work_host[i + 1] = sum += input[i].size(); - } - - deep_copy(row_work, row_work_host); - - output.entries = entries_type(label, sum); - output.row_map = row_work; - } - - // Fill in the entries: - { - typename entries_type::HostMirror host_entries = - create_mirror_view(output.entries); - - size_t sum = 0; - for (size_t i = 0; i < length; ++i) { - for (size_t j = 0; j < input[i].size(); ++j, ++sum) { - host_entries(sum) = input[i][j]; - } - } - - deep_copy(output.entries, host_entries); - } - - return output; -} - -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#endif /* #ifndef KOKKOS_IMPL_CRSARRAY_FACTORY_HPP */ diff --git a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp index 5a22bf31f37d..bb5d1c32096b 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp +++ b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp @@ -1,24 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE #endif +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.unordered_map; +#else #include +#endif +#include namespace Kokkos { namespace Impl { diff --git a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp index a979ee40d8c8..c5c5f1a0b48c 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp @@ -1,23 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_UNORDERED_MAP_IMPL_HPP #define KOKKOS_UNORDERED_MAP_IMPL_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.core_impl; +#else #include +#endif #include #include @@ -132,7 +125,7 @@ struct UnorderedMapHistogram { using size_type = typename map_type::size_type; using histogram_view = View; - using host_histogram_view = typename histogram_view::HostMirror; + using host_histogram_view = typename histogram_view::host_mirror_type; map_type m_map; histogram_view m_length; diff --git a/packages/kokkos/containers/unit_tests/CMakeLists.txt b/packages/kokkos/containers/unit_tests/CMakeLists.txt index bb3c943cb400..4e09f56babf9 100644 --- a/packages/kokkos/containers/unit_tests/CMakeLists.txt +++ b/packages/kokkos/containers/unit_tests/CMakeLists.txt @@ -11,7 +11,6 @@ foreach(Tag Threads;Serial;OpenMP;HPX;Cuda;HIP;SYCL) set(UnitTestSources UnitTestMain.cpp) set(dir ${CMAKE_CURRENT_BINARY_DIR}/${dir}) file(MAKE_DIRECTORY ${dir}) - set(DeprecatedTests Vector StaticCrsGraph) foreach( Name Bitset @@ -20,20 +19,17 @@ foreach(Tag Threads;Serial;OpenMP;HPX;Cuda;HIP;SYCL) DynViewAPI_generic DynViewAPI_rank12345 DynViewAPI_rank67 + DynRankView_Ctors + DynRankView_LayoutMember DynRankView_TeamScratch DynRankView_ViewCustomization ErrorReporter OffsetView ScatterView - StaticCrsGraph WithoutInitializing UnorderedMap - Vector ViewCtorPropEmbeddedDim ) - if(NOT Kokkos_ENABLE_DEPRECATED_CODE_4 AND Name IN_LIST DeprecatedTests) - continue() # skip tests for deprecated features if deprecated code 4 is not enabled - endif() # Write to a temporary intermediate file and call configure_file to avoid # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs. set(file ${dir}/Test${Tag}_${Name}.cpp) @@ -60,7 +56,5 @@ foreach(Tag Threads;Serial;OpenMP;HPX;Cuda;HIP;SYCL) endif() endforeach() -set(COMPILE_ONLY_SOURCES TestCreateMirror.cpp TestDualViewParameterPack.cpp TestIsViewTrait.cpp - TestDynRankViewTypedefs.cpp -) +set(COMPILE_ONLY_SOURCES TestCreateMirror.cpp TestIsViewTrait.cpp TestDynRankViewTypedefs.cpp) kokkos_add_executable(ContainersTestCompileOnly SOURCES TestCompileMain.cpp ${COMPILE_ONLY_SOURCES}) diff --git a/packages/kokkos/containers/unit_tests/Makefile b/packages/kokkos/containers/unit_tests/Makefile deleted file mode 100644 index 73da3c4e2faa..000000000000 --- a/packages/kokkos/containers/unit_tests/Makefile +++ /dev/null @@ -1,174 +0,0 @@ -KOKKOS_PATH = ../.. - -GTEST_PATH = ../../TPL/gtest - -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests/openmp -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests/hpx -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests/serial -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests/threads -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests/hip -vpath %.cpp ${KOKKOS_PATH}/containers/unit_tests/cuda -vpath %.cpp ${CURDIR} -default: build_all - echo "End Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) - CXX = $(KOKKOS_PATH)/bin/nvcc_wrapper -else - CXX = g++ -endif - -CXXFLAGS = -O3 -LINK ?= $(CXX) -LDFLAGS ?= -override LDFLAGS += -lpthread - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -include $(KOKKOS_PATH)/Makefile.kokkos - -KOKKOS_CXXFLAGS += -I$(GTEST_PATH) -I${KOKKOS_PATH}/containers/unit_tests -I${KOKKOS_PATH}/core/unit_test/category_files - -TEST_TARGETS = -TARGETS = - -TESTS = Bitset DualView DynamicView DynViewAPI_generic DynViewAPI_rank12345 DynViewAPI_rank67 ErrorReporter OffsetView ScatterView UnorderedMap ViewCtorPropEmbeddedDim -tmp := $(foreach device, $(KOKKOS_DEVICELIST), \ - tmp2 := $(foreach test, $(TESTS), \ - $(if $(filter Test$(device)_$(test).cpp, $(shell ls Test$(device)_$(test).cpp 2>/dev/null)),,\ - $(shell echo "$(H)include" > Test$(device)_$(test).cpp); \ - $(shell echo "$(H)include" >> Test$(device)_$(test).cpp); \ - )\ - ) \ -) - -ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) - OBJ_CUDA = UnitTestMain.o gtest-all.o - OBJ_CUDA += TestCuda_Bitset.o - OBJ_CUDA += TestCuda_DualView.o - OBJ_CUDA += TestCuda_DynamicView.o - OBJ_CUDA += TestCuda_DynViewAPI_generic.o - OBJ_CUDA += TestCuda_DynViewAPI_rank12345.o - OBJ_CUDA += TestCuda_DynViewAPI_rank67.o - OBJ_CUDA += TestCuda_ErrorReporter.o - OBJ_CUDA += TestCuda_OffsetView.o - OBJ_CUDA += TestCuda_ScatterView.o - OBJ_CUDA += TestCuda_UnorderedMap.o - OBJ_CUDA += TestCuda_ViewCtorPropEmbeddedDim.o - TARGETS += KokkosContainers_UnitTest_Cuda - TEST_TARGETS += test-cuda -endif - -ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) - OBJ_THREADS = UnitTestMain.o gtest-all.o - OBJ_THREADS += TestThreads_Bitset.o - OBJ_THREADS += TestThreads_DualView.o - OBJ_THREADS += TestThreads_DynamicView.o - OBJ_THREADS += TestThreads_DynViewAPI_generic.o - OBJ_THREADS += TestThreads_DynViewAPI_rank12345.o - OBJ_THREADS += TestThreads_DynViewAPI_rank67.o - OBJ_THREADS += TestThreads_ErrorReporter.o - OBJ_THREADS += TestThreads_OffsetView.o - OBJ_THREADS += TestThreads_ScatterView.o - OBJ_THREADS += TestThreads_UnorderedMap.o - OBJ_THREADS += TestThreads_ViewCtorPropEmbeddedDim.o - TARGETS += KokkosContainers_UnitTest_Threads - TEST_TARGETS += test-threads -endif - -ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) - OBJ_OPENMP = UnitTestMain.o gtest-all.o - OBJ_OPENMP += TestOpenMP_Bitset.o - OBJ_OPENMP += TestOpenMP_DualView.o - OBJ_OPENMP += TestOpenMP_DynamicView.o - OBJ_OPENMP += TestOpenMP_DynViewAPI_generic.o - OBJ_OPENMP += TestOpenMP_DynViewAPI_rank12345.o - OBJ_OPENMP += TestOpenMP_DynViewAPI_rank67.o - OBJ_OPENMP += TestOpenMP_ErrorReporter.o - OBJ_OPENMP += TestOpenMP_OffsetView.o - OBJ_OPENMP += TestOpenMP_ScatterView.o - OBJ_OPENMP += TestOpenMP_UnorderedMap.o - OBJ_OPENMP += TestOpenMP_ViewCtorPropEmbeddedDim.o - TARGETS += KokkosContainers_UnitTest_OpenMP - TEST_TARGETS += test-openmp -endif - -ifeq ($(KOKKOS_INTERNAL_USE_HPX), 1) - OBJ_HPX = UnitTestMain.o gtest-all.o - OBJ_HPX += TestHPX_Bitset.o - OBJ_HPX += TestHPX_DualView.o - OBJ_HPX += TestHPX_DynamicView.o - OBJ_HPX += TestHPX_DynViewAPI_generic.o - OBJ_HPX += TestHPX_DynViewAPI_rank12345.o - OBJ_HPX += TestHPX_DynViewAPI_rank67.o - OBJ_HPX += TestHPX_ErrorReporter.o - OBJ_HPX += TestHPX_OffsetView.o - OBJ_HPX += TestHPX_ScatterView.o - OBJ_HPX += TestHPX_UnorderedMap.o - OBJ_HPX += TestHPX_ViewCtorPropEmbeddedDim.o - TARGETS += KokkosContainers_UnitTest_HPX - TEST_TARGETS += test-hpx -endif - -ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) - OBJ_SERIAL = UnitTestMain.o gtest-all.o - OBJ_SERIAL += TestSerial_Bitset.o - OBJ_SERIAL += TestSerial_DualView.o - OBJ_SERIAL += TestSerial_DynamicView.o - OBJ_SERIAL += TestSerial_DynViewAPI_generic.o - OBJ_SERIAL += TestSerial_DynViewAPI_rank12345.o - OBJ_SERIAL += TestSerial_DynViewAPI_rank67.o - OBJ_SERIAL += TestSerial_ErrorReporter.o - OBJ_SERIAL += TestSerial_OffsetView.o - OBJ_SERIAL += TestSerial_ScatterView.o - OBJ_SERIAL += TestSerial_UnorderedMap.o - OBJ_SERIAL += TestSerial_ViewCtorPropEmbeddedDim.o - TARGETS += KokkosContainers_UnitTest_Serial - TEST_TARGETS += test-serial -endif - -KokkosContainers_UnitTest_Cuda: $(OBJ_CUDA) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_CUDA) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosContainers_UnitTest_Cuda - -KokkosContainers_UnitTest_Threads: $(OBJ_THREADS) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_THREADS) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosContainers_UnitTest_Threads - -KokkosContainers_UnitTest_OpenMP: $(OBJ_OPENMP) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_OPENMP) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosContainers_UnitTest_OpenMP - -KokkosContainers_UnitTest_HPX: $(OBJ_HPX) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_HPX) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosContainers_UnitTest_HPX - -KokkosContainers_UnitTest_Serial: $(OBJ_SERIAL) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_SERIAL) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosContainers_UnitTest_Serial - -test-cuda: KokkosContainers_UnitTest_Cuda - ./KokkosContainers_UnitTest_Cuda - -test-threads: KokkosContainers_UnitTest_Threads - ./KokkosContainers_UnitTest_Threads - -test-openmp: KokkosContainers_UnitTest_OpenMP - ./KokkosContainers_UnitTest_OpenMP - -test-hpx: KokkosContainers_UnitTest_HPX - ./KokkosContainers_UnitTest_HPX - -test-serial: KokkosContainers_UnitTest_Serial - ./KokkosContainers_UnitTest_Serial - -build_all: $(TARGETS) - -test: $(TEST_TARGETS) - -clean: kokkos-clean - rm -f *.o $(TARGETS) *.cpp - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< - -gtest-all.o:$(GTEST_PATH)/gtest/gtest-all.cc - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $(GTEST_PATH)/gtest/gtest-all.cc diff --git a/packages/kokkos/containers/unit_tests/TestBitset.hpp b/packages/kokkos/containers/unit_tests/TestBitset.hpp index 91dc1710e5f8..fc0c1e90b47d 100644 --- a/packages/kokkos/containers/unit_tests/TestBitset.hpp +++ b/packages/kokkos/containers/unit_tests/TestBitset.hpp @@ -1,26 +1,19 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_BITSET_HPP #define KOKKOS_TEST_BITSET_HPP #include #include -#include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.bitset; +import kokkos.core; +#else #include +#include +#endif #include #include <../../core/unit_test/tools/include/ToolTestingUtilities.hpp> diff --git a/packages/kokkos/containers/unit_tests/TestCompileMain.cpp b/packages/kokkos/containers/unit_tests/TestCompileMain.cpp index fe164b5ba81e..ea9d8eb1805c 100644 --- a/packages/kokkos/containers/unit_tests/TestCompileMain.cpp +++ b/packages/kokkos/containers/unit_tests/TestCompileMain.cpp @@ -1,17 +1,4 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project int main() {} diff --git a/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp b/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp index 8556f756b0bc..884f94ec31cf 100644 --- a/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp +++ b/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp @@ -1,23 +1,20 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dynamic_view; +import kokkos.dyn_rank_view; +import kokkos.offset_view; +#else #include #include #include #include +#endif + +#include template void check_memory_space(TestView, MemorySpace) { @@ -38,9 +35,9 @@ void test_create_mirror_properties(const View& view) { using DeviceMemorySpace = typename DefaultExecutionSpace::memory_space; // clang-format off - + // create_mirror - // FIXME DynamicView: HostMirror is the same type + // FIXME DynamicView: host_mirror_type is the same type if constexpr (!is_dynamic_view::value) { check_memory_space(create_mirror(WithoutInitializing, view), host_mirror_test_space(view)); check_memory_space(create_mirror( view), host_mirror_test_space(view)); @@ -49,7 +46,7 @@ void test_create_mirror_properties(const View& view) { check_memory_space(create_mirror( DefaultExecutionSpace{}, view), DeviceMemorySpace{}); // create_mirror_view - // FIXME DynamicView: HostMirror is the same type + // FIXME DynamicView: host_mirror_type is the same type if constexpr (!is_dynamic_view::value) { check_memory_space(create_mirror_view(WithoutInitializing, view), host_mirror_test_space(view)); check_memory_space(create_mirror_view( view), host_mirror_test_space(view)); @@ -58,7 +55,7 @@ void test_create_mirror_properties(const View& view) { check_memory_space(create_mirror_view( DefaultExecutionSpace{}, view), DeviceMemorySpace{}); // create_mirror view_alloc - // FIXME DynamicView: HostMirror is the same type + // FIXME DynamicView: host_mirror_type is the same type if constexpr (!is_dynamic_view::value) { check_memory_space(create_mirror(view_alloc(WithoutInitializing), view), host_mirror_test_space(view)); check_memory_space(create_mirror(view_alloc(), view), host_mirror_test_space(view)); @@ -67,7 +64,7 @@ void test_create_mirror_properties(const View& view) { check_memory_space(create_mirror(view_alloc( DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view view_alloc - // FIXME DynamicView: HostMirror is the same type + // FIXME DynamicView: host_mirror_type is the same type if constexpr (!is_dynamic_view::value) { check_memory_space(create_mirror_view(view_alloc(WithoutInitializing), view), host_mirror_test_space(view)); check_memory_space(create_mirror_view(view_alloc(), view), host_mirror_test_space(view)); @@ -76,7 +73,7 @@ void test_create_mirror_properties(const View& view) { check_memory_space(create_mirror_view(view_alloc( DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror view_alloc + execution space - // FIXME DynamicView: HostMirror is the same type + // FIXME DynamicView: host_mirror_type is the same type if constexpr (!is_dynamic_view::value) { check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); @@ -85,7 +82,7 @@ void test_create_mirror_properties(const View& view) { check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view view_alloc + execution space - // FIXME DynamicView: HostMirror is the same type + // FIXME DynamicView: host_mirror_type is the same type if constexpr (!is_dynamic_view::value) { check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); diff --git a/packages/kokkos/containers/unit_tests/TestDualView.hpp b/packages/kokkos/containers/unit_tests/TestDualView.hpp index c4fe9c4fa031..9046236dba28 100644 --- a/packages/kokkos/containers/unit_tests/TestDualView.hpp +++ b/packages/kokkos/containers/unit_tests/TestDualView.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_DUALVIEW_HPP #define KOKKOS_TEST_DUALVIEW_HPP @@ -21,8 +8,15 @@ #include #include #include -#include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dual_view; +#else +#include #include +#endif +#include namespace Test { @@ -775,6 +769,24 @@ TEST(TEST_CATEGORY, dualview_default_constructed) { ASSERT_FALSE(dv.need_sync_device()); dv.sync_device(); } + +TEST(TEST_CATEGORY, dualview_resize_single_device) { + using dv_t = Kokkos::DualView; + dv_t dv("DV", 10); + bool is_same_device = std::is_same_v; + + dv.resize(20); + ASSERT_EQ(!is_same_device, dv.need_sync_host()); + ASSERT_FALSE(dv.need_sync_device()); + + dv.sync_host(); + dv.modify_host(); + dv.resize(30); + ASSERT_FALSE(dv.need_sync_host()); + ASSERT_EQ(!is_same_device, dv.need_sync_device()); +} + } // anonymous namespace } // namespace Test diff --git a/packages/kokkos/containers/unit_tests/TestDualViewParameterPack.cpp b/packages/kokkos/containers/unit_tests/TestDualViewParameterPack.cpp deleted file mode 100644 index 861eba2b3e42..000000000000 --- a/packages/kokkos/containers/unit_tests/TestDualViewParameterPack.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#include -#include - -namespace { - -template -void not_supported_anymore( - Kokkos::DualView x) { - static_assert(Kokkos::is_dual_view_v); -} - -template -void prefer_instead(Kokkos::DualView x) { - static_assert(Kokkos::is_dual_view_v); -} - -using KDV = Kokkos::DualView; - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -static_assert( - std::is_void_v()))>); -#endif - -static_assert(std::is_void_v()))>); - -} // namespace diff --git a/packages/kokkos/containers/unit_tests/TestDynRankViewTypedefs.cpp b/packages/kokkos/containers/unit_tests/TestDynRankViewTypedefs.cpp index 46bf9c7ce263..2bc2a0c58729 100644 --- a/packages/kokkos/containers/unit_tests/TestDynRankViewTypedefs.cpp +++ b/packages/kokkos/containers/unit_tests/TestDynRankViewTypedefs.cpp @@ -1,21 +1,19 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dyn_rank_view; +#else #include #include +#endif + +#include + +#include +#include namespace { @@ -56,16 +54,20 @@ constexpr bool test_view_typedefs_impl() { static_assert(std::is_same_v); static_assert(std::is_same_v::const_data_type>); static_assert(std::is_same_v::non_const_data_type>); - + + KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() + #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_5 // FIXME: these should be deprecated and for proper testing (I.e. where this is different from data_type) // we would need ensemble types which use the hidden View dimension facility of View (i.e. which make // "specialize" not void) static_assert(std::is_same_v); static_assert(std::is_same_v::const_data_type>); static_assert(std::is_same_v::non_const_data_type>); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + #endif + #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static_assert(std::is_same_v); -#endif + #endif + KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() // FIXME: value_type definition conflicts with mdspan value_type static_assert(std::is_same_v); @@ -84,19 +86,27 @@ constexpr bool test_view_typedefs_impl() { static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); - + // FIXME: should be deprecated in favor of reference static_assert(std::is_same_v); // FIXME: should be deprecated in favor of data_handle_type static_assert(std::is_same_v); - + // ========================================= // in Legacy View: some helper View variants // ========================================= // FIXME: in contrast to View, hooks_policy is not propagated static_assert(std::is_same_v); +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_5 +KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() static_assert(std::is_same_v>); +KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() +#endif + static_assert(std::is_same_v>); @@ -108,7 +118,7 @@ constexpr bool test_view_typedefs_impl() { Kokkos::DynRankView>); - static_assert(std::is_same_v>); @@ -173,6 +183,14 @@ constexpr bool test_view_typedefs_impl() { // FIXME: should come from accessor_type static_assert(std::is_same_v); static_assert(std::is_same_v); + + #ifndef KOKKOS_ENABLE_IMPL_VIEW_LEGACY + using base_view_type = typename ViewType::view_type; + static_assert( + std::is_same_v); + static_assert( + std::is_same_v); + #endif return true; } @@ -189,7 +207,7 @@ constexpr bool test_view_typedefs(ViewParams) { constexpr bool is_host_exec = std::is_same_v; -#if defined(KOKKOS_ENABLE_CUDA_UVM) || defined(KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY) || defined(KOKKOS_IMPL_HIP_UNIFIED_MEMORY) +#if defined(KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY) || defined(KOKKOS_IMPL_HIP_UNIFIED_MEMORY) constexpr bool has_unified_mem_space = true; #else constexpr bool has_unified_mem_space = false; diff --git a/packages/kokkos/containers/unit_tests/TestDynRankView_Ctors.hpp b/packages/kokkos/containers/unit_tests/TestDynRankView_Ctors.hpp new file mode 100644 index 000000000000..445557e88ddf --- /dev/null +++ b/packages/kokkos/containers/unit_tests/TestDynRankView_Ctors.hpp @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include + +#include + +namespace { + +void test_dyn_rank_view_ctor_from_members() { + using drview_t = Kokkos::DynRankView; + using view_t = typename drview_t::view_type; + + { + view_t data("data", 2, 3, 4, 5, 6, 7, 8); + drview_t drv(data, 7); + + ASSERT_EQ(drv.rank(), 7lu); + for (size_t r = 0; r < drv.rank(); r++) + ASSERT_EQ(static_cast(drv.extent(r)), r + 2); + ASSERT_EQ(data.use_count(), 2); + ASSERT_EQ(data.data(), drv.data()); + } + { + view_t data("data", 2, 3, 4, 1, 1, 1, 1); + drview_t drv(data, 3); + + ASSERT_EQ(drv.rank(), 3lu); + for (size_t r = 0; r < drv.rank(); r++) + ASSERT_EQ(static_cast(drv.extent(r)), r + 2); + ASSERT_EQ(data.use_count(), 2); + ASSERT_EQ(data.data(), drv.data()); + } + { + view_t data("data", 1, 1, 1, 1, 1, 1, 1); + drview_t drv(data, 0); + + ASSERT_EQ(drv.rank(), 0lu); + ASSERT_EQ(data.use_count(), 2); + ASSERT_EQ(data.data(), drv.data()); + } +} + +TEST(TEST_CATEGORY, dyn_rank_view_ctor_from_members) { + test_dyn_rank_view_ctor_from_members(); +} + +#ifndef KOKKOS_ENABLE_IMPL_VIEW_LEGACY +void test_dyn_rank_view_ctor_from_layout_stride() { + using drview_t = + Kokkos::DynRankView; + using view_t = typename drview_t::view_type; + { + typename view_t::mapping_type map( + Kokkos::dextents(2, 3, 4, 5, 6, 7, 8), + std::array{1, 2, 6, 24, 120, 720, 5040}); + view_t data("data", map); + drview_t drv(data, 7); + + ASSERT_EQ(drv.rank(), 7lu); + for (size_t r = 0; r < drv.rank(); r++) + ASSERT_EQ(static_cast(drv.extent(r)), r + 2); + ASSERT_EQ(data.use_count(), 2); + ASSERT_EQ(data.data(), drv.data()); + } + { + typename view_t::mapping_type map( + Kokkos::dextents(2, 3, 4, 1, 1, 1, 1), + std::array{1, 2, 6, 1, 1, 1, 1}); + view_t data("data", map); + drview_t drv(data, 3); + + ASSERT_EQ(drv.rank(), 3lu); + for (size_t r = 0; r < drv.rank(); r++) + ASSERT_EQ(static_cast(drv.extent(r)), r + 2); + ASSERT_EQ(data.use_count(), 2); + ASSERT_EQ(data.data(), drv.data()); + } + { + typename view_t::mapping_type map( + Kokkos::dextents(1, 1, 1, 1, 1, 1, 1), + std::array{1, 1, 1, 1, 1, 1, 1}); + view_t data("data", map); + drview_t drv(data, 0); + + ASSERT_EQ(drv.rank(), 0lu); + ASSERT_EQ(data.use_count(), 2); + ASSERT_EQ(data.data(), drv.data()); + } +} + +TEST(TEST_CATEGORY, dyn_rank_view_ctor_from_layout_stride) { + test_dyn_rank_view_ctor_from_layout_stride(); +} +#endif + +} // namespace diff --git a/packages/kokkos/containers/unit_tests/TestDynRankView_LayoutMember.hpp b/packages/kokkos/containers/unit_tests/TestDynRankView_LayoutMember.hpp new file mode 100644 index 000000000000..56dc3f0e1231 --- /dev/null +++ b/packages/kokkos/containers/unit_tests/TestDynRankView_LayoutMember.hpp @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include + +#include + +namespace { + +template +void test_dyn_rank_view_layout_member() { + constexpr bool is_ll = std::is_same_v; + { + Kokkos::DynRankView a( + Kokkos::View("A", 11, 7, 5)); + auto l = a.layout(); + ASSERT_EQ(l.dimension[0], 11lu); + ASSERT_EQ(l.dimension[1], 7lu); + ASSERT_EQ(l.dimension[2], 5lu); +#ifdef KOKKOS_ENABLE_IMPL_VIEW_LEGACY + ASSERT_TRUE((l.stride == is_ll ? 11lu : KOKKOS_INVALID_INDEX)); +#else + ASSERT_TRUE((l.stride == is_ll ? 11lu : 5lu)); +#endif + } + { + Kokkos::DynRankView a(Kokkos::View("A", 7, 5)); + auto l = a.layout(); + ASSERT_EQ(l.dimension[0], 7lu); + ASSERT_EQ(l.dimension[1], 5lu); +#ifdef KOKKOS_ENABLE_IMPL_VIEW_LEGACY + ASSERT_TRUE((l.stride == is_ll ? 7lu : KOKKOS_INVALID_INDEX)); +#else + ASSERT_TRUE((l.stride == is_ll ? 7lu : 5lu)); +#endif + } +} + +} // namespace + +TEST(TEST_CATEGORY, dyn_rank_view_layout_member) { + test_dyn_rank_view_layout_member(); + test_dyn_rank_view_layout_member(); +} + +TEST(TEST_CATEGORY, dyn_rank_view_layout_bug) { + Kokkos::DynRankView a("A", 10, 11); + // The following call failed with an error with legacy View off + Kokkos::DynRankView b("B", a.layout()); +#ifndef KOKKOS_ENABLE_IMPL_VIEW_LEGACY + ASSERT_EQ(a.mapping(), b.mapping()); +#endif +} diff --git a/packages/kokkos/containers/unit_tests/TestDynRankView_TeamScratch.hpp b/packages/kokkos/containers/unit_tests/TestDynRankView_TeamScratch.hpp index d03bf0960c1f..96eb83af90f3 100644 --- a/packages/kokkos/containers/unit_tests/TestDynRankView_TeamScratch.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynRankView_TeamScratch.hpp @@ -1,22 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dyn_rank_view; +#else +#include #include +#endif namespace { diff --git a/packages/kokkos/containers/unit_tests/TestDynRankView_ViewCustomization.hpp b/packages/kokkos/containers/unit_tests/TestDynRankView_ViewCustomization.hpp index 0b8c6a341dcb..7bb538b4498b 100644 --- a/packages/kokkos/containers/unit_tests/TestDynRankView_ViewCustomization.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynRankView_ViewCustomization.hpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include // Duplicate from @@ -55,13 +47,14 @@ struct TestAccessorStrided { KOKKOS_DEFAULTED_FUNCTION constexpr TestAccessorStrided() = default; - template , Kokkos::default_accessor>, int> = 0> KOKKOS_FUNCTION constexpr TestAccessorStrided( - const TestAccessorStrided& other) noexcept + const TestAccessorStrided& + other) noexcept : size(other.size), stride(other.stride) {} KOKKOS_FUNCTION @@ -203,4 +196,75 @@ TEST(TEST_CATEGORY, view_customization_extra_int_arg) { sizeof(double); ASSERT_EQ(shmem, expected_shmem_size); } + // Rank 7 + { + view_t a("A", 2, 3, 2, 7, 2, 11, 2, 5); + ASSERT_EQ(a.rank(), 7lu); + ASSERT_EQ(a.extent(0), 2lu); + ASSERT_EQ(a.extent(1), 3lu); + ASSERT_EQ(a.extent(2), 2lu); + ASSERT_EQ(a.extent(3), 7lu); + ASSERT_EQ(a.extent(4), 2lu); + ASSERT_EQ(a.extent(5), 11lu); + ASSERT_EQ(a.extent(2), 2lu); + ASSERT_EQ(a.accessor().size, 5lu); + ASSERT_EQ(a.accessor().stride, size_t(16 * 3 * 7 * 11)); + view_t b(a.data(), 2, 3, 2, 7, 2, 11, 2, 5); + ASSERT_EQ(b.rank(), 7lu); + ASSERT_EQ(b.extent(0), 2lu); + ASSERT_EQ(b.extent(1), 3lu); + ASSERT_EQ(b.extent(2), 2lu); + ASSERT_EQ(b.extent(3), 7lu); + ASSERT_EQ(b.extent(4), 2lu); + ASSERT_EQ(b.extent(5), 11lu); + ASSERT_EQ(b.extent(6), 2lu); + ASSERT_EQ(b.accessor().size, 5lu); + ASSERT_EQ(b.accessor().stride, size_t(16 * 3 * 7 * 11)); + size_t shmem = view_t::shmem_size(2, 3, 2, 7, 2, 11, 2, 5); + size_t expected_shmem_size = + 2lu * 3lu * 2lu * 7lu * 2lu * 11lu * 2lu * 5lu * sizeof(double) + + sizeof(double); + ASSERT_EQ(shmem, expected_shmem_size); + } + // With accessor arg and no label + { + // This should not interpret the last argument (11) as an accessor arg since + // we are providing AccessorArg_t explicitly + // Note that with and without + // labels are two separate cases + view_t a(Kokkos::view_alloc(Kokkos::Impl::AccessorArg_t{5ul}), 3, 7, 11); + ASSERT_EQ(a.rank(), 3lu); + ASSERT_EQ(a.extent(0), 3lu); + ASSERT_EQ(a.extent(1), 7lu); + ASSERT_EQ(a.extent(2), 11lu); + ASSERT_EQ(a.accessor().size, 5lu); + ASSERT_EQ(a.accessor().stride, size_t(3 * 7 * 11)); + } + // With accessor arg and label + { + // This should not interpret the last argument (11) as an accessor arg since + // we are providing AccessorArg_t explicitly + // Note that with and without + // labels are two separate cases + view_t a(Kokkos::view_alloc("A", Kokkos::Impl::AccessorArg_t{5ul}), 3, 7, + 11); + ASSERT_EQ(a.rank(), 3lu); + ASSERT_EQ(a.extent(0), 3lu); + ASSERT_EQ(a.extent(1), 7lu); + ASSERT_EQ(a.extent(2), 11lu); + ASSERT_EQ(a.accessor().size, 5lu); + ASSERT_EQ(a.accessor().stride, size_t(3 * 7 * 11)); + } + // Create mirror + { + view_t a("A", 3, 7, 11, 5); + + auto b = Kokkos::create_mirror(a); + ASSERT_EQ(b.rank(), 3lu); + ASSERT_EQ(b.extent(0), 3lu); + ASSERT_EQ(b.extent(1), 7lu); + ASSERT_EQ(b.extent(2), 11lu); + ASSERT_EQ(b.accessor().size, 5lu); + ASSERT_EQ(b.accessor().stride, size_t(3 * 7 * 11)); + } } diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp index b26b0b2ff295..2a170553cf31 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp @@ -1,25 +1,19 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dyn_rank_view; +import kokkos.dyn_rank_view_impl; +#else #include +#include +#endif #include #include -#include /*--------------------------------------------------------------------------*/ @@ -701,7 +695,11 @@ class TestDynViewAPI { } static void run_operator_test_rank67() { + // FIXME_CLANG 22 The test triggers an internal compiler error in clang 22. +#if !defined(KOKKOS_COMPILER_CLANG) || (KOKKOS_COMPILER_CLANG < 2200) || \ + (KOKKOS_COMPILER_CLANG > 2210) TestViewOperator_LeftAndRight::testit(2, 3, 4, 2, 3, 4, 2); +#endif TestViewOperator_LeftAndRight::testit(2, 3, 4, 2, 3, 4); } @@ -731,7 +729,7 @@ class TestDynViewAPI { static void run_test_mirror() { using view_type = Kokkos::DynRankView; - using mirror_type = typename view_type::HostMirror; + using mirror_type = typename view_type::host_mirror_type; view_type a("a"); mirror_type am = Kokkos::create_mirror_view(a); mirror_type ax = Kokkos::create_mirror(a); @@ -1117,8 +1115,9 @@ class TestDynViewAPI { } static void run_test_scalar() { - using hView0 = typename dView0::HostMirror; // HostMirror of DynRankView is - // a DynRankView + using hView0 = + typename dView0::host_mirror_type; // host_mirror_type of DynRankView + // is a DynRankView dView0 dx, dy; hView0 hx, hy; @@ -1216,7 +1215,7 @@ class TestDynViewAPI { // usual "(void)" marker to avoid compiler warnings for unused // variables. - using hView0 = typename dView0::HostMirror; + using hView0 = typename dView0::host_mirror_type; { hView0 thing; @@ -1691,8 +1690,8 @@ class TestDynViewAPI { ASSERT_EQ(ds5.extent(4), ds5plus.extent(4)); ASSERT_EQ(ds5.extent(5), ds5plus.extent(5)); -#if (!defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_UVM)) && \ - !defined(KOKKOS_ENABLE_HIP) && !defined(KOKKOS_ENABLE_SYCL) +#if !defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_HIP) && \ + !defined(KOKKOS_ENABLE_SYCL) ASSERT_EQ(&ds5(1, 1, 1, 1, 0) - &ds5plus(1, 1, 1, 1, 0), 0); ASSERT_EQ(&ds5(1, 1, 1, 1, 0, 0) - &ds5plus(1, 1, 1, 1, 0, 0), 0); // passing argument to rank beyond the view's rank is allowed diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp index d4747538d9b2..b71fb2d0ede5 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include namespace Test { diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp index 9cefad190a54..a32a4758c935 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp index 703811e0f4b4..71a920bd78c0 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include namespace Test { diff --git a/packages/kokkos/containers/unit_tests/TestDynamicView.hpp b/packages/kokkos/containers/unit_tests/TestDynamicView.hpp index 803650ffc6a1..a78ab39ea27d 100644 --- a/packages/kokkos/containers/unit_tests/TestDynamicView.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynamicView.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_DYNAMICVIEW_HPP #define KOKKOS_TEST_DYNAMICVIEW_HPP @@ -21,9 +8,14 @@ #include #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dynamic_view; +#else #include - #include +#endif #include namespace Test { @@ -220,7 +212,8 @@ struct TestDynamicView { // Case 4: { using device_view_type = Kokkos::View; - using host_view_type = typename Kokkos::View::HostMirror; + using host_view_type = + typename Kokkos::View::host_mirror_type; view_type device_dynamic_view("on-device DynamicView", 1024, arg_total_size); diff --git a/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp b/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp index 4ebab889c78f..d86e11dbaabe 100644 --- a/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp +++ b/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp @@ -1,26 +1,19 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_EXPERIMENTAL_ERROR_REPORTER_HPP #define KOKKOS_TEST_EXPERIMENTAL_ERROR_REPORTER_HPP #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.error_reporter; +#else #include #include +#endif namespace Test { @@ -55,6 +48,7 @@ struct ErrorReporterDriverBase { using report_type = ThreeValReport; using error_reporter_type = Kokkos::Experimental::ErrorReporter; + error_reporter_type m_errorReporter; ErrorReporterDriverBase(int reporter_capacity, int /*test_size*/) @@ -66,8 +60,8 @@ struct ErrorReporterDriverBase { void check_expectations(int reporter_capacity, int test_size) { using namespace std; - int num_reported = m_errorReporter.getNumReports(); - int num_attempts = m_errorReporter.getNumReportAttempts(); + int num_reported = m_errorReporter.num_reports(); + int num_attempts = m_errorReporter.num_report_attempts(); int expected_num_reports = min(reporter_capacity, test_size / 2); EXPECT_EQ(expected_num_reports, num_reported); @@ -82,36 +76,18 @@ struct ErrorReporterDriverBase { template void TestErrorReporter() { using tester_type = ErrorReporterDriverType; + std::vector reporters; std::vector reports; tester_type test1(100, 10); - test1.m_errorReporter.getReports(reporters, reports); - checkReportersAndReportsAgree(reporters, reports); - tester_type test2(10, 100); - test2.m_errorReporter.getReports(reporters, reports); + std::tie(reporters, reports) = test1.m_errorReporter.get_reports(); checkReportersAndReportsAgree(reporters, reports); - typename Kokkos::View< - int *, typename ErrorReporterDriverType::execution_space>::HostMirror - view_reporters; - typename Kokkos::View:: - HostMirror view_reports; - test2.m_errorReporter.getReports(view_reporters, view_reports); - - int num_reports = view_reporters.extent(0); - reporters.clear(); - reports.clear(); - reporters.reserve(num_reports); - reports.reserve(num_reports); - - for (int i = 0; i < num_reports; ++i) { - reporters.push_back(view_reporters(i)); - reports.push_back(view_reports(i)); - } - checkReportersAndReportsAgree(reporters, reports); + tester_type test2(10, 100); + auto [reporters2, reports2] = test2.m_errorReporter.get_reports(); + checkReportersAndReportsAgree(reporters2, reports2); } template @@ -122,12 +98,23 @@ struct ErrorReporterDriver : public ErrorReporterDriverBase { ErrorReporterDriver(int reporter_capacity, int test_size) : driver_base(reporter_capacity, test_size) { + EXPECT_EQ(driver_base::m_errorReporter.capacity(), reporter_capacity); + EXPECT_EQ(driver_base::m_errorReporter.num_reports(), 0); + EXPECT_EQ(driver_base::m_errorReporter.num_report_attempts(), 0); + execute(reporter_capacity, test_size); // Test that clear() and resize() work across memory spaces. if (reporter_capacity < test_size) { driver_base::m_errorReporter.clear(); + EXPECT_EQ(driver_base::m_errorReporter.capacity(), reporter_capacity); + EXPECT_EQ(driver_base::m_errorReporter.num_reports(), 0); + EXPECT_EQ(driver_base::m_errorReporter.num_report_attempts(), 0); + driver_base::m_errorReporter.resize(test_size); + EXPECT_EQ(driver_base::m_errorReporter.capacity(), test_size); + EXPECT_EQ(driver_base::m_errorReporter.num_reports(), 0); + EXPECT_EQ(driver_base::m_errorReporter.num_report_attempts(), 0); execute(test_size, test_size); } } @@ -213,5 +200,33 @@ TEST(TEST_CATEGORY, ErrorReporter) { TestErrorReporter>(); } +TEST(TEST_CATEGORY, ErrorReporter_label_ctor) { + Kokkos::Experimental::ErrorReporter logger("Reporter", + 10); +} + +void ErrorReporter_test_resize() { + Kokkos::Experimental::ErrorReporter logger("Reporter", + 10); + + // produce more errors when we can store + Kokkos::parallel_for( + "TestErrorReporter_resize", Kokkos::RangePolicy(0, 20), + KOKKOS_LAMBDA(int i) { logger.add_report(i, 0); }); + + ASSERT_EQ(logger.num_reports(), 10); + ASSERT_EQ(logger.num_report_attempts(), 20); + + logger.resize(15); + ASSERT_EQ(logger.num_reports(), 10); + ASSERT_EQ(logger.num_report_attempts(), 10); + + logger.resize(5); + ASSERT_EQ(logger.num_reports(), 5); + ASSERT_EQ(logger.num_report_attempts(), 10); +} + +TEST(TEST_CATEGORY, ErrorReporter_resize) { ErrorReporter_test_resize(); } + } // namespace Test #endif // #ifndef KOKKOS_TEST_ERROR_REPORTING_HPP diff --git a/packages/kokkos/containers/unit_tests/TestIsViewTrait.cpp b/packages/kokkos/containers/unit_tests/TestIsViewTrait.cpp index 994ba7ca0cbc..17b90ea6ab76 100644 --- a/packages/kokkos/containers/unit_tests/TestIsViewTrait.cpp +++ b/packages/kokkos/containers/unit_tests/TestIsViewTrait.cpp @@ -1,25 +1,22 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dual_view; +import kokkos.dyn_rank_view; +import kokkos.dynamic_view; +import kokkos.offset_view; +import kokkos.scatter_view; +#else #include #include #include #include #include #include +#endif namespace { diff --git a/packages/kokkos/containers/unit_tests/TestOffsetView.hpp b/packages/kokkos/containers/unit_tests/TestOffsetView.hpp index 4bd98117b1a0..02e3f9f12034 100644 --- a/packages/kokkos/containers/unit_tests/TestOffsetView.hpp +++ b/packages/kokkos/containers/unit_tests/TestOffsetView.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /* * FIXME the OffsetView class is really not very well tested. @@ -24,11 +11,15 @@ #include #include #include -#include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.offset_view; +#else +#include #include - -using std::cout; -using std::endl; +#endif +#include namespace Test { @@ -57,16 +48,6 @@ void test_offsetview_construction() { ASSERT_EQ("firstOV", ov.label()); -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS - KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() -#endif -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - ASSERT_EQ(2u, ov.Rank); -#endif -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS - KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() -#endif - ASSERT_EQ(2u, ov.rank()); ASSERT_EQ(ov.begin(0), -1); @@ -100,7 +81,7 @@ void test_offsetview_construction() { } { // test deep copy of scalar const value into mirro const int constVal = 6; - typename offset_view_type::HostMirror hostOffsetView = + typename offset_view_type::host_mirror_type hostOffsetView = Kokkos::create_mirror_view(ov); Kokkos::deep_copy(hostOffsetView, constVal); @@ -131,7 +112,7 @@ void test_offsetview_construction() { KOKKOS_LAMBDA(const int i, const int j) { ov(i, j) = constValue; }); // test offsetview to offsetviewmirror deep copy - typename offset_view_type::HostMirror hostOffsetView = + typename offset_view_type::host_mirror_type hostOffsetView = Kokkos::create_mirror_view(ov); Kokkos::deep_copy(hostOffsetView, ov); @@ -468,7 +449,7 @@ void test_offsetview_subview() { Kokkos::Experimental::OffsetView sliceMe("offsetToSlice", {-10, 20}); { - auto offsetSubview = Kokkos::Experimental::subview(sliceMe, 0); + auto offsetSubview = Kokkos::subview(sliceMe, 0); ASSERT_EQ(offsetSubview.rank(), 0u) << "subview of offset is broken."; } } @@ -476,14 +457,12 @@ void test_offsetview_subview() { Kokkos::Experimental::OffsetView sliceMe( "offsetToSlice", {-10, 20}, {-20, 30}); { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, Kokkos::ALL(), -2); + auto offsetSubview = Kokkos::subview(sliceMe, Kokkos::ALL(), -2); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, 0, Kokkos::ALL()); + auto offsetSubview = Kokkos::subview(sliceMe, 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } } @@ -495,24 +474,24 @@ void test_offsetview_subview() { // slice 1 { - auto offsetSubview = Kokkos::Experimental::subview(sliceMe, Kokkos::ALL(), - Kokkos::ALL(), 0); + auto offsetSubview = + Kokkos::subview(sliceMe, Kokkos::ALL(), Kokkos::ALL(), 0); ASSERT_EQ(offsetSubview.rank(), 2u) << "subview of offset is broken."; } { - auto offsetSubview = Kokkos::Experimental::subview(sliceMe, Kokkos::ALL(), - 0, Kokkos::ALL()); + auto offsetSubview = + Kokkos::subview(sliceMe, Kokkos::ALL(), 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 2u) << "subview of offset is broken."; } { - auto offsetSubview = Kokkos::Experimental::subview( - sliceMe, 0, Kokkos::ALL(), Kokkos::ALL()); + auto offsetSubview = + Kokkos::subview(sliceMe, 0, Kokkos::ALL(), Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 2u) << "subview of offset is broken."; } { - auto offsetSubview = Kokkos::Experimental::subview( - sliceMe, 0, Kokkos::ALL(), Kokkos::make_pair(-30, -21)); + auto offsetSubview = Kokkos::subview(sliceMe, 0, Kokkos::ALL(), + Kokkos::make_pair(-30, -21)); ASSERT_EQ(offsetSubview.rank(), 2u) << "subview of offset is broken."; ASSERT_EQ(offsetSubview.begin(0), -20); @@ -549,19 +528,16 @@ void test_offsetview_subview() { // slice 2 { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, Kokkos::ALL(), 0, 0); + auto offsetSubview = Kokkos::subview(sliceMe, Kokkos::ALL(), 0, 0); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, 0, 0, Kokkos::ALL()); + auto offsetSubview = Kokkos::subview(sliceMe, 0, 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, 0, Kokkos::ALL(), 0); + auto offsetSubview = Kokkos::subview(sliceMe, 0, Kokkos::ALL(), 0); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } } @@ -573,69 +549,65 @@ void test_offsetview_subview() { // slice 1 { - auto offsetSubview = Kokkos::Experimental::subview( - sliceMe, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL(), 0); + auto offsetSubview = Kokkos::subview(sliceMe, Kokkos::ALL(), + Kokkos::ALL(), Kokkos::ALL(), 0); ASSERT_EQ(offsetSubview.rank(), 3u) << "subview of offset is broken."; } { - auto offsetSubview = Kokkos::Experimental::subview( - sliceMe, Kokkos::ALL(), Kokkos::ALL(), 0, Kokkos::ALL()); + auto offsetSubview = Kokkos::subview(sliceMe, Kokkos::ALL(), + Kokkos::ALL(), 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 3u) << "subview of offset is broken."; } { - auto offsetSubview = Kokkos::Experimental::subview( - sliceMe, Kokkos::ALL(), 0, Kokkos::ALL(), Kokkos::ALL()); + auto offsetSubview = Kokkos::subview(sliceMe, Kokkos::ALL(), 0, + Kokkos::ALL(), Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 3u) << "subview of offset is broken."; } { - auto offsetSubview = Kokkos::Experimental::subview( - sliceMe, 0, Kokkos::ALL(), Kokkos::ALL(), Kokkos::ALL()); + auto offsetSubview = Kokkos::subview(sliceMe, 0, Kokkos::ALL(), + Kokkos::ALL(), Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 3u) << "subview of offset is broken."; } // slice 2 - auto offsetSubview2a = Kokkos::Experimental::subview(sliceMe, Kokkos::ALL(), - Kokkos::ALL(), 0, 0); + auto offsetSubview2a = + Kokkos::subview(sliceMe, Kokkos::ALL(), Kokkos::ALL(), 0, 0); ASSERT_EQ(offsetSubview2a.rank(), 2u) << "subview of offset is broken."; { - auto offsetSubview2b = Kokkos::Experimental::subview( - sliceMe, Kokkos::ALL(), 0, Kokkos::ALL(), 0); + auto offsetSubview2b = + Kokkos::subview(sliceMe, Kokkos::ALL(), 0, Kokkos::ALL(), 0); ASSERT_EQ(offsetSubview2b.rank(), 2u) << "subview of offset is broken."; } { - auto offsetSubview2b = Kokkos::Experimental::subview( - sliceMe, Kokkos::ALL(), 0, 0, Kokkos::ALL()); + auto offsetSubview2b = + Kokkos::subview(sliceMe, Kokkos::ALL(), 0, 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview2b.rank(), 2u) << "subview of offset is broken."; } { - auto offsetSubview2b = Kokkos::Experimental::subview( - sliceMe, 0, Kokkos::ALL(), 0, Kokkos::ALL()); + auto offsetSubview2b = + Kokkos::subview(sliceMe, 0, Kokkos::ALL(), 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview2b.rank(), 2u) << "subview of offset is broken."; } { - auto offsetSubview2b = Kokkos::Experimental::subview( - sliceMe, 0, 0, Kokkos::ALL(), Kokkos::ALL()); + auto offsetSubview2b = + Kokkos::subview(sliceMe, 0, 0, Kokkos::ALL(), Kokkos::ALL()); ASSERT_EQ(offsetSubview2b.rank(), 2u) << "subview of offset is broken."; } // slice 3 { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, Kokkos::ALL(), 0, 0, 0); + auto offsetSubview = Kokkos::subview(sliceMe, Kokkos::ALL(), 0, 0, 0); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, 0, Kokkos::ALL(), 0, 0); + auto offsetSubview = Kokkos::subview(sliceMe, 0, Kokkos::ALL(), 0, 0); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, 0, 0, Kokkos::ALL(), 0); + auto offsetSubview = Kokkos::subview(sliceMe, 0, 0, Kokkos::ALL(), 0); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } { - auto offsetSubview = - Kokkos::Experimental::subview(sliceMe, 0, 0, 0, Kokkos::ALL()); + auto offsetSubview = Kokkos::subview(sliceMe, 0, 0, 0, Kokkos::ALL()); ASSERT_EQ(offsetSubview.rank(), 1u) << "subview of offset is broken."; } } diff --git a/packages/kokkos/containers/unit_tests/TestScatterView.hpp b/packages/kokkos/containers/unit_tests/TestScatterView.hpp index 791271bfcac7..be965ecdafc4 100644 --- a/packages/kokkos/containers/unit_tests/TestScatterView.hpp +++ b/packages/kokkos/containers/unit_tests/TestScatterView.hpp @@ -1,23 +1,18 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_SCATTER_VIEW_HPP #define KOKKOS_TEST_SCATTER_VIEW_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.scatter_view; +import kokkos.scatter_view_impl; +#else +#include #include +#endif #include namespace Test { @@ -84,6 +79,8 @@ struct test_scatter_view_impl_cls - -#include - -#define KOKKOS_IMPL_DO_NOT_WARN_INCLUDE_STATIC_CRS_GRAPH -#include -#undef KOKKOS_IMPL_DO_NOT_WARN_INCLUDE_STATIC_CRS_GRAPH -#include - -/*--------------------------------------------------------------------------*/ -namespace Test { -namespace TestStaticCrsGraph { - -template -void run_test_graph() { - using dView = Kokkos::StaticCrsGraph; - using hView = typename dView::HostMirror; - - const unsigned LENGTH = 1000; - - std::vector > graph(LENGTH); - - for (size_t i = 0; i < LENGTH; ++i) { - graph[i].reserve(8); - for (size_t j = 0; j < 8; ++j) { - graph[i].push_back(i + j * 3); - } - } - - { - dView d1; - ASSERT_FALSE(d1.is_allocated()); - - d1 = Kokkos::create_staticcrsgraph("d1", graph); - - dView d2(d1); - dView d3(d1.entries, d1.row_map); - - ASSERT_TRUE(d1.is_allocated()); - ASSERT_TRUE(d2.is_allocated()); - ASSERT_TRUE(d3.is_allocated()); - } - - dView dx; - hView hx; - - dx = Kokkos::create_staticcrsgraph("dx", graph); - hx = Kokkos::create_mirror(dx); - - ASSERT_EQ(hx.row_map.extent(0) - 1, LENGTH); - - for (size_t i = 0; i < LENGTH; ++i) { - const size_t begin = hx.row_map[i]; - const size_t n = hx.row_map[i + 1] - begin; - ASSERT_EQ(n, graph[i].size()); - for (size_t j = 0; j < n; ++j) { - ASSERT_EQ((int)hx.entries(j + begin), graph[i][j]); - } - } - - // Test row view access - for (size_t i = 0; i < LENGTH; ++i) { - auto rowView = hx.rowConst(i); - ASSERT_EQ(rowView.length, graph[i].size()); - for (size_t j = 0; j < rowView.length; ++j) { - ASSERT_EQ(rowView.colidx(j), (size_t)graph[i][j]); - ASSERT_EQ(rowView(j), (size_t)graph[i][j]); - } - } -} - -template -void run_test_graph2() { - using dView = Kokkos::StaticCrsGraph; - using hView = typename dView::HostMirror; - - const unsigned LENGTH = 10; - - std::vector sizes(LENGTH); - - size_t total_length = 0; - - for (size_t i = 0; i < LENGTH; ++i) { - total_length += (sizes[i] = 6 + i % 4); - } - - dView dx = Kokkos::create_staticcrsgraph("test", sizes); - hView hx = Kokkos::create_mirror(dx); - hView mx = Kokkos::create_mirror(dx); - - ASSERT_EQ((size_t)dx.row_map.extent(0), (size_t)LENGTH + 1); - ASSERT_EQ((size_t)hx.row_map.extent(0), (size_t)LENGTH + 1); - ASSERT_EQ((size_t)mx.row_map.extent(0), (size_t)LENGTH + 1); - - ASSERT_EQ((size_t)dx.entries.extent(0), (size_t)total_length); - ASSERT_EQ((size_t)hx.entries.extent(0), (size_t)total_length); - ASSERT_EQ((size_t)mx.entries.extent(0), (size_t)total_length); - - ASSERT_EQ((size_t)dx.entries.extent(1), (size_t)3); - ASSERT_EQ((size_t)hx.entries.extent(1), (size_t)3); - ASSERT_EQ((size_t)mx.entries.extent(1), (size_t)3); - - for (size_t i = 0; i < LENGTH; ++i) { - const size_t entry_begin = hx.row_map[i]; - const size_t entry_end = hx.row_map[i + 1]; - for (size_t j = entry_begin; j < entry_end; ++j) { - hx.entries(j, 0) = j + 1; - hx.entries(j, 1) = j + 2; - hx.entries(j, 2) = j + 3; - } - } - - Kokkos::deep_copy(dx.entries, hx.entries); - Kokkos::deep_copy(mx.entries, dx.entries); - - ASSERT_EQ(mx.row_map.extent(0), (size_t)LENGTH + 1); - - for (size_t i = 0; i < LENGTH; ++i) { - const size_t entry_begin = mx.row_map[i]; - const size_t entry_end = mx.row_map[i + 1]; - ASSERT_EQ((entry_end - entry_begin), sizes[i]); - for (size_t j = entry_begin; j < entry_end; ++j) { - ASSERT_EQ((size_t)mx.entries(j, 0), (j + 1)); - ASSERT_EQ((size_t)mx.entries(j, 1), (j + 2)); - ASSERT_EQ((size_t)mx.entries(j, 2), (j + 3)); - } - } -} - -template -void run_test_graph3(size_t B, size_t N) { - srand(10310); - - using dView = Kokkos::StaticCrsGraph; - using hView = typename dView::HostMirror; - - const unsigned LENGTH = 2000; - - std::vector sizes(LENGTH); - - for (size_t i = 0; i < LENGTH; ++i) { - sizes[i] = rand() % 1000; - } - - sizes[1] = N; - sizes[1998] = N; - - int C = 0; - dView dx = Kokkos::create_staticcrsgraph("test", sizes); - dx.create_block_partitioning(B, C); - hView hx = Kokkos::create_mirror(dx); - - for (size_t i = 0; i < B; i++) { - size_t ne = 0; - for (auto j = hx.row_block_offsets(i); j < hx.row_block_offsets(i + 1); j++) - ne += hx.row_map(j + 1) - hx.row_map(j) + C; - - ASSERT_FALSE( - (ne > 2 * ((hx.row_map(hx.numRows()) + C * hx.numRows()) / B)) && - (hx.row_block_offsets(i + 1) > hx.row_block_offsets(i) + 1)); - } -} - -template -void run_test_graph4() { - using ordinal_type = unsigned int; - using layout_type = Kokkos::LayoutRight; - using space_type = Space; - using memory_traits_type = Kokkos::MemoryUnmanaged; - using dView = Kokkos::StaticCrsGraph; - using hView = typename dView::HostMirror; - - dView dx; - - // StaticCrsGraph with Unmanaged trait will contain row_map and entries - // members with the Unmanaged memory trait. Use of such a StaticCrsGraph - // requires an allocaton of memory for the unmanaged views to wrap. - // - // In this test, a graph (via raw arrays) resides on the host. - // The pointers are wrapped by unmanaged Views. - // To make use of this on the device, managed device Views are created - // (allocation required), and data from the unmanaged host views is deep - // copied to the device Views Unmanaged views of the appropriate type wrap the - // device data and are assigned to their corresponding unmanaged view members - // of the unmanaged StaticCrsGraph - - // Data types for raw pointers storing StaticCrsGraph info - using ptr_row_map_type = typename dView::size_type; - using ptr_entries_type = typename dView::data_type; - - const ordinal_type numRows = 8; - const ordinal_type nnz = 24; - ptr_row_map_type ptrRaw[] = {0, 4, 8, 10, 12, 14, 16, 20, 24}; - ptr_entries_type indRaw[] = {0, 1, 4, 5, 0, 1, 4, 5, 2, 3, 2, 3, - 4, 5, 4, 5, 2, 3, 6, 7, 2, 3, 6, 7}; - - // Wrap pointers in unmanaged host views - using local_row_map_type = typename hView::row_map_type; - using local_entries_type = typename hView::entries_type; - local_row_map_type unman_row_map(&(ptrRaw[0]), numRows + 1); - local_entries_type unman_entries(&(indRaw[0]), nnz); - - hView hx; - hx = hView(unman_entries, unman_row_map); - - // Create the device Views for copying the host arrays into - // An allocation is needed on the device for the unmanaged StaticCrsGraph to - // wrap the pointer - using d_row_map_view_type = - typename Kokkos::View; - using d_entries_view_type = - typename Kokkos::View; - - d_row_map_view_type tmp_row_map("tmp_row_map", numRows + 1); - d_entries_view_type tmp_entries("tmp_entries", nnz); - - Kokkos::deep_copy(tmp_row_map, unman_row_map); - Kokkos::deep_copy(tmp_entries, unman_entries); - - // Wrap the pointer in unmanaged View and assign to the corresponding - // StaticCrsGraph member - dx.row_map = typename dView::row_map_type(tmp_row_map.data(), numRows + 1); - dx.entries = typename dView::entries_type(tmp_entries.data(), nnz); - - ASSERT_TRUE((std::is_same_v)); - ASSERT_TRUE((std::is_same_v)); - ASSERT_TRUE((std::is_same_v)); - ASSERT_TRUE((std::is_same_v)); -} - -} /* namespace TestStaticCrsGraph */ - -TEST(TEST_CATEGORY, staticcrsgraph) { - TestStaticCrsGraph::run_test_graph(); - TestStaticCrsGraph::run_test_graph2(); - TestStaticCrsGraph::run_test_graph3(1, 0); - TestStaticCrsGraph::run_test_graph3(1, 1000); - TestStaticCrsGraph::run_test_graph3(1, 10000); - TestStaticCrsGraph::run_test_graph3(1, 100000); - TestStaticCrsGraph::run_test_graph3(3, 0); - TestStaticCrsGraph::run_test_graph3(3, 1000); - TestStaticCrsGraph::run_test_graph3(3, 10000); - TestStaticCrsGraph::run_test_graph3(3, 100000); - TestStaticCrsGraph::run_test_graph3(75, 0); - TestStaticCrsGraph::run_test_graph3(75, 1000); - TestStaticCrsGraph::run_test_graph3(75, 10000); - TestStaticCrsGraph::run_test_graph3(75, 100000); - TestStaticCrsGraph::run_test_graph4(); -} -} // namespace Test diff --git a/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp b/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp index fc7435a75e56..0408b35fb27d 100644 --- a/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp +++ b/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp @@ -1,25 +1,22 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_UNORDERED_MAP_HPP #define KOKKOS_TEST_UNORDERED_MAP_HPP #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.functional; +import kokkos.unordered_map; +import kokkos.unordered_map_impl; +#else +#include +#include #include +#endif namespace Test { @@ -75,7 +72,7 @@ struct TestInsert { ASSERT_EQ(map_h.size(), map.size()); if (!rehash_on_fail && CheckValues) { - typename expected_values_type::HostMirror expected_values_h = + typename expected_values_type::host_mirror_type expected_values_h = create_mirror_view(expected_values); Kokkos::deep_copy(expected_values_h, expected_values); for (unsigned i = 0; i < map_h.size(); i++) { @@ -349,7 +346,7 @@ void test_deep_copy(uint32_t num_nodes) { using const_map_type = Kokkos::UnorderedMap; - using host_map_type = typename map_type::HostMirror; + using host_map_type = typename map_type::host_mirror_type; map_type map; map.rehash(num_nodes, false); @@ -560,6 +557,48 @@ TEST(TEST_CATEGORY, UnorderedMap_constructor_view_alloc) { ASSERT_TRUE(map.is_allocated()); } +//////////////////////////Tests for UnorderedMap with View as value_type + +/** + * @test This test ensures that an @ref UnorderedMap with View as value_type can + * be built with SequentialHostInit instance (using @ref view_alloc). + */ +TEST(TEST_CATEGORY, UnorderedMap_View_as_value) { + using value_type = Kokkos::View; + using map_type = Kokkos::UnorderedMap; + map_type map(Kokkos::view_alloc(Kokkos::SequentialHostInit, "test view umap"), + 150); + // creation + ASSERT_EQ(map.size(), 0u); + ASSERT_GE(map.capacity(), 150u); + ASSERT_TRUE(map.is_allocated()); + + // insert + ASSERT_TRUE(map.insert(1, Kokkos::View( + "UnorderedMap inserted View one", 10)) + .success()); + ASSERT_TRUE(map.insert(2, Kokkos::View( + "UnorderedMap inserted View two", 20)) + .success()); + ASSERT_EQ(map.size(), 2u); + + // copy + map_type map_copy(map); + ASSERT_EQ(map_copy.size(), 2u); + ASSERT_GE(map_copy.capacity(), 150u); + ASSERT_TRUE(map_copy.is_allocated()); + + // rehash + ASSERT_TRUE(map.rehash(200u)); + ASSERT_GE(map.capacity(), 200u); + ASSERT_TRUE(map.is_allocated()); + + // assign + map_copy = map; + ASSERT_EQ(map_copy.size(), 2u); + ASSERT_GE(map_copy.capacity(), 200u); + ASSERT_TRUE(map_copy.is_allocated()); +} } // namespace Test #endif // KOKKOS_TEST_UNORDERED_MAP_HPP diff --git a/packages/kokkos/containers/unit_tests/TestVector.hpp b/packages/kokkos/containers/unit_tests/TestVector.hpp deleted file mode 100644 index abed2676d76d..000000000000 --- a/packages/kokkos/containers/unit_tests/TestVector.hpp +++ /dev/null @@ -1,258 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_TEST_VECTOR_HPP -#define KOKKOS_TEST_VECTOR_HPP - -#include -#include -#include -#include -#include -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() -#include - -namespace Test { - -namespace Impl { - -template -struct test_vector_insert { - using scalar_type = Scalar; - using execution_space = Device; - - template - void run_test(Vector& a) { - auto n = a.size(); - - auto it = a.begin(); - if (n > 0) { - ASSERT_EQ(a.data(), &a[0]); - } - it += 15; - ASSERT_EQ(*it, scalar_type(1)); - - auto it_return = a.insert(it, scalar_type(3)); - ASSERT_EQ(a.size(), n + 1); - ASSERT_EQ(std::distance(it_return, a.begin() + 15), 0); - - it = a.begin(); - it += 17; - it_return = a.insert(it, n + 5, scalar_type(5)); - - ASSERT_EQ(a.size(), n + 1 + n + 5); - ASSERT_EQ(std::distance(it_return, a.begin() + 17), 0); - - Vector b; - - b.insert(b.begin(), 7, 9); - ASSERT_EQ(b.size(), 7u); - ASSERT_EQ(b[0], scalar_type(9)); - - it = a.begin(); - it += 27 + n; - it_return = a.insert(it, b.begin(), b.end()); - - ASSERT_EQ(a.size(), n + 1 + n + 5 + 7); - ASSERT_EQ(std::distance(it_return, a.begin() + 27 + n), 0); - - // Testing insert at end via all three function interfaces - a.insert(a.end(), 11); - a.insert(a.end(), 2, 12); - a.insert(a.end(), b.begin(), b.end()); - } - - template - void check_test(Vector& a, int n) { - for (int i = 0; i < (int)a.size(); i++) { - if (i == 15) - ASSERT_EQ(a[i], scalar_type(3)); - else if (i > 16 && i < 16 + 6 + n) - ASSERT_EQ(a[i], scalar_type(5)); - else if (i > 26 + n && i < 34 + n) - ASSERT_EQ(a[i], scalar_type(9)); - else if (i == (int)a.size() - 10) - ASSERT_EQ(a[i], scalar_type(11)); - else if ((i == (int)a.size() - 9) || (i == (int)a.size() - 8)) - ASSERT_EQ(a[i], scalar_type(12)); - else if (i > (int)a.size() - 8) - ASSERT_EQ(a[i], scalar_type(9)); - else - ASSERT_EQ(a[i], scalar_type(1)); - } - } - - test_vector_insert(unsigned int size) { - { - std::vector a(size, scalar_type(1)); - run_test(a); - check_test(a, size); - } - { - Kokkos::vector a(size, scalar_type(1)); - a.sync_device(); - run_test(a); - a.sync_host(); - check_test(a, size); - } - { - Kokkos::vector a(size, scalar_type(1)); - a.sync_host(); - run_test(a); - check_test(a, size); - } - { test_vector_insert_into_empty(size); } - } - - void test_vector_insert_into_empty(const size_t size) { - using Vector = Kokkos::vector; - { - Vector a; - Vector b(size); - a.insert(a.begin(), b.begin(), b.end()); - ASSERT_EQ(a.size(), size); - } - - { - Vector c; - c.insert(c.begin(), size, Scalar{}); - ASSERT_EQ(c.size(), size); - } - } -}; - -template -struct test_vector_allocate { - using self_type = test_vector_allocate; - - using scalar_type = Scalar; - using execution_space = Device; - - bool result = false; - - template - Scalar run_me(unsigned int n) { - { - Vector v1; - if (v1.is_allocated() == true) return false; - - v1 = Vector(n, 1); - Vector v2(v1); - Vector v3(n, 1); - - if (v1.is_allocated() == false) return false; - if (v2.is_allocated() == false) return false; - if (v3.is_allocated() == false) return false; - } - return true; - } - - test_vector_allocate(unsigned int size) { - result = run_me >(size); - } -}; - -template -struct test_vector_combinations { - using self_type = test_vector_combinations; - - using scalar_type = Scalar; - using execution_space = Device; - - Scalar reference; - Scalar result; - - template - Scalar run_me(unsigned int n) { - Vector a(n, 1); - - a.push_back(2); - a.resize(n + 4); - a[n + 1] = 3; - a[n + 2] = 4; - a[n + 3] = 5; - - Scalar temp1 = a[2]; - Scalar temp2 = a[n]; - Scalar temp3 = a[n + 1]; - - a.assign(n + 2, -1); - - a[2] = temp1; - a[n] = temp2; - a[n + 1] = temp3; - - Scalar test1 = 0; - for (unsigned int i = 0; i < a.size(); i++) test1 += a[i]; - - a.assign(n + 1, -2); - Scalar test2 = 0; - for (unsigned int i = 0; i < a.size(); i++) test2 += a[i]; - - a.reserve(n + 10); - - Scalar test3 = 0; - for (unsigned int i = 0; i < a.size(); i++) test3 += a[i]; - - return (test1 * test2 + test3) * test2 + test1 * test3; - } - - test_vector_combinations(unsigned int size) { - reference = run_me >(size); - result = run_me >(size); - } -}; - -} // namespace Impl - -template -void test_vector_combinations(unsigned int size) { - Impl::test_vector_combinations test(size); - ASSERT_EQ(test.reference, test.result); -} - -template -void test_vector_allocate(unsigned int size) { - Impl::test_vector_allocate test(size); - ASSERT_TRUE(test.result); -} - -TEST(TEST_CATEGORY, vector_combination) { - test_vector_allocate(10); - test_vector_combinations(10); - test_vector_combinations(3057); -} - -TEST(TEST_CATEGORY, vector_insert) { - Impl::test_vector_insert(3057); -} - -// The particular scenario below triggered a bug where empty modified_flags -// would cause resize in push_back to be executed on the device overwriting the -// values that were stored on the host previously. -TEST(TEST_CATEGORY, vector_push_back_default_exec) { - Kokkos::vector V; - V.clear(); - V.push_back(4); - ASSERT_EQ(V[0], 4); - V.push_back(3); - ASSERT_EQ(V[1], 3); - ASSERT_EQ(V[0], 4); -} - -} // namespace Test - -#endif // KOKKOS_TEST_UNORDERED_MAP_HPP diff --git a/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp b/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp index 2edddcce34f4..0482a19e7891 100644 --- a/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp +++ b/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp @@ -1,25 +1,18 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dyn_rank_view; +#else #include #include +#endif #include #include @@ -66,7 +59,7 @@ struct TestViewCtorProp_EmbeddedDim { using CommonViewValueType = typename decltype(view_alloc_arg)::value_type; using CVT = typename Kokkos::View; - using HostCVT = typename CVT::HostMirror; + using HostCVT = typename CVT::host_mirror_type; // Construct View using the common type; for case of specialization, an // 'embedded_dim' would be stored by view_alloc_arg @@ -103,7 +96,7 @@ struct TestViewCtorProp_EmbeddedDim { using CommonViewValueType = typename decltype(view_alloc_arg)::value_type; using CVT = typename Kokkos::View; - using HostCVT = typename CVT::HostMirror; + using HostCVT = typename CVT::host_mirror_type; // Construct View using the common type; for case of specialization, an // 'embedded_dim' would be stored by view_alloc_arg @@ -136,7 +129,7 @@ struct TestViewCtorProp_EmbeddedDim { using CommonViewValueType = typename decltype(view_alloc_arg)::value_type; using CVT = typename Kokkos::View; - using HostCVT = typename CVT::HostMirror; + using HostCVT = typename CVT::host_mirror_type; // Construct View using the common type; for case of specialization, an // 'embedded_dim' would be stored by view_alloc_arg @@ -157,7 +150,7 @@ struct TestViewCtorProp_EmbeddedDim { using CommonViewValueType = typename decltype(view_alloc_arg)::value_type; using CVT = typename Kokkos::View; - using HostCVT = typename CVT::HostMirror; + using HostCVT = typename CVT::host_mirror_type; // Construct View using the common type; for case of specialization, an // 'embedded_dim' would be stored by view_alloc_arg diff --git a/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp b/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp index 2932898554c5..b07ff31e9f12 100644 --- a/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp +++ b/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp @@ -1,42 +1,26 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +import kokkos.dual_view; +import kokkos.dyn_rank_view; +import kokkos.dynamic_view; +import kokkos.offset_view; +import kokkos.scatter_view; +#else #include #include #include #include #include #include +#endif #include <../../core/unit_test/tools/include/ToolTestingUtilities.hpp> -/// Some tests are skipped for @c CudaUVM memory space. -/// @todo To be revised according to the future of @c KOKKOS_ENABLE_CUDA_UVM. -///@{ -#ifdef KOKKOS_ENABLE_CUDA -#define GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE \ - if constexpr (std::is_same_v) \ - GTEST_SKIP() << "skipping since CudaUVMSpace requires additional fences"; -#else -#define GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE -#endif -///@} - /// Some tests are skipped for unified memory space #if defined(KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY) #define GTEST_SKIP_IF_UNIFIED_MEMORY_SPACE \ @@ -152,8 +136,6 @@ TEST(TEST_CATEGORY, resize_exec_space_dualview) { } TEST(TEST_CATEGORY, realloc_exec_space_dualview) { - GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE - using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableFences()); using view_type = Kokkos::DualView; @@ -244,8 +226,6 @@ TEST(TEST_CATEGORY, resize_exec_space_dynrankview) { } TEST(TEST_CATEGORY, realloc_exec_space_dynrankview) { - GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE - // FIXME_THREADS The Threads backend fences every parallel_for #ifdef KOKKOS_ENABLE_THREADS if (std::is_same_v) @@ -383,8 +363,6 @@ TEST(TEST_CATEGORY, resize_exec_space_scatterview) { } TEST(TEST_CATEGORY, realloc_exec_space_scatterview) { - GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE - // FIXME_THREADS The Threads backend fences every parallel_for #ifdef KOKKOS_ENABLE_THREADS if (std::is_same_v) @@ -493,8 +471,6 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynrankview_viewctor) { } TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynrankview) { - GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE - using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels(), Config::EnableFences()); @@ -597,8 +573,6 @@ TEST(TEST_CATEGORY, create_mirror_no_init_offsetview_view_ctor) { } TEST(TEST_CATEGORY, create_mirror_view_and_copy_offsetview) { - GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE - using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels(), Config::EnableFences()); @@ -632,8 +606,6 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_offsetview) { ASSERT_TRUE(success); } -// FIXME OPENMPTARGET -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview) { using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels()); @@ -669,7 +641,6 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview) { } TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynamicview) { - GTEST_SKIP_IF_CUDAUVM_MEMORY_SPACE GTEST_SKIP_IF_UNIFIED_MEMORY_SPACE using namespace Kokkos::Test::Tools; @@ -710,10 +681,7 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynamicview) { }); ASSERT_TRUE(success); } -#endif -// FIXME OPENMPTARGET -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview_view_ctor) { using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels()); @@ -759,4 +727,3 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview_view_ctor) { }); ASSERT_TRUE(success); } -#endif diff --git a/packages/kokkos/containers/unit_tests/UnitTestMain.cpp b/packages/kokkos/containers/unit_tests/UnitTestMain.cpp index 11a1cb717a34..cc9e67194709 100644 --- a/packages/kokkos/containers/unit_tests/UnitTestMain.cpp +++ b/packages/kokkos/containers/unit_tests/UnitTestMain.cpp @@ -1,21 +1,13 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif int main(int argc, char *argv[]) { Kokkos::initialize(argc, argv); diff --git a/packages/kokkos/core/CMakeLists.txt b/packages/kokkos/core/CMakeLists.txt index 21f05f627242..e6682f22e2b4 100644 --- a/packages/kokkos/core/CMakeLists.txt +++ b/packages/kokkos/core/CMakeLists.txt @@ -2,13 +2,5 @@ if(NOT Kokkos_INSTALL_TESTING) add_subdirectory(src) endif() -function(KOKKOS_ADD_BENCHMARK_DIRECTORY DIR_NAME) - if(NOT Kokkos_ENABLE_BENCHMARKS) - return() - endif() - - add_subdirectory(${DIR_NAME}) -endfunction() - kokkos_add_test_directories(unit_test) -kokkos_add_benchmark_directory(perf_test) +kokkos_add_benchmark_directories(perf_test) diff --git a/packages/kokkos/core/perf_test/BenchmarkMain.cpp b/packages/kokkos/core/perf_test/BenchmarkMain.cpp index 3524d58c0c96..4c90afc30afa 100644 --- a/packages/kokkos/core/perf_test/BenchmarkMain.cpp +++ b/packages/kokkos/core/perf_test/BenchmarkMain.cpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include "Benchmark_Context.hpp" +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include "PerfTest_Category.hpp" diff --git a/packages/kokkos/core/perf_test/Benchmark_Context.cpp b/packages/kokkos/core/perf_test/Benchmark_Context.cpp index 9aa63cc34f32..30647eae2bcd 100644 --- a/packages/kokkos/core/perf_test/Benchmark_Context.cpp +++ b/packages/kokkos/core/perf_test/Benchmark_Context.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "Benchmark_Context.hpp" @@ -45,7 +32,7 @@ void add_kokkos_configuration(bool verbose) { // Iterate over lines returned from kokkos and extract key:value pairs std::stringstream ss{msg.str()}; for (std::string line; std::getline(ss, line, '\n');) { - auto found = line.find_first_of(':'); + auto found = line.find_last_of(':'); if (found != std::string::npos) { auto val = remove_unwanted_characters(line.substr(found + 1)); // Ignore line without value, for example a category name diff --git a/packages/kokkos/core/perf_test/Benchmark_Context.hpp b/packages/kokkos/core/perf_test/Benchmark_Context.hpp index f9f20c640940..ff5583981f2f 100644 --- a/packages/kokkos/core/perf_test/Benchmark_Context.hpp +++ b/packages/kokkos/core/perf_test/Benchmark_Context.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CORE_PERFTEST_BENCHMARK_CONTEXT_HPP #define KOKKOS_CORE_PERFTEST_BENCHMARK_CONTEXT_HPP @@ -21,7 +8,12 @@ #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include namespace KokkosBenchmark { diff --git a/packages/kokkos/core/perf_test/CMakeLists.txt b/packages/kokkos/core/perf_test/CMakeLists.txt index d48bdcd26d2a..94597c2457c0 100644 --- a/packages/kokkos/core/perf_test/CMakeLists.txt +++ b/packages/kokkos/core/perf_test/CMakeLists.txt @@ -1,43 +1,18 @@ -# FIXME_OPENMPTARGET - the NVIDIA HPC compiler nvc++ in the OpenMPTarget backend does not pass the perf_tests. -# FIXME_OPENACC - temporarily disabled due to unimplemented features -if((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) - return() -endif() -if(KOKKOS_ENABLE_OPENACC AND KOKKOS_CXX_COMPILER_ID STREQUAL Clang) - return() -endif() - -# all PerformanceTest_* executables are part of regular tests -# TODO: finish converting these into benchmarks (in progress) -if(KOKKOS_ENABLE_TESTS) - if(KOKKOS_ENABLE_CUDA OR KOKKOS_ENABLE_HIP OR KOKKOS_ENABLE_SYCL) - kokkos_add_executable(PerformanceTest_SharedSpace SOURCES test_sharedSpace.cpp) - endif() - - kokkos_include_directories(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR}) - - kokkos_add_executable_and_test(PerformanceTest_TaskDag SOURCES test_taskdag.cpp CATEGORIES PERFORMANCE) -endif() - -if(NOT Kokkos_ENABLE_BENCHMARKS) - return() -endif() - -# Find or download google/benchmark library -find_package(benchmark QUIET 1.5.6) +# Download google/benchmark if it was not found by find_package if(benchmark_FOUND) message(STATUS "Using google benchmark found in ${benchmark_DIR}") else() message(STATUS "No installed google benchmark found, fetching from GitHub") include(FetchContent) set(BENCHMARK_ENABLE_TESTING OFF) + set(BENCHMARK_ENABLE_INSTALL OFF) list(APPEND CMAKE_MESSAGE_INDENT "[benchmark] ") FetchContent_Declare( googlebenchmark DOWNLOAD_EXTRACT_TIMESTAMP FALSE - URL https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz - URL_HASH MD5=0459a6c530df9851bee6504c3e37c2e7 + URL https://github.com/google/benchmark/archive/refs/tags/v1.8.3.tar.gz + URL_HASH MD5=7b93dd03670665684f1b2e9b70ad17fe ) FetchContent_MakeAvailable(googlebenchmark) list(POP_BACK CMAKE_MESSAGE_INDENT) @@ -51,17 +26,26 @@ else() target_compile_options(benchmark_main PRIVATE -w) endif() -function(KOKKOS_ADD_BENCHMARK NAME) - cmake_parse_arguments(BENCHMARK "" "" "SOURCES" ${ARGN}) +# This being a macro allows it to be used in other perf test directories without having to +# use absolute paths for the source files we pass as argument. +macro(KOKKOS_ADD_BENCHMARK NAME) + cmake_parse_arguments(BENCHMARK "" "MAIN_FILE" "SOURCES" ${ARGN}) if(DEFINED BENCHMARK_UNPARSED_ARGUMENTS) message(WARNING "Unexpected arguments when adding a benchmark: " ${BENCHMARK_UNPARSED_ARGUMENTS}) endif() set(BENCHMARK_NAME Kokkos_${NAME}) - list(APPEND BENCHMARK_SOURCES BenchmarkMain.cpp Benchmark_Context.cpp) + set(CORE_PERFTEST_DIR ${PROJECT_SOURCE_DIR}/core/perf_test) + if(BENCHMARK_MAIN_FILE) + set(BENCHMARK_MAIN ${BENCHMARK_MAIN_FILE}) + else() + set(BENCHMARK_MAIN ${CORE_PERFTEST_DIR}/BenchmarkMain.cpp) + endif() + list(APPEND BENCHMARK_SOURCES ${BENCHMARK_MAIN} ${CORE_PERFTEST_DIR}/Benchmark_Context.cpp) add_executable(${BENCHMARK_NAME} ${BENCHMARK_SOURCES}) target_link_libraries(${BENCHMARK_NAME} PRIVATE benchmark::benchmark Kokkos::kokkos impl_git_version) + target_include_directories(${BENCHMARK_NAME} PRIVATE ${CORE_PERFTEST_DIR}) target_include_directories(${BENCHMARK_NAME} SYSTEM PRIVATE ${benchmark_SOURCE_DIR}/include) foreach(SOURCE_FILE ${BENCHMARK_SOURCES}) @@ -72,14 +56,35 @@ function(KOKKOS_ADD_BENCHMARK NAME) set(BENCHMARK_ARGS --benchmark_counters_tabular=true --benchmark_out=${BENCHMARK_NAME}_${BENCHMARK_TIME}.json) add_test(NAME ${BENCHMARK_NAME} COMMAND ${BENCHMARK_NAME} ${BENCHMARK_ARGS}) -endfunction() +endmacro() + +# FIXME_OPENACC - temporarily disabled due to unimplemented features +if(KOKKOS_ENABLE_OPENACC AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) + return() +endif() +if(KOKKOS_ENABLE_OPENACC AND KOKKOS_CXX_COMPILER_ID STREQUAL Clang) + return() +endif() + +# all PerformanceTest_* executables are part of regular tests +# TODO: finish converting these into benchmarks (in progress) +if(KOKKOS_ENABLE_TESTS) + if(KOKKOS_ENABLE_CUDA OR KOKKOS_ENABLE_HIP OR KOKKOS_ENABLE_SYCL) + kokkos_add_executable(PerformanceTest_SharedSpace SOURCES test_sharedSpace.cpp) + endif() + + kokkos_include_directories(REQUIRED_DURING_INSTALLATION_TESTING ${CMAKE_CURRENT_SOURCE_DIR}) +endif() set(BENCHMARK_SOURCES PerfTestGramSchmidt.cpp PerfTest_CustomReduction.cpp PerfTest_ExecSpacePartitioning.cpp + PerfTest_Gemv.cpp PerfTestHexGrad.cpp PerfTest_MallocFree.cpp + PerfTest_Stream.cpp + PerfTestMDRange_Stencil.cpp PerfTest_ViewAllocate.cpp PerfTest_ViewCopy_a123.cpp PerfTest_ViewCopy_b123.cpp @@ -116,17 +121,17 @@ set(BENCHMARK_SOURCES PerfTest_ViewResize_Raw.cpp ) -if(Kokkos_ENABLE_OPENMPTARGET) - # FIXME OPENMPTARGET requires TeamPolicy Reductions and Custom Reduction - list(REMOVE_ITEM BENCHMARK_SOURCES PerfTestGramSchmidt.cpp PerfTest_CustomReduction.cpp - PerfTest_ExecSpacePartitioning.cpp - ) -endif() - kokkos_add_benchmark(PerformanceTest_Benchmark SOURCES ${BENCHMARK_SOURCES}) kokkos_add_benchmark(Benchmark_Atomic_MinMax SOURCES test_atomic_minmax_simple.cpp) +kokkos_add_benchmark( + PerformanceTest_ViewFirstTouch SOURCES PerfTest_ViewFirstTouch_Initialize.cpp PerfTest_ViewFirstTouch_ParallelFor.cpp + PerfTest_ViewFirstTouch_DeepCopy.cpp +) + +kokkos_add_benchmark(PerformanceTest_MDRangePolicy_Stream SOURCES PerfTestMDRange_Stream.cpp) + # FIXME_NVHPC if(NOT KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) kokkos_add_benchmark(PerformanceTest_Mempool SOURCES test_mempool.cpp) diff --git a/packages/kokkos/core/perf_test/Makefile b/packages/kokkos/core/perf_test/Makefile deleted file mode 100644 index 4c0172c53b0d..000000000000 --- a/packages/kokkos/core/perf_test/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -KOKKOS_PATH = ../.. - -GTEST_PATH = ../../tpls/gtest - -vpath %.cpp ${KOKKOS_PATH}/core/perf_test - -default: build_all - echo "End Build" - -ifneq (,$(findstring Cuda,$(KOKKOS_DEVICES))) - CXX = $(KOKKOS_PATH)/bin/nvcc_wrapper - KOKKOS_CUDA_OPTIONS=enable_lambda -else - CXX = g++ -endif - -CXXFLAGS = -O3 -#CXXFLAGS += -DGENERIC_REDUCER -LINK ?= $(CXX) -LDFLAGS ?= -override LDFLAGS += -lpthread - -KOKKOS_USE_DEPRECATED_MAKEFILES=1 - -include $(KOKKOS_PATH)/Makefile.kokkos - -KOKKOS_CXXFLAGS += -I$(GTEST_PATH) -I${KOKKOS_PATH}/core/perf_test - -TEST_TARGETS = -TARGETS = - -# - -OBJ_TASKDAG = test_taskdag.o -TARGETS += KokkosCore_PerformanceTest_TaskDAG -TEST_TARGETS += test-taskdag - -# - -KokkosCore_PerformanceTest: $(OBJ_PERF) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_PERF) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_PerformanceTest - -KokkosCore_PerformanceTest_Atomics: $(OBJ_ATOMICS) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_ATOMICS) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_PerformanceTest_Atomics - -KokkosCore_PerformanceTest_Mempool: $(OBJ_MEMPOOL) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_MEMPOOL) $(KOKKOS_LIBS) $(LIB) -o KokkosCore_PerformanceTest_Mempool - -KokkosCore_PerformanceTest_TaskDAG: $(OBJ_TASKDAG) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(KOKKOS_LDFLAGS) $(LDFLAGS) $(EXTRA_PATH) $(OBJ_TASKDAG) $(KOKKOS_LIBS) $(LIB) -o KokkosCore_PerformanceTest_TaskDAG - -KokkosCore_PerformanceTest_Atomics_MinMax: $(OBJ_ATOMICS_MINMAX) $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) $(OBJ_ATOMICS_MINMAX) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_PerformanceTest_Atomics_MinMax - -test-performance: KokkosCore_PerformanceTest - ./KokkosCore_PerformanceTest - -test-atomic: KokkosCore_PerformanceTest_Atomics - ./KokkosCore_PerformanceTest_Atomics - -test-mempool: KokkosCore_PerformanceTest_Mempool - ./KokkosCore_PerformanceTest_Mempool - -test-taskdag: KokkosCore_PerformanceTest_TaskDAG - ./KokkosCore_PerformanceTest_TaskDAG - -test-atomic-minmax: KokkosCore_PerformanceTest_Atomics_MinMax - ./KokkosCore_PerformanceTest_Atomics_MinMax - -build_all: $(TARGETS) - -test: $(TEST_TARGETS) - -clean: kokkos-clean - rm -f *.o $(TARGETS) - -# Compilation rules - -%.o:%.cpp $(KOKKOS_CPP_DEPENDS) - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $< - -gtest-all.o:$(GTEST_PATH)/gtest/gtest-all.cc - $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) $(EXTRA_INC) -c $(GTEST_PATH)/gtest/gtest-all.cc - diff --git a/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp b/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp index 5e6e52f11530..40487fd5802c 100644 --- a/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp +++ b/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_BLAS_KERNELS_HPP #define KOKKOS_BLAS_KERNELS_HPP diff --git a/packages/kokkos/core/perf_test/PerfTestDriver.hpp b/packages/kokkos/core/perf_test/PerfTestDriver.hpp deleted file mode 100644 index ea54f31902b5..000000000000 --- a/packages/kokkos/core/perf_test/PerfTestDriver.hpp +++ /dev/null @@ -1,401 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#include -#include - -// mfh 06 Jun 2013: This macro doesn't work like one might thing it -// should. It doesn't take the template parameter DeviceType and -// print its actual type name; it just literally prints out -// "DeviceType". I've worked around this below without using the -// macro, so I'm commenting out the macro to avoid compiler complaints -// about an unused macro. - -// #define KOKKOS_IMPL_MACRO_TO_STRING( X ) #X -// #define KOKKOS_MACRO_TO_STRING( X ) KOKKOS_IMPL_MACRO_TO_STRING( X ) - -//------------------------------------------------------------------------ - -namespace Test { - -enum { NUMBER_OF_TRIALS = 5 }; - -template -void run_test_mdrange(int exp_beg, int exp_end, const char deviceTypeName[], - int range_offset = 0, int tile_offset = 0) -// exp_beg = 6 => 2^6 = 64 is starting range length -{ -#define MDRANGE_PERFORMANCE_OUTPUT_VERBOSE 0 - - std::string label_mdrange; - label_mdrange.append("\"MDRange< double , "); - label_mdrange.append(deviceTypeName); - label_mdrange.append(" >\""); - - std::string label_range_col2; - label_range_col2.append("\"RangeColTwo< double , "); - label_range_col2.append(deviceTypeName); - label_range_col2.append(" >\""); - - std::string label_range_col_all; - label_range_col_all.append("\"RangeColAll< double , "); - label_range_col_all.append(deviceTypeName); - label_range_col_all.append(" >\""); - - if (std::is_same::value) { - std::cout - << "--------------------------------------------------------------\n" - << "Performance tests for MDRange Layout Right" - << "\n--------------------------------------------------------------" - << std::endl; - } else { - std::cout - << "--------------------------------------------------------------\n" - << "Performance tests for MDRange Layout Left" - << "\n--------------------------------------------------------------" - << std::endl; - } - - for (int i = exp_beg; i < exp_end; ++i) { - const int range_length = (1 << i) + range_offset; - - std::cout - << "\n--------------------------------------------------------------\n" - << "--------------------------------------------------------------\n" - << "MDRange Test: range bounds: " << range_length << " , " - << range_length << " , " << range_length - << "\n--------------------------------------------------------------\n" - << "--------------------------------------------------------------\n"; - // << std::endl; - - int t0_min = 0, t1_min = 0, t2_min = 0; - double seconds_min = 0.0; - - // Test 1: The MDRange in full - { - int t0 = 1, t1 = 1, t2 = 1; - int counter = 1; -#if !defined(KOKKOS_ENABLE_CUDA) - int min_bnd = 8; - int tfast = range_length; -#else - int min_bnd = 2; - int tfast = 32; -#endif - while (tfast >= min_bnd) { - int tmid = min_bnd; - while (tmid < tfast) { - t0 = min_bnd; - t1 = tmid; - t2 = tfast; - int t2_rev = min_bnd; - int t1_rev = tmid; - int t0_rev = tfast; - -#if defined(KOKKOS_ENABLE_CUDA) - // Note: Product of tile sizes must be < 1024 for Cuda - if (t0 * t1 * t2 >= 1024) { - printf(" Exceeded Cuda tile limits; onto next range set\n\n"); - break; - } -#endif - - // Run 1 with tiles LayoutRight style - double seconds_1 = 0; - { - seconds_1 = - MultiDimRangePerf3D::test_multi_index(range_length, - range_length, - range_length, - t0, t1, t2); - } - -#if MDRANGE_PERFORMANCE_OUTPUT_VERBOSE - std::cout << label_mdrange << " , " << t0 << " , " << t1 << " , " - << t2 << " , " << seconds_1 << std::endl; -#endif - - if (counter == 1) { - seconds_min = seconds_1; - t0_min = t0; - t1_min = t1; - t2_min = t2; - } else { - if (seconds_1 < seconds_min) { - seconds_min = seconds_1; - t0_min = t0; - t1_min = t1; - t2_min = t2; - } - } - - // Run 2 with tiles LayoutLeft style - reverse order of tile dims - double seconds_1rev = 0; - { - seconds_1rev = - MultiDimRangePerf3D::test_multi_index(range_length, - range_length, - range_length, - t0_rev, - t1_rev, - t2_rev); - } - -#if MDRANGE_PERFORMANCE_OUTPUT_VERBOSE - std::cout << label_mdrange << " , " << t0_rev << " , " << t1_rev - << " , " << t2_rev << " , " << seconds_1rev << std::endl; -#endif - - if (seconds_1rev < seconds_min) { - seconds_min = seconds_1rev; - t0_min = t0_rev; - t1_min = t1_rev; - t2_min = t2_rev; - } - - ++counter; - tmid <<= 1; - } // end inner while - tfast >>= 1; - } // end outer while - - std::cout - << "\n" - << "--------------------------------------------------------------\n" - << label_mdrange << "\n Min values " - << "\n Range length per dim (3D): " << range_length - << "\n TileDims: " << t0_min << " , " << t1_min << " , " << t2_min - << "\n Min time: " << seconds_min - << "\n---------------------------------------------------------------" - << std::endl; - } // end scope - -#if !defined(KOKKOS_ENABLE_CUDA) - double seconds_min_c = 0.0; - int t0c_min = 0, t1c_min = 0, t2c_min = 0; - int counter = 1; - { - int min_bnd = 8; - // Test 1_c: MDRange with 0 for 'inner' tile dim; this case will utilize - // the full span in that direction, should be similar to Collapse<2> - if (std::is_same::value) { - for (unsigned int T0 = min_bnd; - T0 < static_cast(range_length); T0 <<= 1) { - for (unsigned int T1 = min_bnd; - T1 < static_cast(range_length); T1 <<= 1) { - double seconds_c = 0; - { - seconds_c = MultiDimRangePerf3D:: - test_multi_index(range_length, range_length, range_length, T0, - T1, 0); - } - -#if MDRANGE_PERFORMANCE_OUTPUT_VERBOSE - std::cout << " MDRange LR with '0' tile - collapse-like \n" - << label_mdrange << " , " << T0 << " , " << T1 << " , " - << range_length << " , " << seconds_c << std::endl; -#endif - - t2c_min = range_length; - if (counter == 1) { - seconds_min_c = seconds_c; - t0c_min = T0; - t1c_min = T1; - } else { - if (seconds_c < seconds_min_c) { - seconds_min_c = seconds_c; - t0c_min = T0; - t1c_min = T1; - } - } - ++counter; - } - } - } else { - for (unsigned int T1 = min_bnd; - T1 <= static_cast(range_length); T1 <<= 1) { - for (unsigned int T2 = min_bnd; - T2 <= static_cast(range_length); T2 <<= 1) { - double seconds_c = 0; - { - seconds_c = MultiDimRangePerf3D:: - test_multi_index(range_length, range_length, range_length, 0, - T1, T2); - } - -#if MDRANGE_PERFORMANCE_OUTPUT_VERBOSE - std::cout << " MDRange LL with '0' tile - collapse-like \n" - << label_mdrange << " , " << range_length << " < " << T1 - << " , " << T2 << " , " << seconds_c << std::endl; -#endif - - t0c_min = range_length; - if (counter == 1) { - seconds_min_c = seconds_c; - t1c_min = T1; - t2c_min = T2; - } else { - if (seconds_c < seconds_min_c) { - seconds_min_c = seconds_c; - t1c_min = T1; - t2c_min = T2; - } - } - ++counter; - } - } - } - - std::cout - // << - // "--------------------------------------------------------------\n" - << label_mdrange << " Collapse<2> style: " - << "\n Min values " - << "\n Range length per dim (3D): " << range_length - << "\n TileDims: " << t0c_min << " , " << t1c_min << " , " << t2c_min - << "\n Min time: " << seconds_min_c - << "\n---------------------------------------------------------------" - << std::endl; - } // end scope test 2 -#endif - - // Test 2: RangePolicy Collapse2 style - double seconds_2 = 0; - { - seconds_2 = RangePolicyCollapseTwo:: - test_index_collapse_two(range_length, range_length, range_length); - } - std::cout << label_range_col2 << " , " << range_length << " , " << seconds_2 - << std::endl; - - // Test 3: RangePolicy Collapse all style - not necessary, always slow - /* - double seconds_3 = 0; - { seconds_3 = RangePolicyCollapseAll< DeviceType , double , LayoutType - >::test_collapse_all(range_length,range_length,range_length) ; } std::cout - << label_range_col_all - << " , " << range_length - << " , " << seconds_3 - << "\n---------------------------------------------------------------" - << std::endl ; - */ - - // Compare fastest times... will never be collapse all so ignore it - // seconds_min = tiled MDRange - // seconds_min_c = collapse<2>-like MDRange (tiledim = span for fast dim) - - // only for non-Cuda, else tile too long seconds_2 = collapse<2>-style - // RangePolicy seconds_3 = collapse<3>-style RangePolicy - -#if !defined(KOKKOS_ENABLE_CUDA) - if (seconds_min < seconds_min_c) { - if (seconds_min < seconds_2) { - std::cout - << "--------------------------------------------------------------" - "\n" - << " Fastest run: MDRange tiled\n" - << " Time: " << seconds_min - << " Difference: " << seconds_2 - seconds_min << " Other times: \n" - << " MDrange collapse-like (tiledim = span on fast dim) type: " - << seconds_min_c << "\n" - << " Collapse2 Range Policy: " << seconds_2 << "\n" - << "\n-------------------------------------------------------------" - "-" - << "\n-------------------------------------------------------------" - "-" - //<< "\n\n" - << std::endl; - } else if (seconds_min > seconds_2) { - std::cout - << " Fastest run: Collapse2 RangePolicy\n" - << " Time: " << seconds_2 - << " Difference: " << seconds_min - seconds_2 << " Other times: \n" - << " MDrange Tiled: " << seconds_min << "\n" - << " MDrange collapse-like (tiledim = span on fast dim) type: " - << seconds_min_c << "\n" - << "\n-------------------------------------------------------------" - "-" - << "\n-------------------------------------------------------------" - "-" - //<< "\n\n" - << std::endl; - } - } else if (seconds_min > seconds_min_c) { - if (seconds_min_c < seconds_2) { - std::cout << "---------------------------------------------------------" - "-----\n" - << " Fastest run: MDRange collapse-like (tiledim = span on " - "fast dim) type\n" - << " Time: " << seconds_min_c - << " Difference: " << seconds_2 - seconds_min_c - << " Other times: \n" - << " MDrange Tiled: " << seconds_min << "\n" - << " Collapse2 Range Policy: " << seconds_2 << "\n" - << "\n-------------------------------------------------------" - "-------" - << "\n-------------------------------------------------------" - "-------" - //<< "\n\n" - << std::endl; - } else if (seconds_min_c > seconds_2) { - std::cout - << " Fastest run: Collapse2 RangePolicy\n" - << " Time: " << seconds_2 - << " Difference: " << seconds_min_c - seconds_2 - << " Other times: \n" - << " MDrange Tiled: " << seconds_min << "\n" - << " MDrange collapse-like (tiledim = span on fast dim) type: " - << seconds_min_c << "\n" - << "\n-------------------------------------------------------------" - "-" - << "\n-------------------------------------------------------------" - "-" - //<< "\n\n" - << std::endl; - } - } // end else if -#else - if (seconds_min < seconds_2) { - std::cout - << "--------------------------------------------------------------\n" - << " Fastest run: MDRange tiled\n" - << " Time: " << seconds_min - << " Difference: " << seconds_2 - seconds_min << " Other times: \n" - << " Collapse2 Range Policy: " << seconds_2 << "\n" - << "\n--------------------------------------------------------------" - << "\n--------------------------------------------------------------" - //<< "\n\n" - << std::endl; - } else if (seconds_min > seconds_2) { - std::cout - << " Fastest run: Collapse2 RangePolicy\n" - << " Time: " << seconds_2 - << " Difference: " << seconds_min - seconds_2 << " Other times: \n" - << " MDrange Tiled: " << seconds_min << "\n" - << "\n--------------------------------------------------------------" - << "\n--------------------------------------------------------------" - //<< "\n\n" - << std::endl; - } -#endif - - } // end for - -#undef MDRANGE_PERFORMANCE_OUTPUT_VERBOSE -} - -} // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp b/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp index ddfa73d4ba0d..759fb3541315 100644 --- a/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp +++ b/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "PerfTest_Category.hpp" @@ -141,7 +133,7 @@ struct ModifiedGramSchmidt { multivector_type Q_("Q", length, count); multivector_type R_("R", count, count); - typename multivector_type::HostMirror A = Kokkos::create_mirror(Q_); + typename multivector_type::host_mirror_type A = Kokkos::create_mirror(Q_); // Create and fill A on the host for (size_type j = 0; j < count; ++j) { diff --git a/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp b/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp index 1ebe750f2164..df9074cfbdfd 100644 --- a/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp +++ b/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Benchmark_Context.hpp" #include "PerfTest_Category.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTestMDRange.hpp b/packages/kokkos/core/perf_test/PerfTestMDRange.hpp deleted file mode 100644 index 7ec1cd6996a7..000000000000 --- a/packages/kokkos/core/perf_test/PerfTestMDRange.hpp +++ /dev/null @@ -1,598 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -namespace Test { -template -struct MultiDimRangePerf3D { - using execution_space = DeviceType; - using size_type = typename execution_space::size_type; - - using iterate_type = Kokkos::Iterate; - - using view_type = Kokkos::View; - using host_view_type = typename view_type::HostMirror; - - view_type A; - view_type B; - const long irange; - const long jrange; - const long krange; - - MultiDimRangePerf3D(const view_type &A_, const view_type &B_, - const long &irange_, const long &jrange_, - const long &krange_) - : A(A_), B(B_), irange(irange_), jrange(jrange_), krange(krange_) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const long i, const long j, const long k) const { - A(i, j, k) = - 0.25 * (ScalarType)(B(i + 2, j, k) + B(i + 1, j, k) + B(i, j + 2, k) + - B(i, j + 1, k) + B(i, j, k + 2) + B(i, j, k + 1) + - B(i, j, k)); - } - - struct InitZeroTag {}; - // struct InitViewTag {}; - - struct Init { - Init(const view_type &input_, const long &irange_, const long &jrange_, - const long &krange_) - : input(input_), irange(irange_), jrange(jrange_), krange(krange_) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const long i, const long j, const long k) const { - input(i, j, k) = 1.0; - } - - KOKKOS_INLINE_FUNCTION - void operator()(const InitZeroTag &, const long i, const long j, - const long k) const { - input(i, j, k) = 0; - } - - view_type input; - const long irange; - const long jrange; - const long krange; - }; - - static double test_multi_index(const unsigned int icount, - const unsigned int jcount, - const unsigned int kcount, - const unsigned int Ti = 1, - const unsigned int Tj = 1, - const unsigned int Tk = 1, - const long iter = 1) { - // This test performs multidim range over all dims - view_type Atest("Atest", icount, jcount, kcount); - view_type Btest("Btest", icount + 2, jcount + 2, kcount + 2); - using FunctorType = - MultiDimRangePerf3D; - - double dt_min = 0; - - // LayoutRight - if (std::is_same::value) { - Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Right, iterate_type::Right>, - execution_space> - policy_initA({{0, 0, 0}}, {{icount, jcount, kcount}}, {{Ti, Tj, Tk}}); - Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Right, iterate_type::Right>, - execution_space> - policy_initB({{0, 0, 0}}, {{icount + 2, jcount + 2, kcount + 2}}, - {{Ti, Tj, Tk}}); - - using MDRangeType = typename Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Right, iterate_type::Right>, - execution_space>; - using tile_type = typename MDRangeType::tile_type; - using point_type = typename MDRangeType::point_type; - - Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Right, iterate_type::Right>, - execution_space> - policy(point_type{{0, 0, 0}}, point_type{{icount, jcount, kcount}}, - tile_type{{Ti, Tj, Tk}}); - - Kokkos::parallel_for(policy_initA, Init(Atest, icount, jcount, kcount)); - execution_space().fence(); - Kokkos::parallel_for(policy_initB, - Init(Btest, icount + 2, jcount + 2, kcount + 2)); - execution_space().fence(); - - for (int i = 0; i < iter; ++i) { - Kokkos::Timer timer; - Kokkos::parallel_for(policy, - FunctorType(Atest, Btest, icount, jcount, kcount)); - execution_space().fence(); - const double dt = timer.seconds(); - if (0 == i) - dt_min = dt; - else - dt_min = dt < dt_min ? dt : dt_min; - - // Correctness check - only the first run - if (0 == i) { - long numErrors = 0; - host_view_type Ahost("Ahost", icount, jcount, kcount); - Kokkos::deep_copy(Ahost, Atest); - host_view_type Bhost("Bhost", icount + 2, jcount + 2, kcount + 2); - Kokkos::deep_copy(Bhost, Btest); - - // On KNL, this may vectorize - add print statement to prevent - // Also, compare against epsilon, as vectorization can change bitwise - // answer - for (long l = 0; l < static_cast(icount); ++l) { - for (long j = 0; j < static_cast(jcount); ++j) { - for (long k = 0; k < static_cast(kcount); ++k) { - ScalarType check = - 0.25 * - (ScalarType)(Bhost(l + 2, j, k) + Bhost(l + 1, j, k) + - Bhost(l, j + 2, k) + Bhost(l, j + 1, k) + - Bhost(l, j, k + 2) + Bhost(l, j, k + 1) + - Bhost(l, j, k)); - if (Ahost(l, j, k) - check != 0) { - ++numErrors; - std::cout << " Correctness error at index: " << l << "," << j - << "," << k << "\n" - << " multi Ahost = " << Ahost(l, j, k) - << " expected = " << check - << " multi Bhost(ijk) = " << Bhost(l, j, k) - << " multi Bhost(l+1jk) = " << Bhost(l + 1, j, k) - << " multi Bhost(l+2jk) = " << Bhost(l + 2, j, k) - << " multi Bhost(ij+1k) = " << Bhost(l, j + 1, k) - << " multi Bhost(ij+2k) = " << Bhost(l, j + 2, k) - << " multi Bhost(ijk+1) = " << Bhost(l, j, k + 1) - << " multi Bhost(ijk+2) = " << Bhost(l, j, k + 2) - << std::endl; - // exit(-1); - } - } - } - } - if (numErrors != 0) { - std::cout << "LR multi: errors " << numErrors << " range product " - << icount * jcount * kcount << " LL " << jcount * kcount - << " LR " << icount * jcount << std::endl; - } - // else { std::cout << " multi: No errors!" << std::endl; } - } - } // end for - - } - // LayoutLeft - else { - Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Left, iterate_type::Left>, - execution_space> - policy_initA({{0, 0, 0}}, {{icount, jcount, kcount}}, {{Ti, Tj, Tk}}); - Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Left, iterate_type::Left>, - execution_space> - policy_initB({{0, 0, 0}}, {{icount + 2, jcount + 2, kcount + 2}}, - {{Ti, Tj, Tk}}); - - // using MDRangeType = - // typename Kokkos::MDRangePolicy< - // Kokkos::Rank<3, iterate_type::Left, iterate_type::Left>, - // execution_space >; - // using tile_type = typename MDRangeType::tile_type; - // using point_type = typename MDRangeType::point_type; - // MDRangeType policy(point_type{{0,0,0}}, - // point_type{{icount,jcount,kcount}}, - // tile_type{{Ti,Tj,Tk}}); - Kokkos::MDRangePolicy< - Kokkos::Rank<3, iterate_type::Left, iterate_type::Left>, - execution_space> - policy({{0, 0, 0}}, {{icount, jcount, kcount}}, {{Ti, Tj, Tk}}); - - Kokkos::parallel_for(policy_initA, Init(Atest, icount, jcount, kcount)); - execution_space().fence(); - Kokkos::parallel_for(policy_initB, - Init(Btest, icount + 2, jcount + 2, kcount + 2)); - execution_space().fence(); - - for (int i = 0; i < iter; ++i) { - Kokkos::Timer timer; - Kokkos::parallel_for(policy, - FunctorType(Atest, Btest, icount, jcount, kcount)); - execution_space().fence(); - const double dt = timer.seconds(); - if (0 == i) - dt_min = dt; - else - dt_min = dt < dt_min ? dt : dt_min; - - // Correctness check - only the first run - if (0 == i) { - long numErrors = 0; - host_view_type Ahost("Ahost", icount, jcount, kcount); - Kokkos::deep_copy(Ahost, Atest); - host_view_type Bhost("Bhost", icount + 2, jcount + 2, kcount + 2); - Kokkos::deep_copy(Bhost, Btest); - - // On KNL, this may vectorize - add print statement to prevent - // Also, compare against epsilon, as vectorization can change bitwise - // answer - for (long l = 0; l < static_cast(icount); ++l) { - for (long j = 0; j < static_cast(jcount); ++j) { - for (long k = 0; k < static_cast(kcount); ++k) { - ScalarType check = - 0.25 * - (ScalarType)(Bhost(l + 2, j, k) + Bhost(l + 1, j, k) + - Bhost(l, j + 2, k) + Bhost(l, j + 1, k) + - Bhost(l, j, k + 2) + Bhost(l, j, k + 1) + - Bhost(l, j, k)); - if (Ahost(l, j, k) - check != 0) { - ++numErrors; - std::cout << " Correctness error at index: " << l << "," << j - << "," << k << "\n" - << " multi Ahost = " << Ahost(l, j, k) - << " expected = " << check - << " multi Bhost(ijk) = " << Bhost(l, j, k) - << " multi Bhost(l+1jk) = " << Bhost(l + 1, j, k) - << " multi Bhost(l+2jk) = " << Bhost(l + 2, j, k) - << " multi Bhost(ij+1k) = " << Bhost(l, j + 1, k) - << " multi Bhost(ij+2k) = " << Bhost(l, j + 2, k) - << " multi Bhost(ijk+1) = " << Bhost(l, j, k + 1) - << " multi Bhost(ijk+2) = " << Bhost(l, j, k + 2) - << std::endl; - // exit(-1); - } - } - } - } - if (numErrors != 0) { - std::cout << " LL multi run: errors " << numErrors - << " range product " << icount * jcount * kcount - << " LL " << jcount * kcount << " LR " - << icount * jcount << std::endl; - } - // else { std::cout << " multi: No errors!" << std::endl; } - } - } // end for - } - - return dt_min; - } -}; - -template -struct RangePolicyCollapseTwo { - // RangePolicy for 3D range, but will collapse only 2 dims => like Rank<2> for - // multi-dim; unroll 2 dims in one-dim - - using execution_space = DeviceType; - using size_type = typename execution_space::size_type; - using layout = TestLayout; - - using iterate_type = Kokkos::Iterate; - - using view_type = Kokkos::View; - using host_view_type = typename view_type::HostMirror; - - view_type A; - view_type B; - const long irange; - const long jrange; - const long krange; - - RangePolicyCollapseTwo(view_type &A_, const view_type &B_, - const long &irange_, const long &jrange_, - const long &krange_) - : A(A_), B(B_), irange(irange_), jrange(jrange_), krange(krange_) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const long r) const { - if (std::is_same::value) { - // id(i,j,k) = k + j*Nk + i*Nk*Nj = k + Nk*(j + i*Nj) = k + Nk*r - // r = j + i*Nj - long i = int(r / jrange); - long j = int(r - i * jrange); - for (int k = 0; k < krange; ++k) { - A(i, j, k) = - 0.25 * (ScalarType)(B(i + 2, j, k) + B(i + 1, j, k) + - B(i, j + 2, k) + B(i, j + 1, k) + - B(i, j, k + 2) + B(i, j, k + 1) + B(i, j, k)); - } - } else if (std::is_same::value) { - // id(i,j,k) = i + j*Ni + k*Ni*Nj = i + Ni*(j + k*Nj) = i + Ni*r - // r = j + k*Nj - long k = int(r / jrange); - long j = int(r - k * jrange); - for (int i = 0; i < irange; ++i) { - A(i, j, k) = - 0.25 * (ScalarType)(B(i + 2, j, k) + B(i + 1, j, k) + - B(i, j + 2, k) + B(i, j + 1, k) + - B(i, j, k + 2) + B(i, j, k + 1) + B(i, j, k)); - } - } - } - - struct Init { - view_type input; - const long irange; - const long jrange; - const long krange; - - Init(const view_type &input_, const long &irange_, const long &jrange_, - const long &krange_) - : input(input_), irange(irange_), jrange(jrange_), krange(krange_) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const long r) const { - if (std::is_same::value) { - long i = int(r / jrange); - long j = int(r - i * jrange); - for (int k = 0; k < krange; ++k) { - input(i, j, k) = 1; - } - } else if (std::is_same::value) { - long k = int(r / jrange); - long j = int(r - k * jrange); - for (int i = 0; i < irange; ++i) { - input(i, j, k) = 1; - } - } - } - }; - - static double test_index_collapse_two(const unsigned int icount, - const unsigned int jcount, - const unsigned int kcount, - const long iter = 1) { - // This test refers to collapsing two dims while using the RangePolicy - view_type Atest("Atest", icount, jcount, kcount); - view_type Btest("Btest", icount + 2, jcount + 2, kcount + 2); - using FunctorType = - RangePolicyCollapseTwo; - - long collapse_index_rangeA = 0; - long collapse_index_rangeB = 0; - if (std::is_same::value) { - collapse_index_rangeA = icount * jcount; - collapse_index_rangeB = (icount + 2) * (jcount + 2); - // std::cout << " LayoutRight " << std::endl; - } else if (std::is_same::value) { - collapse_index_rangeA = kcount * jcount; - collapse_index_rangeB = (kcount + 2) * (jcount + 2); - // std::cout << " LayoutLeft " << std::endl; - } else { - std::cout << " LayoutRight or LayoutLeft required - will pass 0 as " - "range instead " - << std::endl; - exit(-1); - } - - Kokkos::RangePolicy policy(0, (collapse_index_rangeA)); - Kokkos::RangePolicy policy_initB(0, - (collapse_index_rangeB)); - - double dt_min = 0; - - Kokkos::parallel_for(policy, Init(Atest, icount, jcount, kcount)); - execution_space().fence(); - Kokkos::parallel_for(policy_initB, - Init(Btest, icount + 2, jcount + 2, kcount + 2)); - execution_space().fence(); - - for (int i = 0; i < iter; ++i) { - Kokkos::Timer timer; - Kokkos::parallel_for(policy, - FunctorType(Atest, Btest, icount, jcount, kcount)); - execution_space().fence(); - const double dt = timer.seconds(); - if (0 == i) - dt_min = dt; - else - dt_min = dt < dt_min ? dt : dt_min; - - // Correctness check - first iteration only - if (0 == i) { - long numErrors = 0; - host_view_type Ahost("Ahost", icount, jcount, kcount); - Kokkos::deep_copy(Ahost, Atest); - host_view_type Bhost("Bhost", icount + 2, jcount + 2, kcount + 2); - Kokkos::deep_copy(Bhost, Btest); - - // On KNL, this may vectorize - add print statement to prevent - // Also, compare against epsilon, as vectorization can change bitwise - // answer - for (long l = 0; l < static_cast(icount); ++l) { - for (long j = 0; j < static_cast(jcount); ++j) { - for (long k = 0; k < static_cast(kcount); ++k) { - ScalarType check = - 0.25 * (ScalarType)(Bhost(l + 2, j, k) + Bhost(l + 1, j, k) + - Bhost(l, j + 2, k) + Bhost(l, j + 1, k) + - Bhost(l, j, k + 2) + Bhost(l, j, k + 1) + - Bhost(l, j, k)); - if (Ahost(l, j, k) - check != 0) { - ++numErrors; - std::cout << " Correctness error at index: " << l << "," << j - << "," << k << "\n" - << " flat Ahost = " << Ahost(l, j, k) - << " expected = " << check << std::endl; - // exit(-1); - } - } - } - } - if (numErrors != 0) { - std::cout << " RP collapse2: errors " << numErrors - << " range product " << icount * jcount * kcount << " LL " - << jcount * kcount << " LR " << icount * jcount - << std::endl; - } - // else { std::cout << " RP collapse2: Pass! " << std::endl; } - } - } - - return dt_min; - } -}; - -template -struct RangePolicyCollapseAll { - // RangePolicy for 3D range, but will collapse all dims - - using execution_space = DeviceType; - using size_type = typename execution_space::size_type; - using layout = TestLayout; - - using view_type = Kokkos::View; - using host_view_type = typename view_type::HostMirror; - - view_type A; - view_type B; - const long irange; - const long jrange; - const long krange; - - RangePolicyCollapseAll(view_type &A_, const view_type &B_, - const long &irange_, const long &jrange_, - const long &krange_) - : A(A_), B(B_), irange(irange_), jrange(jrange_), krange(krange_) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const long r) const { - if (std::is_same::value) { - long i = int(r / (jrange * krange)); - long j = int((r - i * jrange * krange) / krange); - long k = int(r - i * jrange * krange - j * krange); - A(i, j, k) = - 0.25 * (ScalarType)(B(i + 2, j, k) + B(i + 1, j, k) + B(i, j + 2, k) + - B(i, j + 1, k) + B(i, j, k + 2) + B(i, j, k + 1) + - B(i, j, k)); - } else if (std::is_same::value) { - long k = int(r / (irange * jrange)); - long j = int((r - k * irange * jrange) / irange); - long i = int(r - k * irange * jrange - j * irange); - A(i, j, k) = - 0.25 * (ScalarType)(B(i + 2, j, k) + B(i + 1, j, k) + B(i, j + 2, k) + - B(i, j + 1, k) + B(i, j, k + 2) + B(i, j, k + 1) + - B(i, j, k)); - } - } - - struct Init { - view_type input; - const long irange; - const long jrange; - const long krange; - - Init(const view_type &input_, const long &irange_, const long &jrange_, - const long &krange_) - : input(input_), irange(irange_), jrange(jrange_), krange(krange_) {} - - KOKKOS_INLINE_FUNCTION - void operator()(const long r) const { - if (std::is_same::value) { - long i = int(r / (jrange * krange)); - long j = int((r - i * jrange * krange) / krange); - long k = int(r - i * jrange * krange - j * krange); - input(i, j, k) = 1; - } else if (std::is_same::value) { - long k = int(r / (irange * jrange)); - long j = int((r - k * irange * jrange) / irange); - long i = int(r - k * irange * jrange - j * irange); - input(i, j, k) = 1; - } - } - }; - - static double test_collapse_all(const unsigned int icount, - const unsigned int jcount, - const unsigned int kcount, - const long iter = 1) { - // This test refers to collapsing all dims using the RangePolicy - view_type Atest("Atest", icount, jcount, kcount); - view_type Btest("Btest", icount + 2, jcount + 2, kcount + 2); - using FunctorType = - RangePolicyCollapseAll; - - const long flat_index_range = icount * jcount * kcount; - Kokkos::RangePolicy policy(0, flat_index_range); - Kokkos::RangePolicy policy_initB( - 0, (icount + 2) * (jcount + 2) * (kcount + 2)); - - double dt_min = 0; - - Kokkos::parallel_for(policy, Init(Atest, icount, jcount, kcount)); - execution_space().fence(); - Kokkos::parallel_for(policy_initB, - Init(Btest, icount + 2, jcount + 2, kcount + 2)); - execution_space().fence(); - - for (int i = 0; i < iter; ++i) { - Kokkos::Timer timer; - Kokkos::parallel_for(policy, - FunctorType(Atest, Btest, icount, jcount, kcount)); - execution_space().fence(); - const double dt = timer.seconds(); - if (0 == i) - dt_min = dt; - else - dt_min = dt < dt_min ? dt : dt_min; - - // Correctness check - first iteration only - if (0 == i) { - long numErrors = 0; - host_view_type Ahost("Ahost", icount, jcount, kcount); - Kokkos::deep_copy(Ahost, Atest); - host_view_type Bhost("Bhost", icount + 2, jcount + 2, kcount + 2); - Kokkos::deep_copy(Bhost, Btest); - - // On KNL, this may vectorize - add print statement to prevent - // Also, compare against epsilon, as vectorization can change bitwise - // answer - for (long l = 0; l < static_cast(icount); ++l) { - for (long j = 0; j < static_cast(jcount); ++j) { - for (long k = 0; k < static_cast(kcount); ++k) { - ScalarType check = - 0.25 * (ScalarType)(Bhost(l + 2, j, k) + Bhost(l + 1, j, k) + - Bhost(l, j + 2, k) + Bhost(l, j + 1, k) + - Bhost(l, j, k + 2) + Bhost(l, j, k + 1) + - Bhost(l, j, k)); - if (Ahost(l, j, k) - check != 0) { - ++numErrors; - std::cout << " Callapse ALL Correctness error at index: " << l - << "," << j << "," << k << "\n" - << " flat Ahost = " << Ahost(l, j, k) - << " expected = " << check << std::endl; - // exit(-1); - } - } - } - } - if (numErrors != 0) { - std::cout << " RP collapse all: errors " << numErrors - << " range product " << icount * jcount * kcount << " LL " - << jcount * kcount << " LR " << icount * jcount - << std::endl; - } - // else { std::cout << " RP collapse all: Pass! " << std::endl; } - } - } - - return dt_min; - } -}; - -} // end namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTestMDRange_Stencil.cpp b/packages/kokkos/core/perf_test/PerfTestMDRange_Stencil.cpp new file mode 100644 index 000000000000..5a5231a9b9e2 --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTestMDRange_Stencil.cpp @@ -0,0 +1,498 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include +#include +#include +#include + +#include + +#include "PerfTest_Category.hpp" +#include + +namespace Test { + +template +struct LayoutToIterationPattern {}; + +template <> +struct LayoutToIterationPattern { + static constexpr Kokkos::Iterate pattern = Kokkos::Iterate::Right; +}; + +template <> +struct LayoutToIterationPattern { + static constexpr Kokkos::Iterate pattern = Kokkos::Iterate::Left; +}; + +template +void check_computation(const ViewType& A, const ViewType& B) { + int numErrors = 0; + auto Ahost = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), A); + auto Bhost = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), B); + + // On KNL, this may vectorize - add print statement to prevent + // Also, compare against epsilon, as vectorization can change bitwise + // answer + ScalarType epsilon = std::numeric_limits::epsilon() * 100; + if constexpr (ViewType::rank == 2) { + const int n0 = Ahost.extent_int(0) - 2, n1 = Ahost.extent_int(1) - 2; + for (int i0 = 1; i0 < n0 + 1; ++i0) { + for (int i1 = 1; i1 < n1 + 1; ++i1) { + ScalarType check = + 0.25 * + (ScalarType)(Bhost(i0 + 1, i1) + Bhost(i0 - 1, i1) + + Bhost(i0, i1 + 1) + Bhost(i0, i1 - 1) + Bhost(i0, i1)); + if (Kokkos::abs(Ahost(i0, i1) - check) > epsilon) { + ++numErrors; + std::cerr << "Correctness error at index: " << i0 << "," << i1 + << ", got " << Ahost(i0, i1) << ", expected " << check + << "\n"; + } + } + } + } else if constexpr (ViewType::rank == 3) { + const int n0 = Ahost.extent_int(0) - 2, n1 = Ahost.extent_int(1) - 2, + n2 = Ahost.extent_int(2) - 2; + for (int i0 = 1; i0 < n0 + 1; ++i0) { + for (int i1 = 1; i1 < n1 + 1; ++i1) { + for (int i2 = 1; i2 < n2 + 1; ++i2) { + ScalarType check = + 0.25 * + (ScalarType)(Bhost(i0 + 1, i1, i2) + Bhost(i0 - 1, i1, i2) + + Bhost(i0, i1 + 1, i2) + Bhost(i0, i1 - 1, i2) + + Bhost(i0, i1, i2 + 1) + Bhost(i0, i1, i2 - 1) + + Bhost(i0, i1, i2)); + if (Kokkos::abs(Ahost(i0, i1, i2) - check) > epsilon) { + ++numErrors; + std::cerr << "Correctness error at index: " << i0 << "," << i1 + << "," << i2 << ", got " << Ahost(i0, i1, i2) + << ", expected " << check << "\n"; + } + } + } + } + } else if constexpr (ViewType::rank == 4) { + const int n0 = Ahost.extent_int(0) - 2, n1 = Ahost.extent_int(1) - 2, + n2 = Ahost.extent_int(2) - 2, n3 = Ahost.extent_int(3) - 2; + for (int i0 = 1; i0 < n0 + 1; ++i0) { + for (int i1 = 1; i1 < n1 + 1; ++i1) { + for (int i2 = 1; i2 < n2 + 1; ++i2) { + for (int i3 = 1; i3 < n3 + 1; ++i3) { + ScalarType check = 0.25 * (ScalarType)(Bhost(i0 + 1, i1, i2, i3) + + Bhost(i0 - 1, i1, i2, i3) + + Bhost(i0, i1 + 1, i2, i3) + + Bhost(i0, i1 - 1, i2, i3) + + Bhost(i0, i1, i2 + 1, i3) + + Bhost(i0, i1, i2 - 1, i3) + + Bhost(i0, i1, i2, i3 + 1) + + Bhost(i0, i1, i2, i3 - 1) + + Bhost(i0, i1, i2, i3)); + if (Kokkos::abs(Ahost(i0, i1, i2, i3) - check) > epsilon) { + ++numErrors; + std::cerr << "Correctness error at index: " << i0 << "," << i1 + << "," << i2 << "," << i3 << ", got " + << Ahost(i0, i1, i2, i3) << ", expected " << check + << "\n"; + } + } + } + } + } + if (numErrors != 0) { + std::cerr << "Detected some errors for a run with dimensions " + << Ahost.extent(0); + for (std::size_t i = 1; i < Ahost.rank(); i++) { + std::cerr << "x" << Ahost.extent(i); + } + std::cerr << std::endl; + } + } +} + +template +void bench_mdrange(benchmark::State& state, std::index_sequence) { + using execution_space = typename FunctorType::execution_space; + using view_type = typename FunctorType::view_type; + + Kokkos::Array dims, tiles; + for (std::size_t i = 0; i < dims.size(); i++) { + dims[i] = state.range(0); + tiles[i] = state.range(1); + } + + const auto policy = FunctorType::get_policy(dims, tiles); + + bool using_default_tiling = false; + for (std::size_t i = 0; i < tiles.size(); i++) { + state.counters[std::string("tile_") + std::to_string(i)] = tiles[i]; + using_default_tiling |= tiles[i] != state.range(1); + } + state.counters["default_tiling"] = using_default_tiling; + + view_type Atest("Atest", (dims[Idx] + 2)...); + view_type Btest("Btest", (dims[Idx] + 2)...); + + Kokkos::deep_copy(Atest, 1.0); + execution_space().fence(); + Kokkos::deep_copy(Btest, 1.0); + execution_space().fence(); + + for (auto _ : state) { + Kokkos::Timer timer; + Kokkos::parallel_for(policy, FunctorType(Atest, Btest, dims)); + execution_space().fence(); + const double dt = timer.seconds(); + state.SetIterationTime(dt); + } + // Correctness check + check_computation(Atest, Btest); +} + +template +void bench_mdrange(benchmark::State& state) { + bench_mdrange( + state, std::make_index_sequence()); +} + +template +struct add_pointer_n { + using type = typename add_pointer_n::type; +}; + +template +struct add_pointer_n { + using type = T; +}; + +template +using add_pointer_n_t = typename add_pointer_n::type; + +template +struct MDRange { + using execution_space = DeviceType; + using scalar_type = ScalarType; + using size_type = typename execution_space::size_type; + using view_type = Kokkos::View, + TestLayout, DeviceType>; + + static constexpr int dimension = Dimension; + + view_type A; + view_type B; + const Kokkos::Array ranges; + + template + MDRange(const view_type& A_, const view_type& B_, + const Kokkos::Array& dims) + : A(A_), B(B_), ranges(dims) {} + + KOKKOS_INLINE_FUNCTION + void operator()(int i0, int i1) const + requires(dimension == 2) + { + i0++; + i1++; + A(i0, i1) = 0.25 * (ScalarType)(B(i0 + 1, i1) + B(i0 - 1, i1) + + B(i0, i1 + 1) + B(i0, i1 - 1) + B(i0, i1)); + } + + KOKKOS_INLINE_FUNCTION + void operator()(int i0, int i1, int i2) const + requires(dimension == 3) + { + i0++; + i1++; + i2++; + A(i0, i1, i2) = 0.25 * (ScalarType)(B(i0 + 1, i1, i2) + B(i0 - 1, i1, i2) + + B(i0, i1 + 1, i2) + B(i0, i1 - 1, i2) + + B(i0, i1, i2 + 1) + B(i0, i1, i2 - 1) + + B(i0, i1, i2)); + } + + KOKKOS_INLINE_FUNCTION + void operator()(int i0, int i1, int i2, int i3) const + requires(dimension == 4) + { + i0++; + i1++; + i2++; + i3++; + A(i0, i1, i2, i3) = + 0.25 * (ScalarType)(B(i0 + 1, i1, i2, i3) + B(i0 - 1, i1, i2, i3) + + B(i0, i1 + 1, i2, i3) + B(i0, i1 - 1, i2, i3) + + B(i0, i1, i2 + 1, i3) + B(i0, i1, i2 - 1, i3) + + B(i0, i1, i2, i3 + 1) + B(i0, i1, i2, i3 - 1) + + B(i0, i1, i2, i3)); + } + + static auto get_policy(const Kokkos::Array& end, + Kokkos::Array& tile) { + constexpr Kokkos::Iterate iteration_pattern = + LayoutToIterationPattern::pattern; + const Kokkos::MDRangePolicy< + Kokkos::Rank, + execution_space> + policy(Kokkos::Array{}, end, tile); + + for (int i = 0; i < dimension; i++) { + tile[i] = policy.m_tile[i]; + } + + return policy; + } +}; + +template +struct CollapseTwo { + // RangePolicy for ND range, but will collapse only 2 dims; unroll 2 dims in + // one-dim + + using execution_space = DeviceType; + using scalar_type = ScalarType; + using size_type = typename execution_space::size_type; + using view_type = Kokkos::View, + TestLayout, DeviceType>; + + static constexpr int dimension = Dimension; + + view_type A; + view_type B; + const Kokkos::Array ranges; + + CollapseTwo(view_type& A_, const view_type& B_, + const Kokkos::Array& dims) + : A(A_), B(B_), ranges(dims) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const int r) const + requires(dimension == 3) + { + if constexpr (std::is_same_v) { + const int i0 = r % ranges[0] + 1, i1 = r / ranges[0] + 1; + for (int i2 = 1; i2 < ranges[2] + 1; ++i2) { + A(i0, i1, i2) = + 0.25 * + (ScalarType)(B(i0 + 1, i1, i2) + B(i0 - 1, i1, i2) + + B(i0, i1 + 1, i2) + B(i0, i1 - 1, i2) + + B(i0, i1, i2 + 1) + B(i0, i1, i2 - 1) + B(i0, i1, i2)); + } + } else { + const int i2 = r % ranges[2] + 1, i1 = r / ranges[2] + 1; + for (int i0 = 1; i0 < ranges[0] + 1; ++i0) { + A(i0, i1, i2) = + 0.25 * + (ScalarType)(B(i0 + 1, i1, i2) + B(i0 - 1, i1, i2) + + B(i0, i1 + 1, i2) + B(i0, i1 - 1, i2) + + B(i0, i1, i2 + 1) + B(i0, i1, i2 - 1) + B(i0, i1, i2)); + } + } + } + + KOKKOS_INLINE_FUNCTION + void operator()(const int r) const + requires(dimension == 4) + { + if constexpr (std::is_same_v) { + const int i0 = r % ranges[0] + 1, i12 = r / ranges[0]; + const int i1 = i12 % ranges[1] + 1, i2 = i12 / ranges[1] + 1; + for (int i3 = 1; i3 < ranges[3] + 1; ++i3) { + A(i0, i1, i2, i3) = + 0.25 * (ScalarType)(B(i0 + 1, i1, i2, i3) + B(i0 - 1, i1, i2, i3) + + B(i0, i1 + 1, i2, i3) + B(i0, i1 - 1, i2, i3) + + B(i0, i1, i2 + 1, i3) + B(i0, i1, i2 - 1, i3) + + B(i0, i1, i2, i3 + 1) + B(i0, i1, i2, i3 - 1) + + B(i0, i1, i2, i3)); + } + } else { + const int i3 = r % ranges[3] + 1, i21 = r / ranges[3]; + const int i2 = i21 % ranges[2] + 1, i1 = i21 / ranges[2] + 1; + for (int i0 = 1; i0 < ranges[0] + 1; ++i0) { + A(i0, i1, i2, i3) = + 0.25 * (ScalarType)(B(i0 + 1, i1, i2, i3) + B(i0 - 1, i1, i2, i3) + + B(i0, i1 + 1, i2, i3) + B(i0, i1 - 1, i2, i3) + + B(i0, i1, i2 + 1, i3) + B(i0, i1, i2 - 1, i3) + + B(i0, i1, i2, i3 + 1) + B(i0, i1, i2, i3 - 1) + + B(i0, i1, i2, i3)); + } + } + } + + static auto get_policy(const Kokkos::Array& dims, + const Kokkos::Array&) { + int collapse_index_rangeA = 0; + if constexpr (std::is_same_v) { + collapse_index_rangeA = std::reduce(Kokkos::begin(dims), + Kokkos::begin(dims) + (dimension - 1), + 1, std::multiplies{}); + } else if constexpr (std::is_same_v) { + collapse_index_rangeA = + std::reduce(Kokkos::begin(dims) + 1, Kokkos::end(dims), 1, + std::multiplies{}); + } else { + static_assert(!(std::is_same_v || + std::is_same_v), + "LayoutRight or LayoutLeft required"); + } + + return Kokkos::RangePolicy(0, collapse_index_rangeA); + } +}; + +template +struct CollapseAll { + // RangePolicy for ND range, but will collapse all dims + + using execution_space = DeviceType; + using scalar_type = ScalarType; + using size_type = typename execution_space::size_type; + using view_type = Kokkos::View, + TestLayout, DeviceType>; + + static constexpr int dimension = Dimension; + + view_type A; + view_type B; + const Kokkos::Array ranges; + + template + CollapseAll(view_type& A_, const view_type& B_, + const Kokkos::Array& dims) + : A(A_), B(B_), ranges(dims) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const int r) const + requires(dimension == 2) + { + if constexpr (std::is_same_v) { + const int i0 = r % ranges[0] + 1, i1 = r / ranges[0] + 1; + A(i0, i1) = + 0.25 * (ScalarType)(B(i0 + 1, i1) + B(i0 - 1, i1) + B(i0, i1 + 1) + + B(i0, i1 - 1) + B(i0, i1)); + } else { + const int i1 = r % ranges[1] + 1, i0 = r / ranges[1] + 1; + A(i0, i1) = + 0.25 * (ScalarType)(B(i0 + 1, i1) + B(i0 - 1, i1) + B(i0, i1 + 1) + + B(i0, i1 - 1) + B(i0, i1)); + } + } + + KOKKOS_INLINE_FUNCTION + void operator()(const int r) const + requires(dimension == 3) + { + if constexpr (std::is_same_v) { + const int i0 = r % ranges[0] + 1, i12 = r / ranges[0]; + const int i1 = i12 % ranges[1] + 1, i2 = i12 / ranges[1] + 1; + A(i0, i1, i2) = + 0.25 * + (ScalarType)(B(i0 + 1, i1, i2) + B(i0 - 1, i1, i2) + + B(i0, i1 + 1, i2) + B(i0, i1 - 1, i2) + + B(i0, i1, i2 + 1) + B(i0, i1, i2 - 1) + B(i0, i1, i2)); + } else { + const int i2 = r % ranges[2] + 1, i10 = r / ranges[2]; + const int i1 = i10 % ranges[1] + 1, i0 = i10 / ranges[1] + 1; + A(i0, i1, i2) = + 0.25 * + (ScalarType)(B(i0 + 1, i1, i2) + B(i0 - 1, i1, i2) + + B(i0, i1 + 1, i2) + B(i0, i1 - 1, i2) + + B(i0, i1, i2 + 1) + B(i0, i1, i2 - 1) + B(i0, i1, i2)); + } + } + + KOKKOS_INLINE_FUNCTION + void operator()(const int r) const + requires(dimension == 4) + { + if constexpr (std::is_same_v) { + const int i0 = r % ranges[0] + 1, i123 = r / ranges[0]; + const int i1 = i123 % ranges[1] + 1, i23 = i123 / ranges[1]; + const int i2 = i23 % ranges[2] + 1, i3 = i23 / ranges[2] + 1; + A(i0, i1, i2, i3) = + 0.25 * (ScalarType)(B(i0 + 1, i1, i2, i3) + B(i0 - 1, i1, i2, i3) + + B(i0, i1 + 1, i2, i3) + B(i0, i1 - 1, i2, i3) + + B(i0, i1, i2 + 1, i3) + B(i0, i1, i2 - 1, i3) + + B(i0, i1, i2, i3 + 1) + B(i0, i1, i2, i3 - 1) + + B(i0, i1, i2, i3)); + } else { + const int i3 = r % ranges[3] + 1, i210 = r / ranges[3]; + const int i2 = i210 % ranges[2] + 1, i10 = i210 / ranges[2]; + const int i1 = i10 % ranges[1] + 1, i0 = i10 / ranges[1] + 1; + A(i0, i1, i2, i3) = + 0.25 * (ScalarType)(B(i0 + 1, i1, i2, i3) + B(i0 - 1, i1, i2, i3) + + B(i0, i1 + 1, i2, i3) + B(i0, i1 - 1, i2, i3) + + B(i0, i1, i2 + 1, i3) + B(i0, i1, i2 - 1, i3) + + B(i0, i1, i2, i3 + 1) + B(i0, i1, i2, i3 - 1) + + B(i0, i1, i2, i3)); + } + } + + static auto get_policy(const Kokkos::Array& dims, + const Kokkos::Array&) { + const int flat_index_range = std::reduce( + Kokkos::begin(dims), Kokkos::end(dims), 1, std::multiplies{}); + return Kokkos::RangePolicy(0, flat_index_range); + } +}; + +#if !defined(KOKKOS_ENABLE_BENCHMARKS_HEAVY) +#define MDRANGE_STENCIL_BENCHMARK(functor, dim, layout, sizes, ...) \ + BENCHMARK(bench_mdrange>) \ + ->UseManualTime() \ + ->Unit(benchmark::kMillisecond) \ + ->Name("MDRangeStencil_" #dim "D_" #functor "_" #layout) \ + ->ArgNames({"size", "tile_size"}) \ + ->ArgsProduct({sizes, __VA_ARGS__}) \ + ->Iterations(1); + +MDRANGE_STENCIL_BENCHMARK(MDRange, 2, LayoutRight, {512}, {0}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 3, LayoutLeft, {128}, {0}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 4, LayoutRight, {32}, {0}) +#else +#define MDRANGE_STENCIL_BENCHMARK(functor, dim, layout, sizes, ...) \ + BENCHMARK(bench_mdrange>) \ + ->UseManualTime() \ + ->Unit(benchmark::kMillisecond) \ + ->Name("MDRangeStencil_" #dim "D_" #functor "_" #layout) \ + ->ArgNames({"size", "tile_size"}) \ + ->ArgsProduct({sizes, __VA_ARGS__}); + +#define SIZES_2D \ + { 512, 1024, 2048, 4096, 8192 } +#define SIZES_3D \ + { 128, 192, 256, 512 } +#define SIZES_4D \ + { 32, 64, 96 } +MDRANGE_STENCIL_BENCHMARK(MDRange, 2, LayoutRight, SIZES_2D, {0, 1}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 3, LayoutRight, SIZES_3D, {0, 1}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 4, LayoutRight, SIZES_4D, {0, 1}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 2, LayoutLeft, SIZES_2D, {0, 1}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 3, LayoutLeft, SIZES_3D, {0, 1}) +MDRANGE_STENCIL_BENCHMARK(MDRange, 4, LayoutLeft, SIZES_4D, {0, 1}) + +MDRANGE_STENCIL_BENCHMARK(CollapseTwo, 3, LayoutRight, SIZES_3D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseTwo, 3, LayoutLeft, SIZES_3D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseTwo, 4, LayoutRight, SIZES_4D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseTwo, 4, LayoutLeft, SIZES_4D, {-1}) + +MDRANGE_STENCIL_BENCHMARK(CollapseAll, 2, LayoutRight, SIZES_2D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseAll, 2, LayoutLeft, SIZES_2D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseAll, 3, LayoutRight, SIZES_3D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseAll, 3, LayoutLeft, SIZES_3D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseAll, 4, LayoutRight, SIZES_4D, {-1}) +MDRANGE_STENCIL_BENCHMARK(CollapseAll, 4, LayoutLeft, SIZES_4D, {-1}) +#undef SIZES_2D +#undef SIZES_3D +#undef SIZES_4D +#endif + +#undef MDRANGE_STENCIL_BENCHMARK + +} // end namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTestMDRange_Stream.cpp b/packages/kokkos/core/perf_test/PerfTestMDRange_Stream.cpp new file mode 100644 index 000000000000..c53616b205ed --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTestMDRange_Stream.cpp @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include "PerfTestMDRange_Stream.hpp" + +namespace Benchmark { + +template +void MDRangePolicy_Copy(benchmark::State& state) { + int N = static_cast(state.range(0)); + + MDStreamTest stream_bench(N); + stream_bench.test_copy(state); +} + +template +void MDRangePolicy_Set(benchmark::State& state) { + int N = static_cast(state.range(0)); + + MDStreamTest stream_bench(N); + stream_bench.test_set(state); +} + +template +void MDRangePolicy_Scale(benchmark::State& state) { + int N = static_cast(state.range(0)); + + MDStreamTest stream_bench(N); + stream_bench.test_scale(state); +} + +template +void MDRangePolicy_Add(benchmark::State& state) { + int N = static_cast(state.range(0)); + + MDStreamTest stream_bench(N); + stream_bench.test_add(state); +} + +template +void MDRangePolicy_Triad(benchmark::State& state) { + int N = static_cast(state.range(0)); + + MDStreamTest stream_bench(N); + stream_bench.test_triad(state); +} + +// Small size for CPU backends, the problem size is computed as N^6 +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) +#define MDRANGE_BENCHMARK_ARG_SIZE 22 +#else +#define MDRANGE_BENCHMARK_ARG_SIZE 16 +#endif + +// Macros to generate benchmarks +#define MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, RANKS) \ + BENCHMARK_TEMPLATE(BENCH_FUNCTION, RANKS) \ + ->Arg(MDRANGE_BENCHMARK_ARG_SIZE) \ + ->UseManualTime() \ + ->Unit(benchmark::kMillisecond); + +#if defined(KOKKOS_ENABLE_BENCHMARKS_HEAVY) + +// Generate benchmarks for ranks 1 to 6 +#define MDRANGE_MAKE_BENCHMARK(BENCH_FUNCTION) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 1) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 2) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 3) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 4) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 5) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 6) + +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Set) +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Copy) +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Scale) +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Add) +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Triad) + +#else + +// Generate benchmarks for ranks 1, 3 and 6 +#define MDRANGE_MAKE_BENCHMARK(BENCH_FUNCTION) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 1) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 3) \ + MDRANGE_BENCHMARK_ARGS(BENCH_FUNCTION, 6) + +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Set) +MDRANGE_MAKE_BENCHMARK(MDRangePolicy_Triad) + +#endif // defined(KOKKOS_ENABLE_BENCHMARKS_HEAVY) + +#undef MDRANGE_BENCHMARK_ARG_SIZE +#undef MDRANGE_BENCHMARK_ARGS +#undef MDRANGE_MAKE_BENCHMARK + +} // namespace Benchmark diff --git a/packages/kokkos/core/perf_test/PerfTestMDRange_Stream.hpp b/packages/kokkos/core/perf_test/PerfTestMDRange_Stream.hpp new file mode 100644 index 000000000000..b31316175f16 --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTestMDRange_Stream.hpp @@ -0,0 +1,242 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include + +#include + +#include "Benchmark_Context.hpp" +#include "PerfTest_Category.hpp" + +namespace Benchmark { + +struct Tag_Set {}; +struct Tag_Copy {}; +struct Tag_Scale {}; +struct Tag_Add {}; +struct Tag_Triad {}; + +template +int tag_to_data_ratio() { + if constexpr (std::is_same_v) return 1; + if constexpr (std::is_same_v) return 2; + if constexpr (std::is_same_v) return 2; + if constexpr (std::is_same_v) return 3; + if constexpr (std::is_same_v) return 3; + return 0; +} + +template +struct ViewTypeRank { + using type = void; +}; + +template +struct ViewTypeRank<1, ScalarType, Layout, MemorySpace> { + using type = Kokkos::View; +}; + +template +struct ViewTypeRank<2, ScalarType, Layout, MemorySpace> { + using type = Kokkos::View; +}; + +template +struct ViewTypeRank<3, ScalarType, Layout, MemorySpace> { + using type = Kokkos::View; +}; + +template +struct ViewTypeRank<4, ScalarType, Layout, MemorySpace> { + using type = Kokkos::View; +}; + +template +struct ViewTypeRank<5, ScalarType, Layout, MemorySpace> { + using type = Kokkos::View; +}; + +template +struct ViewTypeRank<6, ScalarType, Layout, MemorySpace> { + using type = Kokkos::View; +}; + +// Select between MDRangePolicy and RangePolicy +template , typename Tag = void> +struct policy_selector { + using preferred_layout = typename ExecutionSpace::array_layout; + static const Kokkos::Iterate outer_iter = + Kokkos::Impl::layout_iterate_type_selector< + preferred_layout>::outer_iteration_pattern; + static const Kokkos::Iterate inner_iter = + Kokkos::Impl::layout_iterate_type_selector< + preferred_layout>::inner_iteration_pattern; + using type = Kokkos::MDRangePolicy, + IndexType, Tag>; +}; + +// Specialization for 1D RangePolicy +template +struct policy_selector<1, ExecutionSpace, IndexType, Tag> { + using type = Kokkos::RangePolicy; +}; + +// Choose between 1d and Nd bound types +template +struct bound_type_selector { + using type = typename PolicyType::index_type; +}; + +// Specialization for MDRangePolicy +template +struct bound_type_selector> { + using type = typename Kokkos::MDRangePolicy::point_type; +}; + +// Functor for stream test (set, copy, scale, add, triad). +// The problem size is N^6, meaning that each view will have the size of N^6 +// whatever the rank is. +template > +struct MDStreamTest { + using scalar_type = ScalarType; + using execution_space = ExecutionSpace; + using memory_space = typename ExecutionSpace::memory_space; + using preferred_layout = typename ExecutionSpace::array_layout; + using view_type = typename ViewTypeRank::type; + using policy_init_type = + typename policy_selector::type; + using bound_type = typename bound_type_selector::type; + + view_type m_view_A; + view_type m_view_B; + view_type m_view_C; + ScalarType m_scalar; + + bound_type m_lower_bounds; + bound_type m_upper_bounds; + + // Functor for initialization + struct Init { + view_type m_tensor; + scalar_type m_value; + + Init(const view_type &tensor, const scalar_type &value) + : m_tensor(tensor), m_value(value) {} + + template + KOKKOS_INLINE_FUNCTION void operator()(Indices... indices) const { + m_tensor(indices...) = m_value; + } + }; + + MDStreamTest(const int N) { + static_assert(Rank >= 1 && Rank <= 6, + "MDStreamTest: Only ranks 1 to 6 supported"); + + m_view_A = create_test_view("MDStreamTest::view_A", N); + m_view_B = create_test_view("MDStreamTest::view_B", N); + m_view_C = create_test_view("MDStreamTest::view_C", N); + m_scalar = static_cast(2.718281828); + + if constexpr (Rank == 1) { + m_lower_bounds = 0; + m_upper_bounds = m_view_A.extent(0); + } else { + for (int i = 0; i < Rank; ++i) { + m_lower_bounds[i] = 0; + m_upper_bounds[i] = m_view_A.extent(i); + } + } + + policy_init_type init_policy(m_lower_bounds, m_upper_bounds); + Kokkos::parallel_for(init_policy, + Init(m_view_A, static_cast(1.0))); + Kokkos::parallel_for(init_policy, + Init(m_view_B, static_cast(2.0))); + Kokkos::parallel_for(init_policy, + Init(m_view_C, static_cast(3.0))); + execution_space().fence(); + } + + // Tagged operator() + template + KOKKOS_INLINE_FUNCTION void operator()(Tag_Set, Args... args) const { + m_view_A(args...) = static_cast(m_scalar); + } + + template + KOKKOS_INLINE_FUNCTION void operator()(Tag_Copy, Args... args) const { + m_view_B(args...) = m_view_A(args...); + } + + template + KOKKOS_INLINE_FUNCTION void operator()(Tag_Scale, Args... args) const { + m_view_B(args...) = m_scalar * m_view_A(args...); + } + + template + KOKKOS_INLINE_FUNCTION void operator()(Tag_Add, Args... args) const { + m_view_C(args...) = m_view_A(args...) + m_view_B(args...); + } + + template + KOKKOS_INLINE_FUNCTION void operator()(Tag_Triad, Args... args) const { + m_view_C(args...) = m_view_A(args...) + m_scalar * m_view_B(args...); + } + + // Create test views of size N^6 + view_type create_test_view(const char *name, int dim) { + long N1 = dim; + long N2 = N1 * N1; + long N3 = N2 * N1; + long N6 = N3 * N3; + std::string view_name(name); + if constexpr (Rank == 1) { + return view_type(view_name, N6); + } else if constexpr (Rank == 2) { + return view_type(view_name, N3, N3); + } else if constexpr (Rank == 3) { + return view_type(view_name, N2, N2, N2); + } else if constexpr (Rank == 4) { + return view_type(view_name, N2, N1, N1, N2); + } else if constexpr (Rank == 5) { + return view_type(view_name, N1, N1, N2, N1, N1); + } else if constexpr (Rank == 6) { + return view_type(view_name, N1, N1, N1, N1, N1, N1); + } + } + + template + void run_test(benchmark::State &state) { + using policy_test_type = + typename policy_selector::type; + + policy_test_type compute_policy(m_lower_bounds, m_upper_bounds); + + const int data_ratio = tag_to_data_ratio(); + + for (auto _ : state) { + Kokkos::Timer timer; + Kokkos::parallel_for(compute_policy, *this); + execution_space().fence(); + KokkosBenchmark::report_results(state, m_view_A, data_ratio, + timer.seconds()); + } + } + + void test_set(benchmark::State &state) { run_test(state); } + + void test_copy(benchmark::State &state) { run_test(state); } + + void test_scale(benchmark::State &state) { run_test(state); } + + void test_add(benchmark::State &state) { run_test(state); } + + void test_triad(benchmark::State &state) { run_test(state); } +}; + +} // namespace Benchmark diff --git a/packages/kokkos/core/perf_test/PerfTestMain.cpp b/packages/kokkos/core/perf_test/PerfTestMain.cpp index 7315f26e5c16..e740a5874912 100644 --- a/packages/kokkos/core/perf_test/PerfTestMain.cpp +++ b/packages/kokkos/core/perf_test/PerfTestMain.cpp @@ -1,23 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include int main(int argc, char* argv[]) { diff --git a/packages/kokkos/core/perf_test/PerfTest_Category.hpp b/packages/kokkos/core/perf_test/PerfTest_Category.hpp index 60f76ea8f561..3bcae22d4a62 100644 --- a/packages/kokkos/core/perf_test/PerfTest_Category.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_Category.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_TEST_PERFTEST_CAT_HPP #define KOKKOS_TEST_PERFTEST_CAT_HPP diff --git a/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp b/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp index deb139a5212a..c1da1470ad11 100644 --- a/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp @@ -1,29 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project -#include -#include -#include "Benchmark_Context.hpp" -#include "PerfTest_Category.hpp" #include #ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; import kokkos.random; #else +#include #include #endif +#include +#include "Benchmark_Context.hpp" +#include "PerfTest_Category.hpp" #include namespace Test { @@ -35,65 +23,44 @@ std::pair custom_reduction_test(int N, int R) { Scalar max; + auto reduction_lambda = KOKKOS_LAMBDA( + const Kokkos::TeamPolicy<>::member_type& team, Scalar& lmax) { + Scalar team_max = Scalar(0); + for (int rr = 0; rr < R; rr++) { + int i = team.league_rank(); + Kokkos::parallel_reduce( + Kokkos::TeamThreadRange(team, 32), + [&](const int& j, Scalar& thread_max) { + Scalar t_max = Scalar(0); + Kokkos::parallel_reduce( + Kokkos::ThreadVectorRange(team, 32), + [&](const int& k, Scalar& max_) { + const Scalar val = a((i * 32 + j) * 32 + k); + if (val > max_) max_ = val; + if ((k == 11) && (j == 17) && (i == 2)) max_ = 11.5; + }, + Kokkos::Max(t_max)); + if (t_max > thread_max) thread_max = t_max; + }, + Kokkos::Max(team_max)); + } + if (team_max > lmax) lmax = team_max; + }; + int team_size = 32; - if (team_size > Kokkos::DefaultExecutionSpace().concurrency()) - team_size = Kokkos::DefaultExecutionSpace().concurrency(); + Kokkos::Max reducer(max); + // FIXME Use reducer + int const max_team_size = Kokkos::TeamPolicy<>(1, 1).team_size_max( + reduction_lambda, Kokkos::ParallelReduceTag{}); + if (team_size > max_team_size) team_size = max_team_size; // Warm up - Kokkos::parallel_reduce( - Kokkos::TeamPolicy<>(N / 1024, team_size), - KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type& team, - Scalar& lmax) { - Scalar team_max = Scalar(0); - for (int rr = 0; rr < R; rr++) { - int i = team.league_rank(); - Kokkos::parallel_reduce( - Kokkos::TeamThreadRange(team, 32), - [&](const int& j, Scalar& thread_max) { - Scalar t_max = Scalar(0); - Kokkos::parallel_reduce( - Kokkos::ThreadVectorRange(team, 32), - [&](const int& k, Scalar& max_) { - const Scalar val = a((i * 32 + j) * 32 + k); - if (val > max_) max_ = val; - if ((k == 11) && (j == 17) && (i == 2)) max_ = 11.5; - }, - Kokkos::Max(t_max)); - if (t_max > thread_max) thread_max = t_max; - }, - Kokkos::Max(team_max)); - } - if (team_max > lmax) lmax = team_max; - }, - Kokkos::Max(max)); + Kokkos::parallel_reduce(Kokkos::TeamPolicy<>(N / 1024, team_size), + reduction_lambda, reducer); // Timing Kokkos::Timer timer; - Kokkos::parallel_reduce( - Kokkos::TeamPolicy<>(N / 1024, team_size), - KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type& team, - Scalar& lmax) { - Scalar team_max = Scalar(0); - for (int rr = 0; rr < R; rr++) { - int i = team.league_rank(); - Kokkos::parallel_reduce( - Kokkos::TeamThreadRange(team, 32), - [&](const int& j, Scalar& thread_max) { - Scalar t_max = Scalar(0); - Kokkos::parallel_reduce( - Kokkos::ThreadVectorRange(team, 32), - [&](const int& k, Scalar& max_) { - const Scalar val = a((i * 32 + j) * 32 + k); - if (val > max_) max_ = val; - if ((k == 11) && (j == 17) && (i == 2)) max_ = 11.5; - }, - Kokkos::Max(t_max)); - if (t_max > thread_max) thread_max = t_max; - }, - Kokkos::Max(team_max)); - } - if (team_max > lmax) lmax = team_max; - }, - Kokkos::Max(max)); + Kokkos::parallel_reduce(Kokkos::TeamPolicy<>(N / 1024, team_size), + reduction_lambda, reducer); return std::make_pair(timer.seconds(), max); } diff --git a/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp b/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp index e966eaa45dd0..fbf651edc311 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp @@ -1,20 +1,14 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif +#include + #include #include "PerfTest_Category.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_Gemv.cpp b/packages/kokkos/core/perf_test/PerfTest_Gemv.cpp new file mode 100644 index 000000000000..509208ee59a4 --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTest_Gemv.cpp @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +/** + * @file PerfTest_Gemv.cpp + * + * This file implements a performance test of a naive GEMV implementation. + * This was created to reproduce a performance problem observed on MI300A using + * the HIP backend. With a relatively small number of rows (4000), the HIP + * backend was choosing large block sizes, which led to very few active EUs on + * the GPU. + */ + +#include +#include +#include "Benchmark_Context.hpp" + +namespace Benchmark { + +template +void impl(benchmark::State& state) { + const size_t M = state.range(0); + const size_t N = state.range(1); + + Kokkos::View A("A", M, N); + Kokkos::View y("y", M); + Kokkos::View x("x", N); + + for (auto _ : state) { + Kokkos::Timer timer; + Kokkos::parallel_for( + P(0, y.extent(0)), KOKKOS_LAMBDA(const int i) { + int sum = 0; + for (int j = 0; j < x.extent_int(0); j++) { + sum += A(i, j) * x(j); + } + y(i) = sum; + }); + Kokkos::fence(); + state.SetIterationTime(timer.seconds()); + } +} + +template +static void GemvDefault(benchmark::State& state) { + using P = Kokkos::RangePolicy<>; + impl(state); +} + +template +static void Gemv(benchmark::State& state) { + using P = Kokkos::RangePolicy>; + impl(state); +} + +#define COMMON_ARGS() \ + ArgNames({"M", "N"}) \ + ->UseManualTime() \ + ->Unit(benchmark::kMicrosecond) \ + ->Args({4'000, 10'000}) \ + ->Args({400'000, 100}) + +BENCHMARK(GemvDefault)->COMMON_ARGS(); +BENCHMARK(GemvDefault)->COMMON_ARGS(); + +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) +BENCHMARK(Gemv<64, Kokkos::LayoutLeft>)->COMMON_ARGS(); +BENCHMARK(Gemv<64, Kokkos::LayoutRight>)->COMMON_ARGS(); +BENCHMARK(Gemv<256, Kokkos::LayoutLeft>)->COMMON_ARGS(); +BENCHMARK(Gemv<256, Kokkos::LayoutRight>)->COMMON_ARGS(); +BENCHMARK(Gemv<1024, Kokkos::LayoutLeft>)->COMMON_ARGS(); +BENCHMARK(Gemv<1024, Kokkos::LayoutRight>)->COMMON_ARGS(); +#endif + +#undef COMMON_ARGS + +} // namespace Benchmark diff --git a/packages/kokkos/core/perf_test/PerfTest_MallocFree.cpp b/packages/kokkos/core/perf_test/PerfTest_MallocFree.cpp index 80736d991521..729f401e3a46 100644 --- a/packages/kokkos/core/perf_test/PerfTest_MallocFree.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_MallocFree.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Benchmark_Context.hpp" @@ -69,31 +61,41 @@ static void MallocTouchFree(benchmark::State& state) { Impl(state, true, When::after_free); } +#ifdef KOKKOS_IMPL_32BIT +constexpr int test_range = 30; +#else +#ifndef KOKKOS_ENABLE_LARGE_MEM_TESTS +constexpr int test_range = 31; +#else +constexpr int test_range = 32; +#endif +#endif + BENCHMARK(Malloc) ->ArgName("N") ->RangeMultiplier(16) - ->Range(1, int64_t(1) << 32) + ->Range(1, int64_t(1) << test_range) ->UseManualTime() ->Unit(benchmark::kMicrosecond); BENCHMARK(MallocFree) ->ArgName("N") ->RangeMultiplier(16) - ->Range(1, int64_t(1) << 32) + ->Range(1, int64_t(1) << test_range) ->UseManualTime() ->Unit(benchmark::kMicrosecond); BENCHMARK(MallocTouch) ->ArgName("N") ->RangeMultiplier(16) - ->Range(1, int64_t(1) << 32) + ->Range(1, int64_t(1) << test_range) ->UseManualTime() ->Unit(benchmark::kMicrosecond); BENCHMARK(MallocTouchFree) ->ArgName("N") ->RangeMultiplier(16) - ->Range(1, int64_t(1) << 32) + ->Range(1, int64_t(1) << test_range) ->UseManualTime() ->Unit(benchmark::kMicrosecond); diff --git a/packages/kokkos/core/perf_test/PerfTest_Stream.cpp b/packages/kokkos/core/perf_test/PerfTest_Stream.cpp new file mode 100644 index 000000000000..204e40e41ee4 --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTest_Stream.cpp @@ -0,0 +1,266 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +/** + * @file PerfTest_Stream.cpp + * @brief Implementation of STREAM benchmark operations for Kokkos. + * + * @details This file provides a set of memory bandwidth benchmarks based on the + * STREAM benchmark suite. It implements the five core STREAM operations (Set, + * Copy, Scale, Add, and Triad) using Kokkos parallel primitives. It includes + * validation. + * + * The implementation strives to use as few Kokkos features as possible, thus + * validation is performed on the host rather than via parallel_reduce. + */ + +#include +#include +#include "Benchmark_Context.hpp" + +namespace { + +using StreamType = double; +constexpr static StreamType A_INIT = 1.0; +constexpr static StreamType B_INIT = 2.0; +constexpr static StreamType C_INIT = 3.0; +constexpr static StreamType SCALAR = 4.0; + +template +using StreamView = Kokkos::View>; + +// different than benchmarks/stream, which uses int +// wide index types are common as GPU memory grows +using StreamIndex = int64_t; +using Policy = Kokkos::RangePolicy>; + +template +void perform_set(const V& a, typename V::const_value_type scalar) { + Kokkos::parallel_for( + "set", Policy(0, a.extent(0)), + KOKKOS_LAMBDA(const StreamIndex i) { a[i] = scalar; }); + + Kokkos::fence(); +} + +template +void perform_copy(const V& a, const V& b) { + Kokkos::parallel_for( + "copy", Policy(0, a.extent(0)), + KOKKOS_LAMBDA(const StreamIndex i) { b[i] = a[i]; }); + + Kokkos::fence(); +} + +template +void perform_scale(const V& b, const V& c, + typename V::const_value_type scalar) { + Kokkos::parallel_for( + "scale", Policy(0, b.extent(0)), + KOKKOS_LAMBDA(const StreamIndex i) { b[i] = scalar * c[i]; }); + + Kokkos::fence(); +} + +template +void perform_add(const V& a, const V& b, const V& c) { + Kokkos::parallel_for( + "add", Policy(0, a.extent(0)), + KOKKOS_LAMBDA(const StreamIndex i) { c[i] = a[i] + b[i]; }); + + Kokkos::fence(); +} + +template +void perform_triad(const V& a, const V& b, const V& c, + typename V::const_value_type scalar) { + Kokkos::parallel_for( + "triad", Policy(0, a.extent(0)), + KOKKOS_LAMBDA(const StreamIndex i) { a[i] = b[i] + scalar * c[i]; }); + + Kokkos::fence(); +} + +template +int validate_array(V& a_dev, typename V::const_value_type expected) { + using scalar_type = typename V::non_const_value_type; + + const auto a = + Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, a_dev); + + scalar_type error = 0.0; + for (size_t i = 0; i < a.size(); ++i) { + error += std::abs(a[i] - expected); + } + const scalar_type avgError = error / (scalar_type)a.size(); + + // all values here are pretty easy for float types to represent + // so let's make the tolerances very tight. + return std::abs(avgError / expected) > + Kokkos::Experimental::epsilon_v; +} + +template +static void StreamSet(benchmark::State& state) { + const size_t N8 = std::pow(state.range(0), 8); + static constexpr int DATA_RATIO = 1; + + StreamView a(Kokkos::view_alloc(Kokkos::WithoutInitializing, "a"), + N8); + + for (auto _ : state) { + Kokkos::Timer timer; + perform_set(a, SCALAR); + KokkosBenchmark::report_results(state, a, DATA_RATIO, timer.seconds()); + } + + if (validate_array(a, SCALAR)) { + state.SkipWithError("validation failure"); + } +} + +template +static void StreamCopy(benchmark::State& state) { + const size_t N8 = std::pow(state.range(0), 8); + static constexpr int DATA_RATIO = 2; + + StreamView a("a", N8), b("b", N8); + + perform_set(a, A_INIT); + + for (auto _ : state) { + Kokkos::Timer timer; + perform_copy(a, b); + KokkosBenchmark::report_results(state, a, DATA_RATIO, timer.seconds()); + } + + if (validate_array(b, A_INIT)) { + state.SkipWithError("validation failure"); + } +} + +template +static void StreamScale(benchmark::State& state) { + const size_t N8 = std::pow(state.range(0), 8); + static constexpr int DATA_RATIO = 2; + + StreamView a("a", N8), b("b", N8); + + perform_set(b, B_INIT); + + for (auto _ : state) { + Kokkos::Timer timer; + perform_scale(a, b, SCALAR); + KokkosBenchmark::report_results(state, b, DATA_RATIO, timer.seconds()); + } + + if (validate_array(a, B_INIT * SCALAR)) { + state.SkipWithError("validation failure"); + } +} + +template +static void StreamAdd(benchmark::State& state) { + const size_t N8 = std::pow(state.range(0), 8); + static constexpr int DATA_RATIO = 3; + + StreamView a("a", N8), b("b", N8), c("c", N8); + + perform_set(a, A_INIT); + perform_set(b, B_INIT); + perform_set(c, C_INIT); + + for (auto _ : state) { + Kokkos::Timer timer; + perform_add(a, b, c); + KokkosBenchmark::report_results(state, c, DATA_RATIO, timer.seconds()); + } + + if (validate_array(c, A_INIT + B_INIT)) { + state.SkipWithError("validation failure"); + } +} + +template +static void StreamTriad(benchmark::State& state) { + const size_t N8 = std::pow(state.range(0), 8); + static constexpr int DATA_RATIO = 3; + + StreamView a("a", N8), b("b", N8), c("c", N8); + + perform_set(a, A_INIT); + perform_set(b, B_INIT); + perform_set(c, C_INIT); + + for (auto _ : state) { + Kokkos::Timer timer; + perform_triad(a, b, c, SCALAR); + KokkosBenchmark::report_results(state, a, DATA_RATIO, timer.seconds()); + } + + if (validate_array(a, B_INIT + SCALAR * C_INIT)) { + state.SkipWithError("validation failure"); + } +} + +// skips a benchmark with an error from thrown exceptions +template +static void or_skip(benchmark::State& state) { + try { + bm(state); + } catch (const std::runtime_error& e) { + state.SkipWithError(e.what()); + } +} + +// We choose the case of 9^8 doubles to test with (which allocates ~1 GB), as +// well as a quick test with 10^8 doubles (~2.4 GB) for checking convergence. As +// of January 2026, This value is higher than caches but reasonable enough +// to be safely allocated, even on low-memory devices. This needs to be +// (potentially) periodically revisited. + +#define STREAM_ARGS(label) \ + Name(label) \ + ->ArgName("N") \ + ->Arg(9) \ + ->Arg(10) \ + ->Unit(benchmark::kMillisecond) \ + ->UseManualTime() + +// clang-format off +// clang-format formatted these lines inconsistently, making it hard to +// see the common pattern +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamSet"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamSet"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamCopy"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamCopy"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamScale"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamScale"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamAdd"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamAdd"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamTriad"); + +BENCHMARK(or_skip>) + ->STREAM_ARGS("StreamTriad"); +// clang-format on + +#undef STREAM_ARGS + +} // namespace diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp index 163e1d7d0488..0a6b8dfc2773 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp @@ -1,23 +1,17 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Benchmark_Context.hpp" +#include + namespace Test { static constexpr int N = 10; diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp index 1d1cb1f48dc1..2a375597b011 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp @@ -1,28 +1,21 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CORE_PERFTEST_BENCHMARK_VIEW_COPY_HPP #define KOKKOS_CORE_PERFTEST_BENCHMARK_VIEW_COPY_HPP +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Benchmark_Context.hpp" #include +#include namespace Test { diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp index e4db40e128c3..77a79b65bf6a 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp index 5b627d3dd466..c4c677445cec 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp index 320060256601..be25727ad3d0 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp index 0855299aad32..50a467b59ccd 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp index 36577ef2eff7..35602ef6789a 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp index c449d684f1c5..5bf3c19522ce 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp index 8675f427d749..a61b5c162056 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp index 93522fcf0d49..2ec8469cca47 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp index be95c7cab3ea..37b3804b2b66 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp index f8eee75ce71d..d463c74960bb 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp index 01dda2a33f5f..2bf58baf8ffd 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp index 25e874747462..c1dbf94e94c5 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp index b1f4a7b57732..930f0e5e5e59 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp index 8120664792a8..7f3b263ab3b5 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp index cee9f5bd014b..8c5ad225cfb6 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp index 6f204a422215..09e1ab442e3d 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp index 6d72bea4908c..90d366c451b2 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp index 1a407cd648cf..ac8bd8cfac2c 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp index 27b1a816fc82..d23ae54abac5 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp index 17d4bf207730..50ddc1f5598a 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp index 7bd026322873..9ab7a2ffc017 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewCopy.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp index e0fd432d94ee..7dd60291d1d8 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp @@ -1,22 +1,10 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "Benchmark_Context.hpp" #include +#include namespace Test { diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp index c714181fc972..93d8a8da7a47 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewFill.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp index 6a5acfb0d6e5..ca333e4230de 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewFill.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp index dca20c70dfb5..f5d2cbec3ce8 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewFill.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp index 6fa8a418c6a3..e00b323f5301 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewFill.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp index 954b097d83e9..27ee742b29c2 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewFill.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_Raw.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_Raw.cpp index 57bba83a9c1e..87aa2e411875 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_Raw.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_Raw.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewFill.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_DeepCopy.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_DeepCopy.cpp new file mode 100644 index 000000000000..4f042abc4abd --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_DeepCopy.cpp @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include "Benchmark_Context.hpp" + +namespace Benchmark { + +template +void ViewFirstTouch_DeepCopy(benchmark::State& state) { + const int N = state.range(0); + const DataType init_value = static_cast(state.range(1)); + using ViewType = Kokkos::View; + ViewType v_a("A", N); + + for (auto _ : state) { + Kokkos::Timer timer; + Kokkos::deep_copy(v_a, init_value); + KokkosBenchmark::report_results(state, v_a, 2, timer.seconds()); + } +} + +BENCHMARK_TEMPLATE(ViewFirstTouch_DeepCopy, double) + ->ArgNames({"N", "init_value"}) + ->RangeMultiplier(8) + ->Ranges({{int64_t(1) << 6, int64_t(1) << 24}, {0, 1}}) + ->UseManualTime(); + +} // namespace Benchmark diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_Initialize.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_Initialize.cpp new file mode 100644 index 000000000000..c1dc57cf3839 --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_Initialize.cpp @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include "Benchmark_Context.hpp" + +namespace Benchmark { + +template +void ViewFirstTouch_Initialize(benchmark::State& state) { + const int N = state.range(0); + using ViewType = Kokkos::View; + + for (auto _ : state) { + Kokkos::Timer timer; + ViewType v_a("A", N); + Kokkos::fence(); + KokkosBenchmark::report_results(state, v_a, 1, timer.seconds()); + } +} + +BENCHMARK_TEMPLATE(ViewFirstTouch_Initialize, double) + ->ArgName("N") + ->RangeMultiplier(8) + ->Range(int64_t(1) << 6, int64_t(1) << 24) + ->UseManualTime(); + +} // namespace Benchmark diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_ParallelFor.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_ParallelFor.cpp new file mode 100644 index 000000000000..85879e9b41f1 --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFirstTouch_ParallelFor.cpp @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#include "Benchmark_Context.hpp" + +namespace Benchmark { + +template +void ViewFirstTouch_ParallelFor(benchmark::State& state) { + const int N = state.range(0); + using ViewType = Kokkos::View; + + for (auto _ : state) { + ViewType v_a("A", N); + Kokkos::fence(); + Kokkos::Timer timer; + Kokkos::parallel_for( + "ViewFirstTouch_ParallelFor", N, KOKKOS_LAMBDA(const int i) { + v_a(i) = static_cast(2) * v_a(i) + static_cast(1); + }); + Kokkos::fence(); + KokkosBenchmark::report_results(state, v_a, 2, timer.seconds()); + } +} + +BENCHMARK_TEMPLATE(ViewFirstTouch_ParallelFor, double) + ->ArgName("N") + ->RangeMultiplier(8) + ->Range(int64_t(1) << 6, int64_t(1) << 24) + ->UseManualTime(); + +} // namespace Benchmark diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp index de6981e17afd..ce1d8c4af12d 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include #include "Benchmark_Context.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp index 0b3141eead00..82fc2e752ee9 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewResize.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp index f5eec387cbdf..481e4833f266 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewResize.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp index 6b639d3a6722..22e451c30431 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewResize.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp index 8ebf80e3ffea..cf8dec6eab35 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewResize.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp index 5e741e800b1e..13366149e60d 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewResize.hpp" diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_Raw.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_Raw.cpp index ab469cb647ca..754e1e34ec7f 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_Raw.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_Raw.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include "PerfTest_ViewResize.hpp" diff --git a/packages/kokkos/core/perf_test/run_taskdag.sh b/packages/kokkos/core/perf_test/run_taskdag.sh deleted file mode 100755 index dcb016c9d54c..000000000000 --- a/packages/kokkos/core/perf_test/run_taskdag.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -e -NT=$1 -PROG="./KokkosCore_PerformanceTest_TaskDAG" -COMMON_ARGS="--kokkos-threads=$NT --alloc_size=10027008 --super_size=65536 --repeat_outer=10" - -postproc() { -cat log | grep "tasks per second" | rev | cut -d ' ' -f 2 | rev >> yvals -} - -rm -f xvals yvals -for x in 21 23 -do - echo "test input $x" - echo $x >> xvals - $PROG $COMMON_ARGS --input=$x 2>&1 | tee log - postproc -done - -rm -f datapoints.txt -paste xvals yvals > datapoints.txt - diff --git a/packages/kokkos/core/perf_test/test_atomic.cpp b/packages/kokkos/core/perf_test/test_atomic.cpp index 99c2dc89a491..b702b3ba6ed2 100644 --- a/packages/kokkos/core/perf_test/test_atomic.cpp +++ b/packages/kokkos/core/perf_test/test_atomic.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -21,7 +8,12 @@ #include #include "Benchmark_Context.hpp" +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include using exec_space = Kokkos::DefaultExecutionSpace; @@ -30,7 +22,7 @@ template struct ZeroFunctor { using execution_space = DEVICE_TYPE; using type = typename Kokkos::View; - using h_type = typename Kokkos::View::HostMirror; + using h_type = typename Kokkos::View::host_mirror_type; type data; KOKKOS_INLINE_FUNCTION void operator()(int) const { data() = 0; } diff --git a/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp b/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp index bc35d1c776f8..a3ad984f0326 100644 --- a/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp +++ b/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project // export OMP_PROC_BIND=spread ; export OMP_PLACES=threads // c++ -O2 -g -DNDEBUG -fopenmp @@ -25,7 +12,12 @@ #include "Benchmark_Context.hpp" #include "PerfTest_Category.hpp" +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif using exec_space = Kokkos::DefaultExecutionSpace; diff --git a/packages/kokkos/core/perf_test/test_mempool.cpp b/packages/kokkos/core/perf_test/test_mempool.cpp index 7f9c5be77ca7..50bb744576e4 100644 --- a/packages/kokkos/core/perf_test/test_mempool.cpp +++ b/packages/kokkos/core/perf_test/test_mempool.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #include #include @@ -21,7 +8,12 @@ #include #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Benchmark_Context.hpp" diff --git a/packages/kokkos/core/perf_test/test_reduction.cpp b/packages/kokkos/core/perf_test/test_reduction.cpp index 2d000650b948..f5dcede8994e 100644 --- a/packages/kokkos/core/perf_test/test_reduction.cpp +++ b/packages/kokkos/core/perf_test/test_reduction.cpp @@ -1,20 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include "Benchmark_Context.hpp" diff --git a/packages/kokkos/core/perf_test/test_sharedSpace.cpp b/packages/kokkos/core/perf_test/test_sharedSpace.cpp index 3c06770e2861..e69ae131c4d6 100644 --- a/packages/kokkos/core/perf_test/test_sharedSpace.cpp +++ b/packages/kokkos/core/perf_test/test_sharedSpace.cpp @@ -1,19 +1,11 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #if defined _WIN32 #include diff --git a/packages/kokkos/core/perf_test/test_taskdag.cpp b/packages/kokkos/core/perf_test/test_taskdag.cpp deleted file mode 100644 index 347d9748b5a9..000000000000 --- a/packages/kokkos/core/perf_test/test_taskdag.cpp +++ /dev/null @@ -1,235 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#include - -#include - -#if !defined(KOKKOS_ENABLE_TASKDAG) || \ - defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS) - -int main() { return 0; } - -#else - -#include -#include -#include -#include - -#include - -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS -// We allow using deprecated classes in this file -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() -#endif - -using ExecSpace = Kokkos::DefaultExecutionSpace; - -inline long eval_fib(long n) { - constexpr long mask = 0x03; - - long fib[4] = {0, 1, 0, 0}; - - for (long i = 2; i <= n; ++i) { - fib[i & mask] = fib[(i - 1) & mask] + fib[(i - 2) & mask]; - } - - return fib[n & mask]; -} - -inline long fib_alloc_count(long n) { - constexpr long mask = 0x03; - - long count[4] = {1, 1, 0, 0}; - - for (long i = 2; i <= n; ++i) { - count[i & mask] = 2 // this task plus the 'when_all' task - + count[(i - 1) & mask] + count[(i - 2) & mask]; - } - - return count[n & mask]; -} - -template -struct TestFib { - using MemorySpace = typename Scheduler::memory_space; - using MemberType = typename Scheduler::member_type; - using FutureType = Kokkos::BasicFuture; - - using value_type = long; - - FutureType dep[2]; - const value_type n; - - KOKKOS_INLINE_FUNCTION - TestFib(const value_type arg_n) : dep{}, n(arg_n) {} - - KOKKOS_INLINE_FUNCTION - void operator()(MemberType& member, value_type& result) noexcept { - auto& sched = member.scheduler(); - if (n < 2) { - result = n; - } else if (!dep[0].is_null() && !dep[1].is_null()) { - result = dep[0].get() + dep[1].get(); - } else { - // Spawn new children and respawn myself to sum their results. - // Spawn lower value at higher priority as it has a shorter - // path to completion. - - dep[1] = Kokkos::task_spawn( - Kokkos::TaskSingle(sched, Kokkos::TaskPriority::High), - TestFib(n - 2)); - - dep[0] = Kokkos::task_spawn(Kokkos::TaskSingle(sched), TestFib(n - 1)); - - auto fib_all = sched.when_all(dep, 2); - - if (!dep[0].is_null() && !dep[1].is_null() && !fib_all.is_null()) { - // High priority to retire this branch. - Kokkos::respawn(this, fib_all, Kokkos::TaskPriority::High); - } else { - Kokkos::abort("Failed nested task spawn (allocation)"); - } - } - } -}; - -int main(int argc, char* argv[]) { - static const char help[] = "--help"; - static const char alloc_size[] = "--alloc_size="; - static const char super_size[] = "--super_size="; - static const char repeat_outer[] = "--repeat_outer="; - static const char input_value[] = "--input="; - - long total_alloc_size = 1000000; - int min_superblock_size = 10000; - int test_repeat_outer = 1; - int fib_input = 4; - - int ask_help = 0; - - for (int i = 1; i < argc; i++) { - const char* const a = argv[i]; - - if (!strncmp(a, help, strlen(help))) ask_help = 1; - - if (!strncmp(a, alloc_size, strlen(alloc_size))) - total_alloc_size = atol(a + strlen(alloc_size)); - - if (!strncmp(a, super_size, strlen(super_size))) - min_superblock_size = std::stoi(a + strlen(super_size)); - - if (!strncmp(a, repeat_outer, strlen(repeat_outer))) - test_repeat_outer = std::stoi(a + strlen(repeat_outer)); - - if (!strncmp(a, input_value, strlen(input_value))) - fib_input = std::stoi(a + strlen(input_value)); - } - - const long fib_output = eval_fib(fib_input); - const long number_alloc = fib_alloc_count(fib_input); - - const unsigned min_block_size = 32; - const unsigned max_block_size = 128; - - long task_count_max = 0; - long task_count_accum = 0; - long test_result = 0; - - if (ask_help) { - std::cout << "command line options:" - << " " << help << " " << alloc_size << "##" - << " " << super_size << "##" - << " " << input_value << "##" - << " " << repeat_outer << "##" << std::endl; - return -1; - } - - using Scheduler = Kokkos::TaskSchedulerMultiple; - - using Functor = TestFib; - - Kokkos::initialize(argc, argv); - - { - Scheduler sched(Functor::MemorySpace(), total_alloc_size, min_block_size, - max_block_size, min_superblock_size); - - Functor::FutureType f = - Kokkos::host_spawn(Kokkos::TaskSingle(sched), Functor(fib_input)); - - Kokkos::wait(sched); - - test_result = f.get(); - - // task_count_max = sched.allocated_task_count_max(); - // task_count_accum = sched.allocated_task_count_accum(); - - // if ( number_alloc != task_count_accum ) { - // std::cout << " number_alloc( " << number_alloc << " )" - // << " != task_count_accum( " << task_count_accum << " )" - // << std::endl ; - //} - - if (fib_output != test_result) { - std::cout << " answer( " << fib_output << " )" - << " != result( " << test_result << " )" << std::endl; - } - - if (fib_output != test_result) { // || number_alloc != task_count_accum ) { - printf(" TEST FAILED\n"); - return -1; - } - - double min_time = std::numeric_limits::max(); - double time_sum = 0; - - for (int i = 0; i < test_repeat_outer; ++i) { - Kokkos::Timer timer; - - Functor::FutureType ftmp = - Kokkos::host_spawn(Kokkos::TaskSingle(sched), Functor(fib_input)); - - Kokkos::wait(sched); - auto this_time = timer.seconds(); - min_time = std::min(min_time, this_time); - time_sum += this_time; - } - - auto avg_time = time_sum / test_repeat_outer; - - printf( - "\"taskdag: alloc super repeat input output task-accum task-max\" %ld " - "%d %d %d %ld %ld %ld\n", - total_alloc_size, min_superblock_size, test_repeat_outer, fib_input, - fib_output, task_count_accum, task_count_max); - - printf("\"taskdag: time (min, avg)\" %g %g\n", min_time, avg_time); - printf("\"taskdag: tasks per second (max, avg)\" %g %g\n", - number_alloc / min_time, number_alloc / avg_time); - } // end scope to destroy scheduler prior to finalize - - Kokkos::finalize(); - - return 0; -} - -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() -#endif - -#endif diff --git a/packages/kokkos/core/src/CMakeLists.txt b/packages/kokkos/core/src/CMakeLists.txt index 67846cb76ee2..9c76c70e020b 100644 --- a/packages/kokkos/core/src/CMakeLists.txt +++ b/packages/kokkos/core/src/CMakeLists.txt @@ -18,15 +18,15 @@ if(NOT desul_FOUND) set(DESUL_ATOMICS_ENABLE_SYCL_SEPARABLE_COMPILATION ON) endif() endif() - if(KOKKOS_ENABLE_OPENMPTARGET) - set(DESUL_ATOMICS_ENABLE_OPENMP ON) # not a typo Kokkos OpenMPTarget -> Desul OpenMP - endif() if(KOKKOS_ENABLE_OPENACC) # FIXME_OPENACC FIXME_CLACC - Below condition will be removed if Clacc can compile atomics. if(KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) set(DESUL_ATOMICS_ENABLE_OPENACC ON) endif() endif() + if(BUILD_SHARED_LIBS) + set(DESUL_IMPL_BUILD_SHARED_LIBS ON) + endif() configure_file( ${KOKKOS_SOURCE_DIR}/tpls/desul/Config.hpp.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/desul/atomics/Config.hpp ) @@ -49,25 +49,14 @@ append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.hpp) if(KOKKOS_ENABLE_CUDA) append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/Cuda/*.cpp) - if(NOT Kokkos_ENABLE_DEPRECATED_CODE_4) - list(REMOVE_ITEM KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/Cuda/Kokkos_Cuda_Task.cpp) - endif() append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Cuda/*.hpp) endif() if(KOKKOS_ENABLE_OPENMP) append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/OpenMP/*.cpp) - if(NOT Kokkos_ENABLE_DEPRECATED_CODE_4) - list(REMOVE_ITEM KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/OpenMP/Kokkos_OpenMP_Task.cpp) - endif() append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/OpenMP/*.hpp) endif() -if(KOKKOS_ENABLE_OPENMPTARGET) - append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/OpenMPTarget/*.cpp) - append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/OpenMPTarget/*.hpp) -endif() - if(KOKKOS_ENABLE_OPENACC) append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/OpenACC/*.cpp) append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/OpenACC/*.hpp) @@ -85,17 +74,11 @@ endif() if(KOKKOS_ENABLE_HPX) append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/HPX/*.cpp) - if(NOT Kokkos_ENABLE_DEPRECATED_CODE_4) - list(REMOVE_ITEM KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/HPX/Kokkos_HPX_Task.cpp) - endif() append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/HPX/*.hpp) endif() if(KOKKOS_ENABLE_SERIAL) append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/Serial/*.cpp) - if(NOT Kokkos_ENABLE_DEPRECATED_CODE_4) - list(REMOVE_ITEM KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/Serial/Kokkos_Serial_Task.cpp) - endif() append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Serial/*.hpp) endif() @@ -104,6 +87,11 @@ if(KOKKOS_ENABLE_SYCL) append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/SYCL/*.hpp) endif() +if(KOKKOS_ENABLE_NEXTSILICON) + append_glob(KOKKOS_CORE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/NextSilicon/*.cpp) + append_glob(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/NextSilicon/*.hpp) +endif() + if(NOT desul_FOUND) if(KOKKOS_ENABLE_CUDA) append_glob(KOKKOS_CORE_SRCS ${KOKKOS_SOURCE_DIR}/tpls/desul/src/Lock_Array_CUDA.cpp) @@ -127,14 +115,27 @@ if(NOT desul_FOUND) PATTERN "*.hpp" ) - message(STATUS "Using internal desul_atomics copy") + file(STRINGS "${KOKKOS_SOURCE_DIR}/tpls/desul-hash.txt" KOKKOS_DESUL_HASH) + global_set(KOKKOS_DESUL_VERSION "${KOKKOS_DESUL_HASH}") + message(STATUS "Using bundled desul_atomics copy (desul/desul@${KOKKOS_DESUL_HASH})") else() + global_set(KOKKOS_DESUL_VERSION "unknown") message(STATUS "Using external desul_atomics install found at:") message(STATUS " " ${desul_DIR}) endif() +if(Kokkos_ENABLE_EXPERIMENTAL_CXX20_MODULES) + set(KOKKOS_CORE_MODULE_FILES Kokkos_Core.cppm Kokkos_Core_Impl.cppm) +endif() + kokkos_add_library( - kokkoscore SOURCES ${KOKKOS_CORE_SRCS} HEADERS ${KOKKOS_CORE_HEADERS} + kokkoscore + SOURCES + ${KOKKOS_CORE_SRCS} + MODULE_INTERFACE + ${KOKKOS_CORE_MODULE_FILES} + HEADERS + ${KOKKOS_CORE_HEADERS} ADD_BUILD_OPTIONS # core should be given all the necessary compiler/linker flags ) @@ -143,12 +144,14 @@ kokkos_lib_include_directories( ) if(NOT desul_FOUND) target_include_directories(kokkoscore SYSTEM PUBLIC $) + if(BUILD_SHARED_LIBS) + target_compile_definitions(kokkoscore PRIVATE DESUL_IMPL_EXPORT_SYMBOLS) + endif() endif() if(Kokkos_ENABLE_IMPL_MDSPAN) - message(STATUS "Experimental mdspan support is enabled") - if(Kokkos_ENABLE_MDSPAN_EXTERNAL) + global_set(KOKKOS_MDSPAN_VERSION "unknown") message(STATUS "Using external mdspan") target_link_libraries(kokkoscore PUBLIC std::mdspan) else() @@ -164,14 +167,20 @@ if(Kokkos_ENABLE_IMPL_MDSPAN) PATTERN "mdspan" PATTERN "*.hpp" ) - message(STATUS "Using internal mdspan directory ${KOKKOS_SOURCE_DIR}/tpls/mdspan/include") + + file(STRINGS "${KOKKOS_SOURCE_DIR}/tpls/mdspan-hash.txt" KOKKOS_MDSPAN_HASH) + global_set(KOKKOS_MDSPAN_VERSION "${KOKKOS_MDSPAN_HASH}") + message(STATUS "Using bundled mdspan copy (kokkos/mdspan@${KOKKOS_MDSPAN_HASH})") endif() endif() +if(Kokkos_ENABLE_IMPL_VIEW_LEGACY) + global_set(KOKKOS_MDSPAN_VERSION "not applicable") +endif() + kokkos_link_tpl(kokkoscore PUBLIC HWLOC) kokkos_link_tpl(kokkoscore PUBLIC CUDA) kokkos_link_tpl(kokkoscore PUBLIC HPX) -kokkos_link_tpl(kokkoscore PUBLIC LIBDL) # On *nix-like systems (Linux, macOS) we need pthread for C++ std::thread if(NOT WIN32) kokkos_link_tpl(kokkoscore PUBLIC THREADS) @@ -179,14 +188,9 @@ endif() if(NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) kokkos_link_tpl(kokkoscore PUBLIC ROCM) endif() +kokkos_link_tpl(kokkoscore PUBLIC LIBQUADMATH) -# FIXME: We need a proper solution to figure out whether to enable -# libatomic -# Most compilers only require libatomic for 128-bit CAS -# I (CT) had removed 128bit CAS from desul to not need libatomic. -if(KOKKOS_ENABLE_OPENMPTARGET) - target_link_libraries(kokkoscore PUBLIC atomic) -endif() +kokkos_link_tpl(kokkoscore PUBLIC NEXTAPI) if(desul_FOUND) target_link_libraries(kokkoscore PUBLIC desul_atomics) @@ -196,4 +200,6 @@ if(Kokkos_ENABLE_OPENMP) target_link_libraries(kokkoscore PUBLIC OpenMP::OpenMP_CXX) endif() -kokkos_link_tpl(kokkoscore PUBLIC LIBQUADMATH) +if(Kokkos_ENABLE_LIBDL) + target_link_libraries(kokkoscore PUBLIC ${CMAKE_DL_LIBS}) +endif() diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda.hpp index 7d1ad831e0bc..19864bb6f450 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include @@ -93,13 +80,8 @@ class Cuda { //! Tag this class as a kokkos execution space using execution_space = Cuda; -#if defined(KOKKOS_ENABLE_CUDA_UVM) - //! This execution space's preferred memory space. - using memory_space = CudaUVMSpace; -#else //! This execution space's preferred memory space. using memory_space = CudaSpace; -#endif //! This execution space preferred device_type using device_type = Kokkos::Device; @@ -118,19 +100,6 @@ class Cuda { //! \name Functions that all Kokkos devices must implement. //@{ - /// \brief True if and only if this method is being called in a - /// thread-parallel function. - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static int in_parallel() { -#if defined(__CUDA_ARCH__) - return true; -#else - return false; -#endif - } -#endif - /// \brief Wait until all dispatched functors complete. /// /// The parallel_for or parallel_reduce dispatch of a functor may @@ -143,11 +112,7 @@ class Cuda { "Kokkos::Cuda::fence(): Unnamed Instance Fence") const; /** \brief Return the maximum amount of concurrency. */ -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - static int concurrency(); -#else int concurrency() const; -#endif //! Print configuration information to the given output stream. void print_configuration(std::ostream& os, bool verbose = false) const; @@ -156,64 +121,35 @@ class Cuda { //-------------------------------------------------- //! \name Cuda space instances + KOKKOS_DEFAULTED_FUNCTION Cuda(const Cuda&) = default; + KOKKOS_FUNCTION Cuda(Cuda&& other) noexcept + : Cuda(static_cast(other)) {} + KOKKOS_DEFAULTED_FUNCTION Cuda& operator=(const Cuda&) = default; + KOKKOS_FUNCTION Cuda& operator=(Cuda&& other) noexcept { + return *this = static_cast(other); + } Cuda(); - explicit Cuda(cudaStream_t stream) : Cuda(stream, Impl::ManageStream::no) {} + // This destructor is never actually called on device, but, for the implicitly + // defined ~RangePolicy(), we need destructor to be __host__ + // __device__ to avoid nvcc warnings. This destructor will only execute + // internals on host. + KOKKOS_FUNCTION ~Cuda() { + KOKKOS_IF_ON_HOST( + (Impl::check_execution_space_destructor_precondition(name());)) + } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - template - KOKKOS_DEPRECATED_WITH_COMMENT( - "Cuda execution space should be constructed explicitly.") - Cuda(cudaStream_t stream) - : Cuda(stream) {} -#endif + explicit Cuda(cudaStream_t stream) : Cuda(stream, Impl::ManageStream::no) {} Cuda(cudaStream_t stream, Impl::ManageStream manage_stream); - KOKKOS_DEPRECATED Cuda(cudaStream_t stream, bool manage_stream); - //-------------------------------------------------------------------------- //! Free any resources being consumed by the device. static void impl_finalize(); - //! Has been initialized - static int impl_is_initialized(); - //! Initialize, telling the CUDA run-time library which device to use. static void impl_initialize(InitializationSettings const&); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - /// \brief Cuda device architecture of the selected device. - /// - /// This matches the __CUDA_ARCH__ specification. - KOKKOS_DEPRECATED static size_type device_arch() { - const cudaDeviceProp cudaProp = Cuda().cuda_device_prop(); - return cudaProp.major * 100 + cudaProp.minor; - } - - //! Query device count. - KOKKOS_DEPRECATED static size_type detect_device_count() { - int count; - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDeviceCount(&count)); - return count; - } - - /** \brief Detect the available devices and their architecture - * as defined by the __CUDA_ARCH__ specification. - */ - KOKKOS_DEPRECATED static std::vector detect_device_arch() { - int count; - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDeviceCount(&count)); - std::vector out; - for (int i = 0; i < count; ++i) { - cudaDeviceProp prop; - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDeviceProperties(&prop, i)); - out.push_back(prop.major * 100 + prop.minor); - } - return out; - } -#endif - cudaStream_t cuda_stream() const; int cuda_device() const; const cudaDeviceProp& cuda_device_prop() const; @@ -265,24 +201,6 @@ struct MemorySpaceAccess -struct MemorySpaceAccess { - enum : bool { assignable = false }; - enum : bool { accessible = true }; - enum : bool { deepcopy = false }; -}; - -#endif - } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp index 128068eb9d96..bd2f104517f2 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -21,7 +8,12 @@ #include #ifdef KOKKOS_ENABLE_CUDA +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include @@ -42,25 +34,18 @@ cudaStream_t Kokkos::Impl::cuda_get_deep_copy_stream() { static cudaStream_t s = nullptr; if (s == nullptr) { KOKKOS_IMPL_CUDA_SAFE_CALL( - (CudaInternal::singleton().cuda_stream_create_wrapper(&s))); + (CudaInternal::default_instance->cuda_stream_create_wrapper(&s))); } return s; } -const std::unique_ptr &Kokkos::Impl::cuda_get_deep_copy_space( - bool initialize) { - static std::unique_ptr space = nullptr; - if (!space && initialize) - space = std::make_unique(Kokkos::Impl::cuda_get_deep_copy_stream()); - return space; -} - namespace Kokkos { namespace Impl { void DeepCopyCuda(void *dst, const void *src, size_t n) { - KOKKOS_IMPL_CUDA_SAFE_CALL((CudaInternal::singleton().cuda_memcpy_wrapper( - dst, src, n, cudaMemcpyDefault))); + KOKKOS_IMPL_CUDA_SAFE_CALL( + (CudaInternal::default_instance->cuda_memcpy_wrapper(dst, src, n, + cudaMemcpyDefault))); } void DeepCopyAsyncCuda(const Cuda &instance, void *dst, const void *src, @@ -89,12 +74,6 @@ void DeepCopyAsyncCuda(void *dst, const void *src, size_t n) { namespace Kokkos { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -bool CudaUVMSpace::available() { return true; } -#endif - -/*--------------------------------------------------------------------------*/ - #ifdef KOKKOS_IMPL_DEBUG_CUDA_PIN_UVM_TO_HOST // The purpose of the following variable is to allow a state-based choice // for pinning UVM allocations to the CPU. For now this is considered @@ -186,7 +165,7 @@ void *impl_allocate_common(const int device_id, "Please update your CUDA runtime version or " "reconfigure with " "-D Kokkos_ENABLE_IMPL_CUDA_UNIFIED_MEMORY=OFF"); - if (arg_alloc_size) { // cudaMemAdvise_v2 does not work with nullptr + if (arg_alloc_size) { // cudaMemAdvise does not work with nullptr error_code = cudaMallocManaged(&ptr, arg_alloc_size, cudaMemAttachGlobal); if (error_code == cudaSuccess) { // One would think cudaMemLocation{device_id, @@ -195,12 +174,17 @@ void *impl_allocate_common(const int device_id, cudaMemLocation loc; loc.id = device_id; loc.type = cudaMemLocationTypeDevice; +#if CUDART_VERSION < 13000 // cudaMemAdvise_v2 was deprecated in CUDA 13, it is + // now the same as cudaMemAdvise KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemAdvise_v2( ptr, arg_alloc_size, cudaMemAdviseSetPreferredLocation, loc)); +#else + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemAdvise( + ptr, arg_alloc_size, cudaMemAdviseSetPreferredLocation, loc)); +#endif } } #elif (defined(KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC) && CUDART_VERSION >= 11020) - // FIXME_KEPLER Everything after Kepler should support cudaMallocAsync int device_supports_cuda_malloc_async; KOKKOS_IMPL_CUDA_SAFE_CALL( cudaDeviceGetAttribute(&device_supports_cuda_malloc_async, @@ -443,23 +427,28 @@ void CudaHostPinnedSpace::impl_deallocate( namespace Kokkos { namespace Impl { -void cuda_prefetch_pointer(const Cuda &space, const void *ptr, size_t bytes, +void cuda_prefetch_pointer(cudaStream_t stream, const void *ptr, size_t bytes, bool to_device) { if ((ptr == nullptr) || (bytes == 0)) return; cudaPointerAttributes attr; - KOKKOS_IMPL_CUDA_SAFE_CALL(( - space.impl_internal_space_instance()->cuda_pointer_get_attributes_wrapper( - &attr, ptr))); + KOKKOS_IMPL_CUDA_SAFE_CALL((cudaPointerGetAttributes(&attr, ptr))); // I measured this and it turns out prefetching towards the host slows // DualView syncs down. Probably because the latency is not too bad in the - // first place for the pull down. If we want to change that provde + // first place for the pull down. If we want to change that provide // cudaCpuDeviceId as the device if to_device is false bool is_managed = attr.type == cudaMemoryTypeManaged; + Cuda default_instance; if (to_device && is_managed && - space.cuda_device_prop().concurrentManagedAccess) { + default_instance.cuda_device_prop().concurrentManagedAccess) { + const int dstDevice = default_instance.cuda_device(); +#if CUDART_VERSION >= 13000 + cudaMemLocation loc = {cudaMemLocationTypeDevice, dstDevice}; + KOKKOS_IMPL_CUDA_SAFE_CALL( + (cudaMemPrefetchAsync(ptr, bytes, loc, /*flags=*/0, stream))); +#else KOKKOS_IMPL_CUDA_SAFE_CALL( - (space.impl_internal_space_instance()->cuda_mem_prefetch_async_wrapper( - ptr, bytes, space.cuda_device()))); + (cudaMemPrefetchAsync(ptr, bytes, dstDevice, stream))); +#endif } } diff --git a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.hpp b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.hpp index 704521bef821..9172644c6135 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include @@ -73,12 +60,6 @@ class CudaSpace { CudaSpace(int device_id, cudaStream_t stream); public: - CudaSpace(CudaSpace&& rhs) = default; - CudaSpace(const CudaSpace& rhs) = default; - CudaSpace& operator=(CudaSpace&& rhs) = default; - CudaSpace& operator=(const CudaSpace& rhs) = default; - ~CudaSpace() = default; - /**\brief Allocate untracked memory in the cuda space */ void* allocate(const Cuda& exec_space, const size_t arg_alloc_size) const; void* allocate(const Cuda& exec_space, const char* arg_label, @@ -159,11 +140,6 @@ class CudaUVMSpace { using device_type = Kokkos::Device; using size_type = unsigned int; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - /** \brief If UVM capability is available */ - KOKKOS_DEPRECATED static bool available(); -#endif - /*--------------------------------*/ /*--------------------------------*/ @@ -174,12 +150,6 @@ class CudaUVMSpace { CudaUVMSpace(int device_id, cudaStream_t stream); public: - CudaUVMSpace(CudaUVMSpace&& rhs) = default; - CudaUVMSpace(const CudaUVMSpace& rhs) = default; - CudaUVMSpace& operator=(CudaUVMSpace&& rhs) = default; - CudaUVMSpace& operator=(const CudaUVMSpace& rhs) = default; - ~CudaUVMSpace() = default; - /**\brief Allocate untracked memory in the cuda space */ template void* allocate(const ExecutionSpace&, const size_t arg_alloc_size) const { @@ -334,9 +304,6 @@ namespace Impl { cudaStream_t cuda_get_deep_copy_stream(); -const std::unique_ptr& cuda_get_deep_copy_space( - bool initialize = true); - static_assert(Kokkos::Impl::MemorySpaceAccess::assignable); static_assert(Kokkos::Impl::MemorySpaceAccess< diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp index 247cb5b02c56..4ac17b3e8243 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_INTERNAL_HPP #define KOKKOS_CUDA_INTERNAL_HPP @@ -103,24 +90,7 @@ inline int cuda_max_active_blocks_per_sm(cudaDeviceProp const& properties, : max_blocks_regs); // Limits due to blocks/SM -#if CUDA_VERSION >= 11000 int const max_blocks_per_sm = properties.maxBlocksPerMultiProcessor; -#else - int const max_blocks_per_sm = [&properties]() { - switch (properties.major) { - case 3: return 16; - case 5: - case 6: return 32; - case 7: { - int isTuring = properties.minor == 5; - return (isTuring) ? 16 : 32; - } - default: - throw_runtime_exception("Unknown device in cuda block size deduction"); - return 0; - } - }(); -#endif // Overall occupancy in blocks return std::min({max_blocks_regs, max_blocks_shmem, max_blocks_per_sm}); diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp index 66656fefda5d..dfb396d5f024 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_ERROR_HPP #define KOKKOS_CUDA_ERROR_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp index 872958ceca9b..41b1f5b23b10 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_KOKKOS_CUDA_GRAPHNODEKERNEL_IMPL_HPP #define KOKKOS_KOKKOS_CUDA_GRAPHNODEKERNEL_IMPL_HPP @@ -27,7 +14,6 @@ #include #include -#include #include @@ -98,8 +84,8 @@ class GraphNodeKernelImpl m_graph_ptr = nullptr; - Kokkos::ObservingRawPtr m_graph_node_ptr = nullptr; + cudaGraph_t const* m_graph_ptr = nullptr; + cudaGraphNode_t* m_graph_node_ptr = nullptr; // Basically, we have to make this mutable for the same reasons that the // global kernel buffers in the Cuda instance are mutable... mutable std::shared_ptr m_driver_storage = nullptr; @@ -137,8 +123,7 @@ class GraphNodeKernelImpl allocate_driver_memory_buffer( - const CudaSpace& mem) const { + base_t* allocate_driver_memory_buffer(const CudaSpace& mem) const { KOKKOS_EXPECTS(m_driver_storage == nullptr) std::string alloc_label = label + " - GraphNodeKernel global memory functor storage"; @@ -160,12 +145,12 @@ template ::type> struct get_graph_node_kernel_type - : type_identity< + : std::type_identity< GraphNodeKernelImpl> {}; template struct get_graph_node_kernel_type - : type_identity, diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp index ff0aa0da0de2..ed3b3a0dd17a 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_KOKKOS_CUDA_GRAPHNODE_IMPL_HPP #define KOKKOS_KOKKOS_CUDA_GRAPHNODE_IMPL_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp index 23659b57ad95..eb03825e1769 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_KOKKOS_CUDA_GRAPH_IMPL_HPP #define KOKKOS_KOKKOS_CUDA_GRAPH_IMPL_HPP @@ -43,7 +30,9 @@ struct GraphImpl { using execution_space = Kokkos::Cuda; private: - execution_space m_execution_space; + using device_handle_t = Kokkos::Impl::DeviceHandle; + + device_handle_t m_device_handle; cudaGraph_t m_graph = nullptr; cudaGraphExec_t m_graph_exec = nullptr; @@ -59,10 +48,9 @@ struct GraphImpl { void instantiate() { KOKKOS_EXPECTS(!m_graph_exec); KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_instantiate_wrapper(&m_graph_exec, m_graph))); KOKKOS_ENSURES(m_graph_exec); - // TODO @graphs print out errors } using root_node_impl_t = @@ -84,31 +72,30 @@ struct GraphImpl { // TODO @graphs we need to somehow indicate the need for a fence in the // destructor of the GraphImpl object (so that we don't have to // just always do it) - m_execution_space.fence("Kokkos::GraphImpl::~GraphImpl: Graph Destruction"); + m_device_handle.m_exec.fence( + "Kokkos::GraphImpl::~GraphImpl: Graph Destruction"); KOKKOS_EXPECTS(bool(m_graph)) if (bool(m_graph_exec)) { KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_exec_destroy_wrapper(m_graph_exec))); } if (m_graph_owning) { KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_destroy_wrapper(m_graph))); } } - explicit GraphImpl(Kokkos::Cuda arg_instance) - : m_execution_space(std::move(arg_instance)), m_graph_owning(true) { + explicit GraphImpl(const device_handle_t& device_handle) + : m_device_handle(device_handle), m_graph_owning(true) { KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_create_wrapper(&m_graph, cuda_graph_flags_t{0}))); } - explicit GraphImpl(Kokkos::Cuda arg_instance, cudaGraph_t graph) - : m_execution_space(std::move(arg_instance)), - m_graph(graph), - m_graph_owning(false) { + explicit GraphImpl(const device_handle_t& device_handle, cudaGraph_t graph) + : m_device_handle(device_handle), m_graph(graph), m_graph_owning(false) { KOKKOS_EXPECTS(graph != nullptr); } @@ -116,7 +103,7 @@ struct GraphImpl { // All of the predecessors are just added as normal, so all we need to // do here is add an empty node KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_add_empty_node_wrapper( &(arg_node_ptr->node_details_t::node), m_graph, /* dependencies = */ nullptr, @@ -195,14 +182,12 @@ struct GraphImpl { KOKKOS_EXPECTS(bool(cuda_node)) KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_add_dependencies_wrapper(m_graph, &pred_cuda_node, &cuda_node, 1))); } void submit(const execution_space& exec) { - desul::ensure_cuda_lock_arrays_on_device(); - if (!bool(m_graph_exec)) { instantiate(); } @@ -211,17 +196,17 @@ struct GraphImpl { m_graph_exec))); } - execution_space const& get_execution_space() const noexcept { - return m_execution_space; + device_handle_t const& get_device_handle() const noexcept { + return m_device_handle; } auto create_root_node_ptr() { KOKKOS_EXPECTS(bool(m_graph)) KOKKOS_EXPECTS(!bool(m_graph_exec)) auto rv = std::make_shared( - get_execution_space(), _graph_node_is_root_ctor_tag{}); + m_device_handle, _graph_node_is_root_ctor_tag{}); KOKKOS_IMPL_CUDA_SAFE_CALL( - (m_execution_space.impl_internal_space_instance() + (m_device_handle.m_exec.impl_internal_space_instance() ->cuda_graph_add_empty_node_wrapper(&(rv->node_details_t::node), m_graph, /* dependencies = */ nullptr, @@ -238,7 +223,7 @@ struct GraphImpl { // each predecessor ref, so all we need to do here is create the (trivial) // aggregate node. return std::make_shared( - m_execution_space, _graph_node_kernel_ctor_tag{}, aggregate_impl_t{}); + m_device_handle, _graph_node_kernel_ctor_tag{}, aggregate_impl_t{}); } cudaGraph_t cuda_graph() { return m_graph; } diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp index f54459d2c4d7..e6adc014e73f 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp @@ -1,181 +1,20 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_HALF_HPP_ #define KOKKOS_CUDA_HALF_HPP_ -#ifdef KOKKOS_IMPL_CUDA_HALF_TYPE_DEFINED - #include -#include +#include -#if CUDA_VERSION >= 11000 #include -#endif -namespace Kokkos { -namespace Experimental { +namespace Kokkos::Experimental { /************************** half conversions **********************************/ KOKKOS_INLINE_FUNCTION half_t cast_to_half(half_t val) { return val; } -// CUDA before 11.1 only has the half <-> float conversions marked host device -// So we will largely convert to float on the host for conversion -// But still call the correct functions on the device -#if (CUDA_VERSION < 11010) - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(float val) { return half_t(__float2half(val)); } - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(bool val) { return cast_to_half(static_cast(val)); } - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(double val) { - // double2half was only introduced in CUDA 11 too - return half_t(__float2half(static_cast(val))); -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(short val) { - KOKKOS_IF_ON_DEVICE((return half_t(__short2half_rn(val));)) - KOKKOS_IF_ON_HOST((return half_t(__float2half(static_cast(val)));)) -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(unsigned short val) { - KOKKOS_IF_ON_DEVICE((return half_t(__ushort2half_rn(val));)) - KOKKOS_IF_ON_HOST((return half_t(__float2half(static_cast(val)));)) -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(int val) { - KOKKOS_IF_ON_DEVICE((return half_t(__int2half_rn(val));)) - KOKKOS_IF_ON_HOST((return half_t(__float2half(static_cast(val)));)) -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(unsigned int val) { - KOKKOS_IF_ON_DEVICE((return half_t(__uint2half_rn(val));)) - KOKKOS_IF_ON_HOST((return half_t(__float2half(static_cast(val)));)) -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(long long val) { - KOKKOS_IF_ON_DEVICE((return half_t(__ll2half_rn(val));)) - KOKKOS_IF_ON_HOST((return half_t(__float2half(static_cast(val)));)) -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(unsigned long long val) { - KOKKOS_IF_ON_DEVICE((return half_t(__ull2half_rn(val));)) - KOKKOS_IF_ON_HOST((return half_t(__float2half(static_cast(val)));)) -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(long val) { - return cast_to_half(static_cast(val)); -} - -KOKKOS_INLINE_FUNCTION -half_t cast_to_half(unsigned long val) { - return cast_to_half(static_cast(val)); -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - return __half2float(half_t::impl_type(val)); -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - return static_cast(cast_from_half(val)); -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - return static_cast(__half2float(half_t::impl_type(val))); -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - KOKKOS_IF_ON_DEVICE((return __half2short_rz(half_t::impl_type(val));)) - KOKKOS_IF_ON_HOST( - (return static_cast(__half2float(half_t::impl_type(val)));)) -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - KOKKOS_IF_ON_DEVICE((return __half2ushort_rz(half_t::impl_type(val));)) - KOKKOS_IF_ON_HOST( - (return static_cast(__half2float(half_t::impl_type(val)));)) -} -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - KOKKOS_IF_ON_DEVICE((return __half2int_rz(half_t::impl_type(val));)) - KOKKOS_IF_ON_HOST( - (return static_cast(__half2float(half_t::impl_type(val)));)) -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - KOKKOS_IF_ON_DEVICE((return __half2uint_rz(half_t::impl_type(val));)) - KOKKOS_IF_ON_HOST( - (return static_cast(__half2float(half_t::impl_type(val)));)) -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - KOKKOS_IF_ON_DEVICE((return __half2ll_rz(half_t::impl_type(val));)) - KOKKOS_IF_ON_HOST( - (return static_cast(__half2float(half_t::impl_type(val)));)) -} - -template -KOKKOS_INLINE_FUNCTION - std::enable_if_t, T> - cast_from_half(half_t val) { - KOKKOS_IF_ON_DEVICE((return __half2ull_rz(half_t::impl_type(val));)) - KOKKOS_IF_ON_HOST( - (return static_cast(__half2float(half_t::impl_type(val)));)) -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - return static_cast(cast_from_half(val)); -} - -template -KOKKOS_INLINE_FUNCTION std::enable_if_t, T> -cast_from_half(half_t val) { - return static_cast(cast_from_half(val)); -} - -#else // CUDA 11.1 versions follow - KOKKOS_INLINE_FUNCTION half_t cast_to_half(float val) { return __float2half(val); } KOKKOS_INLINE_FUNCTION @@ -252,20 +91,10 @@ KOKKOS_INLINE_FUNCTION std::enable_if_t, T> cast_from_half(half_t val) { return static_cast(cast_from_half(val)); } -#endif /************************** bhalf conversions *********************************/ -// Go in this branch if CUDA version is >= 11.0.0 and less than 11.1.0 or if the -// architecture is older than Ampere -#if !defined(KOKKOS_ARCH_KEPLER) && !defined(KOKKOS_ARCH_MAXWELL) && \ - !defined(KOKKOS_ARCH_PASCAL) && !defined(KOKKOS_ARCH_VOLTA) && \ - !defined(KOKKOS_ARCH_TURING75) -#define KOKKOS_IMPL_NVIDIA_GPU_ARCH_SUPPORT_BHALF -#endif - -#if CUDA_VERSION >= 11000 && \ - (CUDA_VERSION < 11010 || \ - !defined(KOKKOS_IMPL_NVIDIA_GPU_ARCH_SUPPORT_BHALF)) +// if architecture is older than Ampere +#if KOKKOS_IMPL_ARCH_NVIDIA_GPU < 80 KOKKOS_INLINE_FUNCTION bhalf_t cast_to_bhalf(bhalf_t val) { return val; } @@ -388,9 +217,7 @@ KOKKOS_INLINE_FUNCTION std::enable_if_t, T> cast_from_bhalf(bhalf_t val) { return static_cast(cast_from_bhalf(val)); } -#endif // CUDA_VERSION >= 11000 && CUDA_VERSION < 11010 - -#if CUDA_VERSION >= 11010 && defined(KOKKOS_IMPL_NVIDIA_GPU_ARCH_SUPPORT_BHALF) +#else KOKKOS_INLINE_FUNCTION bhalf_t cast_to_bhalf(bhalf_t val) { return val; } KOKKOS_INLINE_FUNCTION @@ -469,47 +296,8 @@ KOKKOS_INLINE_FUNCTION std::enable_if_t, T> cast_from_bhalf(bhalf_t val) { return static_cast(cast_from_bhalf(val)); } -#endif // CUDA_VERSION >= 11010 - -#undef KOKKOS_IMPL_NVIDIA_GPU_ARCH_SUPPORT_BHALF -} // namespace Experimental - -#if (CUDA_VERSION >= 11000) -template <> -struct reduction_identity { - KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() noexcept { - return 0.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() noexcept { - return 1.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() noexcept { - return -0x7f7f; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() noexcept { - return 0x7f7f; - } -}; -#endif // CUDA_VERSION >= 11000 - -// use float as the return type for sum and prod since cuda_fp16.h -// has no constexpr functions for casting to __half -template <> -struct reduction_identity { - KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() noexcept { - return 0.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() noexcept { - return 1.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() noexcept { - return -65504.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() noexcept { - return 65504.0F; - } -}; - -} // namespace Kokkos -#endif // KOKKOS_IMPL_CUDA_HALF_TYPE_DEFINED +#endif + +} // namespace Kokkos::Experimental + #endif diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp index 79d3322da282..8a4861cd6df0 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp @@ -1,52 +1,33 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_HALF_IMPL_TYPE_HPP_ #define KOKKOS_CUDA_HALF_IMPL_TYPE_HPP_ #include -#ifdef KOKKOS_ENABLE_CUDA -#if !(defined(KOKKOS_COMPILER_CLANG) && KOKKOS_COMPILER_CLANG < 900) && \ - !(defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL50) || \ - defined(KOKKOS_ARCH_MAXWELL52)) + +#if !(defined(KOKKOS_ARCH_MAXWELL50) || defined(KOKKOS_ARCH_MAXWELL52)) + #include -#if (CUDA_VERSION >= 11000) #include -#endif // CUDA_VERSION >= 11000 #ifndef KOKKOS_IMPL_HALF_TYPE_DEFINED // Make sure no one else tries to define half_t #define KOKKOS_IMPL_HALF_TYPE_DEFINED -#define KOKKOS_IMPL_CUDA_HALF_TYPE_DEFINED -namespace Kokkos { -namespace Impl { +namespace Kokkos::Impl { + struct half_impl_t { using type = __half; }; -#if (CUDA_VERSION >= 11000) #define KOKKOS_IMPL_BHALF_TYPE_DEFINED struct bhalf_impl_t { using type = __nv_bfloat16; }; -#endif // CUDA_VERSION >= 11000 -} // namespace Impl -} // namespace Kokkos + +} // namespace Kokkos::Impl + #endif // KOKKOS_IMPL_HALF_TYPE_DEFINED -#endif // Disables for half_t on cuda: - // Clang/8||KEPLER30||KEPLER32||KEPLER37||MAXWELL50||MAXWELL52 -#endif // KOKKOS_ENABLE_CUDA +#endif // Disables for half_t on cuda: MAXWELL50||MAXWELL52 + #endif diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_MathematicalFunctions.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_MathematicalFunctions.hpp index 86de39e475ce..64f7dee1f1a1 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_MathematicalFunctions.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_MathematicalFunctions.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_HALF_MATHEMATICAL_FUNCTIONS_HPP_ #define KOKKOS_CUDA_HALF_MATHEMATICAL_FUNCTIONS_HPP_ @@ -38,8 +25,6 @@ namespace Impl { return CUDA_NAME(HALF_TYPE::impl_type(x)); \ } -#ifdef KOKKOS_IMPL_CUDA_HALF_TYPE_DEFINED - #define KOKKOS_CUDA_HALF_UNARY_FUNCTION_IMPL(OP, CUDA_NAME) \ KOKKOS_CUDA_HALF_UNARY_FUNCTION(OP, CUDA_NAME, Kokkos::Experimental::half_t) #define KOKKOS_CUDA_HALF_BINARY_FUNCTION_IMPL(OP, CUDA_NAME) \ @@ -52,12 +37,6 @@ KOKKOS_INLINE_FUNCTION Kokkos::Experimental::half_t impl_test_fallback_half( return Kokkos::Experimental::half_t(0.f); } -#else -#define KOKKOS_CUDA_HALF_UNARY_FUNCTION_IMPL(OP, CUDA_NAME) -#define KOKKOS_CUDA_HALF_BINARY_FUNCTION_IMPL(OP, CUDA_NAME) -#define KOKKOS_CUDA_HALF_UNARY_PREDICATE_IMPL(OP, CUDA_NAME) -#endif - // Function for bhalf are not available prior to Ampere #if defined(KOKKOS_IMPL_BHALF_TYPE_DEFINED) && \ (KOKKOS_IMPL_ARCH_NVIDIA_GPU >= 80) @@ -97,6 +76,7 @@ KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(abs, __habs) KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(fabs, __habs) // fmod // remainder +// remquo #if KOKKOS_IMPL_ARCH_NVIDIA_GPU >= 80 KOKKOS_CUDA_HALF_AND_BHALF_BINARY_FUNCTION_IMPL(fmax, __hmax) KOKKOS_CUDA_HALF_AND_BHALF_BINARY_FUNCTION_IMPL(fmin, __hmin) @@ -142,18 +122,31 @@ KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(ceil, hceil) KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(floor, hfloor) KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(trunc, htrunc) // round -KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(nearbyint, hrint) +KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(rint, hrint) +// NOTE Cuda does not provide these functions, but we can exclude domain errors, +// as the range of int is enough for any value half_t can take. +// Thus we just cast to the required return type here. +// We are still missing the bhalf_t versions +KOKKOS_INLINE_FUNCTION long impl_lrint(Kokkos::Experimental::half_t x) { + return static_cast(impl_rint(x)); +} +KOKKOS_INLINE_FUNCTION long long impl_llrint(Kokkos::Experimental::half_t x) { + return static_cast(impl_rint(x)); +} // logb // nextafter // copysign // isfinite -#if (KOKKOS_COMPILER_NVCC <= 1210 || KOKKOS_COMPILER_NVCC >= 1300) || \ - defined(KOKKOS_ENABLE_CXX17) +#if KOKKOS_COMPILER_NVCC >= 1230 // __hisinf always returns false with nvcc 12.2 when compiling with cxx20 +// https://docs.nvidia.com/cuda/archive/12.3.2/cuda-toolkit-release-notes/index.html#cuda-math-release-12-3 KOKKOS_CUDA_HALF_AND_BHALF_UNARY_PREDICATE_IMPL(isinf, __hisinf) #endif KOKKOS_CUDA_HALF_AND_BHALF_UNARY_PREDICATE_IMPL(isnan, __hisnan) // signbit +// Non-standard functions +KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(rsqrt, hrsqrt) +KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(rcp, hrcp) #undef KOKKOS_CUDA_HALF_AND_BHALF_UNARY_FUNCTION_IMPL #undef KOKKOS_CUDA_HALF_AND_BHALF_BINARY_FUNCTION_IMPL diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp index 8c730d4ee537..80c2ae405a8b 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*--------------------------------------------------------------------------*/ /* Kokkos interfaces */ @@ -24,7 +11,12 @@ #include #ifdef KOKKOS_ENABLE_CUDA +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif // #include // #include @@ -33,6 +25,7 @@ #include #include #include +#include #include #include @@ -202,7 +195,7 @@ void CudaInternal::print_configuration(std::ostream &s) const { s << "macro KOKKOS_ENABLE_CUDA : defined\n"; #endif #if defined(CUDA_VERSION) - s << "macro CUDA_VERSION = " << CUDA_VERSION << " = version " + s << "macro CUDA_VERSION : " << CUDA_VERSION << " = version " << CUDA_VERSION / 1000 << "." << (CUDA_VERSION % 1000) / 10 << '\n'; #endif @@ -210,7 +203,10 @@ void CudaInternal::print_configuration(std::ostream &s) const { cudaDeviceProp prop; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDeviceProperties(&prop, i)); s << "Kokkos::Cuda[ " << i << " ] " << prop.name; - if (m_cudaDev == i) s << " : Selected"; + if (m_cudaDev == i) + s << " : Selected"; + else + s << " : Not Selected"; s << '\n' << " Capability: " << prop.major << "." << prop.minor << '\n' << " Total Global Memory: " << human_memory_size(prop.totalGlobalMem) @@ -227,22 +223,30 @@ void CudaInternal::print_configuration(std::ostream &s) const { //---------------------------------------------------------------------------- CudaInternal::~CudaInternal() { - if (m_scratchSpace || m_scratchFlags || m_scratchUnified) { - std::cerr << "Kokkos::Cuda ERROR: Failed to call Kokkos::Cuda::finalize()" - << std::endl; + fence("Kokkos::CudaInternal: fence on destruction"); + + auto cuda_mem_space = Kokkos::CudaSpace::impl_create(m_cudaDev, m_stream); + if (nullptr != m_scratchSpace || nullptr != m_scratchFlags) { + auto host_mem_space = + Kokkos::CudaHostPinnedSpace::impl_create(m_cudaDev, m_stream); + cuda_mem_space.deallocate(m_scratchFlags, + m_scratchFlagsCount * sizeScratchGrain); + cuda_mem_space.deallocate(m_scratchSpace, + m_scratchSpaceCount * sizeScratchGrain); + host_mem_space.deallocate(m_scratchUnified, + m_scratchUnifiedCount * sizeScratchGrain); + if (m_scratchFunctorSize > 0) { + cuda_mem_space.deallocate(m_scratchFunctor, m_scratchFunctorSize); + } } - m_scratchSpaceCount = 0; - m_scratchFlagsCount = 0; - m_scratchUnifiedCount = 0; - m_scratchSpace = nullptr; - m_scratchFlags = nullptr; - m_scratchUnified = nullptr; - m_stream = nullptr; for (int i = 0; i < m_n_team_scratch; ++i) { - m_team_scratch_current_size[i] = 0; - m_team_scratch_ptr[i] = nullptr; + if (m_team_scratch_current_size[i] > 0) + cuda_mem_space.deallocate(m_team_scratch_ptr[i], + m_team_scratch_current_size[i]); } + + KOKKOS_IMPL_CUDA_SAFE_CALL((cuda_free_wrapper(m_scratch_locks))); } int CudaInternal::verify_is_initialized(const char *const label) const { @@ -254,10 +258,6 @@ int CudaInternal::verify_is_initialized(const char *const label) const { return 0 <= m_cudaDev; } uint32_t CudaInternal::impl_get_instance_id() const { return m_instance_id; } -CudaInternal &CudaInternal::singleton() { - static CudaInternal self; - return self; -} void CudaInternal::fence(const std::string &name) const { Impl::cuda_stream_synchronize(m_stream, this, name); } @@ -265,13 +265,7 @@ void CudaInternal::fence() const { fence("Kokkos::CudaInternal::fence(): Unnamed Instance Fence"); } -void CudaInternal::initialize(cudaStream_t stream) { - KOKKOS_EXPECTS(!is_initialized()); - - if (was_finalized) - Kokkos::abort("Calling Cuda::initialize after Cuda::finalize is illegal\n"); - was_initialized = true; - +CudaInternal::CudaInternal(cudaStream_t stream) : m_stream(stream) { // Check that the device associated with the stream matches cuda_device CUcontext context; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaError_t(cuStreamGetCtx(stream, &context))); @@ -279,7 +273,6 @@ void CudaInternal::initialize(cudaStream_t stream) { KOKKOS_IMPL_CUDA_SAFE_CALL(cudaError_t(cuCtxGetDevice(&m_cudaDev))); KOKKOS_IMPL_CUDA_SAFE_CALL(cudaSetDevice(m_cudaDev)); - m_stream = stream; CudaInternal::cuda_devices.insert(m_cudaDev); // Allocate a staging buffer for constant mem in pinned host memory @@ -314,11 +307,6 @@ void CudaInternal::initialize(cudaStream_t stream) { (void)scratch_space(reduce_block_count * 16 * sizeof(size_type)); } - for (int i = 0; i < m_n_team_scratch; ++i) { - m_team_scratch_current_size[i] = 0; - m_team_scratch_ptr[i] = nullptr; - } - m_num_scratch_locks = concurrency(); void *scratch_locks_void_ptr = nullptr; KOKKOS_IMPL_CUDA_SAFE_CALL((cuda_malloc_wrapper( @@ -459,52 +447,6 @@ void CudaInternal::release_team_scratch_space(int scratch_pool_id) { //---------------------------------------------------------------------------- -void CudaInternal::finalize() { - // skip if finalize() has already been called - if (was_finalized) return; - - was_finalized = true; - - auto cuda_mem_space = Kokkos::CudaSpace::impl_create(m_cudaDev, m_stream); - if (nullptr != m_scratchSpace || nullptr != m_scratchFlags) { - auto host_mem_space = - Kokkos::CudaHostPinnedSpace::impl_create(m_cudaDev, m_stream); - cuda_mem_space.deallocate(m_scratchFlags, - m_scratchFlagsCount * sizeScratchGrain); - cuda_mem_space.deallocate(m_scratchSpace, - m_scratchSpaceCount * sizeScratchGrain); - host_mem_space.deallocate(m_scratchUnified, - m_scratchUnifiedCount * sizeScratchGrain); - if (m_scratchFunctorSize > 0) { - cuda_mem_space.deallocate(m_scratchFunctor, m_scratchFunctorSize); - } - } - - for (int i = 0; i < m_n_team_scratch; ++i) { - if (m_team_scratch_current_size[i] > 0) - cuda_mem_space.deallocate(m_team_scratch_ptr[i], - m_team_scratch_current_size[i]); - } - - m_scratchSpaceCount = 0; - m_scratchFlagsCount = 0; - m_scratchUnifiedCount = 0; - m_scratchSpace = nullptr; - m_scratchFlags = nullptr; - m_scratchUnified = nullptr; - for (int i = 0; i < m_n_team_scratch; ++i) { - m_team_scratch_current_size[i] = 0; - m_team_scratch_ptr[i] = nullptr; - } - - KOKKOS_IMPL_CUDA_SAFE_CALL((cuda_free_wrapper(m_scratch_locks))); - m_scratch_locks = nullptr; - m_num_scratch_locks = 0; - m_cudaDev = -1; -} - -//---------------------------------------------------------------------------- - Cuda::size_type *cuda_internal_scratch_space(const Cuda &instance, const std::size_t size) { return instance.impl_internal_space_instance()->scratch_space(size); @@ -527,17 +469,7 @@ Cuda::size_type *cuda_internal_scratch_unified(const Cuda &instance, namespace Kokkos { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -int Cuda::concurrency() { -#else -int Cuda::concurrency() const { -#endif - return Impl::CudaInternal::concurrency(); -} - -int Cuda::impl_is_initialized() { - return Impl::CudaInternal::singleton().is_initialized(); -} +int Cuda::concurrency() const { return Impl::CudaInternal::concurrency(); } void Cuda::impl_initialize(InitializationSettings const &settings) { const std::vector &visible_devices = Impl::get_visible_devices(); @@ -587,33 +519,6 @@ void Cuda::impl_initialize(InitializationSettings const &settings) { //---------------------------------- -#ifdef KOKKOS_ENABLE_CUDA_UVM - const char *env_force_device_alloc = - getenv("CUDA_MANAGED_FORCE_DEVICE_ALLOC"); - bool force_device_alloc; - if (env_force_device_alloc == nullptr) - force_device_alloc = false; - else - force_device_alloc = std::stoi(env_force_device_alloc) != 0; - - const char *env_visible_devices = getenv("CUDA_VISIBLE_DEVICES"); - bool visible_devices_one = true; - if (env_visible_devices == nullptr) visible_devices_one = false; - - if (Kokkos::show_warnings() && - (!visible_devices_one && !force_device_alloc)) { - std::cerr << R"warning( -Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default - without setting CUDA_MANAGED_FORCE_DEVICE_ALLOC=1 or - setting CUDA_VISIBLE_DEVICES. - This could on multi GPU systems lead to severe performance" - penalties.)warning" - << std::endl; - } -#endif - - //---------------------------------- - #ifdef KOKKOS_ENABLE_IMPL_CUDA_UNIFIED_MEMORY // Check if unified memory is available int cuda_result; @@ -630,14 +535,20 @@ Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default //---------------------------------- - cudaStream_t singleton_stream; + cudaStream_t stream; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaSetDevice(cuda_device_id)); - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamCreate(&singleton_stream)); + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamCreate(&stream)); // Init the array for used for arbitrarily sized atomics desul::Impl::init_lock_arrays(); // FIXME - Impl::CudaInternal::singleton().initialize(singleton_stream); + // Create the default instance. + Impl::CudaInternal::default_instance = Impl::HostSharedPtr( + new Impl::CudaInternal(stream), [](Impl::CudaInternal *ptr) { + cudaStream_t s = ptr->m_stream; + delete ptr; + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamDestroy(s)); + }); } void Cuda::impl_finalize() { @@ -653,41 +564,30 @@ void Cuda::impl_finalize() { Kokkos::Impl::CudaInternal::constantMemReusablePerDevice[cuda_device])); } - auto &deep_copy_space = Impl::cuda_get_deep_copy_space(/*initialize*/ false); - if (deep_copy_space) - deep_copy_space->impl_internal_space_instance()->finalize(); KOKKOS_IMPL_CUDA_SAFE_CALL( cudaStreamDestroy(Impl::cuda_get_deep_copy_stream())); - Impl::CudaInternal::singleton().finalize(); - KOKKOS_IMPL_CUDA_SAFE_CALL( - cudaStreamDestroy(Impl::CudaInternal::singleton().m_stream)); + // Destroy the default instance. + Impl::CudaInternal::default_instance = nullptr; } Cuda::Cuda() - : m_space_instance(&Impl::CudaInternal::singleton(), - [](Impl::CudaInternal *) {}) { - Impl::CudaInternal::singleton().verify_is_initialized( - "Cuda instance constructor"); -} - -KOKKOS_DEPRECATED Cuda::Cuda(cudaStream_t stream, bool manage_stream) - : Cuda(stream, - manage_stream ? Impl::ManageStream::yes : Impl::ManageStream::no) {} + : m_space_instance( + (Impl::check_execution_space_constructor_precondition(name()), + Impl::CudaInternal::default_instance)) {} Cuda::Cuda(cudaStream_t stream, Impl::ManageStream manage_stream) : m_space_instance( - new Impl::CudaInternal, [manage_stream](Impl::CudaInternal *ptr) { - ptr->finalize(); - if (static_cast(manage_stream)) { - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamDestroy(ptr->m_stream)); - } - delete ptr; - }) { - Impl::CudaInternal::singleton().verify_is_initialized( - "Cuda instance constructor"); - m_space_instance->initialize(stream); -} + (Impl::check_execution_space_constructor_precondition(name()), + static_cast(manage_stream) + ? Impl::HostSharedPtr(new Impl::CudaInternal(stream), + [](Impl::CudaInternal *ptr) { + cudaStream_t s = ptr->m_stream; + delete ptr; + KOKKOS_IMPL_CUDA_SAFE_CALL( + cudaStreamDestroy(s)); + }) + : Impl::HostSharedPtr(new Impl::CudaInternal(stream)))) {} void Cuda::print_configuration(std::ostream &os, bool /*verbose*/) const { os << "Device Execution Space:\n"; @@ -699,12 +599,6 @@ void Cuda::print_configuration(std::ostream &os, bool /*verbose*/) const { os << "yes\n"; #else os << "no\n"; -#endif - os << " KOKKOS_ENABLE_CUDA_UVM: "; -#ifdef KOKKOS_ENABLE_CUDA_UVM - os << "yes\n"; -#else - os << "no\n"; #endif os << " KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC: "; #ifdef KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC @@ -747,12 +641,15 @@ int g_cuda_space_factory_initialized = initialize_space_factory("150_Cuda"); int CudaInternal::m_cudaArch = -1; -cudaDeviceProp CudaInternal::m_deviceProp; +KOKKOS_IMPL_EXPORT cudaDeviceProp CudaInternal::m_deviceProp; +HostSharedPtr CudaInternal::default_instance; std::set CudaInternal::cuda_devices = {}; -std::map CudaInternal::constantMemHostStagingPerDevice = - {}; -std::map CudaInternal::constantMemReusablePerDevice = {}; -std::map CudaInternal::constantMemMutexPerDevice = {}; +KOKKOS_IMPL_EXPORT std::map + CudaInternal::constantMemHostStagingPerDevice = {}; +KOKKOS_IMPL_EXPORT std::map + CudaInternal::constantMemReusablePerDevice = {}; +KOKKOS_IMPL_EXPORT std::map + CudaInternal::constantMemMutexPerDevice = {}; } // namespace Impl diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp index 7dfb7e788a09..b55612c44336 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp @@ -1,23 +1,11 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_INSTANCE_HPP_ #define KOKKOS_CUDA_INSTANCE_HPP_ #include +#include #include #include #include @@ -37,6 +25,11 @@ extern "C" void kokkos_impl_cuda_set_serial_execution(bool); extern "C" bool kokkos_impl_cuda_use_serial_execution(); #endif +#if defined(KOKKOS_COMPILER_NVCC) && !defined(KOKKOS_ARCH_MAXWELL) && \ + !defined(KOKKOS_ARCH_PASCAL) +#define KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT +#endif + namespace Kokkos { namespace Impl { @@ -52,7 +45,11 @@ struct CudaTraits { static constexpr CudaSpace::size_type ConstantMemoryCache = 0x002000; /* 8k bytes */ static constexpr CudaSpace::size_type KernelArgumentLimit = +#ifdef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT + 0x008000; /* 32k bytes */ +#else 0x001000; /* 4k bytes */ +#endif static constexpr CudaSpace::size_type MaxHierarchicalParallelism = 1024; /* team_size * vector_length */ using ConstantGlobalBufferType = @@ -78,9 +75,6 @@ namespace Kokkos { namespace Impl { class CudaInternal { - private: - CudaInternal(const CudaInternal&); - CudaInternal& operator=(const CudaInternal&); #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION static bool kokkos_impl_cuda_use_serial_execution_v; #endif @@ -94,47 +88,46 @@ class CudaInternal { static int m_cudaArch; static int concurrency(); - static cudaDeviceProp m_deviceProp; + static HostSharedPtr default_instance; + + KOKKOS_IMPL_EXPORT static cudaDeviceProp m_deviceProp; // Scratch Spaces for Reductions - mutable std::size_t m_scratchSpaceCount; - mutable std::size_t m_scratchFlagsCount; - mutable std::size_t m_scratchUnifiedCount; - mutable std::size_t m_scratchFunctorSize; - - mutable size_type* m_scratchSpace; - mutable size_type* m_scratchFlags; - mutable size_type* m_scratchUnified; - mutable size_type* m_scratchFunctor; - cudaStream_t m_stream; - uint32_t m_instance_id; + mutable std::size_t m_scratchSpaceCount = 0; + mutable std::size_t m_scratchFlagsCount = 0; + mutable std::size_t m_scratchUnifiedCount = 0; + mutable std::size_t m_scratchFunctorSize = 0; + + mutable size_type* m_scratchSpace = nullptr; + mutable size_type* m_scratchFlags = nullptr; + mutable size_type* m_scratchUnified = nullptr; + mutable size_type* m_scratchFunctor = nullptr; + cudaStream_t m_stream = nullptr; + uint32_t m_instance_id = + Kokkos::Tools::Experimental::Impl::idForInstance( + reinterpret_cast(this)); // Team Scratch Level 1 Space - int m_n_team_scratch = 10; - mutable int64_t m_team_scratch_current_size[10]; - mutable void* m_team_scratch_ptr[10]; - mutable std::atomic_int m_team_scratch_pool[10]; - int32_t* m_scratch_locks; - size_t m_num_scratch_locks; - - bool was_initialized = false; - bool was_finalized = false; + int m_n_team_scratch = 10; + mutable int64_t m_team_scratch_current_size[10] = {}; + mutable void* m_team_scratch_ptr[10] = {}; + mutable std::atomic_int m_team_scratch_pool[10] = {}; + int32_t* m_scratch_locks = nullptr; + size_t m_num_scratch_locks = 0; static std::set cuda_devices; - static std::map constantMemHostStagingPerDevice; - static std::map constantMemReusablePerDevice; - static std::map constantMemMutexPerDevice; - - static CudaInternal& singleton(); + KOKKOS_IMPL_EXPORT static std::map + constantMemHostStagingPerDevice; + KOKKOS_IMPL_EXPORT static std::map + constantMemReusablePerDevice; + KOKKOS_IMPL_EXPORT static std::map constantMemMutexPerDevice; int verify_is_initialized(const char* const label) const; - int is_initialized() const { - return nullptr != m_scratchSpace && nullptr != m_scratchFlags; - } - - void initialize(cudaStream_t stream); - void finalize(); + CudaInternal(cudaStream_t stream); + ~CudaInternal(); + CudaInternal(const CudaInternal&) = delete; + CudaInternal& operator=(const CudaInternal&) = delete; void print_configuration(std::ostream&) const; @@ -146,28 +139,6 @@ class CudaInternal { void fence(const std::string&) const; void fence() const; - ~CudaInternal(); - - CudaInternal() - : m_scratchSpaceCount(0), - m_scratchFlagsCount(0), - m_scratchUnifiedCount(0), - m_scratchFunctorSize(0), - m_scratchSpace(nullptr), - m_scratchFlags(nullptr), - m_scratchUnified(nullptr), - m_scratchFunctor(nullptr), - m_stream(nullptr), - m_instance_id( - Kokkos::Tools::Experimental::Impl::idForInstance( - reinterpret_cast(this))) { - for (int i = 0; i < m_n_team_scratch; ++i) { - m_team_scratch_current_size[i] = 0; - m_team_scratch_ptr[i] = nullptr; - m_team_scratch_pool[i] = 0; - } - } - // Using CUDA API function/objects will be w.r.t. device 0 unless // cudaSetDevice(device_id) is called with the correct device_id. // The correct device_id is stored in the variable @@ -222,7 +193,11 @@ class CudaInternal { cudaGraph_t graph, const cudaGraphNode_t* from, const cudaGraphNode_t* to, size_t numDependencies) const { set_cuda_device(); +#if CUDART_VERSION >= 13000 + return cudaGraphAddDependencies(graph, from, to, NULL, numDependencies); +#else return cudaGraphAddDependencies(graph, from, to, numDependencies); +#endif } cudaError_t cuda_graph_add_empty_node_wrapper( @@ -273,12 +248,6 @@ class CudaInternal { return cudaMallocHost(ptr, size); } - cudaError_t cuda_mem_prefetch_async_wrapper(const void* devPtr, size_t count, - int dstDevice) const { - set_cuda_device(); - return cudaMemPrefetchAsync(devPtr, count, dstDevice, m_stream); - } - cudaError_t cuda_memcpy_wrapper(void* dst, const void* src, size_t count, cudaMemcpyKind kind) const { set_cuda_device(); @@ -311,12 +280,6 @@ class CudaInternal { return cudaMemsetAsync(devPtr, value, count, m_stream); } - cudaError_t cuda_pointer_get_attributes_wrapper( - cudaPointerAttributes* attributes, const void* ptr) const { - set_cuda_device(); - return cudaPointerGetAttributes(attributes, ptr); - } - cudaError_t cuda_stream_create_wrapper(cudaStream_t* pStream) const { set_cuda_device(); return cudaStreamCreate(pStream); diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp index 61b890089e8a..77006a24afa5 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDAEXEC_HPP #define KOKKOS_CUDAEXEC_HPP @@ -35,6 +22,14 @@ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- +// If KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT is used we leverage implicit constant +// cache use via an argument attribute in the "local launch" mechanism. At that +// point we only need local and global launch - the latter for functors that +// exceed the kernel argument limit which is now 32kB. Local launch is always +// strictly better than global launch - which means the light weight/heavy +// weight property can be ignored - the only thing that matters is the size of +// the functor. +#ifndef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT /** \brief Access to constant memory on the device */ #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE @@ -47,6 +42,7 @@ __device__ __constant__ unsigned long kokkos_impl_cuda_constant_memory_buffer [Kokkos::Impl::CudaTraits::ConstantMemoryUsage / sizeof(unsigned long)]; #endif +#endif // !KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT template inline __device__ T* kokkos_impl_cuda_shared_memory() { @@ -64,6 +60,7 @@ namespace Impl { // function qualifier which could be used to improve performance. //---------------------------------------------------------------------------- +#ifndef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT template __global__ static void cuda_parallel_launch_constant_memory() { const DriverType& driver = @@ -94,6 +91,22 @@ __global__ __launch_bounds__( driver) { driver(); } +#else +template +__global__ static void cuda_parallel_launch_local_memory( + const __grid_constant__ DriverType driver) { + driver(); +} + +template +__global__ __launch_bounds__( + maxTperB, + minBperSM) static void cuda_parallel_launch_local_memory(const __grid_constant__ + DriverType + driver) { + driver(); +} +#endif // KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT template __global__ static void cuda_parallel_launch_global_memory( @@ -149,8 +162,6 @@ inline void configure_shmem_preference(const CudaInternal* cuda_instance, const KernelFuncPtr& func, const size_t block_size, int& shmem, const size_t occupancy) { -#ifndef KOKKOS_ARCH_KEPLER - const auto& func_attr = get_cuda_kernel_func_attributes(cuda_instance, func); @@ -231,13 +242,6 @@ inline void configure_shmem_preference(const CudaInternal* cuda_instance, if (cache_config_preference_cached != carveout) { cache_config_preference_cached = set_cache_config(); } -#else - // Use the parameters so we don't get a warning - (void)func; - (void)device_props; - (void)block_size; - (void)occupancy; -#endif } // end Some helper functions for launch code readability }}}1 @@ -263,31 +267,51 @@ struct DeduceCudaLaunchMechanism { (sizeof(DriverType) < CudaTraits::KernelArgumentLimit ? CudaLaunchMechanism::LocalMemory : CudaLaunchMechanism::Default) | +#ifndef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT (sizeof(DriverType) < CudaTraits::ConstantMemoryUsage ? CudaLaunchMechanism::ConstantMemory : CudaLaunchMechanism::Default) | +#endif CudaLaunchMechanism::GlobalMemory; static constexpr CudaLaunchMechanism requested_launch_mechanism = +#ifdef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT + CudaLaunchMechanism::LocalMemory | +#else (((property & light_weight) == light_weight) ? CudaLaunchMechanism::LocalMemory : CudaLaunchMechanism::ConstantMemory) | +#endif CudaLaunchMechanism::GlobalMemory; static constexpr CudaLaunchMechanism default_launch_mechanism = +#ifdef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT + (sizeof(DriverType) < CudaTraits::KernelArgumentLimit) + ? CudaLaunchMechanism::LocalMemory + : CudaLaunchMechanism::GlobalMemory; +#else // BuildValidMask (sizeof(DriverType) < CudaTraits::ConstantMemoryUseThreshold) ? CudaLaunchMechanism::LocalMemory : ((sizeof(DriverType) < CudaTraits::ConstantMemoryUsage) ? CudaLaunchMechanism::ConstantMemory : CudaLaunchMechanism::GlobalMemory); +#endif - // None LightWeight HeavyWeight - // F end DeduceCudaLaunchMechanism }}}2 @@ -504,7 +529,8 @@ struct CudaParallelLaunchKernelInvokercuda_memcpy_async_wrapper( driver_ptr, &driver, sizeof(DriverType), cudaMemcpyDefault))); - void const* args[] = {&driver_ptr}; + // NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion) + void* args[] = {&driver_ptr}; cudaKernelNodeParams params = {}; @@ -513,7 +539,7 @@ struct CudaParallelLaunchKernelInvoker(base_t::get_kernel_func()); - params.kernelParams = const_cast(args); + params.kernelParams = args; params.extra = nullptr; KOKKOS_IMPL_CUDA_SAFE_CALL( @@ -537,7 +563,7 @@ struct CudaParallelLaunchKernelInvoker {{{2 - +#ifndef KOKKOS_IMPL_CUDA_USE_GRID_CONSTANT template struct CudaParallelLaunchKernelFunc< @@ -628,6 +654,7 @@ struct CudaParallelLaunchKernelInvoker end Constant Memory }}}2 //------------------------------------------------------------------------------ @@ -677,8 +704,6 @@ struct CudaParallelLaunchImpl< desired_occupancy); } - desul::ensure_cuda_lock_arrays_on_device(); - // Invoke the driver function on the device base_t::invoke_kernel(driver, grid, block, shmem, cuda_instance); @@ -708,33 +733,23 @@ template , CudaLaunchMechanism LaunchMechanism = DeduceCudaLaunchMechanism::launch_mechanism, bool DoGraph = DriverType::Policy::is_graph_kernel::value> -struct CudaParallelLaunch; - -// General launch mechanism -template -struct CudaParallelLaunch +struct CudaParallelLaunch : CudaParallelLaunchImpl { using base_t = CudaParallelLaunchImpl; - template - CudaParallelLaunch(Args&&... args) { - base_t::launch_kernel((Args&&)args...); - } -}; + CudaParallelLaunch(const DriverType& driver, const dim3& grid, + const dim3& block, const int shmem, + const CudaInternal* cuda_instance) { + if (!Impl::is_empty_launch(grid, block)) { + desul::ensure_cuda_lock_arrays_on_device(); + } -// Launch mechanism for creating graph nodes -template -struct CudaParallelLaunch - : CudaParallelLaunchImpl { - using base_t = - CudaParallelLaunchImpl; - template - CudaParallelLaunch(Args&&... args) { - base_t::create_parallel_launch_graph_node((Args&&)args...); + if constexpr (DoGraph) { + base_t::create_parallel_launch_graph_node(driver, grid, block, shmem, + cuda_instance); + } else { + base_t::launch_kernel(driver, grid, block, shmem, cuda_instance); + } } }; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp index 2c7eba7a18ff..07b3e9594a99 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_MDRANGEPOLICY_HPP_ #define KOKKOS_CUDA_MDRANGEPOLICY_HPP_ @@ -35,16 +22,66 @@ struct default_inner_direction { namespace Impl { +template <> +struct TileSizeRecommended { + template + static auto get(Policy const&) { + constexpr auto InnerDirection = Policy::inner_direction; + constexpr int Rank = Policy::rank; + + using tile_type = typename Policy::tile_type; + + if constexpr (InnerDirection == Iterate::Left) { + if constexpr (Rank == 2) { + return tile_type{64, 4}; + } else if constexpr (Rank == 3) { + return tile_type{32, 2, 4}; + } else if constexpr (Rank == 4) { + return tile_type{16, 2, 2, 4}; + } else if constexpr (Rank == 5) { + return tile_type{16, 2, 4, 2, 1}; + } else if constexpr (Rank == 6) { + return tile_type{8, 4, 2, 2, 2, 1}; + } + tile_type tile_sizes{}; + for (int i = 0; i < Rank; ++i) { + tile_sizes[i] = 2; + } + tile_sizes[0] = 16; + return tile_sizes; + } else { + if constexpr (Rank == 2) { + return tile_type{4, 64}; + } else if constexpr (Rank == 3) { + return tile_type{4, 2, 32}; + } else if constexpr (Rank == 4) { + return tile_type{4, 2, 2, 16}; + } else if constexpr (Rank == 5) { + return tile_type{1, 2, 4, 2, 16}; + } else if constexpr (Rank == 6) { + return tile_type{1, 2, 2, 2, 4, 8}; + } + tile_type tile_sizes{}; + for (int i = 0; i < Rank; ++i) { + tile_sizes[i] = 2; + } + tile_sizes[Rank - 1] = 16; + return tile_sizes; + } + } +}; + // Settings for MDRangePolicy template <> inline TileSizeProperties get_tile_size_properties( const Kokkos::Cuda& space) { TileSizeProperties properties; - properties.max_threads = space.impl_internal_space_instance() - ->m_deviceProp.maxThreadsPerMultiProcessor; - properties.default_largest_tile_size = 16; - properties.default_tile_size = 2; - properties.max_total_tile_size = 512; + const auto& device_prop = space.cuda_device_prop(); + properties.max_threads = device_prop.maxThreadsPerMultiProcessor; + properties.max_total_tile_size = 512; + properties.max_threads_dimensions[0] = device_prop.maxThreadsDim[0]; + properties.max_threads_dimensions[1] = device_prop.maxThreadsDim[1]; + properties.max_threads_dimensions[2] = device_prop.maxThreadsDim[2]; return properties; } diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp index a65b063427ee..43e799eff19b 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_PARALLEL_MD_RANGE_HPP #define KOKKOS_CUDA_PARALLEL_MD_RANGE_HPP @@ -21,7 +8,6 @@ #if defined(KOKKOS_ENABLE_CUDA) #include -#include #include @@ -29,9 +15,6 @@ #include #include -#include -#include - #include #include @@ -73,44 +56,47 @@ class ParallelFor, Kokkos::Cuda> { using functor_type = FunctorType; private: - using RP = Policy; using array_index_type = typename Policy::array_index_type; using index_type = typename Policy::index_type; using LaunchBounds = typename Policy::launch_bounds; using MaxGridSize = Kokkos::Array; + using array_type = typename Policy::point_type; const FunctorType m_functor; - const Policy m_rp; + const Policy m_policy; const MaxGridSize m_max_grid_size; + array_type m_lower; + array_type m_upper; + array_type m_extent; // tile_size * num_tiles + public: template static int max_tile_size_product(const Policy& pol, const Functor&) { return max_tile_size_product_helper(pol, LaunchBounds{}); } - Policy const& get_policy() const { return m_rp; } + + Policy const& get_policy() const { return m_policy; } + inline __device__ void operator()() const { - Kokkos::Impl::DeviceIterateTile( - m_rp, m_functor, m_max_grid_size) + Kokkos::Impl::DeviceIterate(m_lower, m_upper, + m_extent, m_functor) .exec_range(); } inline void execute() const { - if (m_rp.m_num_tiles == 0) return; + if (m_policy.m_num_tiles == 0) return; // maximum number of threads in each dimension of the block as fetched by // the API - const auto max_threads_dim = m_rp.space().cuda_device_prop().maxThreadsDim; + [[maybe_unused]] const auto max_threads_dim = + m_policy.space().cuda_device_prop().maxThreadsDim; // maximum total number of threads per block as fetched by the API [[maybe_unused]] const auto max_threads_per_block = - m_rp.space().cuda_device_prop().maxThreadsPerBlock; - - // make sure the Z dimension (it is less than x,y limits) isn't exceeded - const auto clampZ = [&](const int input) { - return std::min(input, max_threads_dim[2]); - }; + m_policy.space().cuda_device_prop().maxThreadsPerBlock; // make sure the block dimensions don't exceed the max number of threads // allowed @@ -136,113 +122,44 @@ class ParallelFor, Kokkos::Cuda> { grid.z <= static_cast(m_max_grid_size[2])); }; - if (RP::rank == 2) { - // id0 to threadIdx.x; id1 to threadIdx.y - const dim3 block(m_rp.m_tile[0], m_rp.m_tile[1], 1); - check_block_sizes(block); - - const dim3 grid( - std::min( - (m_rp.m_upper[0] - m_rp.m_lower[0] + block.x - 1) / block.x, - m_max_grid_size[0]), - std::min( - (m_rp.m_upper[1] - m_rp.m_lower[1] + block.y - 1) / block.y, - m_max_grid_size[1]), - 1); - check_grid_sizes(grid); - - CudaParallelLaunch( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); - } else if (RP::rank == 3) { - // id0 to threadIdx.x; id1 to threadIdx.y; id2 to threadIdx.z - const dim3 block(m_rp.m_tile[0], m_rp.m_tile[1], clampZ(m_rp.m_tile[2])); - check_block_sizes(block); - - const dim3 grid( - std::min( - (m_rp.m_upper[0] - m_rp.m_lower[0] + block.x - 1) / block.x, - m_max_grid_size[0]), - std::min( - (m_rp.m_upper[1] - m_rp.m_lower[1] + block.y - 1) / block.y, - m_max_grid_size[1]), - std::min( - (m_rp.m_upper[2] - m_rp.m_lower[2] + block.z - 1) / block.z, - m_max_grid_size[2])); - // ensure we don't exceed the capability of the device - check_grid_sizes(grid); - - CudaParallelLaunch( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); - } else if (RP::rank == 4) { - // id0,id1 encoded within threadIdx.x; id2 to threadIdx.y; id3 to - // threadIdx.z - const dim3 block(m_rp.m_tile[0] * m_rp.m_tile[1], m_rp.m_tile[2], - clampZ(m_rp.m_tile[3])); - check_block_sizes(block); - const dim3 grid( - std::min(m_rp.m_tile_end[0] * m_rp.m_tile_end[1], - m_max_grid_size[0]), - std::min( - (m_rp.m_upper[2] - m_rp.m_lower[2] + block.y - 1) / block.y, - m_max_grid_size[1]), - std::min( - (m_rp.m_upper[3] - m_rp.m_lower[3] + block.z - 1) / block.z, - m_max_grid_size[2])); - check_grid_sizes(grid); - CudaParallelLaunch( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); - } else if (RP::rank == 5) { - // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4 to - // threadIdx.z - const dim3 block(m_rp.m_tile[0] * m_rp.m_tile[1], - m_rp.m_tile[2] * m_rp.m_tile[3], clampZ(m_rp.m_tile[4])); - check_block_sizes(block); - const dim3 grid( - std::min(m_rp.m_tile_end[0] * m_rp.m_tile_end[1], - m_max_grid_size[0]), - std::min(m_rp.m_tile_end[2] * m_rp.m_tile_end[3], - m_max_grid_size[1]), - std::min( - (m_rp.m_upper[4] - m_rp.m_lower[4] + block.z - 1) / block.z, - m_max_grid_size[2])); - check_grid_sizes(grid); - CudaParallelLaunch( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); - } else if (RP::rank == 6) { - // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4,id5 to - // threadIdx.z - const dim3 block(m_rp.m_tile[0] * m_rp.m_tile[1], - m_rp.m_tile[2] * m_rp.m_tile[3], - clampZ(m_rp.m_tile[4] * m_rp.m_tile[5])); - check_block_sizes(block); - const dim3 grid( - std::min(m_rp.m_tile_end[0] * m_rp.m_tile_end[1], - m_max_grid_size[0]), - std::min(m_rp.m_tile_end[2] * m_rp.m_tile_end[3], - m_max_grid_size[1]), - std::min(m_rp.m_tile_end[4] * m_rp.m_tile_end[5], - m_max_grid_size[2])); - check_grid_sizes(grid); - CudaParallelLaunch( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); - } else { - Kokkos::abort("Kokkos::MDRange Error: Exceeded rank bounds with Cuda\n"); - } + const auto [grid, block] = + Kokkos::Impl::compute_device_launch_params(m_policy, m_max_grid_size); + // ensure we don't exceed the capability of the device + check_grid_sizes(grid); + check_block_sizes(block); + // launch the kernel + CudaParallelLaunch( + *this, grid, block, 0, m_policy.space().impl_internal_space_instance()); } // end execute // inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy) : m_functor(arg_functor), - m_rp(arg_policy), + m_policy(arg_policy), m_max_grid_size({ static_cast( - m_rp.space().cuda_device_prop().maxGridSize[0]), + m_policy.space().cuda_device_prop().maxGridSize[0]), static_cast( - m_rp.space().cuda_device_prop().maxGridSize[1]), + m_policy.space().cuda_device_prop().maxGridSize[1]), static_cast( - m_rp.space().cuda_device_prop().maxGridSize[2]), - }) {} + m_policy.space().cuda_device_prop().maxGridSize[2]), + }) { + // Initialize begins and ends based on layout + // Swap the fastest indexes to x dimension + for (array_index_type i = 0; i < Policy::rank; ++i) { + if constexpr (Policy::inner_direction == Iterate::Left) { + m_lower[i] = m_policy.m_lower[i]; + m_upper[i] = m_policy.m_upper[i]; + m_extent[i] = m_policy.m_tile[i] * m_policy.m_tile_end[i]; + } else { + m_lower[i] = m_policy.m_lower[Policy::rank - 1 - i]; + m_upper[i] = m_policy.m_upper[Policy::rank - 1 - i]; + m_extent[i] = m_policy.m_tile[Policy::rank - 1 - i] * + m_policy.m_tile_end[Policy::rank - 1 - i]; + } + } + } }; template diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp index c26658ce5da9..8c18284c6675 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_PARALLEL_RANGE_HPP #define KOKKOS_CUDA_PARALLEL_RANGE_HPP @@ -41,9 +28,10 @@ class ParallelFor, Kokkos::Cuda> { using Policy = Kokkos::RangePolicy; private: - using Member = typename Policy::member_type; - using WorkTag = typename Policy::work_tag; - using LaunchBounds = typename Policy::launch_bounds; + using Member = typename Policy::member_type; + using WorkTag = typename Policy::work_tag; + using LaunchBounds = typename Policy::launch_bounds; + using StaticBatchSize = typename Policy::static_batch_size; const FunctorType m_functor; const Policy m_policy; @@ -63,29 +51,41 @@ class ParallelFor, Kokkos::Cuda> { public: using functor_type = FunctorType; - ParallelFor() = delete; - ParallelFor(const ParallelFor&) = default; - ParallelFor& operator=(const ParallelFor&) = delete; + ParallelFor() = delete; Policy const& get_policy() const { return m_policy; } inline __device__ void operator()() const { - const auto work_stride = Member(blockDim.y) * gridDim.x; - const Member work_end = m_policy.end(); + constexpr auto batch_size = Member(StaticBatchSize::batch_size); + const auto work_stride = Member(blockDim.y) * gridDim.x; + const Member work_end = m_policy.end(); for (Member iwork = m_policy.begin() + threadIdx.y + static_cast(blockDim.y) * blockIdx.x; iwork < work_end; - iwork = iwork < static_cast(work_end - work_stride) - ? iwork + work_stride - : work_end) { - this->template exec_range(iwork); + iwork = + iwork < static_cast(work_end - work_stride * batch_size) + ? iwork + work_stride * batch_size + : work_end) { +#if defined(KOKKOS_COMPILER_NVCC) +#pragma unroll +#endif + for (Member i = 0; i < static_cast(work_stride * batch_size) && + i < work_end - iwork; + i = (i < static_cast(work_end - work_stride - iwork)) + ? i + work_stride + : work_end - iwork) { + this->template exec_range(iwork + i); + } } } inline void execute() const { - const typename Policy::index_type nwork = m_policy.end() - m_policy.begin(); - + constexpr typename Policy::index_type batch_size = + StaticBatchSize::batch_size; + const typename Policy::index_type nwork = + (m_policy.end() - m_policy.begin()) / batch_size + + ((m_policy.end() - m_policy.begin()) % batch_size == 0 ? 0 : 1); cudaFuncAttributes attr = CudaParallelLaunch::get_cuda_func_attributes( m_policy.space().impl_internal_space_instance()); diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp index 86102fa8e2a4..70eb5a348284 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_PARALLEL_TEAM_HPP #define KOKKOS_CUDA_PARALLEL_TEAM_HPP @@ -43,8 +30,6 @@ namespace Kokkos { -extern bool show_warnings() noexcept; - namespace Impl { template @@ -123,9 +108,19 @@ class TeamPolicyInternal return internal_team_size_max(f); } - template - inline int team_size_max(const FunctorType& f, const ReducerType& /*r*/, - const ParallelReduceTag&) const { + template + inline int team_size_max(const FunctorType& f, const ReducerType& reducer, + const ParallelReduceTag& tag) const { + using functor_analysis_type = + Impl::FunctorAnalysis; + return team_size_max_internal( + f, typename functor_analysis_type::Reducer{reducer}, tag); + } + + template + inline int team_size_max_internal(const FunctorType& f, const ReducerType&, + const ParallelReduceTag&) const { using closure_type = Impl::ParallelReduce, TeamPolicy, Kokkos::Cuda>; @@ -162,9 +157,19 @@ class TeamPolicyInternal return internal_team_size_recommended(f); } - template - int team_size_recommended(const FunctorType& f, const ReducerType&, - const ParallelReduceTag&) const { + template + int team_size_recommended(const FunctorType& f, const ReducerType& reducer, + const ParallelReduceTag& tag) const { + using functor_analysis_type = + Impl::FunctorAnalysis; + return team_size_recommended_internal( + f, typename functor_analysis_type::Reducer{reducer}, tag); + } + + template + int team_size_recommended_internal(const FunctorType& f, const ReducerType&, + const ParallelReduceTag&) const { using closure_type = Impl::ParallelReduce, TeamPolicy, Kokkos::Cuda>; @@ -192,7 +197,7 @@ class TeamPolicyInternal // arbitrarily setting level 1 scratch limit to 20MB, for a // Volta V100 that would give us about 3.2GB for 2 teams per SM constexpr size_t max_l1_scratch_size = - static_cast(20) * 1024 * 1024; + static_cast(80) * 1024 * 1024; size_t max_shmem = Cuda().cuda_device_prop().sharedMemPerBlock; return (level == 0 ? max_shmem - max_reserved_shared_mem_per_team @@ -225,7 +230,7 @@ class TeamPolicyInternal const typename traits::execution_space& space() const { return m_space; } TeamPolicyInternal() - : m_space(typename traits::execution_space()), + : m_space(), m_league_size(0), m_team_size(-1), m_vector_length(0), @@ -236,9 +241,9 @@ class TeamPolicyInternal m_tune_vector(false) {} /** \brief Specify league size, specify team size, specify vector length */ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, int team_size_request, int vector_length_request = 1) - : m_space(space_), + : m_space(std::move(space)), m_league_size(league_size_), m_team_size(team_size_request), m_vector_length(impl_determine_vector_length(vector_length_request)), @@ -256,31 +261,36 @@ class TeamPolicyInternal // Make sure total block size is permissible if (m_team_size * m_vector_length > - int(Impl::CudaTraits::MaxHierarchicalParallelism)) { - Impl::throw_runtime_exception( - std::string("Kokkos::TeamPolicy< Cuda > the team size is too large. " - "Team size x vector length must be smaller than 1024.")); + static_cast(Impl::CudaTraits::MaxHierarchicalParallelism)) { + std::stringstream error; + error << "Kokkos::TeamPolicy: Requested too large team size. " + "Requested: " + << m_team_size << ", Maximum: " + << Impl::CudaTraits::MaxHierarchicalParallelism / m_vector_length; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } } /** \brief Specify league size, request team size, specify vector length */ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, const Kokkos::AUTO_t& /* team_size_request */ , int vector_length_request = 1) - : TeamPolicyInternal(space_, league_size_, -1, vector_length_request) {} + : TeamPolicyInternal(std::move(space), league_size_, -1, + vector_length_request) {} /** \brief Specify league size, request team size and vector length */ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, const Kokkos::AUTO_t& /* team_size_request */, const Kokkos::AUTO_t& /* vector_length_request */ ) - : TeamPolicyInternal(space_, league_size_, -1, -1) {} + : TeamPolicyInternal(std::move(space), league_size_, -1, -1) {} /** \brief Specify league size, specify team size, request vector length */ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, int team_size_request, const Kokkos::AUTO_t&) - : TeamPolicyInternal(space_, league_size_, team_size_request, -1) {} + : TeamPolicyInternal(std::move(space), league_size_, team_size_request, + -1) {} TeamPolicyInternal(int league_size_, int team_size_request, int vector_length_request = 1) @@ -306,6 +316,12 @@ class TeamPolicyInternal : TeamPolicyInternal(typename traits::execution_space(), league_size_, team_size_request, vector_length_request) {} + TeamPolicyInternal(const PolicyUpdate, const TeamPolicyInternal& other, + typename traits::execution_space space) + : TeamPolicyInternal(other) { + this->m_space = std::move(space); + } + inline int chunk_size() const { return m_chunk_size; } /** \brief set chunk_size to a discrete value*/ @@ -517,19 +533,24 @@ class ParallelFor, *this, grid, block, shmem_size_total, m_policy.space() .impl_internal_space_instance()); // copy to device and execute + + if (m_scratch_pool_id >= 0) { + m_policy.space() + .impl_internal_space_instance() + ->release_team_scratch_space(m_scratch_pool_id); + } } ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) : m_functor(arg_functor), m_policy(arg_policy), - m_league_size(arg_policy.league_size()), - m_team_size(arg_policy.team_size()), - m_vector_size(arg_policy.impl_vector_length()) { + m_league_size(m_policy.league_size()), + m_team_size(m_policy.team_size()), + m_vector_size(m_policy.impl_vector_length()) { auto internal_space_instance = m_policy.space().impl_internal_space_instance(); if (m_team_size < 0) { - m_team_size = - arg_policy.team_size_recommended(arg_functor, ParallelForTag()); + m_team_size = m_policy.team_size_recommended(m_functor, ParallelForTag()); if (m_team_size <= 0) Kokkos::Impl::throw_runtime_exception( "Kokkos::Impl::ParallelFor could not find a " @@ -565,22 +586,30 @@ class ParallelFor, m_policy.space().cuda_device_prop().sharedMemPerBlock; const int shmem_size_total = m_shmem_begin + m_shmem_size; if (maxShmemPerBlock < shmem_size_total) { - printf("%i %i\n", maxShmemPerBlock, shmem_size_total); - Kokkos::Impl::throw_runtime_exception(std::string( - "Kokkos::Impl::ParallelFor< Cuda > insufficient shared memory")); + std::stringstream error; + error << "Kokkos::parallel_for: Requested too much scratch memory " + "on level 0. Requested: " + << m_shmem_size + << ", Maximum: " << maxShmemPerBlock - m_shmem_begin; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - if (m_team_size > arg_policy.team_size_max(arg_functor, ParallelForTag())) { - Kokkos::Impl::throw_runtime_exception(std::string( - "Kokkos::Impl::ParallelFor< Cuda > requested too large team size.")); + if (m_scratch_size[1] > static_cast(m_policy.scratch_size_max(1))) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too much scratch memory " + "on level 1. Requested: " + << m_scratch_size[1] + << ", Maximum: " << m_policy.scratch_size_max(1); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - } - ~ParallelFor() { - if (m_scratch_pool_id >= 0) { - m_policy.space() - .impl_internal_space_instance() - ->release_team_scratch_space(m_scratch_pool_id); + if (m_team_size > arg_policy.team_size_max(arg_functor, ParallelForTag())) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too large team size. " + "Requested: " + << m_team_size << ", Maximum: " + << arg_policy.team_size_max(arg_functor, ParallelForTag()); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } } }; @@ -863,6 +892,12 @@ class ParallelReduce= 0) { + m_policy.space() + .impl_internal_space_instance() + ->release_team_scratch_space(m_scratch_pool_id); + } } template @@ -891,7 +926,7 @@ class ParallelReduce requested too much " - "L0 scratch memory")); + std::stringstream error; + error + << "Kokkos::parallel_reduce: Requested too much scratch memory " + "on level 0. Requested: " + << m_shmem_size + << ", Maximum: " << maxShmemPerBlock - m_shmem_begin - m_team_begin; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - if (int(m_team_size) > - arg_policy.team_size_max(m_functor_reducer.get_functor(), - m_functor_reducer.get_reducer(), - ParallelReduceTag())) { - Kokkos::Impl::throw_runtime_exception( - std::string("Kokkos::Impl::ParallelReduce< Cuda > requested too " - "large team size.")); + if (m_scratch_size[1] > static_cast(m_policy.scratch_size_max(1))) { + std::stringstream error; + error + << "Kokkos::parallel_reduce: Requested too much scratch memory " + "on level 1. Requested: " + << m_scratch_size[1] << ", Maximum: " << m_policy.scratch_size_max(1); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - } - ~ParallelReduce() { - if (m_scratch_pool_id >= 0) { - m_policy.space() - .impl_internal_space_instance() - ->release_team_scratch_space(m_scratch_pool_id); + if (m_team_size > + arg_policy.team_size_max_internal(m_functor_reducer.get_functor(), + m_functor_reducer.get_reducer(), + ParallelReduceTag())) { + std::stringstream error; + error << "Kokkos::parallel_reduce: Requested too large team size. " + "Requested: " + << m_team_size << ", Maximum: " + << arg_policy.team_size_max_internal( + m_functor_reducer.get_functor(), + m_functor_reducer.get_reducer(), ParallelReduceTag()); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } } }; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp index 29ff01ac91b2..7069e89f189e 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_REDUCESCAN_HPP #define KOKKOS_CUDA_REDUCESCAN_HPP @@ -215,14 +202,19 @@ struct CudaReductionsFunctor { __device__ static inline void scalar_intra_block_reduction( const FunctorType& functor, Scalar value, const bool skip, - Scalar* my_global_team_buffer_element, const int shared_elements, + Scalar* my_global_team_buffer_element, const unsigned int shared_elements, Scalar* shared_team_buffer_element) { - const int warp_id = (threadIdx.y * blockDim.x) / 32; + const unsigned int warp_id = (threadIdx.y * blockDim.x) / 32u; + const unsigned int num_threads = blockDim.x * blockDim.y; Scalar* const my_shared_team_buffer_element = shared_team_buffer_element + warp_id % shared_elements; + const unsigned int num_active_threads_in_warp0 = + Kokkos::min(32u, num_threads); + // Warp Level Reduction, ignoring Kokkos vector entries - scalar_intra_warp_reduction(functor, value, skip, 32, value); + scalar_intra_warp_reduction(functor, value, skip, + num_active_threads_in_warp0, value); if (warp_id < shared_elements) { *my_shared_team_buffer_element = value; @@ -231,21 +223,27 @@ struct CudaReductionsFunctor { // warp reduction __syncthreads(); - const int num_warps = blockDim.x * blockDim.y / 32; - for (int w = shared_elements; w < num_warps; w += shared_elements) { + const unsigned int num_warps = num_threads / 32u; + for (unsigned int w = shared_elements; w < num_warps; + w += shared_elements) { if (warp_id >= w && warp_id < w + shared_elements) { - if ((threadIdx.y * blockDim.x + threadIdx.x) % 32 == 0) + if ((threadIdx.y * blockDim.x + threadIdx.x) % 32u == 0u) functor.join(my_shared_team_buffer_element, &value); } __syncthreads(); } - if (warp_id == 0) { + if (warp_id == 0u) { functor.init(&value); + + // We can increment by WarpSize rather than num_active_threads_in_warp0 + // because if the first warp is not complete, we won't enter the loop for (unsigned int i = threadIdx.y * blockDim.x + threadIdx.x; - i < blockDim.y * blockDim.x / 32; i += 32) + i < num_warps; i += 32u) functor.join(&value, &shared_team_buffer_element[i]); - scalar_intra_warp_reduction(functor, value, false, 32, + + scalar_intra_warp_reduction(functor, value, false, + num_active_threads_in_warp0, *my_global_team_buffer_element); } } @@ -258,9 +256,9 @@ struct CudaReductionsFunctor { Scalar* const my_global_team_buffer_element = global_team_buffer_element + blockIdx.x; Scalar* shared_team_buffer_elements = ((Scalar*)shared_data); - Scalar value = shared_team_buffer_elements[threadIdx.y]; - int shared_elements = blockDim.x * blockDim.y / 32; - int global_elements = block_count; + Scalar value = shared_team_buffer_elements[threadIdx.y]; + unsigned int shared_elements = blockDim.x * blockDim.y / 32u; + unsigned int global_elements = block_count; __syncthreads(); scalar_intra_block_reduction(functor, value, true, @@ -268,21 +266,21 @@ struct CudaReductionsFunctor { shared_team_buffer_elements); __threadfence(); __syncthreads(); - unsigned int num_teams_done = 0; + unsigned int num_teams_done = 0u; // The cast in the atomic call is necessary to find matching call with // MSVC/NVCC - if (threadIdx.x + threadIdx.y == 0) { + if (threadIdx.x + threadIdx.y == 0u) { num_teams_done = Kokkos::atomic_fetch_add(global_flags, static_cast(1)) + - 1; + 1u; } bool is_last_block = false; if (__syncthreads_or(num_teams_done == gridDim.x)) { is_last_block = true; - *global_flags = 0; + *global_flags = 0u; functor.init(&value); - for (int i = threadIdx.y * blockDim.x + threadIdx.x; i < global_elements; - i += blockDim.x * blockDim.y) { + for (unsigned int i = threadIdx.y * blockDim.x + threadIdx.x; + i < global_elements; i += blockDim.x * blockDim.y) { functor.join(&value, &global_team_buffer_element[i]); } scalar_intra_block_reduction( @@ -315,7 +313,7 @@ struct CudaReductionsFunctor { __syncwarp(mask); for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) { - if ((lane_id + delta < 32) && (lane_id % (delta * 2) == 0)) { + if ((lane_id + delta < width) && (lane_id % (delta * 2) == 0)) { functor.join(value, value + delta); } __syncwarp(mask); @@ -328,24 +326,25 @@ struct CudaReductionsFunctor { __device__ static inline void scalar_intra_block_reduction( const FunctorType& functor, Scalar value, const bool skip, Scalar* result, const int /*shared_elements*/, Scalar* shared_team_buffer_element) { - const int warp_id = (threadIdx.y * blockDim.x) / 32; + const int warp_id = (threadIdx.y * blockDim.x) / 32; + const unsigned int num_threads = blockDim.x * blockDim.y; Scalar* const my_shared_team_buffer_element = shared_team_buffer_element + threadIdx.y * blockDim.x + threadIdx.x; *my_shared_team_buffer_element = value; // Warp Level Reduction, ignoring Kokkos vector entries scalar_intra_warp_reduction(functor, my_shared_team_buffer_element, skip, - 32); + Kokkos::min(32u, num_threads)); // Wait for every warp to be done before using one warp to do final cross // warp reduction __syncthreads(); if (warp_id == 0) { const unsigned int delta = (threadIdx.y * blockDim.x + threadIdx.x) * 32; - if (delta < blockDim.x * blockDim.y) + if (delta < num_threads) *my_shared_team_buffer_element = shared_team_buffer_element[delta]; __syncwarp(0xffffffff); scalar_intra_warp_reduction(functor, my_shared_team_buffer_element, false, - blockDim.x * blockDim.y / 32); + num_threads / 32); if (threadIdx.x + threadIdx.y == 0) *result = *shared_team_buffer_element; } } diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp deleted file mode 100644 index e401c9f74b1f..000000000000 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE -#define KOKKOS_IMPL_PUBLIC_INCLUDE -#endif - -#include -#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_TASKDAG) - -#include - -#include - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -template class TaskQueue< - Kokkos::Cuda, - Impl::default_tasking_memory_space_for_execution_space_t >; -template class TaskQueueMultiple< - Kokkos::Cuda, - Impl::default_tasking_memory_space_for_execution_space_t >; - -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- -#else -void KOKKOS_CORE_SRC_CUDA_KOKKOS_CUDA_TASK_PREVENT_LINK_ERROR() {} -#endif /* #if defined( KOKKOS_ENABLE_CUDA ) && defined( KOKKOS_ENABLE_TASKDAG \ - ) */ diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp deleted file mode 100644 index 30a9fde1ea0b..000000000000 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp +++ /dev/null @@ -1,1248 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_IMPL_CUDA_TASK_HPP -#define KOKKOS_IMPL_CUDA_TASK_HPP - -#include -#if defined(KOKKOS_ENABLE_TASKDAG) - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#include - -#include -#include // KOKKOS_IMPL_CUDA_SAFE_CALL -#include - -//---------------------------------------------------------------------------- - -// We allow using deprecated classes in this file -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() - -// NOLINTBEGIN - -#if defined(__CUDA_ARCH__) -#define KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN(MSG) \ - { \ - __syncwarp(); \ - const unsigned b = __activemask(); \ - if (b != 0xffffffff) { \ - printf(" SYNCWARP AT %s (%d,%d,%d) (%d,%d,%d) failed %x\n", MSG, \ - blockIdx.x, blockIdx.y, blockIdx.z, threadIdx.x, threadIdx.y, \ - threadIdx.z, b); \ - return; \ - } \ - } -#else -#define KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN(MSG) -#endif - -namespace Kokkos { -namespace Impl { -namespace { - -template -__global__ void set_cuda_task_base_apply_function_pointer( - typename TaskType::function_type* ptr, - typename TaskType::destroy_type* dtor) { - *ptr = TaskType::apply; - *dtor = TaskType::destroy; -} - -template -__global__ void cuda_task_queue_execute(Scheduler scheduler, - int32_t shmem_size) { - TaskQueueSpecialization::driver(std::move(scheduler), shmem_size); -} - -} // namespace - -template -class TaskExec; - -template -class TaskQueueSpecialization> { - public: - using scheduler_type = SimpleTaskScheduler; - using execution_space = Kokkos::Cuda; - using memory_space = Kokkos::CudaUVMSpace; - using member_type = TaskExec; - - enum : long { max_league_size = 16 }; - enum : int { warps_per_block = 4 }; - - KOKKOS_INLINE_FUNCTION - static void iff_single_thread_recursive_execute(scheduler_type const&) {} - - static int get_max_team_count(execution_space const& space) { - return space.cuda_device_prop().multiProcessorCount * warps_per_block; - } - - __device__ static void driver(scheduler_type scheduler, - int32_t shmem_per_warp) { - using task_base_type = typename scheduler_type::task_base_type; - using runnable_task_base_type = - typename scheduler_type::runnable_task_base_type; - using scheduling_info_storage_type = SchedulingInfoStorage< - runnable_task_base_type, - typename scheduler_type::task_scheduling_info_type>; - - extern __shared__ int32_t shmem_all[]; - - int32_t* const warp_shmem = - shmem_all + (threadIdx.z * shmem_per_warp) / sizeof(int32_t); - - task_base_type* const shared_memory_task_copy = (task_base_type*)warp_shmem; - - const int warp_lane = threadIdx.x + threadIdx.y * blockDim.x; - - member_type single_exec(scheduler, warp_shmem, 1); - member_type team_exec(scheduler, warp_shmem, blockDim.y); - - auto& queue = scheduler.queue(); - auto& team_scheduler = team_exec.scheduler(); - - auto current_task = OptionalRef(); - - // Loop until all queues are empty and no tasks in flight - while (!queue.is_done()) { - if (warp_lane == 0) { // should be (?) same as team_exec.team_rank() == 0 - // pop off a task - current_task = - queue.pop_ready_task(team_scheduler.team_scheduler_info()); - } - - // Broadcast task pointer: - - // Sync before the broadcast - __syncwarp(0xffffffff); - - // pretend it's an int* for shuffle purposes - ((int*)¤t_task)[0] = - __shfl_sync(0xffffffff, ((int*)¤t_task)[0], 0, 32); - ((int*)¤t_task)[1] = - __shfl_sync(0xffffffff, ((int*)¤t_task)[1], 0, 32); - - if (current_task) { - KOKKOS_ASSERT(!current_task->as_runnable_task().get_respawn_flag()); - - int32_t b = sizeof(scheduling_info_storage_type) / sizeof(int32_t); - static_assert( - sizeof(scheduling_info_storage_type) % sizeof(int32_t) == 0, - "bad task size"); - int32_t const e = current_task->get_allocation_size() / sizeof(int32_t); - KOKKOS_ASSERT(current_task->get_allocation_size() % sizeof(int32_t) == - 0); - - int32_t volatile* const task_mem = - (int32_t volatile*)current_task.get(); - - // do a coordinated copy of the task closure from global to shared - // memory: - for (int32_t i = warp_lane; i < e; i += CudaTraits::WarpSize) { - warp_shmem[i] = task_mem[i]; - } - - // Synchronize threads of the warp and insure memory - // writes are visible to all threads in the warp. - __syncwarp(0xffffffff); - - if (shared_memory_task_copy->is_team_runnable()) { - // Thread Team Task - shared_memory_task_copy->as_runnable_task().run(team_exec); - } else if (threadIdx.y == 0) { - // TODO @tasking @optimization DSH Change this to warp_lane == 0 when - // we allow blockDim.x to be more than 1 Single Thread Task - shared_memory_task_copy->as_runnable_task().run(single_exec); - } - - // Synchronize threads of the warp and insure memory - // writes are visible to all threads in the warp. - - __syncwarp(0xffffffff); - - // if(warp_lane < b % CudaTraits::WarpSize) b += CudaTraits::WarpSize; - // b -= b % CudaTraits::WarpSize; - - // copy task closure from shared to global memory: - for (int32_t i = b + warp_lane; i < e; i += CudaTraits::WarpSize) { - task_mem[i] = warp_shmem[i]; - } - - // Synchronize threads of the warp and insure memory - // writes are visible to root thread of the warp for - // respawn or completion. - - __syncwarp(0xffffffff); - - if (warp_lane == 0) { - // If respawn requested copy respawn data back to main memory - if (shared_memory_task_copy->as_runnable_task().get_respawn_flag()) { - if (shared_memory_task_copy->as_runnable_task().has_predecessor()) { - // It's not necessary to make this a volatile write because - // the next read of the predecessor is on this thread in complete, - // and the predecessor is cleared there (using a volatile write) - current_task->as_runnable_task().acquire_predecessor_from( - shared_memory_task_copy->as_runnable_task()); - } - - // It may not necessary to make this a volatile write, since the - // next read will be done by this thread in complete where the - // rescheduling occurs, but since the task could be stolen later - // before this is written again, we should do the volatile write - // here. (It might not be necessary though because I don't know - // where else the priority would be read after it is scheduled - // by this thread; for now, we leave it volatile, but we should - // benchmark the cost of this.) - current_task.as_volatile()->set_priority( - shared_memory_task_copy->get_priority()); - - // It's not necessary to make this a volatile write, since the - // next read of it (if true) will be by this thread in `complete()`, - // which will unset the flag (using volatile) once it has handled - // the respawn - current_task->as_runnable_task().set_respawn_flag(); - } - - queue.complete((*std::move(current_task)).as_runnable_task(), - team_scheduler.team_scheduler_info()); - } - } - } - } - - // FIXME_CUDA_MULTIPLE_DEVICES - static void execute(scheduler_type const& scheduler) { - const int shared_per_warp = 2048; - const Kokkos::Cuda& exec = scheduler.get_execution_space(); - const auto& impl_instance = exec.impl_internal_space_instance(); - const int multi_processor_count = - exec.cuda_device_prop().multiProcessorCount; - const dim3 grid(multi_processor_count, 1, 1); - const dim3 block(1, Kokkos::Impl::CudaTraits::WarpSize, warps_per_block); - const int shared_total = shared_per_warp * warps_per_block; - const cudaStream_t stream = nullptr; - - KOKKOS_ASSERT( - static_cast(grid.x * grid.y * grid.z * block.x * block.y * - block.z) == - static_cast(get_max_team_count(scheduler.get_execution_space()) * - Kokkos::Impl::CudaTraits::WarpSize)); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecialization::execute: Pre Task Execution"); - - // Query the stack size, in bytes: - - size_t previous_stack_size = 0; - KOKKOS_IMPL_CUDA_SAFE_CALL(impl_instance->cuda_device_get_limit_wrapper( - &previous_stack_size, cudaLimitStackSize)); - - // If not large enough then set the stack size, in bytes: - - const size_t larger_stack_size = 1 << 11; - - if (previous_stack_size < larger_stack_size) { - KOKKOS_IMPL_CUDA_SAFE_CALL(impl_instance->cuda_device_set_limit_wrapper( - cudaLimitStackSize, larger_stack_size)); - } - - cuda_task_queue_execute<<>>( - scheduler, shared_per_warp); - - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetLastError()); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecialization::execute: Post Task Execution"); - - if (previous_stack_size < larger_stack_size) { - KOKKOS_IMPL_CUDA_SAFE_CALL(impl_instance->cuda_device_set_limit_wrapper( - cudaLimitStackSize, previous_stack_size)); - } - } - - template - static - // TODO @tasking @optimiazation DSH specialize this for trivially - // destructible types - void - get_function_pointer(typename TaskType::function_type& ptr, - typename TaskType::destroy_type& dtor) { - using function_type = typename TaskType::function_type; - using destroy_type = typename TaskType::destroy_type; - - // TODO @tasking @minor DSH make sure there aren't any alignment concerns? - void* storage = cuda_internal_scratch_unified( - Kokkos::Cuda(), sizeof(function_type) + sizeof(destroy_type)); - function_type* ptr_ptr = (function_type*)storage; - destroy_type* dtor_ptr = - (destroy_type*)((char*)storage + sizeof(function_type)); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecialization::execute: Pre Get Function Pointer for Tasks"); - - set_cuda_task_base_apply_function_pointer - <<<1, 1>>>(ptr_ptr, dtor_ptr); - - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetLastError()); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecialization::execute: Post Get Function Pointer for Tasks"); - - ptr = *ptr_ptr; - dtor = *dtor_ptr; - } -}; - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -template -class TaskQueueSpecializationConstrained< - Scheduler, std::enable_if_t::value>> { - public: - using scheduler_type = Scheduler; - using execution_space = Kokkos::Cuda; - using memory_space = Kokkos::CudaUVMSpace; - using member_type = TaskExec; - - enum : long { max_league_size = 16 }; - - KOKKOS_INLINE_FUNCTION - static void iff_single_thread_recursive_execute(scheduler_type const&) {} - - __device__ static void driver(scheduler_type scheduler, - int32_t shmem_per_warp) { - using queue_type = typename scheduler_type::queue_type; - using task_root_type = TaskBase; - - extern __shared__ int32_t shmem_all[]; - - task_root_type* const end = (task_root_type*)task_root_type::EndTag; - task_root_type* const no_more_tasks_sentinel = nullptr; - - int32_t* const warp_shmem = - shmem_all + (threadIdx.z * shmem_per_warp) / sizeof(int32_t); - - task_root_type* const task_shmem = (task_root_type*)warp_shmem; - - const int warp_lane = threadIdx.x + threadIdx.y * blockDim.x; - - member_type single_exec(scheduler, warp_shmem, 1); - member_type team_exec(scheduler, warp_shmem, blockDim.y); - - auto& team_queue = team_exec.scheduler().queue(); - - task_root_type* task_ptr = no_more_tasks_sentinel; - - // Loop until all queues are empty and no tasks in flight - - do { - // Each team lead attempts to acquire either a thread team task - // or collection of single thread tasks for the team. - - if (0 == warp_lane) { - if (*((volatile int*)&team_queue.m_ready_count) > 0) { - task_ptr = end; - // Attempt to acquire a task - // Loop by priority and then type - for (int i = 0; i < queue_type::NumQueue && end == task_ptr; ++i) { - for (int j = 0; j < 2 && end == task_ptr; ++j) { - task_ptr = queue_type::pop_ready_task(&team_queue.m_ready[i][j]); - } - } - } else { - // returns nullptr if and only if all other queues have a ready - // count of 0 also. Otherwise, returns a task from another queue - // or `end` if one couldn't be popped - task_ptr = team_queue.attempt_to_steal_task(); - } - } - - // Synchronize warp with memory fence before broadcasting task pointer: - - // KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN( "A" ); - __syncwarp(0xffffffff); - - // Broadcast task pointer: - - ((int*)&task_ptr)[0] = - __shfl_sync(0xffffffff, ((int*)&task_ptr)[0], 0, 32); - ((int*)&task_ptr)[1] = - __shfl_sync(0xffffffff, ((int*)&task_ptr)[1], 0, 32); - -#if defined(KOKKOS_ENABLE_DEBUG) - KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN("TaskQueue CUDA task_ptr"); -#endif - - if (0 == task_ptr) break; // 0 == queue->m_ready_count - - if (end != task_ptr) { - // Whole warp copy task's closure to/from shared memory. - // Use all threads of warp for coalesced read/write. - - int32_t const b = sizeof(task_root_type) / sizeof(int32_t); - int32_t const e = - *((int32_t volatile*)(&task_ptr->m_alloc_size)) / sizeof(int32_t); - - int32_t volatile* const task_mem = (int32_t volatile*)task_ptr; - - KOKKOS_ASSERT(e * sizeof(int32_t) < shmem_per_warp); - - // copy task closure from global to shared memory: - - for (int32_t i = warp_lane; i < e; i += CudaTraits::WarpSize) { - warp_shmem[i] = task_mem[i]; - } - - // Synchronize threads of the warp and insure memory - // writes are visible to all threads in the warp. - - // KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN( "B" ); - __syncwarp(0xffffffff); - - if (task_root_type::TaskTeam == task_shmem->m_task_type) { - // Thread Team Task - (*task_shmem->m_apply)(task_shmem, &team_exec); - } else if (0 == threadIdx.y) { - // Single Thread Task - (*task_shmem->m_apply)(task_shmem, &single_exec); - } - - // Synchronize threads of the warp and insure memory - // writes are visible to all threads in the warp. - - // KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN( "C" ); - __syncwarp(0xffffffff); - - // copy task closure from shared to global memory: - - for (int32_t i = b + warp_lane; i < e; i += CudaTraits::WarpSize) { - task_mem[i] = warp_shmem[i]; - } - - // Synchronize threads of the warp and insure memory - // writes are visible to root thread of the warp for - // respawn or completion. - - // KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN( "D" ); - __syncwarp(0xffffffff); - - // If respawn requested copy respawn data back to main memory - - if (0 == warp_lane) { - if (((task_root_type*)task_root_type::LockTag) != - task_shmem->m_next) { - ((volatile task_root_type*)task_ptr)->m_next = task_shmem->m_next; - ((volatile task_root_type*)task_ptr)->m_priority = - task_shmem->m_priority; - } - - team_queue.complete(task_ptr); - } - } - } while (1); - } - - // FIXME_CUDA_MULTIPLE_DEVICES - static void execute(scheduler_type const& scheduler) { - const int shared_per_warp = 2048; - const int warps_per_block = 4; - const Kokkos::Cuda exec = Cuda(); // FIXME_CUDA_MULTIPLE_DEVICES - const auto& impl_instance = exec.impl_internal_space_instance(); - const int multi_processor_count = - // FIXME not sure why this didn't work - // exec.cuda_device_prop().multiProcessorCount; - impl_instance->m_deviceProp.multiProcessorCount; - const dim3 grid(multi_processor_count, 1, 1); - // const dim3 grid( 1 , 1 , 1 ); - const dim3 block(1, Kokkos::Impl::CudaTraits::WarpSize, warps_per_block); - const int shared_total = shared_per_warp * warps_per_block; - const cudaStream_t stream = 0; - - auto& queue = scheduler.queue(); - queue.initialize_team_queues(warps_per_block * grid.x); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecializationConstrained::execute: Pre Execute Task"); - - // Query the stack size, in bytes: - - size_t previous_stack_size = 0; - KOKKOS_IMPL_CUDA_SAFE_CALL(impl_instance->cuda_device_get_limit_wrapper( - &previous_stack_size, cudaLimitStackSize)); - - // If not large enough then set the stack size, in bytes: - - const size_t larger_stack_size = 2048; - - if (previous_stack_size < larger_stack_size) { - KOKKOS_IMPL_CUDA_SAFE_CALL(impl_instance->cuda_device_set_limit_wrapper( - cudaLimitStackSize, larger_stack_size)); - } - - cuda_task_queue_execute<<>>( - scheduler, shared_per_warp); - - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetLastError()); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecializationConstrained::execute: Post Execute Task"); - - if (previous_stack_size < larger_stack_size) { - KOKKOS_IMPL_CUDA_SAFE_CALL(impl_instance->cuda_device_set_limit_wrapper( - cudaLimitStackSize, previous_stack_size)); - } - } - - template - static void get_function_pointer(typename TaskType::function_type& ptr, - typename TaskType::destroy_type& dtor) { - using function_type = typename TaskType::function_type; - using destroy_type = typename TaskType::destroy_type; - - void* storage = cuda_internal_scratch_unified( - Kokkos::Cuda(), sizeof(function_type) + sizeof(destroy_type)); - function_type* ptr_ptr = (function_type*)storage; - destroy_type* dtor_ptr = - (destroy_type*)((char*)storage + sizeof(function_type)); - - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecializationConstrained::get_function_pointer: Pre Get Function Pointer"); - - set_cuda_task_base_apply_function_pointer - <<<1, 1>>>(ptr_ptr, dtor_ptr); - - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetLastError()); - Impl::cuda_device_synchronize( - "Kokkos::Impl::TaskQueueSpecializationConstrained::get_function_pointer: Post Get Function Pointer"); - - ptr = *ptr_ptr; - dtor = *dtor_ptr; - } -}; - -extern template class TaskQueue< - Kokkos::Cuda, - default_tasking_memory_space_for_execution_space_t>; - -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -/**\brief Impl::TaskExec is the TaskScheduler::member_type - * passed to tasks running in a Cuda space. - * - * Cuda thread blocks for tasking are dimensioned: - * blockDim.x == vector length - * blockDim.y == team size - * blockDim.z == number of teams - * where - * blockDim.x * blockDim.y == WarpSize - * - * Current implementation requires blockDim.x == 1. - * Vector level parallelism with blockDim.y > 1 on Volta will - * require a vector-level synchronization mask for vector-level - * collective operaitons. - * - * Both single thread and thread team tasks are run by a full Cuda warp. - * A single thread task is called by warp lane #0 and the remaining - * lanes of the warp are idle. - * - * When executing a single thread task the syncwarp or other - * warp synchronizing functions must not be called. - */ -template -class TaskExec { - private: - enum : int { WarpSize = Kokkos::Impl::CudaTraits::WarpSize }; - - TaskExec(TaskExec&&) = delete; - TaskExec(TaskExec const&) = delete; - TaskExec& operator=(TaskExec&&) = delete; - TaskExec& operator=(TaskExec const&) = delete; - - friend class Kokkos::Impl::TaskQueue< - Kokkos::Cuda, - default_tasking_memory_space_for_execution_space_t>; - template - friend class Kokkos::Impl::TaskQueueSpecializationConstrained; - template - friend struct Kokkos::Impl::TaskQueueSpecialization; - - int32_t* m_team_shmem; - const int m_team_size; - Scheduler m_scheduler; - - // If constructed with arg_team_size == 1 the object - // can only be used by 0 == threadIdx.y. - KOKKOS_INLINE_FUNCTION - TaskExec(Scheduler const& parent_scheduler, int32_t* arg_team_shmem, - int arg_team_size = blockDim.y) - : m_team_shmem(arg_team_shmem), - m_team_size(arg_team_size), - m_scheduler(parent_scheduler.get_team_scheduler(league_rank())) {} - - public: - using thread_team_member = TaskExec; - -#if defined(__CUDA_ARCH__) - __device__ int team_rank() const { return threadIdx.y; } - __device__ int team_size() const { return m_team_size; } - //__device__ int league_rank() const { return threadIdx.z; } - __device__ int league_rank() const { - return blockIdx.x * blockDim.z + threadIdx.z; - } - __device__ int league_size() const { return blockDim.z * gridDim.x; } - - __device__ void team_barrier() const { - if (1 < m_team_size) { - __syncwarp(0xffffffff); - } - } - - template - __device__ void team_broadcast(ValueType& val, const int thread_id) const { - if (1 < m_team_size) { - // WarpSize = blockDim.X * blockDim.y - // thread_id < blockDim.y - ValueType tmp(val); // input might not be register variable - Impl::in_place_shfl(val, tmp, blockDim.x * thread_id, WarpSize); - } - } - -#else - __host__ int team_rank() const { return 0; } - __host__ int team_size() const { return 0; } - __host__ int league_rank() const { return 0; } - __host__ int league_size() const { return 0; } - __host__ void team_barrier() const {} - template - __host__ void team_broadcast(ValueType&, const int) const {} -#endif - - KOKKOS_INLINE_FUNCTION Scheduler const& scheduler() const noexcept { - return m_scheduler; - } - KOKKOS_INLINE_FUNCTION Scheduler& scheduler() noexcept { return m_scheduler; } -}; - -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -template -struct TeamThreadRangeBoundariesStruct> { - using index_type = iType; - using member_type = TaskExec; - - const iType start; - const iType end; - const iType increment; - member_type const& member; - -#if defined(__CUDA_ARCH__) - - __device__ inline TeamThreadRangeBoundariesStruct( - member_type const& arg_thread, const iType& arg_count) - : start(threadIdx.y), - end(arg_count), - increment(blockDim.y), - member(arg_thread) {} - - __device__ inline TeamThreadRangeBoundariesStruct( - member_type const& arg_thread, const iType& arg_start, - const iType& arg_end) - : start(arg_start + threadIdx.y), - end(arg_end), - increment(blockDim.y), - member(arg_thread) {} - -#else - - TeamThreadRangeBoundariesStruct(member_type const& arg_thread, - const iType& arg_count); - - TeamThreadRangeBoundariesStruct(member_type const& arg_thread, - const iType& arg_start, const iType& arg_end); - -#endif -}; - -//---------------------------------------------------------------------------- - -template -struct ThreadVectorRangeBoundariesStruct> { - using index_type = iType; - using member_type = TaskExec; - - const index_type start; - const index_type end; - const index_type increment; - const member_type& member; - -#if defined(__CUDA_ARCH__) - - __device__ inline ThreadVectorRangeBoundariesStruct( - member_type const& arg_thread, const index_type& arg_count) - : start(threadIdx.x), - end(arg_count), - increment(blockDim.x), - member(arg_thread) {} - - __device__ inline ThreadVectorRangeBoundariesStruct( - member_type const& arg_thread, const index_type& arg_begin, - const index_type& arg_end) - : start(arg_begin + threadIdx.x), - end(arg_end), - increment(blockDim.x), - member(arg_thread) {} - -#else - - ThreadVectorRangeBoundariesStruct(member_type const& arg_thread, - const index_type& arg_count); - - ThreadVectorRangeBoundariesStruct(member_type const& arg_thread, - const index_type& arg_begin, - const index_type& arg_end); - -#endif -}; - -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- - -namespace Kokkos { - -// template -// KOKKOS_INLINE_FUNCTION -// Impl::TeamThreadRangeBoundariesStruct< iType, Impl::TaskExec< Kokkos::Cuda > -// > TeamThreadRange( const Impl::TaskExec< Kokkos::Cuda > & thread, const iType -// & count ) -//{ -// return Impl::TeamThreadRangeBoundariesStruct< iType, Impl::TaskExec< -// Kokkos::Cuda > >( thread, count ); -//} -// -// template -// KOKKOS_INLINE_FUNCTION -// Impl::TeamThreadRangeBoundariesStruct -// < std::common_type_t -// , Impl::TaskExec< Kokkos::Cuda > > -// TeamThreadRange( const Impl::TaskExec< Kokkos::Cuda > & thread -// , const iType1 & begin, const iType2 & end ) -//{ -// using iType = std::common_type_t< iType1, iType2 >; -// return Impl::TeamThreadRangeBoundariesStruct< iType, Impl::TaskExec< -// Kokkos::Cuda > >( -// thread, iType(begin), iType(end) ); -//} -// -// template -// KOKKOS_INLINE_FUNCTION -// Impl::ThreadVectorRangeBoundariesStruct -// > ThreadVectorRange( const Impl::TaskExec< Kokkos::Cuda > & thread -// , const iType & count ) -//{ -// return Impl::ThreadVectorRangeBoundariesStruct >(thread,count); -//} -// -// template -// KOKKOS_INLINE_FUNCTION -// Impl::ThreadVectorRangeBoundariesStruct -// > ThreadVectorRange( const Impl::TaskExec< Kokkos::Cuda > & thread -// , const iType & arg_begin -// , const iType & arg_end ) -//{ -// return Impl::ThreadVectorRangeBoundariesStruct >(thread,arg_begin,arg_end); -//} - -// KOKKOS_INLINE_FUNCTION -// Impl::ThreadSingleStruct > -// PerTeam(const Impl::TaskExec< Kokkos::Cuda >& thread) -// { -// return Impl::ThreadSingleStruct >(thread); -// } - -// KOKKOS_INLINE_FUNCTION -// Impl::VectorSingleStruct > -// PerThread(const Impl::TaskExec< Kokkos::Cuda >& thread) -// { -// return Impl::VectorSingleStruct >(thread); -// } - -/** \brief Inter-thread parallel_for. Executes lambda(iType i) for each - * i=0..N-1. - * - * The range i=0..N-1 is mapped to all threads of the the calling thread team. - */ -template -KOKKOS_INLINE_FUNCTION void parallel_for( - const Impl::TeamThreadRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Lambda& lambda) { - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - lambda(i); - } -} - -template -KOKKOS_INLINE_FUNCTION void parallel_for( - const Impl::ThreadVectorRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Lambda& lambda) { - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - lambda(i); - } -} - -// reduce across corresponding lanes between team members within warp -// assume stride*team_size == warp_size -template -KOKKOS_INLINE_FUNCTION void strided_shfl_warp_reduction(const JoinType& join, - ValueType& val, - int team_size, - int stride) { - for (int lane_delta = (team_size * stride) >> 1; lane_delta >= stride; - lane_delta >>= 1) { - join(val, Kokkos::shfl_down(val, lane_delta, team_size * stride)); - } -} - -// multiple within-warp non-strided reductions -template -KOKKOS_INLINE_FUNCTION void multi_shfl_warp_reduction(const JoinType& join, - ValueType& val, - int vec_length) { - for (int lane_delta = vec_length >> 1; lane_delta; lane_delta >>= 1) { - join(val, Kokkos::shfl_down(val, lane_delta, vec_length)); - } -} - -// broadcast within warp -template -KOKKOS_INLINE_FUNCTION ValueType shfl_warp_broadcast(ValueType& val, - int src_lane, int width) { - if (1 < width) { - return Kokkos::shfl(val, src_lane, width); - } else { - return val; - } -} - -/*// all-reduce across corresponding vector lanes between team members within -warp -// assume vec_length*team_size == warp_size -// blockDim.x == vec_length == stride -// blockDim.y == team_size -// threadIdx.x == position in vec -// threadIdx.y == member number -template< typename iType, class Lambda, typename ValueType, class JoinType > -KOKKOS_INLINE_FUNCTION -void parallel_reduce - (const Impl::TeamThreadRangeBoundariesStruct >& loop_boundaries, const Lambda & lambda, const JoinType& join, - ValueType& initialized_result) { - - ValueType result = initialized_result; - for( iType i = loop_boundaries.start; i < loop_boundaries.end; -i+=loop_boundaries.increment) { lambda(i,result); - } - initialized_result = result; - - strided_shfl_warp_reduction( - join, - initialized_result, - loop_boundaries.member.team_size(), - blockDim.x); - initialized_result = shfl_warp_broadcast( initialized_result, -threadIdx.x, Impl::CudaTraits::WarpSize ); -}*/ - -// all-reduce across corresponding vector lanes between team members within warp -// if no join() provided, use sum -// assume vec_length*team_size == warp_size -// blockDim.x == vec_length == stride -// blockDim.y == team_size -// threadIdx.x == position in vec -// threadIdx.y == member number -template -KOKKOS_INLINE_FUNCTION void parallel_reduce( - const Impl::TeamThreadRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Lambda& lambda, ValueType& initialized_result) { - // TODO @internal_documentation what is the point of creating this temporary? - ValueType result = initialized_result; - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - lambda(i, result); - } - initialized_result = result; - - if (1 < loop_boundaries.member.team_size()) { - strided_shfl_warp_reduction( - [&](ValueType& val1, const ValueType& val2) { val1 += val2; }, - initialized_result, loop_boundaries.member.team_size(), blockDim.x); - - initialized_result = shfl_warp_broadcast( - initialized_result, threadIdx.x, Impl::CudaTraits::WarpSize); - } -} - -template -KOKKOS_INLINE_FUNCTION void parallel_reduce( - const Impl::TeamThreadRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Lambda& lambda, const ReducerType& reducer) { - using ValueType = typename ReducerType::value_type; - // TODO @internal_documentation what is the point of creating this temporary? - ValueType result = ValueType(); - reducer.init(result); - - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - lambda(i, result); - } - - if (1 < loop_boundaries.member.team_size()) { - strided_shfl_warp_reduction( - [&](ValueType& val1, const ValueType& val2) { - reducer.join(val1, val2); - }, - result, loop_boundaries.member.team_size(), blockDim.x); - - reducer.reference() = shfl_warp_broadcast( - result, threadIdx.x, Impl::CudaTraits::WarpSize); - } else { - reducer.reference() = result; - } -} -// all-reduce within team members within warp -// assume vec_length*team_size == warp_size -// blockDim.x == vec_length == stride -// blockDim.y == team_size -// threadIdx.x == position in vec -// threadIdx.y == member number -/*template< typename iType, class Lambda, typename ValueType, class JoinType > -KOKKOS_INLINE_FUNCTION -void parallel_reduce - (const Impl::ThreadVectorRangeBoundariesStruct >& loop_boundaries, const Lambda & lambda, const JoinType& join, - ValueType& initialized_result) { - - ValueType result = initialized_result; - for( iType i = loop_boundaries.start; i < loop_boundaries.end; -i+=loop_boundaries.increment) { lambda(i,result); - } - initialized_result = result; - - multi_shfl_warp_reduction(join, initialized_result, -blockDim.x); initialized_result = shfl_warp_broadcast( -initialized_result, 0, blockDim.x ); -}*/ - -// all-reduce within team members within warp -// if no join() provided, use sum -// assume vec_length*team_size == warp_size -// blockDim.x == vec_length == stride -// blockDim.y == team_size -// threadIdx.x == position in vec -// threadIdx.y == member number -template -KOKKOS_INLINE_FUNCTION void parallel_reduce( - const Impl::ThreadVectorRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Lambda& lambda, ValueType& initialized_result) { - ValueType result = initialized_result; - - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - lambda(i, result); - } - - initialized_result = result; - - if (1 < loop_boundaries.member.team_size()) { - // initialized_result = multi_shfl_warp_reduction( - multi_shfl_warp_reduction( - [&](ValueType& val1, const ValueType& val2) { val1 += val2; }, - initialized_result, blockDim.x); - - initialized_result = - shfl_warp_broadcast(initialized_result, 0, blockDim.x); - } -} - -template -KOKKOS_INLINE_FUNCTION void parallel_reduce( - const Impl::ThreadVectorRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Lambda& lambda, const ReducerType& reducer) { - using ValueType = typename ReducerType::value_type; - - ValueType result = ValueType(); - reducer.init(result); - - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - lambda(i, result); - } - - if (1 < loop_boundaries.member.team_size()) { - multi_shfl_warp_reduction( - [&](ValueType& val1, const ValueType& val2) { - reducer.join(val1, val2); - }, - result, blockDim.x); - - reducer.reference() = shfl_warp_broadcast(result, 0, blockDim.x); - } else { - reducer.reference() = result; - } -} -// scan across corresponding vector lanes between team members within warp -// assume vec_length*team_size == warp_size -// blockDim.x == vec_length == stride -// blockDim.y == team_size -// threadIdx.x == position in vec -// threadIdx.y == member number -template -KOKKOS_INLINE_FUNCTION void parallel_scan( - const Impl::TeamThreadRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Closure& closure) { - // Extract value_type from closure - - using value_type = typename Kokkos::Impl::FunctorAnalysis< - Kokkos::Impl::FunctorPatternInterface::SCAN, void, Closure, - void>::value_type; - - if (1 < loop_boundaries.member.team_size()) { - // make sure all threads perform all loop iterations - const iType bound = loop_boundaries.end + loop_boundaries.start; - const int lane = threadIdx.y * blockDim.x; - - value_type accum = 0; - value_type val, y, local_total; - - for (iType i = loop_boundaries.start; i < bound; - i += loop_boundaries.increment) { - val = 0; - if (i < loop_boundaries.end) closure(i, val, false); - - // intra-blockDim.y exclusive scan on 'val' - // accum = accumulated, sum in total for this iteration - - // INCLUSIVE scan - for (int offset = blockDim.x; - offset < static_cast(Impl::CudaTraits::WarpSize); - offset <<= 1) { - y = Kokkos::shfl_up(val, offset, Impl::CudaTraits::WarpSize); - if (lane >= offset) { - val += y; - } - } - - // pass accum to all threads - local_total = shfl_warp_broadcast( - val, threadIdx.x + Impl::CudaTraits::WarpSize - blockDim.x, - Impl::CudaTraits::WarpSize); - - // make EXCLUSIVE scan by shifting values over one - val = Kokkos::shfl_up(val, blockDim.x, Impl::CudaTraits::WarpSize); - if (threadIdx.y == 0) { - val = 0; - } - - val += accum; - if (i < loop_boundaries.end) closure(i, val, true); - accum += local_total; - } - } else { - value_type accum = 0; - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - closure(i, accum, true); - } - } -} - -// scan within team member (vector) within warp -// assume vec_length*team_size == warp_size -// blockDim.x == vec_length == stride -// blockDim.y == team_size -// threadIdx.x == position in vec -// threadIdx.y == member number -template -KOKKOS_INLINE_FUNCTION void parallel_scan( - const Impl::ThreadVectorRangeBoundariesStruct< - iType, Impl::TaskExec>& loop_boundaries, - const Closure& closure) { - // Extract value_type from closure - - using value_type = typename Kokkos::Impl::FunctorAnalysis< - Kokkos::Impl::FunctorPatternInterface::SCAN, void, Closure, - void>::value_type; - - if (1 < loop_boundaries.member.team_size()) { - // make sure all threads perform all loop iterations - const iType bound = loop_boundaries.end + loop_boundaries.start; - - value_type accum = 0; - value_type val, y, local_total; - - for (iType i = loop_boundaries.start; i < bound; - i += loop_boundaries.increment) { - val = 0; - if (i < loop_boundaries.end) closure(i, val, false); - - // intra-blockDim.x exclusive scan on 'val' - // accum = accumulated, sum in total for this iteration - - // INCLUSIVE scan - for (int offset = 1; offset < static_cast(blockDim.x); - offset <<= 1) { - y = Kokkos::shfl_up(val, offset, blockDim.x); - if (static_cast(threadIdx.x) >= offset) { - val += y; - } - } - - // pass accum to all threads - local_total = - shfl_warp_broadcast(val, blockDim.x - 1, blockDim.x); - - // make EXCLUSIVE scan by shifting values over one - val = Kokkos::shfl_up(val, 1, blockDim.x); - if (threadIdx.x == 0) { - val = 0; - } - - val += accum; - if (i < loop_boundaries.end) closure(i, val, true); - accum += local_total; - } - } else { - value_type accum = 0; - for (iType i = loop_boundaries.start; i < loop_boundaries.end; - i += loop_boundaries.increment) { - closure(i, accum, true); - } - } -} - -} /* namespace Kokkos */ - -namespace Kokkos { - -template -KOKKOS_INLINE_FUNCTION void single( - const Impl::VectorSingleStruct>&, - const FunctorType& lambda) { -#ifdef __CUDA_ARCH__ - if (threadIdx.x == 0) lambda(); -#else - (void)lambda; -#endif -} - -template -KOKKOS_INLINE_FUNCTION void single( - const Impl::ThreadSingleStruct>&, - const FunctorType& lambda) { -#ifdef __CUDA_ARCH__ - if (threadIdx.x == 0 && threadIdx.y == 0) lambda(); -#else - (void)lambda; -#endif -} - -template -KOKKOS_INLINE_FUNCTION void single( - const Impl::VectorSingleStruct>& s, - const FunctorType& lambda, ValueType& val) { -#ifdef __CUDA_ARCH__ - if (threadIdx.x == 0) lambda(val); - if (1 < s.team_member.team_size()) { - val = shfl(val, 0, blockDim.x); - } -#else - (void)s; - (void)val; - (void)lambda; -#endif -} - -template -KOKKOS_INLINE_FUNCTION void single( - const Impl::ThreadSingleStruct>& - single_struct, - const FunctorType& lambda, ValueType& val) { -#ifdef __CUDA_ARCH__ - if (threadIdx.x == 0 && threadIdx.y == 0) { - lambda(val); - } - single_struct.team_member.team_broadcast(val, 0); -#else - (void)single_struct; - (void)val; - (void)lambda; -#endif -} - -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#undef KOKKOS_IMPL_CUDA_SYNCWARP_OR_RETURN - -// NOLINTEND - -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() - -#endif /* #if defined( KOKKOS_ENABLE_TASKDAG ) */ -#endif /* #ifndef KOKKOS_IMPL_CUDA_TASK_HPP */ diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp index eb893ee4d2b6..217a013d4533 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_TEAM_HPP #define KOKKOS_CUDA_TEAM_HPP @@ -51,7 +38,7 @@ struct CudaJoinFunctor { } }; -/**\brief Team member_type passed to TeamPolicy or TeamTask closures. +/**\brief Team member_type passed to the TeamPolicy closure. * * Cuda thread blocks for team closures are dimensioned as: * blockDim.x == number of "vector lanes" per "thread" @@ -801,7 +788,7 @@ parallel_reduce(Impl::ThreadVectorRangeBoundariesStruct< * less than N) and a scan operation is performed. The last call to closure has * final == true. */ -// This is the same code as in HIP and largely the same as in OpenMPTarget +// This is the same code as in HIP. template KOKKOS_INLINE_FUNCTION void parallel_scan( const Impl::TeamThreadRangeBoundariesStruct& diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp index 40c7de1e20d5..6c3185c40ae3 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_UNIQUE_TOKEN_HPP #define KOKKOS_CUDA_UNIQUE_TOKEN_HPP @@ -59,18 +46,6 @@ class UniqueToken { } public: - KOKKOS_DEFAULTED_FUNCTION - UniqueToken(const UniqueToken&) = default; - - KOKKOS_DEFAULTED_FUNCTION - UniqueToken(UniqueToken&&) = default; - - KOKKOS_DEFAULTED_FUNCTION - UniqueToken& operator=(const UniqueToken&) = default; - - KOKKOS_DEFAULTED_FUNCTION - UniqueToken& operator=(UniqueToken&&) = default; - /// \brief upper bound for acquired values, i.e. 0 <= value < size() KOKKOS_INLINE_FUNCTION size_type size() const noexcept { return m_locks.extent(0); } @@ -80,8 +55,7 @@ class UniqueToken { int idx = blockIdx.x * (blockDim.x * blockDim.y) + threadIdx.y * blockDim.x + threadIdx.x; idx = idx % size(); -#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_PASCAL) || \ - defined(KOKKOS_ARCH_MAXWELL) +#if defined(KOKKOS_ARCH_MAXWELL) || defined(KOKKOS_ARCH_PASCAL) unsigned int mask = __activemask(); unsigned int active = __ballot_sync(mask, 1); unsigned int done_active = 0; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp index 9e0c5819f712..49a8fbf9539f 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_VECTORIZATION_HPP #define KOKKOS_CUDA_VECTORIZATION_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp index 2141774503b9..df41ad6be526 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_EXPERIMENTAL_CUDA_VIEW_HPP #define KOKKOS_EXPERIMENTAL_CUDA_VIEW_HPP @@ -32,14 +19,10 @@ struct CudaLDGFetch { template KOKKOS_FUNCTION ValueType operator[](const iType& i) const { -#if defined(KOKKOS_ARCH_KEPLER30) || defined(KOKKOS_ARCH_KEPLER32) - return m_ptr[i]; -#else KOKKOS_IF_ON_DEVICE( (AliasType v = __ldg(reinterpret_cast(&m_ptr[i])); return *(reinterpret_cast(&v));)) KOKKOS_IF_ON_HOST((return m_ptr[i];)) -#endif } KOKKOS_FUNCTION diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp index 74a1395e9094..296f0e697d8b 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_WORKGRAPHPOLICY_HPP #define KOKKOS_CUDA_WORKGRAPHPOLICY_HPP @@ -67,8 +54,7 @@ class ParallelFor, } // On pre-volta architectures we need a __syncwarp here to prevent // infinite loops depending on the scheduling order above -#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ - defined(KOKKOS_ARCH_PASCAL) +#if defined(KOKKOS_ARCH_MAXWELL) || defined(KOKKOS_ARCH_PASCAL) __syncwarp(__activemask()); #endif } @@ -84,7 +70,8 @@ class ParallelFor, const int shared = 0; Kokkos::Impl::CudaParallelLaunch( - *this, grid, block, shared, Cuda().impl_internal_space_instance()); + *this, grid, block, shared, + m_policy.space().impl_internal_space_instance()); } inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ZeroMemset.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ZeroMemset.hpp index 0ac2d4052d2a..e22c8c199d04 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ZeroMemset.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ZeroMemset.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_ZEROMEMSET_HPP #define KOKKOS_CUDA_ZEROMEMSET_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp index 79faad01bf5d..1f4332520b97 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CUDA_ABORT_HPP #define KOKKOS_CUDA_ABORT_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp index b755e38316b9..4aa143fc5e3b 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp @@ -1,28 +1,21 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE #endif +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include #include +#include #include #include @@ -30,19 +23,21 @@ #include -namespace Kokkos { +namespace { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -int HIP::concurrency() { -#else -int HIP::concurrency() const { -#endif - return Impl::HIPInternal::concurrency(); -} +struct { + void operator()(Kokkos::Impl::HIPInternal* ptr) const { + hipStream_t stream = ptr->m_stream; + delete ptr; + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(stream)); + } +} customDeleterManagesStream; -int HIP::impl_is_initialized() { - return Impl::HIPInternal::singleton().is_initialized(); -} +} // namespace + +namespace Kokkos { + +int HIP::concurrency() const { return Impl::HIPInternal::concurrency(); } void HIP::impl_initialize(InitializationSettings const& settings) { const std::vector& visible_devices = Impl::get_visible_devices(); @@ -106,13 +101,11 @@ Kokkos::HIP::initialize WARNING: Could not determine that xnack is enabled. // Init the array for used for arbitrarily sized atomics desul::Impl::init_lock_arrays(); // FIXME - // Set singleton device id - Impl::HIPInternal::singleton().m_hipDev = hip_device_id; - - // Create the singleton stream and initialize singleton instance. - hipStream_t singleton_stream; - KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&singleton_stream)); - Impl::HIPInternal::singleton().initialize(singleton_stream); + // Create the default instance. + hipStream_t stream; + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream)); + Impl::HIPInternal::default_instance = Impl::HostSharedPtr( + new Impl::HIPInternal(stream), customDeleterManagesStream); } void HIP::impl_finalize() { @@ -130,36 +123,24 @@ void HIP::impl_finalize() { lock.finalize(); } - Impl::HIPInternal::singleton().finalize(); - - KOKKOS_IMPL_HIP_SAFE_CALL( - hipStreamDestroy(Impl::HIPInternal::singleton().m_stream)); + // Destroy the default instance. + Impl::HIPInternal::default_instance = nullptr; } +HIP::~HIP() { Impl::check_execution_space_destructor_precondition(name()); } + HIP::HIP() - : m_space_instance(&Impl::HIPInternal::singleton(), - [](Impl::HIPInternal*) {}) { - Impl::HIPInternal::singleton().verify_is_initialized( - "HIP instance constructor"); -} + : m_space_instance( + (Impl::check_execution_space_constructor_precondition(name()), + Impl::HIPInternal::default_instance)) {} HIP::HIP(hipStream_t const stream, Impl::ManageStream manage_stream) : m_space_instance( - new Impl::HIPInternal, [manage_stream](Impl::HIPInternal* ptr) { - ptr->finalize(); - if (static_cast(manage_stream)) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(ptr->m_stream)); - } - delete ptr; - }) { - Impl::HIPInternal::singleton().verify_is_initialized( - "HIP instance constructor"); - m_space_instance->initialize(stream); -} - -KOKKOS_DEPRECATED HIP::HIP(hipStream_t const stream, bool manage_stream) - : HIP(stream, - manage_stream ? Impl::ManageStream::yes : Impl::ManageStream::no) {} + (Impl::check_execution_space_constructor_precondition(name()), + static_cast(manage_stream) + ? Impl::HostSharedPtr(new Impl::HIPInternal(stream), + customDeleterManagesStream) + : Impl::HostSharedPtr(new Impl::HIPInternal(stream)))) {} void HIP::print_configuration(std::ostream& os, bool /*verbose*/) const { os << "Device Execution Space:\n"; @@ -208,7 +189,7 @@ hipStream_t HIP::hip_stream() const { return m_space_instance->m_stream; } int HIP::hip_device() const { return impl_internal_space_instance()->m_hipDev; } hipDeviceProp_t const& HIP::hip_device_prop() { - return Impl::HIPInternal::singleton().m_deviceProp; + return Impl::HIPInternal::default_instance->m_deviceProp; } const char* HIP::name() { return "HIP"; } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp index 439075fc6cc5..7d1a8eb99e8a 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_HPP #define KOKKOS_HIP_HPP @@ -47,37 +34,25 @@ class HIP { using scratch_memory_space = ScratchMemorySpace; + KOKKOS_DEFAULTED_FUNCTION HIP(const HIP&) = default; + KOKKOS_FUNCTION HIP(HIP&& other) noexcept + : HIP(static_cast(other)) {} + KOKKOS_DEFAULTED_FUNCTION HIP& operator=(const HIP&) = default; + KOKKOS_FUNCTION HIP& operator=(HIP&& other) noexcept { + return *this = static_cast(other); + } + ~HIP(); HIP(); explicit HIP(hipStream_t stream) : HIP(stream, Impl::ManageStream::no) {} -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - template - KOKKOS_DEPRECATED_WITH_COMMENT( - "HIP execution space should be constructed explicitly.") - HIP(hipStream_t stream) - : HIP(stream) {} -#endif - HIP(hipStream_t stream, Impl::ManageStream manage_stream); - KOKKOS_DEPRECATED HIP(hipStream_t stream, bool manage_stream); - //@} //------------------------------------ //! \name Functions that all Kokkos devices must implement. //@{ -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static int in_parallel() { -#if defined(__HIP_DEVICE_COMPILE__) - return true; -#else - return false; -#endif - } -#endif - /** \brief Wait until all dispatched functors complete. * * The parallel_for or parallel_reduce dispatch of a functor may return @@ -105,21 +80,8 @@ class HIP { static void impl_initialize(InitializationSettings const&); - static int impl_is_initialized(); - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED static size_type detect_device_count() { - int count; - KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&count)); - return count; - } -#endif - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - static int concurrency(); -#else int concurrency() const; -#endif + static const char* name(); inline Impl::HIPInternal* impl_internal_space_instance() const { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp index fdf688fdad8f..a3c109b2ba52 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_ABORT_HPP #define KOKKOS_HIP_ABORT_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp index 710fbeab9d93..96e0e831204a 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp @@ -1,24 +1,12 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_BLOCKSIZE_DEDUCTION_HPP #define KOKKOS_HIP_BLOCKSIZE_DEDUCTION_HPP #include #include +#include #if defined(__HIPCC__) @@ -159,6 +147,39 @@ unsigned hip_get_preferred_blocksize(const int hip_device) { return get_preferred_blocksize_impl(hip_device); } +// Heuristic to compute the block size for non-team parallelism +template , + HIPLaunchMechanism LaunchMechanism = + DeduceHIPLaunchMechanism::launch_mechanism> +unsigned get_preferred_blocksize_for_range(HIPInternal const *hip_instance, + size_t requested_parallelism) { + /* General approach, if the user did not make a launch bounds request + - If the requested parallelism is less than the available concurrency, get the + largest block size that would result in at least 1 block per PE, while also: + - at least 256 + - power of 2 + - no more than 1024 + */ + + if constexpr (HIPParallelLaunch::default_launchbounds()) { + if (requested_parallelism && + requested_parallelism < size_t(hip_instance->concurrency())) { + const unsigned eus = hip_instance->m_deviceProp.multiProcessorCount; + const unsigned requestedPerEU = (requested_parallelism + eus - 1) / eus; + // round up to power of 2 + unsigned threadsPerEU = Kokkos::bit_ceil(requestedPerEU); + threadsPerEU = std::max(threadsPerEU, + unsigned(HIPTraits::ConservativeThreadsPerBlock)); + threadsPerEU = + std::min(threadsPerEU, unsigned(HIPTraits::MaxThreadsPerBlock)); + return threadsPerEU; + } + } + const int hip_device = hip_instance->m_hipDev; + return get_preferred_blocksize_impl(hip_device); +} + // Standardized blocksize deduction for parallel constructs with no LDS usage // Returns the max blocksize as dictated by register usage // @@ -176,6 +197,9 @@ unsigned hip_get_max_blocksize() { // The ShmemFunctor takes a single argument of the current blocksize under // consideration, and returns the LDS usage // +// requested_parallelism is a hint about how much parallelism was requested +// in the parallel construct +// // Note: a returned block_size of zero indicates that the algorithm could not // find a valid block size. The caller is responsible for error handling. template diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp index fc44a61ddb8a..8a38c37f0a00 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp index c838c07a1a27..c8ff7696c677 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_DEEP_COPY_HPP #define KOKKOS_HIP_DEEP_COPY_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.cpp new file mode 100644 index 000000000000..ce544bcb2883 --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.cpp @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#endif + +#include + +#include + +namespace Kokkos { +namespace Impl { +void hip_internal_error_throw(hipError_t e, const char *name, const char *file, + const int line) { + std::ostringstream out; + out << name << " error( " << hipGetErrorName(e) + << "): " << hipGetErrorString(e); + if (file) { + out << " " << file << ":" << line; + } + throw_runtime_exception(out.str()); +} + +void hip_internal_error_abort(hipError_t e, const char *name, const char *file, + const int line) { + std::ostringstream out; + out << name << " error( " << hipGetErrorName(e) + << "): " << hipGetErrorString(e); + if (file) { + out << " " << file << ":" << line; + } + host_abort(out.str().c_str()); +} +} // namespace Impl +} // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp index fa45dcfec315..43fcfabc5e79 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_ERROR_HPP #define KOKKOS_HIP_ERROR_HPP @@ -28,11 +15,48 @@ namespace Impl { void hip_internal_error_throw(hipError_t e, const char* name, const char* file = nullptr, const int line = 0); +void hip_internal_error_abort(hipError_t e, const char* name, + const char* file = nullptr, const int line = 0); + inline void hip_internal_safe_call(hipError_t e, const char* name, const char* file = nullptr, const int line = 0) { - if (hipSuccess != e) { - hip_internal_error_throw(e, name, file, line); + // 1. Success -> normal continuation. + // 2. Error codes for which, to continue using HIP, the process must be + // terminated and relaunched -> call abort on the host-side. + // 3. Any other error code -> throw a runtime error. + switch (e) { + case hipSuccess: break; + case hipErrorInvalidValue: + case hipErrorOutOfMemory: + case hipErrorInitializationError: + case hipErrorDeinitialized: + case hipErrorInvalidConfiguration: + case hipErrorInvalidSymbol: + case hipErrorInvalidDevicePointer: + case hipErrorInvalidMemcpyDirection: + case hipErrorInsufficientDriver: + case hipErrorMissingConfiguration: + case hipErrorPriorLaunchFailure: + case hipErrorInvalidDeviceFunction: + case hipErrorNoDevice: + case hipErrorInvalidDevice: + case hipErrorInvalidContext: + case hipErrorNoBinaryForGpu: + case hipErrorInvalidSource: + case hipErrorIllegalState: + case hipErrorNotFound: + case hipErrorIllegalAddress: + case hipErrorLaunchOutOfResources: + case hipErrorLaunchTimeOut: + case hipErrorAssert: + case hipErrorLaunchFailure: + case hipErrorNotSupported: + case hipErrorStreamCaptureUnsupported: + case hipErrorCapturedEvent: + case hipErrorGraphExecUpdateFailure: + case hipErrorUnknown: hip_internal_error_abort(e, name, file, line); break; + default: hip_internal_error_throw(e, name, file, line); } } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNodeKernel.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNodeKernel.hpp index a228af4470c3..7aa1f77bb911 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNodeKernel.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNodeKernel.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_GRAPHNODEKERNEL_HPP #define KOKKOS_HIP_GRAPHNODEKERNEL_HPP @@ -23,7 +10,6 @@ #include #include -#include #include @@ -111,8 +97,7 @@ class GraphNodeKernelImpl hipGraph_t const* get_hip_graph_ptr() const { return m_graph_ptr; } - Kokkos::ObservingRawPtr allocate_driver_memory_buffer( - const HIP& exec) const { + base_t* allocate_driver_memory_buffer(const HIP& exec) const { KOKKOS_EXPECTS(m_driver_storage == nullptr); std::string alloc_label = label + " - GraphNodeKernel global memory functor storage"; @@ -130,9 +115,9 @@ class GraphNodeKernelImpl auto get_driver_storage() const { return m_driver_storage; } private: - Kokkos::ObservingRawPtr m_graph_ptr = nullptr; - Kokkos::ObservingRawPtr m_graph_node_ptr = nullptr; - mutable std::shared_ptr m_driver_storage = nullptr; + hipGraph_t const* m_graph_ptr = nullptr; + hipGraphNode_t* m_graph_node_ptr = nullptr; + mutable std::shared_ptr m_driver_storage = nullptr; std::string label; }; @@ -142,13 +127,13 @@ template ::type> struct get_graph_node_kernel_type - : type_identity< + : std::type_identity< GraphNodeKernelImpl> {}; template struct get_graph_node_kernel_type - : type_identity, diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNode_Impl.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNode_Impl.hpp index 819ee12f396f..d1136f0ee7f6 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNode_Impl.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_GraphNode_Impl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_GRAPHNODE_IMPL_HPP #define KOKKOS_HIP_GRAPHNODE_IMPL_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Graph_Impl.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Graph_Impl.hpp index e1ae48b4c80e..5eab26595bb4 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Graph_Impl.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Graph_Impl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_GRAPH_IMPL_HPP #define KOKKOS_HIP_GRAPH_IMPL_HPP @@ -41,6 +28,8 @@ class GraphImpl { GraphNodeImpl; + using device_handle_t = Kokkos::Impl::DeviceHandle; + // Not movable or copyable; it spends its whole life as a shared_ptr in the // Graph object. GraphImpl() = delete; @@ -51,9 +40,9 @@ class GraphImpl { ~GraphImpl(); - explicit GraphImpl(Kokkos::HIP instance); + explicit GraphImpl(const device_handle_t& device_handle); - GraphImpl(Kokkos::HIP instance, hipGraph_t graph); + GraphImpl(const device_handle_t& device_handle, hipGraph_t graph); void add_node(std::shared_ptr const& arg_node_ptr); @@ -77,7 +66,7 @@ class GraphImpl { void submit(const Kokkos::HIP& exec); - Kokkos::HIP const& get_execution_space() const noexcept; + auto get_device_handle() const noexcept -> device_handle_t const&; auto create_root_node_ptr(); @@ -87,7 +76,7 @@ class GraphImpl { void instantiate() { KOKKOS_EXPECTS(!m_graph_exec); KOKKOS_IMPL_HIP_SAFE_CALL( - m_execution_space.impl_internal_space_instance() + m_device_handle.m_exec.impl_internal_space_instance() ->hip_graph_instantiate_wrapper(&m_graph_exec, m_graph, nullptr, nullptr, 0)); KOKKOS_ENSURES(m_graph_exec); @@ -97,7 +86,7 @@ class GraphImpl { hipGraphExec_t hip_graph_exec() { return m_graph_exec; } private: - Kokkos::HIP m_execution_space; + device_handle_t m_device_handle; hipGraph_t m_graph = nullptr; hipGraphExec_t m_graph_exec = nullptr; @@ -107,29 +96,31 @@ class GraphImpl { }; inline GraphImpl::~GraphImpl() { - m_execution_space.fence("Kokkos::GraphImpl::~GraphImpl: Graph Destruction"); + m_device_handle.m_exec.fence( + "Kokkos::GraphImpl::~GraphImpl: Graph Destruction"); KOKKOS_EXPECTS(m_graph); if (m_graph_exec) { KOKKOS_IMPL_HIP_SAFE_CALL( - m_execution_space.impl_internal_space_instance() + m_device_handle.m_exec.impl_internal_space_instance() ->hip_graph_exec_destroy_wrapper(m_graph_exec)); } if (m_graph_owning) { - KOKKOS_IMPL_HIP_SAFE_CALL(m_execution_space.impl_internal_space_instance() - ->hip_graph_destroy_wrapper(m_graph)); + KOKKOS_IMPL_HIP_SAFE_CALL( + m_device_handle.m_exec.impl_internal_space_instance() + ->hip_graph_destroy_wrapper(m_graph)); } } -inline GraphImpl::GraphImpl(Kokkos::HIP instance) - : m_execution_space(std::move(instance)), m_graph_owning(true) { - KOKKOS_IMPL_HIP_SAFE_CALL(m_execution_space.impl_internal_space_instance() - ->hip_graph_create_wrapper(&m_graph, 0)); +inline GraphImpl::GraphImpl(const device_handle_t& device_handle) + : m_device_handle(device_handle), m_graph_owning(true) { + KOKKOS_IMPL_HIP_SAFE_CALL( + m_device_handle.m_exec.impl_internal_space_instance() + ->hip_graph_create_wrapper(&m_graph, 0)); } -inline GraphImpl::GraphImpl(Kokkos::HIP instance, hipGraph_t graph) - : m_execution_space(std::move(instance)), - m_graph(graph), - m_graph_owning(false) { +inline GraphImpl::GraphImpl(const device_handle_t& device_handle, + hipGraph_t graph) + : m_device_handle(device_handle), m_graph(graph), m_graph_owning(false) { KOKKOS_EXPECTS(graph != nullptr); } @@ -137,12 +128,12 @@ inline void GraphImpl::add_node( std::shared_ptr const& arg_node_ptr) { // All of the predecessors are just added as normal, so all we need to // do here is add an empty node - KOKKOS_IMPL_HIP_SAFE_CALL(m_execution_space.impl_internal_space_instance() - ->hip_graph_add_empty_node_wrapper( - &(arg_node_ptr->node_details_t::node), - m_graph, - /* dependencies = */ nullptr, - /* numDependencies = */ 0)); + KOKKOS_IMPL_HIP_SAFE_CALL( + m_device_handle.m_exec.impl_internal_space_instance() + ->hip_graph_add_empty_node_wrapper( + &(arg_node_ptr->node_details_t::node), m_graph, + /* dependencies = */ nullptr, + /* numDependencies = */ 0)); } template @@ -209,13 +200,11 @@ inline void GraphImpl::add_predecessor( KOKKOS_EXPECTS(node); KOKKOS_IMPL_HIP_SAFE_CALL( - m_execution_space.impl_internal_space_instance() + m_device_handle.m_exec.impl_internal_space_instance() ->hip_graph_add_dependencies_wrapper(m_graph, &pred_node, &node, 1)); } inline void GraphImpl::submit(const Kokkos::HIP& exec) { - desul::ensure_hip_lock_arrays_on_device(); - if (!m_graph_exec) { instantiate(); } @@ -224,21 +213,22 @@ inline void GraphImpl::submit(const Kokkos::HIP& exec) { m_graph_exec)); } -inline Kokkos::HIP const& GraphImpl::get_execution_space() - const noexcept { - return m_execution_space; +inline auto GraphImpl::get_device_handle() const noexcept + -> device_handle_t const& { + return m_device_handle; } inline auto GraphImpl::create_root_node_ptr() { KOKKOS_EXPECTS(m_graph); KOKKOS_EXPECTS(!m_graph_exec); - auto rv = std::make_shared(get_execution_space(), + auto rv = std::make_shared(m_device_handle, _graph_node_is_root_ctor_tag{}); - KOKKOS_IMPL_HIP_SAFE_CALL(m_execution_space.impl_internal_space_instance() - ->hip_graph_add_empty_node_wrapper( - &(rv->node_details_t::node), m_graph, - /* dependencies = */ nullptr, - /* numDependencies = */ 0)); + KOKKOS_IMPL_HIP_SAFE_CALL( + m_device_handle.m_exec.impl_internal_space_instance() + ->hip_graph_add_empty_node_wrapper(&(rv->node_details_t::node), + m_graph, + /* dependencies = */ nullptr, + /* numDependencies = */ 0)); KOKKOS_ENSURES(rv->node_details_t::node); return rv; } @@ -250,7 +240,7 @@ inline auto GraphImpl::create_aggregate_ptr(PredecessorRefs&&...) { // each predecessor ref, so all we need to do here is create the (trivial) // aggregate node. return std::make_shared( - m_execution_space, _graph_node_kernel_ctor_tag{}, aggregate_impl_t{}); + m_device_handle, _graph_node_kernel_ctor_tag{}, aggregate_impl_t{}); } } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp index 26480d354a39..7a578f35eec3 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_HALF_HPP_ #define KOKKOS_HIP_HALF_HPP_ @@ -20,10 +7,8 @@ #ifdef KOKKOS_IMPL_HALF_TYPE_DEFINED #include -#include -namespace Kokkos { -namespace Experimental { +namespace Kokkos::Experimental { /************************** half conversions **********************************/ KOKKOS_INLINE_FUNCTION @@ -193,26 +178,122 @@ KOKKOS_INLINE_FUNCTION std::enable_if_t, T> cast_from_half(half_t val) { return static_cast(cast_from_half(val)); } -} // namespace Experimental - -// use float as the return type for sum and prod since hip_fp16.h -// has no constexpr functions for casting to __half -template <> -struct reduction_identity { - KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() noexcept { - return 0.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() noexcept { - return 1.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() noexcept { - return -65504.0F; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() noexcept { - return 65504.0F; - } -}; - -} // namespace Kokkos + +/************************** bhalf conversions *********************************/ +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(bhalf_t val) { return val; } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(float val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(bool val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(double val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(short val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(unsigned short val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(int val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(unsigned int val) { return bhalf_t::impl_type(val); } + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(long long val) { + // FIXME_HIP + return bhalf_t::impl_type(static_cast(val)); +} + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(unsigned long long val) { + // FIXME_HIP + return bhalf_t::impl_type(static_cast(val)); +} + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(long val) { + return cast_to_bhalf(static_cast(val)); +} + +KOKKOS_INLINE_FUNCTION +bhalf_t cast_to_bhalf(unsigned long val) { + return cast_to_bhalf(static_cast(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION + std::enable_if_t, T> + cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +template +KOKKOS_INLINE_FUNCTION std::enable_if_t, T> +cast_from_bhalf(bhalf_t val) { + return static_cast(bhalf_t::impl_type(val)); +} + +} // namespace Kokkos::Experimental + #endif #endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp index 64c7706f9457..a447efaf6451 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp @@ -1,28 +1,15 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_HALF_IMPL_TYPE_HPP_ #define KOKKOS_HIP_HALF_IMPL_TYPE_HPP_ #include +#include #ifndef KOKKOS_IMPL_HALF_TYPE_DEFINED // Make sure no one else tries to define half_t #define KOKKOS_IMPL_HALF_TYPE_DEFINED -#define KOKKOS_IMPL_HIP_HALF_TYPE_DEFINED namespace Kokkos { namespace Impl { @@ -32,4 +19,17 @@ struct half_impl_t { } // namespace Impl } // namespace Kokkos #endif // KOKKOS_IMPL_HALF_TYPE_DEFINED + +#ifndef KOKKOS_IMPL_BHALF_TYPE_DEFINED +// Make sure no one else tries to define bhalf_t +#define KOKKOS_IMPL_BHALF_TYPE_DEFINED +namespace Kokkos::Impl { +struct bhalf_impl_t { + using type = __hip_bfloat16; +}; + +} // namespace Kokkos::Impl + +#endif // KOKKOS_IMPL_BHALF_TYPE_DEFINED + #endif // KOKKOS_ENABLE_HIP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_MathematicalFunctions.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_MathematicalFunctions.hpp new file mode 100644 index 000000000000..c652c5a640ac --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_MathematicalFunctions.hpp @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project + +#ifndef KOKKOS_HIP_HALF_MATHEMATICAL_FUNCTIONS_HPP_ +#define KOKKOS_HIP_HALF_MATHEMATICAL_FUNCTIONS_HPP_ + +#include + +namespace Kokkos { +namespace Impl { + +// Mathematical functions are only available on the device +#if defined(KOKKOS_HALF_IS_FULL_TYPE_ON_ARCH) && defined(__HIP_DEVICE_COMPILE__) +#define KOKKOS_HIP_HALF_UNARY_FUNCTION(OP, HIP_NAME, HALF_TYPE) \ + KOKKOS_INLINE_FUNCTION HALF_TYPE impl_##OP(HALF_TYPE x) { \ + return HIP_NAME(HALF_TYPE::impl_type(x)); \ + } + +#define KOKKOS_HIP_HALF_BINARY_FUNCTION(OP, HIP_NAME, HALF_TYPE) \ + KOKKOS_INLINE_FUNCTION HALF_TYPE impl_##OP(HALF_TYPE x, HALF_TYPE y) { \ + return HIP_NAME(HALF_TYPE::impl_type(x), HALF_TYPE::impl_type(y)); \ + } + +#define KOKKOS_HIP_HALF_UNARY_PREDICATE(OP, HIP_NAME, HALF_TYPE) \ + KOKKOS_INLINE_FUNCTION bool impl_##OP(HALF_TYPE x) { \ + return HIP_NAME(HALF_TYPE::impl_type(x)); \ + } + +#define KOKKOS_HIP_HALF_UNARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_UNARY_FUNCTION(OP, HIP_NAME, Kokkos::Experimental::half_t) +#define KOKKOS_HIP_HALF_BINARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_BINARY_FUNCTION(OP, HIP_NAME, Kokkos::Experimental::half_t) +#define KOKKOS_HIP_HALF_UNARY_PREDICATE_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_UNARY_PREDICATE(OP, HIP_NAME, Kokkos::Experimental::half_t) + +KOKKOS_INLINE_FUNCTION Kokkos::Experimental::half_t impl_test_fallback_half( + Kokkos::Experimental::half_t) { + return Kokkos::Experimental::half_t(0.f); +} + +#define KOKKOS_HIP_BHALF_UNARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_UNARY_FUNCTION(OP, HIP_NAME, Kokkos::Experimental::bhalf_t) +#define KOKKOS_HIP_BHALF_BINARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_BINARY_FUNCTION(OP, HIP_NAME, Kokkos::Experimental::bhalf_t) +#define KOKKOS_HIP_BHALF_UNARY_PREDICATE_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_UNARY_PREDICATE(OP, HIP_NAME, Kokkos::Experimental::bhalf_t) + +KOKKOS_INLINE_FUNCTION Kokkos::Experimental::bhalf_t impl_test_fallback_bhalf( + Kokkos::Experimental::bhalf_t) { + return Kokkos::Experimental::bhalf_t(0.f); +} + +#define KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_UNARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_BHALF_UNARY_FUNCTION_IMPL(OP, HIP_NAME) + +#define KOKKOS_HIP_HALF_AND_BHALF_BINARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_BINARY_FUNCTION_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_BHALF_BINARY_FUNCTION_IMPL(OP, HIP_NAME) + +#define KOKKOS_HIP_HALF_AND_BHALF_UNARY_PREDICATE_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_HALF_UNARY_PREDICATE_IMPL(OP, HIP_NAME) \ + KOKKOS_HIP_BHALF_UNARY_PREDICATE_IMPL(OP, HIP_NAME) + +// Basic operations +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(abs, __habs) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(fabs, __habs) +// fmod +// remainder +// remquo +KOKKOS_HIP_HALF_AND_BHALF_BINARY_FUNCTION_IMPL(fmax, __hmax) +KOKKOS_HIP_HALF_AND_BHALF_BINARY_FUNCTION_IMPL(fmin, __hmin) +// fdim +// Exponential functions +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(exp, hexp) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(exp2, hexp2) +// expm1 +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(log, hlog) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(log10, hlog10) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(log2, hlog2) +// log1p +// Power functions +// pow +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(sqrt, hsqrt) +// cbrt +// hypot +// Trigonometric functions +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(sin, hsin) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(cos, hcos) +// tan +// asin +// acos +// atan +// atan2 +// Hyperbolic functions +// sinh +// cosh +// tanh +// asinh +// acosh +// atanh +// Error and gamma functions +// erf +// erfc +// tgamma +// lgamma +// Nearest integer floating point functions +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(ceil, hceil) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(floor, hfloor) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(trunc, htrunc) +// round +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(rint, hrint) +// NOTE HIP does not provide these functions, but we can exclude domain errors, +// as the range of int is enough for any value half_t can take. +// Thus we just cast to the required return type +// We are still missing the bhalf_t versions +KOKKOS_INLINE_FUNCTION long impl_lrint(Kokkos::Experimental::half_t x) { + return static_cast(impl_rint(x)); +} +KOKKOS_INLINE_FUNCTION long long impl_llrint(Kokkos::Experimental::half_t x) { + return static_cast(impl_rint(x)); +} +// logb +// nextafter +// copysign +// isfinite +KOKKOS_HIP_HALF_AND_BHALF_UNARY_PREDICATE_IMPL(isinf, __hisinf) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_PREDICATE_IMPL(isnan, __hisnan) +// signbit +// Non-standard functions +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(rsqrt, hrsqrt) +KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL(rcp, hrcp) + +#undef KOKKOS_HIP_HALF_AND_BHALF_UNARY_FUNCTION_IMPL +#undef KOKKOS_HIP_HALF_AND_BHALF_BINARY_FUNCTION_IMPL +#undef KOKKOS_HIP_HALF_AND_BHALF_UNARY_PREDICATE_IMPL + +#undef KOKKOS_HIP_BHALF_UNARY_FUNCTION_IMPL +#undef KOKKOS_HIP_BHALF_BINARY_FUNCTION_IMPL +#undef KOKKOS_HIP_BHALF_UNARY_PREDICATE_IMPL + +#undef KOKKOS_HIP_HALF_UNARY_FUNCTION_IMPL +#undef KOKKOS_HIP_HALF_BINARY_FUNCTION_IMPL +#undef KOKKOS_HIP_HALF_UNARY_PREDICATE_IMPL + +#undef KOKKOS_HIP_HALF_UNARY_FUNCTION +#undef KOKKOS_HIP_HALF_BINARY_FUNCTION +#undef KOKKOS_HIP_HALF_UNARY_PREDICATE + +#endif // defined(KOKKOS_HALF_IS_FULL_TYPE_ON_ARCH) && + // defined(__HIP_DEVICE_COMPILE__) + +} // namespace Impl +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp index 9f39d3fd4662..aefd9a0362fe 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*--------------------------------------------------------------------------*/ /* Kokkos interfaces */ @@ -21,7 +8,12 @@ #define KOKKOS_IMPL_PUBLIC_INCLUDE #endif +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include @@ -29,7 +21,6 @@ #include #include #include -#include /*--------------------------------------------------------------------------*/ /* Standard 'C' libraries */ @@ -37,7 +28,6 @@ /* Standard 'C++' libraries */ #include -#include #include #include @@ -87,7 +77,7 @@ int HIPInternal::concurrency() { void HIPInternal::print_configuration(std::ostream &s) const { s << "macro KOKKOS_ENABLE_HIP : defined" << '\n'; #if defined(HIP_VERSION) - s << "macro HIP_VERSION = " << HIP_VERSION << " = version " + s << "macro HIP_VERSION : " << HIP_VERSION << " = version " << HIP_VERSION_MAJOR << '.' << HIP_VERSION_MINOR << '.' << HIP_VERSION_PATCH << '\n'; #endif @@ -113,7 +103,10 @@ void HIPInternal::print_configuration(std::ostream &s) const { s << "Kokkos::HIP[ " << i << " ] " << "gcnArch " << hipProp.gcnArchName; - if (m_hipDev == i) s << " : Selected"; + if (m_hipDev == i) + s << " : Selected"; + else + s << " : Not Selected"; s << '\n' << " Total Global Memory: " << ::Kokkos::Impl::human_memory_size(hipProp.totalGlobalMem) << '\n' @@ -134,21 +127,6 @@ void HIPInternal::print_configuration(std::ostream &s) const { //---------------------------------------------------------------------------- -HIPInternal::~HIPInternal() { - if (m_scratchSpace || m_scratchFlags) { - std::cerr << "Kokkos::HIP ERROR: Failed to call " - "Kokkos::HIP::finalize()" - << std::endl; - std::cerr.flush(); - } - - m_scratchSpaceCount = 0; - m_scratchFlagsCount = 0; - m_scratchSpace = nullptr; - m_scratchFlags = nullptr; - m_stream = nullptr; -} - int HIPInternal::verify_is_initialized(const char *const label) const { if (m_hipDev < 0) { Kokkos::abort((std::string("Kokkos::HIP::") + label + @@ -161,13 +139,6 @@ int HIPInternal::verify_is_initialized(const char *const label) const { uint32_t HIPInternal::impl_get_instance_id() const noexcept { return m_instance_id; } -HIPInternal &HIPInternal::singleton() { - static HIPInternal *self = nullptr; - if (!self) { - self = new HIPInternal(); - } - return *self; -} void HIPInternal::fence() const { fence("Kokkos::HIPInternal::fence: Unnamed Internal Fence"); @@ -180,28 +151,11 @@ void HIPInternal::fence(const std::string &name) const { [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream)); }); } -void HIPInternal::initialize(hipStream_t stream) { - KOKKOS_EXPECTS(!is_initialized()); - - if (was_finalized) - Kokkos::abort("Calling HIP::initialize after HIP::finalize is illegal\n"); - - // Get the device ID. If this is ROCm 5.6 or later, we can query this from - // the provided stream and potentially use multiple GPU devices. For - // ROCm 5.5 or earlier, we must use the singleton device id and there are no - // checks possible for the device id matching the device the stream was - // created on. -#if (HIP_VERSION_MAJOR > 5 || \ - (HIP_VERSION_MAJOR == 5 && HIP_VERSION_MINOR >= 6)) - KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamGetDevice(stream, &m_hipDev)); -#else - m_hipDev = singleton().m_hipDev; -#endif +HIPInternal::HIPInternal(hipStream_t stream) : m_stream(stream) { + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamGetDevice(m_stream, &m_hipDev)); KOKKOS_IMPL_HIP_SAFE_CALL(hipSetDevice(m_hipDev)); hip_devices.insert(m_hipDev); - m_stream = stream; - // Allocate a staging buffer for constant mem in pinned host memory. if (!constantMemHostStaging[m_hipDev]) { void *constant_mem_void_ptr = nullptr; @@ -370,7 +324,7 @@ void HIPInternal::release_team_scratch_space(int scratch_pool_id) { //---------------------------------------------------------------------------- -void HIPInternal::finalize() { +HIPInternal::~HIPInternal() { // First, lock the shared resource locking helper. // Then, fence the stream and check if it was involved in the last constant // memory launch. @@ -378,12 +332,10 @@ void HIPInternal::finalize() { // thread from launching another kernel in-between the fence // and the 'check_if_involved_and_unlock'. auto lock = HIPInternal::constantMemReusable[m_hipDev].lock(); - this->fence("Kokkos::HIPInternal::finalize: fence on finalization"); + this->fence("Kokkos::HIPInternal::finalize: fence on destruction"); HIPInternal::constantMemReusable[m_hipDev].check_if_involved_and_unlock( std::move(lock), m_stream); - was_finalized = true; - auto device_mem_space = Kokkos::HIPSpace::impl_create(m_hipDev, m_stream); if (nullptr != m_scratchSpace || nullptr != m_scratchFlags) { device_mem_space.deallocate(m_scratchFlags, @@ -405,19 +357,7 @@ void HIPInternal::finalize() { m_team_scratch_current_size[i]); } - m_scratchSpaceCount = 0; - m_scratchFlagsCount = 0; - m_scratchSpace = nullptr; - m_scratchFlags = nullptr; - for (int i = 0; i < m_n_team_scratch; ++i) { - m_team_scratch_current_size[i] = 0; - m_team_scratch_ptr[i] = nullptr; - } - KOKKOS_IMPL_HIP_SAFE_CALL(hip_free_wrapper(m_scratch_locks)); - m_scratch_locks = nullptr; - m_num_scratch_locks = 0; - m_hipDev = -1; } int HIPInternal::m_maxThreadsPerSM = 0; @@ -426,16 +366,14 @@ hipDeviceProp_t HIPInternal::m_deviceProp; std::mutex HIPInternal::scratchFunctorMutex; +HostSharedPtr HIPInternal::default_instance; + std::set HIPInternal::hip_devices = {}; std::map HIPInternal::constantMemHostStaging = {}; std::map HIPInternal::constantMemReusable = {}; //---------------------------------------------------------------------------- -Kokkos::HIP::size_type hip_internal_multiprocessor_count() { - return HIPInternal::singleton().m_deviceProp.multiProcessorCount; -} - Kokkos::HIP::size_type *hip_internal_scratch_space(const HIP &instance, const std::size_t size) { return instance.impl_internal_space_instance()->scratch_space(size); @@ -450,20 +388,3 @@ Kokkos::HIP::size_type *hip_internal_scratch_flags(const HIP &instance, } // namespace Kokkos //---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { -void hip_internal_error_throw(hipError_t e, const char *name, const char *file, - const int line) { - std::ostringstream out; - out << name << " error( " << hipGetErrorName(e) - << "): " << hipGetErrorString(e); - if (file) { - out << " " << file << ":" << line; - } - throw_runtime_exception(out.str()); -} -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp index 181a88393049..bcbfd36a7755 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*--------------------------------------------------------------------------*/ @@ -21,6 +8,7 @@ #include #include +#include #include @@ -33,17 +21,20 @@ namespace Kokkos { namespace Impl { struct HIPTraits { -#if defined(KOKKOS_ARCH_AMD_GFX906) || defined(KOKKOS_ARCH_AMD_GFX908) || \ - defined(KOKKOS_ARCH_AMD_GFX90A) || defined(KOKKOS_ARCH_AMD_GFX940) || \ - defined(KOKKOS_ARCH_AMD_GFX942) || defined(KOKKOS_ARCH_AMD_GFX942_APU) +#if defined(KOKKOS_ARCH_AMD_GFX906) || defined(KOKKOS_ARCH_AMD_GFX908) || \ + defined(KOKKOS_ARCH_AMD_GFX90A) || defined(KOKKOS_ARCH_AMD_GFX940) || \ + defined(KOKKOS_ARCH_AMD_GFX942) || defined(KOKKOS_ARCH_AMD_GFX942_APU) || \ + defined(KOKKOS_ARCH_AMD_GFX950) static constexpr int WarpSize = 64; static constexpr int WarpIndexMask = 0x003f; /* hexadecimal for 63 */ static constexpr int WarpIndexShift = 6; /* WarpSize == 1 << WarpShift*/ #elif defined(KOKKOS_ARCH_AMD_GFX1030) || defined(KOKKOS_ARCH_AMD_GFX1100) || \ - defined(KOKKOS_ARCH_AMD_GFX1103) + defined(KOKKOS_ARCH_AMD_GFX1103) || defined(KOKKOS_ARCH_AMD_GFX1201) static constexpr int WarpSize = 32; static constexpr int WarpIndexMask = 0x001f; /* hexadecimal for 31 */ static constexpr int WarpIndexShift = 5; /* WarpSize == 1 << WarpShift*/ +#else +#error "Unexpected AMD GFX architecture!" #endif static constexpr int ConservativeThreadsPerBlock = 256; // conservative fallback blocksize in case of spills @@ -56,8 +47,6 @@ struct HIPTraits { //---------------------------------------------------------------------------- -HIP::size_type hip_internal_multiprocessor_count(); - HIP::size_type *hip_internal_scratch_space(const HIP &instance, const std::size_t size); HIP::size_type *hip_internal_scratch_flags(const HIP &instance, @@ -120,6 +109,7 @@ struct SharedResourceLock { SharedResourceLock(SharedResourceLock &&other) = delete; SharedResourceLock &operator=(SharedResourceLock const &other) = delete; SharedResourceLock &operator=(SharedResourceLock &&other) = delete; + ~SharedResourceLock() = default; // Acquire the right to use the shared resource. The instance is locked first. [[nodiscard]] auto acquire() { @@ -156,16 +146,14 @@ struct SharedResourceLock { }; class HIPInternal { - private: - HIPInternal(const HIPInternal &); - HIPInternal &operator=(const HIPInternal &); - public: using size_type = ::Kokkos::HIP::size_type; int m_hipDev = -1; static int m_maxThreadsPerSM; + static HostSharedPtr default_instance; + static hipDeviceProp_t m_deviceProp; static int concurrency(); @@ -194,32 +182,22 @@ class HIPInternal { int32_t *m_scratch_locks = nullptr; size_t m_num_scratch_locks = 0; - bool was_finalized = false; - static std::set hip_devices; static std::map constantMemHostStaging; static std::map constantMemReusable; - static HIPInternal &singleton(); - int verify_is_initialized(const char *const label) const; - int is_initialized() const { - return nullptr != m_scratchSpace && nullptr != m_scratchFlags; - } - - void initialize(hipStream_t stream); - void finalize(); + HIPInternal(hipStream_t stream); + ~HIPInternal(); + HIPInternal(const HIPInternal &) = delete; + HIPInternal &operator=(const HIPInternal &) = delete; void print_configuration(std::ostream &) const; void fence() const; void fence(const std::string &) const; - ~HIPInternal(); - - HIPInternal() = default; - // Using HIP API function/objects will be w.r.t. device 0 unless // hipSetDevice(device_id) is called with the correct device_id. // The correct device_id is stored in the variable diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.cpp index 32cd0f80ad99..90da82d356e4 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*--------------------------------------------------------------------------*/ diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.hpp index 32a26a46df1e..c9836d2c1a86 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_IsXnack.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /*--------------------------------------------------------------------------*/ @@ -50,11 +37,13 @@ bool xnack_boot_config_has_hmm_mirror(); // Returns true iff the architecture of the gpu supports accessing system // allocated memory constexpr bool gpu_arch_can_access_system_allocations() { -#if defined(KOKKOS_ARCH_AMD_GFX908) || defined(KOKKOS_ARCH_AMD_GFX90A) || \ - defined(KOKKOS_ARCH_AMD_GFX942) || defined(KOKKOS_ARCH_AMD_GFX942_APU) +#if defined(KOKKOS_ARCH_AMD_GFX908) || defined(KOKKOS_ARCH_AMD_GFX90A) || \ + defined(KOKKOS_ARCH_AMD_GFX942) || defined(KOKKOS_ARCH_AMD_GFX942_APU) || \ + defined(KOKKOS_ARCH_AMD_GFX950) return true; #elif defined(KOKKOS_ARCH_AMD_GFX906) || defined(KOKKOS_ARCH_AMD_GFX1103) || \ - defined(KOKKOS_ARCH_AMD_GFX1100) || defined(KOKKOS_ARCH_AMD_GFX1030) + defined(KOKKOS_ARCH_AMD_GFX1100) || defined(KOKKOS_ARCH_AMD_GFX1030) || \ + defined(KOKKOS_ARCH_AMD_GFX1201) return false; #endif } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp index 97996ae6d548..d7fe82336ec0 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_KERNEL_LAUNCH_HPP #define KOKKOS_HIP_KERNEL_LAUNCH_HPP @@ -22,13 +9,10 @@ #if defined(__HIPCC__) #include +#include #include #include - -#ifdef KOKKOS_IMPL_HIP_NATIVE_GRAPH -#include #include -#endif // Must use global variable on the device with HIP-Clang #ifdef __HIP__ @@ -383,7 +367,6 @@ struct HIPParallelLaunchKernelInvoker(base_t::get_kernel_func()); - params.kernelParams = const_cast(args); + params.kernelParams = args; params.extra = nullptr; KOKKOS_IMPL_HIP_SAFE_CALL(hip_instance->hip_graph_add_kernel_node_wrapper( @@ -494,7 +475,6 @@ struct HIPParallelLaunchKernelInvokerm_deviceProp.sharedMemPerBlock < shmem) { Kokkos::Impl::throw_runtime_exception( "HIPParallelLaunch FAILED: shared memory request is too large"); } - desul::ensure_hip_lock_arrays_on_device(); - // Invoke the driver function on the device base_t::invoke_kernel(driver, grid, block, shmem, hip_instance); @@ -613,16 +591,17 @@ void hip_parallel_launch(const DriverType &driver, const dim3 &grid, const dim3 &block, const int shmem, const HIPInternal *hip_instance, const bool prefer_shmem) { -#ifdef KOKKOS_IMPL_HIP_NATIVE_GRAPH + if (!is_empty_launch(grid, block)) { + desul::ensure_hip_lock_arrays_on_device(); + } + if constexpr (DoGraph) { // Graph launch using base_t = HIPParallelLaunchKernelInvoker; base_t::create_parallel_launch_graph_node(driver, grid, block, shmem, hip_instance); - } else -#endif - { + } else { // Regular kernel launch #ifndef KOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS HIPParallelLaunch( diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp index 58e13cf3e824..f7a2b832a7f2 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_MDRANGEPOLICY_HPP_ #define KOKKOS_HIP_MDRANGEPOLICY_HPP_ @@ -35,15 +22,65 @@ struct default_inner_direction { namespace Impl { +template <> +struct TileSizeRecommended { + template + static auto get(Policy const&) { + constexpr auto InnerDirection = Policy::inner_direction; + constexpr int Rank = Policy::rank; + + using tile_type = typename Policy::tile_type; + + if constexpr (InnerDirection == Iterate::Left) { + if constexpr (Rank == 2) { + return tile_type{64, 4}; + } else if constexpr (Rank == 3) { + return tile_type{32, 2, 4}; + } else if constexpr (Rank == 4) { + return tile_type{16, 4, 2, 2}; + } else if constexpr (Rank == 5) { + return tile_type{16, 4, 2, 2, 1}; + } else if constexpr (Rank == 6) { + return tile_type{8, 4, 2, 2, 2, 1}; + } + tile_type tile_sizes{}; + for (int i = 0; i < Rank; ++i) { + tile_sizes[i] = 2; + } + tile_sizes[0] = 16; + return tile_sizes; + } else { + if constexpr (Rank == 2) { + return tile_type{4, 64}; + } else if constexpr (Rank == 3) { + return tile_type{4, 2, 32}; + } else if constexpr (Rank == 4) { + return tile_type{2, 2, 4, 16}; + } else if constexpr (Rank == 5) { + return tile_type{1, 2, 2, 4, 16}; + } else if constexpr (Rank == 6) { + return tile_type{1, 2, 2, 2, 4, 8}; + } + tile_type tile_sizes{}; + for (int i = 0; i < Rank; ++i) { + tile_sizes[i] = 2; + } + tile_sizes[Rank - 1] = 16; + return tile_sizes; + } + } +}; + // Settings for MDRangePolicy template <> inline TileSizeProperties get_tile_size_properties(const HIP& space) { TileSizeProperties properties; - properties.max_threads = - space.impl_internal_space_instance()->m_maxThreadsPerSM; - properties.default_largest_tile_size = 16; - properties.default_tile_size = 4; + const auto& device_prop = space.hip_device_prop(); + properties.max_threads = device_prop.maxThreadsPerBlock; properties.max_total_tile_size = HIPTraits::MaxThreadsPerBlock; + properties.max_threads_dimensions[0] = device_prop.maxThreadsDim[0]; + properties.max_threads_dimensions[1] = device_prop.maxThreadsDim[1]; + properties.max_threads_dimensions[2] = device_prop.maxThreadsDim[2]; return properties; } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_MDRange.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_MDRange.hpp index 630798984636..e06e7977e494 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_MDRange.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_MDRange.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_FOR_MDRANGE_HPP #define KOKKOS_HIP_PARALLEL_FOR_MDRANGE_HPP @@ -39,20 +26,24 @@ class ParallelFor, HIP> { using index_type = typename Policy::index_type; using LaunchBounds = typename Policy::launch_bounds; using MaxGridSize = Kokkos::Array; + using array_type = typename Policy::point_type; const FunctorType m_functor; const Policy m_policy; const MaxGridSize m_max_grid_size; + array_type m_lower; + array_type m_upper; + array_type m_extent; // tile_size * num_tiles + public: - ParallelFor() = delete; - ParallelFor(ParallelFor const&) = default; - ParallelFor& operator=(ParallelFor const&) = delete; + ParallelFor() = delete; inline __device__ void operator()() const { - Kokkos::Impl::DeviceIterateTile( - m_policy, m_functor, m_max_grid_size) + Kokkos::Impl::DeviceIterate(m_lower, m_upper, + m_extent, m_functor) .exec_range(); } @@ -60,114 +51,12 @@ class ParallelFor, HIP> { using ClosureType = ParallelFor; if (m_policy.m_num_tiles == 0) return; - if (Policy::rank == 2) { - // id0 to threadIdx.x; id1 to threadIdx.y - dim3 const block(m_policy.m_tile[0], m_policy.m_tile[1], 1); - - dim3 const grid( - std::min( - (m_policy.m_upper[0] - m_policy.m_lower[0] + block.x - 1) / - block.x, - m_max_grid_size[0]), - std::min( - (m_policy.m_upper[1] - m_policy.m_lower[1] + block.y - 1) / - block.y, - m_max_grid_size[1]), - 1); - - hip_parallel_launch( - *this, grid, block, 0, - m_policy.space().impl_internal_space_instance(), false); - } else if (Policy::rank == 3) { - // id0 to threadIdx.x; id1 to threadIdx.y; id2 to threadIdx.z - dim3 const block(m_policy.m_tile[0], m_policy.m_tile[1], - m_policy.m_tile[2]); - - dim3 const grid( - std::min( - (m_policy.m_upper[0] - m_policy.m_lower[0] + block.x - 1) / - block.x, - m_max_grid_size[0]), - std::min( - (m_policy.m_upper[1] - m_policy.m_lower[1] + block.y - 1) / - block.y, - m_max_grid_size[1]), - std::min( - (m_policy.m_upper[2] - m_policy.m_lower[2] + block.z - 1) / - block.z, - m_max_grid_size[2])); - - hip_parallel_launch( - *this, grid, block, 0, - m_policy.space().impl_internal_space_instance(), false); - } else if (Policy::rank == 4) { - // id0,id1 encoded within threadIdx.x; id2 to threadIdx.y; id3 to - // threadIdx.z - dim3 const block(m_policy.m_tile[0] * m_policy.m_tile[1], - m_policy.m_tile[2], m_policy.m_tile[3]); - - dim3 const grid( - std::min( - m_policy.m_tile_end[0] * m_policy.m_tile_end[1], - m_max_grid_size[0]), - std::min( - (m_policy.m_upper[2] - m_policy.m_lower[2] + block.y - 1) / - block.y, - m_max_grid_size[1]), - std::min( - (m_policy.m_upper[3] - m_policy.m_lower[3] + block.z - 1) / - block.z, - m_max_grid_size[2])); - - hip_parallel_launch( - *this, grid, block, 0, - m_policy.space().impl_internal_space_instance(), false); - } else if (Policy::rank == 5) { - // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4 - // to threadIdx.z - dim3 const block(m_policy.m_tile[0] * m_policy.m_tile[1], - m_policy.m_tile[2] * m_policy.m_tile[3], - m_policy.m_tile[4]); - - dim3 const grid( - std::min( - m_policy.m_tile_end[0] * m_policy.m_tile_end[1], - m_max_grid_size[0]), - std::min( - m_policy.m_tile_end[2] * m_policy.m_tile_end[3], - m_max_grid_size[1]), - std::min( - (m_policy.m_upper[4] - m_policy.m_lower[4] + block.z - 1) / - block.z, - m_max_grid_size[2])); - - hip_parallel_launch( - *this, grid, block, 0, - m_policy.space().impl_internal_space_instance(), false); - } else if (Policy::rank == 6) { - // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; - // id4,id5 to threadIdx.z - dim3 const block(m_policy.m_tile[0] * m_policy.m_tile[1], - m_policy.m_tile[2] * m_policy.m_tile[3], - m_policy.m_tile[4] * m_policy.m_tile[5]); - - dim3 const grid(std::min( - m_policy.m_tile_end[0] * m_policy.m_tile_end[1], - m_max_grid_size[0]), - std::min( - m_policy.m_tile_end[2] * m_policy.m_tile_end[3], - m_max_grid_size[1]), - std::min( - m_policy.m_tile_end[4] * m_policy.m_tile_end[5], - m_max_grid_size[2])); - - hip_parallel_launch( - *this, grid, block, 0, - m_policy.space().impl_internal_space_instance(), false); - } else { - Kokkos::abort("Kokkos::MDRange Error: Exceeded rank bounds with HIP\n"); - } + const auto [grid, block] = + Kokkos::Impl::compute_device_launch_params(m_policy, m_max_grid_size); + hip_parallel_launch( + *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), + false); } // end execute ParallelFor(FunctorType const& arg_functor, Policy const& arg_policy) @@ -180,7 +69,22 @@ class ParallelFor, HIP> { m_policy.space().hip_device_prop().maxGridSize[1]), static_cast( m_policy.space().hip_device_prop().maxGridSize[2]), - }) {} + }) { + // Initialize begins and ends based on layout + // Swap the fastest indexes to x dimension + for (array_index_type i = 0; i < Policy::rank; ++i) { + if constexpr (Policy::inner_direction == Iterate::Left) { + m_lower[i] = m_policy.m_lower[i]; + m_upper[i] = m_policy.m_upper[i]; + m_extent[i] = m_policy.m_tile[i] * m_policy.m_tile_end[i]; + } else { + m_lower[i] = m_policy.m_lower[Policy::rank - 1 - i]; + m_upper[i] = m_policy.m_upper[Policy::rank - 1 - i]; + m_extent[i] = m_policy.m_tile[Policy::rank - 1 - i] * + m_policy.m_tile_end[Policy::rank - 1 - i]; + } + } + } template static int max_tile_size_product(const Policy&, const Functor&) { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Range.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Range.hpp index 91d6528a65dc..7ebdc92e1d67 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Range.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Range.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_FOR_RANGE_HPP #define KOKKOS_HIP_PARALLEL_FOR_RANGE_HPP @@ -31,9 +18,10 @@ class ParallelFor, Kokkos::HIP> { using Policy = Kokkos::RangePolicy; private: - using Member = typename Policy::member_type; - using WorkTag = typename Policy::work_tag; - using LaunchBounds = typename Policy::launch_bounds; + using Member = typename Policy::member_type; + using WorkTag = typename Policy::work_tag; + using LaunchBounds = typename Policy::launch_bounds; + using StaticBatchSize = typename Policy::static_batch_size; const FunctorType m_functor; const Policy m_policy; @@ -53,31 +41,42 @@ class ParallelFor, Kokkos::HIP> { public: using functor_type = FunctorType; - ParallelFor() = delete; - ParallelFor(ParallelFor const&) = default; - ParallelFor& operator=(ParallelFor const&) = delete; + ParallelFor() = delete; inline __device__ void operator()() const { - const auto work_stride = Member(blockDim.y) * gridDim.x; - const Member work_end = m_policy.end(); + constexpr auto batch_size = Member(StaticBatchSize::batch_size); + const auto work_stride = Member(blockDim.y) * gridDim.x; + const Member work_end = m_policy.end(); for (Member iwork = m_policy.begin() + threadIdx.y + static_cast(blockDim.y) * blockIdx.x; iwork < work_end; - iwork = iwork < static_cast(work_end - work_stride) - ? iwork + work_stride - : work_end) { - this->template exec_range(iwork); + iwork = + iwork < static_cast(work_end - work_stride * batch_size) + ? iwork + work_stride * batch_size + : work_end) { + for (Member i = 0; i < static_cast(work_stride * batch_size) && + i < work_end - iwork; + i = (i < static_cast(work_end - work_stride - iwork)) + ? i + work_stride + : work_end - iwork) { + this->template exec_range(iwork + i); + } } } inline void execute() const { - const typename Policy::index_type nwork = m_policy.end() - m_policy.begin(); + constexpr typename Policy::index_type batch_size = + StaticBatchSize::batch_size; + const typename Policy::index_type nwork = + (m_policy.end() - m_policy.begin()) / batch_size + + ((m_policy.end() - m_policy.begin()) % batch_size == 0 ? 0 : 1); using DriverType = ParallelFor; const int block_size = - Kokkos::Impl::hip_get_preferred_blocksize( - m_policy.space().hip_device()); + Kokkos::Impl::get_preferred_blocksize_for_range( + m_policy.space().impl_internal_space_instance(), nwork); if (block_size == 0) { Kokkos::Impl::throw_runtime_exception( diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Team.hpp index 16fff77e5cbf..7cc6b56d022c 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Team.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelFor_Team.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_FOR_TEAM_HPP #define KOKKOS_HIP_PARALLEL_FOR_TEAM_HPP @@ -71,9 +58,7 @@ class ParallelFor, HIP> { } public: - ParallelFor() = delete; - ParallelFor(ParallelFor const&) = default; - ParallelFor& operator=(ParallelFor const&) = delete; + ParallelFor() = delete; __device__ inline void operator()() const { // Iterate this block through the league @@ -112,19 +97,24 @@ class ParallelFor, HIP> { *this, grid, block, shmem_size_total, m_policy.space().impl_internal_space_instance(), true); // copy to device and execute + + if (m_scratch_pool_id >= 0) { + m_policy.space() + .impl_internal_space_instance() + ->release_team_scratch_space(m_scratch_pool_id); + } } ParallelFor(FunctorType const& arg_functor, Policy const& arg_policy) : m_functor(arg_functor), m_policy(arg_policy), - m_league_size(arg_policy.league_size()), - m_team_size(arg_policy.team_size()), - m_vector_size(arg_policy.impl_vector_length()) { + m_league_size(m_policy.league_size()), + m_team_size(m_policy.team_size()), + m_vector_size(m_policy.impl_vector_length()) { auto internal_space_instance = m_policy.space().impl_internal_space_instance(); if (m_team_size < 0) { - m_team_size = - arg_policy.team_size_recommended(arg_functor, ParallelForTag()); + m_team_size = m_policy.team_size_recommended(m_functor, ParallelForTag()); if (m_team_size <= 0) Kokkos::Impl::throw_runtime_exception( "Kokkos::Impl::ParallelFor could not find a " @@ -157,24 +147,34 @@ class ParallelFor, HIP> { } unsigned int const shmem_size_total = m_shmem_begin + m_shmem_size; - if (internal_space_instance->m_deviceProp.sharedMemPerBlock < - shmem_size_total) { - Kokkos::Impl::throw_runtime_exception(std::string( - "Kokkos::Impl::ParallelFor< HIP > insufficient shared memory")); + + auto maxShmemPerBlock = + internal_space_instance->m_deviceProp.sharedMemPerBlock; + if (maxShmemPerBlock < shmem_size_total) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too much scratch memory " + "on level 0. Requested: " + << m_shmem_size + << ", Maximum: " << maxShmemPerBlock - m_shmem_begin; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - size_t max_size = arg_policy.team_size_max(arg_functor, ParallelForTag()); - if (static_cast(m_team_size) > static_cast(max_size)) { - Kokkos::Impl::throw_runtime_exception(std::string( - "Kokkos::Impl::ParallelFor< HIP > requested too large team size.")); + if (m_scratch_size[1] > static_cast(m_policy.scratch_size_max(1))) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too much scratch memory " + "on level 1. Requested: " + << m_scratch_size[1] + << ", Maximum: " << m_policy.scratch_size_max(1); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - } - ~ParallelFor() { - if (m_scratch_pool_id >= 0) { - m_policy.space() - .impl_internal_space_instance() - ->release_team_scratch_space(m_scratch_pool_id); + int max_size = arg_policy.team_size_max(arg_functor, ParallelForTag()); + if (m_team_size > max_size) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too large team size. " + "Requested: " + << m_team_size << ", Maximum: " << max_size; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } } }; diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_MDRange.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_MDRange.hpp index 162951164626..b3e2d94eded2 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_MDRange.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_MDRange.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_REDUCE_MDRANGE_HPP #define KOKKOS_HIP_PARALLEL_REDUCE_MDRANGE_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Range.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Range.hpp index 907266b0c847..c0701b453e3b 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Range.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Range.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_REDUCE_RANGE_HPP #define KOKKOS_HIP_PARALLEL_REDUCE_RANGE_HPP @@ -216,9 +203,17 @@ class ParallelReduce, return hip_single_inter_block_reduce_scan_shmem(f, n); }; - return Kokkos::Impl::hip_get_preferred_blocksize( - instance, shmem_functor); + constexpr auto light_weight = + Kokkos::Experimental::WorkItemProperty::HintLightWeight; + constexpr typename Policy::work_item_property property; + if constexpr ((property & light_weight) == light_weight) { + return Kokkos::Impl::hip_get_max_blocksize( + instance, shmem_functor); + } else { + return Kokkos::Impl::hip_get_preferred_blocksize( + instance, shmem_functor); + } } inline void execute() { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Team.hpp index d222005a1dab..f46c8b2fcd3d 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Team.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelReduce_Team.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_REDUCE_TEAM_HPP #define KOKKOS_HIP_PARALLEL_REDUCE_TEAM_HPP @@ -300,6 +287,12 @@ class ParallelReduce= 0) { + m_policy.space() + .impl_internal_space_instance() + ->release_team_scratch_space(m_scratch_pool_id); + } } template @@ -326,7 +319,7 @@ class ParallelReduce bad team size")); } - if (internal_space_instance->m_deviceProp.sharedMemPerBlock < - shmem_size_total) { - Kokkos::Impl::throw_runtime_exception( - std::string("Kokkos::Impl::ParallelReduce< HIP > requested too much " - "L0 scratch memory")); + auto maxShmemPerBlock = + internal_space_instance->m_deviceProp.sharedMemPerBlock; + if (maxShmemPerBlock < shmem_size_total) { + std::stringstream error; + error + << "Kokkos::parallel_reduce: Requested too much scratch memory " + "on level 0. Requested: " + << m_shmem_size + << ", Maximum: " << maxShmemPerBlock - m_shmem_begin - m_team_begin; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - size_t max_size = arg_policy.team_size_max( - arg_functor_reducer.get_functor(), arg_functor_reducer.get_reducer(), - ParallelReduceTag()); - if (static_cast(m_team_size) > static_cast(max_size)) { - Kokkos::Impl::throw_runtime_exception( - std::string("Kokkos::Impl::ParallelReduce< HIP > requested too " - "large team size.")); + if (m_scratch_size[1] > static_cast(m_policy.scratch_size_max(1))) { + std::stringstream error; + error + << "Kokkos::parallel_reduce: Requested too much scratch memory " + "on level 1. Requested: " + << m_scratch_size[1] << ", Maximum: " << m_policy.scratch_size_max(1); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } - } - ~ParallelReduce() { - if (m_scratch_pool_id >= 0) { - m_policy.space() - .impl_internal_space_instance() - ->release_team_scratch_space(m_scratch_pool_id); + if (m_team_size > + arg_policy.team_size_max_internal(m_functor_reducer.get_functor(), + m_functor_reducer.get_reducer(), + ParallelReduceTag())) { + std::stringstream error; + error << "Kokkos::parallel_reduce: Requested too large team size. " + "Requested: " + << m_team_size << ", Maximum: " + << arg_policy.team_size_max_internal( + m_functor_reducer.get_functor(), + m_functor_reducer.get_reducer(), ParallelReduceTag()); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } } }; diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelScan_Range.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelScan_Range.hpp index cc10493b2e02..665e4f3524a0 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelScan_Range.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ParallelScan_Range.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_PARALLEL_SCAN_RANGE_HPP #define KOKKOS_HIP_PARALLEL_SCAN_RANGE_HPP @@ -162,6 +149,9 @@ class ParallelScanHIPBase { } else if (0 == threadIdx.y) { final_reducer.init(reinterpret_cast(shared_accum)); } + // FIXME_HIP below __syncthreads() is added to handle MI300A. + // Likely compiler optimization bug. + __syncthreads(); const WorkRange range(m_policy, blockIdx.x, gridDim.x); @@ -169,8 +159,10 @@ class ParallelScanHIPBase { iwork_base < range.end(); iwork_base += blockDim.y) { const typename Policy::member_type iwork = iwork_base + threadIdx.y; - __syncthreads(); // Don't overwrite previous iteration values until they - // are used + // FIXME_HIP: we encountered something believed to be a compiler bug on + // MI300A: instead of syncing here, we need to sync before the loop + // and at the very end of the loop. + //__syncthreads(); final_reducer.init( reinterpret_cast(shared_prefix + word_count.value)); @@ -218,6 +210,9 @@ class ParallelScanHIPBase { if (iwork + 1 == m_policy.end() && m_policy.end() == range.end() && m_result_ptr_device_accessible) *m_result_ptr = *reinterpret_cast(shared_prefix); + // FIXME_HIP below __syncthreads() is moved from the beginning of this + // loop to here to handle issues on MI300A. Likely compiler bug. + __syncthreads(); } } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp index fad4c53344d8..472116db26ef 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_REDUCESCAN_HPP #define KOKKOS_HIP_REDUCESCAN_HPP @@ -56,15 +43,17 @@ struct HIPReductionsFunctor { __device__ static inline void scalar_intra_block_reduction( FunctorType const& functor, Scalar value, bool const skip, - Scalar* my_global_team_buffer_element, int const shared_elements, + Scalar* my_global_team_buffer_element, unsigned int const shared_elements, Scalar* shared_team_buffer_element) { constexpr unsigned int warp_size = HIPTraits::WarpSize; - int const warp_id = (threadIdx.y * blockDim.x) / warp_size; + unsigned int const warp_id = (threadIdx.y * blockDim.x) / warp_size; + unsigned int const num_threads = blockDim.x * blockDim.y; Scalar* const my_shared_team_buffer_element = shared_team_buffer_element + warp_id % shared_elements; // Warp Level Reduction, ignoring Kokkos vector entries - scalar_intra_warp_reduction(functor, value, skip, warp_size, value); + scalar_intra_warp_reduction(functor, value, skip, + Kokkos::min(warp_size, num_threads), value); if (warp_id < shared_elements) { *my_shared_team_buffer_element = value; @@ -73,8 +62,9 @@ struct HIPReductionsFunctor { // cross warp reduction __syncthreads(); - int const num_warps = blockDim.x * blockDim.y / warp_size; - for (int w = shared_elements; w < num_warps; w += shared_elements) { + unsigned int const num_warps = num_threads / warp_size; + for (unsigned int w = shared_elements; w < num_warps; + w += shared_elements) { if (warp_id >= w && warp_id < w + shared_elements) { if ((threadIdx.y * blockDim.x + threadIdx.x) % warp_size == 0) functor.join(my_shared_team_buffer_element, &value); @@ -85,7 +75,7 @@ struct HIPReductionsFunctor { if (warp_id == 0) { functor.init(&value); for (unsigned int i = threadIdx.y * blockDim.x + threadIdx.x; - i < blockDim.y * blockDim.x / warp_size; i += warp_size) { + i < num_warps; i += warp_size) { functor.join(&value, &shared_team_buffer_element[i]); } scalar_intra_warp_reduction(functor, value, false, warp_size, @@ -106,8 +96,8 @@ struct HIPReductionsFunctor { reinterpret_cast(shared_data); Scalar value = shared_team_buffer_elements[threadIdx.y]; constexpr unsigned int warp_size = Impl::HIPTraits::WarpSize; - int shared_elements = blockDim.x * blockDim.y / warp_size; - int global_elements = block_count; + unsigned int shared_elements = blockDim.x * blockDim.y / warp_size; + unsigned int global_elements = block_count; __syncthreads(); scalar_intra_block_reduction(functor, value, true, @@ -126,8 +116,8 @@ struct HIPReductionsFunctor { is_last_block = true; *global_flags = 0; functor.init(&value); - for (int i = threadIdx.y * blockDim.x + threadIdx.x; i < global_elements; - i += blockDim.x * blockDim.y) { + for (unsigned int i = threadIdx.y * blockDim.x + threadIdx.x; + i < global_elements; i += blockDim.x * blockDim.y) { functor.join(&value, &global_team_buffer_element[i]); } scalar_intra_block_reduction( @@ -154,8 +144,7 @@ struct HIPReductionsFunctor { int const lane_id = (threadIdx.y * blockDim.x + threadIdx.x) % HIPTraits::WarpSize; for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) { - if (lane_id + delta < HIPTraits::WarpSize && - (lane_id % (delta * 2) == 0)) { + if (lane_id + delta < width && (lane_id % (delta * 2) == 0)) { functor.join(value, value + delta); } } @@ -165,26 +154,27 @@ struct HIPReductionsFunctor { __device__ static inline void scalar_intra_block_reduction( FunctorType const& functor, Scalar value, bool const skip, Scalar* result, int const /*shared_elements*/, Scalar* shared_team_buffer_element) { - int const warp_id = (threadIdx.y * blockDim.x) / HIPTraits::WarpSize; + constexpr unsigned int warp_size = Impl::HIPTraits::WarpSize; + unsigned int const warp_id = (threadIdx.y * blockDim.x) / warp_size; + const unsigned int num_threads = blockDim.x * blockDim.y; Scalar* const my_shared_team_buffer_element = shared_team_buffer_element + threadIdx.y * blockDim.x + threadIdx.x; *my_shared_team_buffer_element = value; // Warp Level Reduction, ignoring Kokkos vector entries scalar_intra_warp_reduction(functor, my_shared_team_buffer_element, skip, - HIPTraits::WarpSize); + Kokkos::min(num_threads, warp_size)); // Wait for every warp to be done before using one warp to do final cross // warp reduction __syncthreads(); - if (warp_id == 0) { + if (warp_id == 0u) { const unsigned int delta = - (threadIdx.y * blockDim.x + threadIdx.x) * HIPTraits::WarpSize; - if (delta < blockDim.x * blockDim.y) + (threadIdx.y * blockDim.x + threadIdx.x) * warp_size; + if (delta < num_threads) *my_shared_team_buffer_element = shared_team_buffer_element[delta]; - scalar_intra_warp_reduction( - functor, my_shared_team_buffer_element, false, - blockDim.x * blockDim.y / HIPTraits::WarpSize); - if (threadIdx.x + threadIdx.y == 0) { + scalar_intra_warp_reduction(functor, my_shared_team_buffer_element, false, + num_threads / warp_size); + if (threadIdx.x + threadIdx.y == 0u) { *result = *shared_team_buffer_element; if (skip) __threadfence(); } @@ -252,7 +242,6 @@ __device__ void hip_intra_block_reduce_scan( typename FunctorType::pointer_type const base_data) { using pointer_type = typename FunctorType::pointer_type; - const unsigned value_count = functor.length(); const unsigned not_less_power_of_two = Kokkos::Experimental::bit_ceil_builtin(blockDim.y); const unsigned BlockSizeMask = not_less_power_of_two - 1; @@ -263,15 +252,19 @@ __device__ void hip_intra_block_reduce_scan( const bool is_full_warp = (((threadIdx.y >> HIPTraits::WarpIndexShift) + 1) << HIPTraits::WarpIndexShift) <= blockDim.y; - auto block_reduce_step = [&functor, value_count]( - int const R, pointer_type const TD, int const S, - pointer_type memory_start, int index_shift) { + auto block_reduce_step = [&functor](int const R, pointer_type const TD, + int const S, pointer_type memory_start, + int index_shift) { + // FIXME_HIP define value_count inside the lambda instead of capturing it to + // avoid a warning when using ROCm 7.0 with C++ 23 + const unsigned value_count = functor.length(); const auto join_ptr = TD - (value_count << S) + value_count * index_shift; if (R > ((1 << S) - 1) && join_ptr >= memory_start) { functor.join(TD, join_ptr); } }; + const unsigned value_count = functor.length(); // Intra-warp reduction: int bit_shift = 0; { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp index 0b679218092d..8cba732b0be3 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp index a464609108cd..c6fd9d693eac 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_SHARED_ALLOCATION_RECORD_HPP #define KOKKOS_HIP_SHARED_ALLOCATION_RECORD_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp index feee44ccaf17..54be69729881 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_SHUFFLE_REDUCE_HPP #define KOKKOS_HIP_SHUFFLE_REDUCE_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index fad8d910b051..b41edad76030 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -20,7 +7,12 @@ #include +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #include #include @@ -96,9 +88,7 @@ void* HIPSpace::impl_allocate(const int device_id, const size_t arg_logical_size, [[maybe_unused]] bool stream_sync_only) const { void* ptr = nullptr; - // ROCm 5.5 and earlier throw an error when using hipMallocAsync and - // arg_alloc_size is zero. Instead of trying to allocate memory, just return - // early. + // Instead of trying to allocate zero memory, return early. if (arg_alloc_size == 0) return ptr; KOKKOS_IMPL_HIP_SAFE_CALL(hipSetDevice(device_id)); diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp index 63590f278621..66e8d4d23724 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIPSPACE_HPP #define KOKKOS_HIPSPACE_HPP @@ -58,11 +45,6 @@ class HIPSpace { /*--------------------------------*/ HIPSpace(); - HIPSpace(HIPSpace&& rhs) = default; - HIPSpace(const HIPSpace& rhs) = default; - HIPSpace& operator=(HIPSpace&& rhs) = default; - HIPSpace& operator=(const HIPSpace& rhs) = default; - ~HIPSpace() = default; private: HIPSpace(int device_id, hipStream_t stream); @@ -144,11 +126,6 @@ class HIPHostPinnedSpace { /*--------------------------------*/ HIPHostPinnedSpace(); - HIPHostPinnedSpace(HIPHostPinnedSpace&& rhs) = default; - HIPHostPinnedSpace(const HIPHostPinnedSpace& rhs) = default; - HIPHostPinnedSpace& operator=(HIPHostPinnedSpace&& rhs) = default; - HIPHostPinnedSpace& operator=(const HIPHostPinnedSpace& rhs) = default; - ~HIPHostPinnedSpace() = default; private: HIPHostPinnedSpace(int device_id, hipStream_t stream); @@ -229,11 +206,6 @@ class HIPManagedSpace { /*--------------------------------*/ HIPManagedSpace(); - HIPManagedSpace(HIPManagedSpace&& rhs) = default; - HIPManagedSpace(const HIPManagedSpace& rhs) = default; - HIPManagedSpace& operator=(HIPManagedSpace&& rhs) = default; - HIPManagedSpace& operator=(const HIPManagedSpace& rhs) = default; - ~HIPManagedSpace() = default; private: HIPManagedSpace(int device_id, hipStream_t stream); diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp index 80cb3804be47..b730c2dc9d4b 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_TEAM_HPP #define KOKKOS_HIP_TEAM_HPP @@ -46,7 +33,7 @@ struct HIPJoinFunctor { } }; -/**\brief Team member_type passed to TeamPolicy or TeamTask closures. +/**\brief Team member_type passed to the TeamPolicy closure. * * HIP thread blocks for team closures are dimensioned as: * blockDim.x == number of "vector lanes" per "thread" @@ -580,7 +567,7 @@ parallel_reduce(const Impl::TeamThreadRangeBoundariesStruct< * less than N) and a scan operation is performed. The last call to closure has * final == true. */ -// This is the same code as in CUDA and largely the same as in OpenMPTarget +// This is the same code as in CUDA. template KOKKOS_INLINE_FUNCTION void parallel_scan( const Impl::TeamThreadRangeBoundariesStruct& diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_TeamPolicyInternal.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_TeamPolicyInternal.hpp index ac0d424c2974..3ee586d28443 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_TeamPolicyInternal.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_TeamPolicyInternal.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_TEAM_POLICY_INTERNAL_HPP #define KOKKOS_HIP_TEAM_POLICY_INTERNAL_HPP @@ -87,8 +74,18 @@ class TeamPolicyInternal } template - inline int team_size_max(const FunctorType& f, const ReducerType&, - const ParallelReduceTag&) const { + inline int team_size_max(const FunctorType& f, const ReducerType& reducer, + const ParallelReduceTag& tag) const { + using functor_analysis_type = + Impl::FunctorAnalysis; + return team_size_max_internal( + f, typename functor_analysis_type::Reducer{reducer}, tag); + } + + template + inline int team_size_max_internal(const FunctorType& f, const ReducerType&, + const ParallelReduceTag&) const { using closure_type = Impl::ParallelReduce, TeamPolicy, Kokkos::HIP>; @@ -121,8 +118,18 @@ class TeamPolicyInternal } template - int team_size_recommended(FunctorType const& f, ReducerType const&, - ParallelReduceTag const&) const { + int team_size_recommended(const FunctorType& f, const ReducerType& reducer, + const ParallelReduceTag& tag) const { + using functor_analysis_type = + Impl::FunctorAnalysis; + return team_size_recommended_internal( + f, typename functor_analysis_type::Reducer{reducer}, tag); + } + + template + int team_size_recommended_internal(const FunctorType& f, const ReducerType&, + const ParallelReduceTag&) const { using closure_type = Impl::ParallelReduce, TeamPolicy, Kokkos::HIP>; @@ -153,7 +160,7 @@ class TeamPolicyInternal // arbitrarily setting level 1 scratch limit to 20MB, for a // MI250 that would give us about 4.4GB for 2 teams per CU constexpr size_t max_l1_scratch_size = - static_cast(20 * 1024 * 1024); + static_cast(80 * 1024 * 1024); size_t max_shmem = HIP().hip_device_prop().sharedMemPerBlock; return (level == 0 ? max_shmem - max_reserved_shared_mem_per_team @@ -185,7 +192,7 @@ class TeamPolicyInternal typename traits::execution_space space() const { return m_space; } TeamPolicyInternal() - : m_space(typename traits::execution_space()), + : m_space(), m_league_size(0), m_team_size(-1), m_vector_length(0), @@ -196,9 +203,9 @@ class TeamPolicyInternal m_tune_vector_length(false) {} /** \brief Specify league size, request team size */ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, int team_size_request, int vector_length_request = 1) - : m_space(space_), + : m_space(std::move(space)), m_league_size(league_size_), m_team_size(team_size_request), m_vector_length(impl_determine_vector_length(vector_length_request)), @@ -215,35 +222,41 @@ class TeamPolicyInternal "space."); // Make sure total block size is permissible - if (m_team_size * m_vector_length > HIPTraits::MaxThreadsPerBlock) { - Impl::throw_runtime_exception( - std::string("Kokkos::TeamPolicy< HIP > the team size is too large. " - "Team size x vector length must be smaller than 1024.")); + if (m_team_size * m_vector_length > + static_cast(HIPTraits::MaxThreadsPerBlock)) { + std::stringstream error; + error << "Kokkos::TeamPolicy: Requested too large team size. " + "Requested: " + << m_team_size + << ", Maximum: " << HIPTraits::MaxThreadsPerBlock / m_vector_length; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); } } /** \brief Specify league size, request team size */ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, const Kokkos::AUTO_t& /* team_size_request */, int vector_length_request = 1) - : TeamPolicyInternal(space_, league_size_, -1, vector_length_request) {} + : TeamPolicyInternal(std::move(space), league_size_, -1, + vector_length_request) {} // FLAG /** \brief Specify league size and team size, request vector length*/ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, int team_size_request, const Kokkos::AUTO_t& /* vector_length_request */ ) - : TeamPolicyInternal(space_, league_size_, team_size_request, -1) + : TeamPolicyInternal(std::move(space), league_size_, team_size_request, + -1) {} /** \brief Specify league size, request team size and vector length*/ - TeamPolicyInternal(const execution_space space_, int league_size_, + TeamPolicyInternal(execution_space space, int league_size_, const Kokkos::AUTO_t& /* team_size_request */, const Kokkos::AUTO_t& /* vector_length_request */ ) - : TeamPolicyInternal(space_, league_size_, -1, -1) + : TeamPolicyInternal(std::move(space), league_size_, -1, -1) {} @@ -277,6 +290,12 @@ class TeamPolicyInternal : TeamPolicyInternal(typename traits::execution_space(), league_size_, -1, -1) {} + TeamPolicyInternal(const PolicyUpdate, const TeamPolicyInternal& other, + typename traits::execution_space space) + : TeamPolicyInternal(other) { + this->m_space = std::move(space); + } + int chunk_size() const { return m_chunk_size; } TeamPolicyInternal& set_chunk_size(typename traits::index_type chunk_size_) { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp index 2da38b950b03..57e082ee2929 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_UNIQUE_TOKEN_HPP #define KOKKOS_HIP_UNIQUE_TOKEN_HPP @@ -57,18 +44,6 @@ class UniqueToken { } public: - KOKKOS_DEFAULTED_FUNCTION - UniqueToken(const UniqueToken&) = default; - - KOKKOS_DEFAULTED_FUNCTION - UniqueToken(UniqueToken&&) = default; - - KOKKOS_DEFAULTED_FUNCTION - UniqueToken& operator=(const UniqueToken&) = default; - - KOKKOS_DEFAULTED_FUNCTION - UniqueToken& operator=(UniqueToken&&) = default; - /// \brief upper bound for acquired values, i.e. 0 <= value < size() KOKKOS_INLINE_FUNCTION size_type size() const noexcept { return m_locks.extent(0); } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp index f5b1d321e8cf..37b30e57d99f 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_VECTORIZATION_HPP #define KOKKOS_HIP_VECTORIZATION_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp index c39963d277b8..ec16a64c4eae 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_WORKGRAPHPOLICY_HPP #define KOKKOS_HIP_WORKGRAPHPOLICY_HPP @@ -62,12 +49,15 @@ class ParallelFor, HIP> { inline void execute() { const int warps_per_block = 4; - const dim3 grid(hip_internal_multiprocessor_count(), 1, 1); + const int multiProcessorCount = + m_policy.space().hip_device_prop().multiProcessorCount; + const dim3 grid(multiProcessorCount, 1, 1); const dim3 block(1, HIPTraits::WarpSize, warps_per_block); const int shared = 0; HIPParallelLaunch(*this, grid, block, shared, - HIP().impl_internal_space_instance(), false); + m_policy.space().impl_internal_space_instance(), + false); } inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp index 9ed9f334fb69..b2b245829b7e 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.cpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.hpp index 86aa7890a862..874a98c6d7b3 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ZeroMemset.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HIP_ZEROMEMSET_HPP #define KOKKOS_HIP_ZEROMEMSET_HPP diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp index 1946c20fa970..ff0c0c15873e 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp @@ -1,24 +1,16 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE #endif +#include +#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES +import kokkos.core; +#else #include +#endif #ifdef KOKKOS_ENABLE_HPX #include @@ -103,33 +95,6 @@ void HPX::print_configuration(std::ostream &os, const bool) const { os << hpx::configuration_string() << '\n'; } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -bool &HPX::impl_get_in_parallel() noexcept { - static thread_local bool in_parallel = false; - return in_parallel; -} - -HPX::impl_in_parallel_scope::impl_in_parallel_scope() noexcept { - KOKKOS_EXPECTS(!impl_get_in_parallel()); - impl_get_in_parallel() = true; -} - -HPX::impl_in_parallel_scope::~impl_in_parallel_scope() noexcept { - KOKKOS_EXPECTS(impl_get_in_parallel()); - impl_get_in_parallel() = false; -} - -HPX::impl_not_in_parallel_scope::impl_not_in_parallel_scope() noexcept { - KOKKOS_EXPECTS(impl_get_in_parallel()); - impl_get_in_parallel() = false; -} - -HPX::impl_not_in_parallel_scope::~impl_not_in_parallel_scope() noexcept { - KOKKOS_EXPECTS(!impl_get_in_parallel()); - impl_get_in_parallel() = true; -} -#endif - void HPX::impl_decrement_active_parallel_region_count() { std::unique_lock l(m_active_parallel_region_count_mutex); if (--m_active_parallel_region_count == 0) { @@ -144,23 +109,11 @@ void HPX::impl_increment_active_parallel_region_count() { } void HPX::impl_instance_fence_locked(const std::string &name) const { - Kokkos::Tools::Experimental::Impl::profile_fence_event< - Kokkos::Experimental::HPX>( - name, - Kokkos::Tools::Experimental::Impl::DirectFenceIDHandle{ - impl_instance_id()}, - [&]() { - auto &s = impl_get_sender(); - - hpx::this_thread::experimental::sync_wait(std::move(s)); - s = hpx::execution::experimental::unique_any_sender<>( - hpx::execution::experimental::just()); - }); + impl_get_instance_data().fence_locked(name); } void HPX::impl_instance_fence(const std::string &name) const { - std::lock_guard l(impl_get_sender_mutex()); - impl_instance_fence_locked(name); + impl_get_instance_data().fence(name); } void HPX::impl_static_fence(const std::string &name) { @@ -189,11 +142,7 @@ void HPX::impl_static_fence(const std::string &name) { }); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -int HPX::concurrency() { -#else int HPX::concurrency() const { -#endif hpx::runtime *rt = hpx::get_runtime_ptr(); if (rt == nullptr) { return hpx::threads::hardware_concurrency(); @@ -223,11 +172,6 @@ void HPX::impl_initialize(InitializationSettings const &settings) { } } -bool HPX::impl_is_initialized() noexcept { - hpx::runtime *rt = hpx::get_runtime_ptr(); - return rt != nullptr; -} - void HPX::impl_finalize() { if (m_hpx_initialized) { hpx::runtime *rt = hpx::get_runtime_ptr(); diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX.hpp index 441b7b26222c..6efdec58b24e 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX.hpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include @@ -33,11 +20,12 @@ static_assert(false, #include #include #include +#include #include #include #include -#include #include +#include #include @@ -54,6 +42,7 @@ static_assert(false, #include #include #include +#include #include #include @@ -132,8 +121,11 @@ class HPX { static hpx::condition_variable_any m_active_parallel_region_count_cond; struct instance_data { - instance_data() = default; - ~instance_data() = default; + instance_data() = default; + // NOLINTNEXTLINE(bugprone-exception-escape) + ~instance_data() { + fence("Kokkos::Experimental::HPX: fence on destruction"); + } instance_data(uint32_t instance_id) : m_instance_id(instance_id) {} instance_data(uint32_t instance_id, hpx::execution::experimental::unique_any_sender<> &&sender) @@ -144,6 +136,25 @@ class HPX { instance_data &operator=(const instance_data &) = delete; instance_data &operator=(instance_data) = delete; + void fence(const std::string &name) { + std::lock_guard l(m_sender_mutex); + fence_locked(name); + } + + void fence_locked(const std::string &name) { + Kokkos::Tools::Experimental::Impl::profile_fence_event< + Kokkos::Experimental::HPX>( + name, + Kokkos::Tools::Experimental::Impl::DirectFenceIDHandle{m_instance_id}, + [&]() { + auto &s = m_sender; + + hpx::this_thread::experimental::sync_wait(std::move(s)); + s = hpx::execution::experimental::unique_any_sender<>( + hpx::execution::experimental::just()); + }); + } + uint32_t m_instance_id{HPX::impl_default_instance_id()}; hpx::execution::experimental::unique_any_sender<> m_sender{ hpx::execution::experimental::just()}; @@ -169,42 +180,40 @@ class HPX { #pragma GCC diagnostic ignored "-Wuninitialized" HPX() - : m_instance_data(Kokkos::Impl::HostSharedPtr( - &m_default_instance_data, &default_instance_deleter)) {} + : m_instance_data( + (Kokkos::Impl::check_execution_space_constructor_precondition( + name()), + Kokkos::Impl::HostSharedPtr( + &m_default_instance_data, &default_instance_deleter))) {} #pragma GCC diagnostic pop - ~HPX() = default; + ~HPX() { + Kokkos::Impl::check_execution_space_destructor_precondition(name()); + } explicit HPX(instance_mode mode) : m_instance_data( - mode == instance_mode::independent - ? (Kokkos::Impl::HostSharedPtr( - new instance_data(m_next_instance_id++))) - : Kokkos::Impl::HostSharedPtr( - &m_default_instance_data, &default_instance_deleter)) {} + (Kokkos::Impl::check_execution_space_constructor_precondition( + name()), + mode == instance_mode::independent + ? (Kokkos::Impl::HostSharedPtr( + new instance_data(m_next_instance_id++))) + : Kokkos::Impl::HostSharedPtr( + &m_default_instance_data, &default_instance_deleter))) {} explicit HPX(hpx::execution::experimental::unique_any_sender<> &&sender) - : m_instance_data(Kokkos::Impl::HostSharedPtr( - new instance_data(m_next_instance_id++, std::move(sender)))) {} - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - template - KOKKOS_DEPRECATED_WITH_COMMENT( - "HPX execution space should be constructed explicitly.") - HPX(instance_mode mode) - : HPX(mode) {} - - template - KOKKOS_DEPRECATED_WITH_COMMENT( - "HPX execution space should be constructed explicitly.") - HPX(hpx::execution::experimental::unique_any_sender<> &&sender) - : HPX(std::move(sender)) {} -#endif - - HPX(HPX &&other) = default; - HPX(const HPX &other) = default; + : m_instance_data( + (Kokkos::Impl::check_execution_space_constructor_precondition( + name()), + Kokkos::Impl::HostSharedPtr(new instance_data( + m_next_instance_id++, std::move(sender))))) {} - HPX &operator=(HPX &&) = default; - HPX &operator=(const HPX &) = default; + KOKKOS_DEFAULTED_FUNCTION HPX(const HPX &) = default; + KOKKOS_FUNCTION HPX(HPX &&other) noexcept + : HPX(static_cast(other)) {} + KOKKOS_DEFAULTED_FUNCTION HPX &operator=(const HPX &) = default; + KOKKOS_FUNCTION HPX &operator=(HPX &&other) noexcept { + return *this = static_cast(other); + } void print_configuration(std::ostream &os, bool /*verbose*/ = false) const; instance_data &impl_get_instance_data() const noexcept { @@ -215,34 +224,6 @@ class HPX { return impl_get_instance_data().m_instance_id; } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - static bool &impl_get_in_parallel() noexcept; - - struct impl_in_parallel_scope { - impl_in_parallel_scope() noexcept; - ~impl_in_parallel_scope() noexcept; - impl_in_parallel_scope(impl_in_parallel_scope &&) = delete; - impl_in_parallel_scope(impl_in_parallel_scope const &) = delete; - impl_in_parallel_scope &operator=(impl_in_parallel_scope &&) = delete; - impl_in_parallel_scope &operator=(impl_in_parallel_scope const &) = delete; - }; - - struct impl_not_in_parallel_scope { - impl_not_in_parallel_scope() noexcept; - ~impl_not_in_parallel_scope() noexcept; - impl_not_in_parallel_scope(impl_not_in_parallel_scope &&) = delete; - impl_not_in_parallel_scope(impl_not_in_parallel_scope const &) = delete; - impl_not_in_parallel_scope &operator=(impl_not_in_parallel_scope &&) = - delete; - impl_not_in_parallel_scope &operator=(impl_not_in_parallel_scope const &) = - delete; - }; - - KOKKOS_DEPRECATED static bool in_parallel(HPX const & = HPX()) noexcept { - return impl_get_in_parallel(); - } -#endif - static void impl_decrement_active_parallel_region_count(); static void impl_increment_active_parallel_region_count(); @@ -253,26 +234,11 @@ class HPX { void fence( const std::string &name = "Kokkos::Experimental::HPX::fence: Unnamed Instance Fence") const { - impl_instance_fence(name); + impl_get_instance_data().fence(name); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - KOKKOS_DEPRECATED static bool is_asynchronous(HPX const & = HPX()) noexcept { -#if defined(KOKKOS_ENABLE_IMPL_HPX_ASYNC_DISPATCH) - return true; -#else - return false; -#endif - } -#endif - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - static int concurrency(); -#else int concurrency() const; -#endif static void impl_initialize(InitializationSettings const &); - static bool impl_is_initialized() noexcept; static void impl_finalize(); static int impl_thread_pool_size() noexcept; static int impl_thread_pool_rank() noexcept; @@ -360,12 +326,8 @@ class HPX { hpx::threads::thread_stacksize stacksize = hpx::threads::thread_stacksize::default_) const { impl_bulk_plain_erased(force_synchronous, is_light_weight_policy, - {[functor](Index i) { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - impl_in_parallel_scope p; -#endif - functor.execute_range(i); - }}, + // NOLINTNEXTLINE(bugprone-exception-escape) + {[functor](Index i) { functor.execute_range(i); }}, n, stacksize); } @@ -423,26 +385,11 @@ class HPX { Functor const &functor, Index const n, hpx::threads::thread_stacksize stacksize = hpx::threads::thread_stacksize::default_) const { - impl_bulk_setup_finalize_erased(force_synchronous, is_light_weight_policy, - {[functor](Index i) { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - impl_in_parallel_scope p; -#endif - functor.execute_range(i); - }}, - {[functor]() { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - impl_in_parallel_scope p; -#endif - functor.setup(); - }}, - {[functor]() { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - impl_in_parallel_scope p; -#endif - functor.finalize(); - }}, - n, stacksize); + impl_bulk_setup_finalize_erased( + force_synchronous, is_light_weight_policy, + {[functor](Index i) { functor.execute_range(i); }}, + {[functor]() { functor.setup(); }}, + {[functor]() { functor.finalize(); }}, n, stacksize); } static constexpr const char *name() noexcept { return "HPX"; } @@ -529,6 +476,15 @@ struct MemorySpaceAccess +struct ZeroMemset { + ZeroMemset(const Kokkos::Experimental::HPX &exec, void *dst, size_t cnt) { + exec.fence( + "Kokkos::Impl::ZeroMemset: HostSpace fence before calling std::memset"); + std::memset(dst, 0, cnt); + } +}; + } // namespace Impl } // namespace Kokkos @@ -797,8 +753,16 @@ class TeamPolicyInternal m_league_size = league_size_request; const int max_team_size = 1; // TODO: Can't use team_size_max(...) because // it requires a functor as argument. - m_team_size = - team_size_request > max_team_size ? max_team_size : team_size_request; + + if (team_size_request > max_team_size) { + std::stringstream error; + error << "Kokkos::TeamPolicy: Requested too large team size. " + "Requested: " + << team_size_request << ", Maximum: " << max_team_size; + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); + } + + m_team_size = team_size_request; if (m_chunk_size > 0 && !Kokkos::has_single_bit(static_cast(m_chunk_size))) { @@ -932,6 +896,12 @@ class TeamPolicyInternal init(league_size_request, 1); } + TeamPolicyInternal(const PolicyUpdate, const TeamPolicyInternal &other, + typename traits::execution_space space) + : TeamPolicyInternal(other) { + this->m_space = std::move(space); + } + inline int chunk_size() const { return m_chunk_size; } inline TeamPolicyInternal &set_chunk_size( @@ -999,7 +969,7 @@ class ParallelFor, } inline ParallelFor(const FunctorType &arg_functor, Policy arg_policy) - : m_functor(arg_functor), m_policy(arg_policy) {} + : m_functor(arg_functor), m_policy(std::move(arg_policy)) {} }; template @@ -1321,17 +1291,7 @@ class ParallelScan, const WorkRange range(m_policy, t, num_worker_threads); execute_chunk(range.begin(), range.end(), update_sum, false); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - { - // Since arrive_and_wait may yield and resume on another worker thread we - // set in_parallel = false on the current thread before suspending and set - // it again to true when we resume. - Kokkos::Experimental::HPX::impl_not_in_parallel_scope p; - barrier.arrive_and_wait(); - } -#else barrier.arrive_and_wait(); -#endif if (t == 0) { final_reducer.init(reinterpret_cast( @@ -1353,17 +1313,7 @@ class ParallelScan, } } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - { - // Since arrive_and_wait may yield and resume on another worker thread we - // set in_parallel = false on the current thread before suspending and set - // it again to true when we resume. - Kokkos::Experimental::HPX::impl_not_in_parallel_scope p; - barrier.arrive_and_wait(); - } -#else barrier.arrive_and_wait(); -#endif reference_type update_base = Analysis::Reducer::reference(reinterpret_cast( @@ -1444,17 +1394,7 @@ class ParallelScanWithTotal, const WorkRange range(m_policy, t, num_worker_threads); execute_chunk(range.begin(), range.end(), update_sum, false); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - { - // Since arrive_and_wait may yield and resume on another worker thread we - // set in_parallel = false on the current thread before suspending and set - // it again to true when we resume. - Kokkos::Experimental::HPX::impl_not_in_parallel_scope p; - barrier.arrive_and_wait(); - } -#else barrier.arrive_and_wait(); -#endif if (t == 0) { final_reducer.init(reinterpret_cast( @@ -1476,17 +1416,7 @@ class ParallelScanWithTotal, } } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 - { - // Since arrive_and_wait may yield and resume on another worker thread we - // set in_parallel = false on the current thread before suspending and set - // it again to true when we resume. - Kokkos::Experimental::HPX::impl_not_in_parallel_scope p; - barrier.arrive_and_wait(); - } -#else barrier.arrive_and_wait(); -#endif reference_type update_base = Analysis::Reducer::reference(reinterpret_cast( @@ -1587,10 +1517,35 @@ class ParallelFor, ParallelFor(const FunctorType &arg_functor, const Policy &arg_policy) : m_functor(arg_functor), m_policy(arg_policy), - m_league(arg_policy.league_size()), - m_shared(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) + + m_league(m_policy.league_size()), + m_shared(m_policy.scratch_size(0) + m_policy.scratch_size(1) + FunctorTeamShmemSize::value( - arg_functor, arg_policy.team_size())) {} + m_functor, m_policy.team_size())) { + if ((m_policy.scratch_size(0) + FunctorTeamShmemSize::value( + m_functor, m_policy.team_size())) > + static_cast( + TeamPolicy::scratch_size_max(0))) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too much scratch memory " + "on level 0. Requested: " + << m_policy.scratch_size(0) + + FunctorTeamShmemSize::value( + m_functor, m_policy.team_size()) + << ", Maximum: " + << TeamPolicy::scratch_size_max(0); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); + } + if (m_policy.scratch_size(1) > + static_cast( + TeamPolicy::scratch_size_max(1))) { + std::stringstream error; + error << "Kokkos::parallel_for: Requested too much scratch memory " + "on level 1. Requested: " + << m_policy.scratch_size(1) << ", Maximum: " + << TeamPolicy::scratch_size_max(1); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); + } + } }; template @@ -1715,6 +1670,32 @@ class ParallelReduce::accessible, "HPX reduce result must be a View accessible from HostSpace"); + if ((arg_policy.scratch_size(0) + + FunctorTeamShmemSize::value( + arg_functor_reducer.get_functor(), arg_policy.team_size())) > + static_cast( + TeamPolicy::scratch_size_max(0))) { + std::stringstream error; + error << "Kokkos::parallel_reduce: Requested too much scratch " + "memory on level 0. Requested: " + << arg_policy.scratch_size(0) + + FunctorTeamShmemSize::value( + arg_functor_reducer.get_functor(), + arg_policy.team_size()) + << ", Maximum: " + << TeamPolicy::scratch_size_max(0); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); + } + if (arg_policy.scratch_size(1) > + static_cast( + TeamPolicy::scratch_size_max(1))) { + std::stringstream error; + error << "Kokkos::parallel_reduce: Requested too much scratch " + "memory on level 1. Requested: " + << arg_policy.scratch_size(1) << ", Maximum: " + << TeamPolicy::scratch_size_max(1); + Kokkos::Impl::throw_runtime_exception(error.str().c_str()); + } } }; } // namespace Impl @@ -2089,9 +2070,5 @@ KOKKOS_INLINE_FUNCTION void single( } // namespace Kokkos -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -#include -#endif - #endif /* #if defined( KOKKOS_ENABLE_HPX ) */ #endif /* #ifndef KOKKOS_HPX_HPP */ diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp index cf0d1add1268..1a9d38f33d80 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HPX_MDRANGEPOLICY_HPP_ #define KOKKOS_HPX_MDRANGEPOLICY_HPP_ diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp deleted file mode 100644 index ad540a203d5b..000000000000 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE -#define KOKKOS_IMPL_PUBLIC_INCLUDE -#endif - -#include -#if defined(KOKKOS_ENABLE_HPX) && defined(KOKKOS_ENABLE_TASKDAG) - -#include - -#include - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -template class TaskQueue; - -} // namespace Impl -} // namespace Kokkos - -#else -void KOKKOS_CORE_SRC_IMPL_HPX_TASK_PREVENT_LINK_ERROR() {} -#endif // #if defined( KOKKOS_ENABLE_HPX ) && defined( KOKKOS_ENABLE_TASKDAG ) diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp deleted file mode 100644 index 42603440355d..000000000000 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp +++ /dev/null @@ -1,274 +0,0 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER - -#ifndef KOKKOS_HPX_TASK_HPP -#define KOKKOS_HPX_TASK_HPP - -#include -#if defined(KOKKOS_ENABLE_HPX) && defined(KOKKOS_ENABLE_TASKDAG) - -#include -#include - -#include - -#include - -#include -#include - -#include - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS -// We allow using deprecated classes in this file -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_PUSH() -#endif - -namespace Kokkos { -namespace Impl { - -template -class TaskQueueSpecialization< - SimpleTaskScheduler> { - public: - void setup() const { - const int num_worker_threads = Kokkos::Experimental::HPX().concurrency(); - - hpx_thread_buffer &buffer = Kokkos::Experimental::HPX().impl_get_buffer(); - buffer.resize(num_worker_threads, 512); - } - - void execute_range(int t) const { - // NOTE: This implementation has been simplified based on the - // assumption that team_size = 1. The HPX backend currently only - // supports a team size of 1. - const int num_worker_threads = Kokkos::Experimental::HPX().concurrency(); - - hpx_thread_buffer &buffer = Kokkos::Experimental::HPX().impl_get_buffer(); - - buffer.get(t); - HPXTeamMember member( - TeamPolicyInternal( - Kokkos::Experimental::HPX(), num_worker_threads, 1), - 0, t, buffer.get(t), 512); - - member_type single_exec(*scheduler, member); - member_type &team_exec = single_exec; - - auto &queue = scheduler->queue(); - auto &team_scheduler = team_exec.scheduler(); - - using task_base_type = typename scheduler_type::task_base_type; - auto current_task = OptionalRef(nullptr); - - while (!queue.is_done()) { - current_task = queue.pop_ready_task(team_scheduler.team_scheduler_info()); - - if (current_task) { - KOKKOS_EXPECTS(current_task->is_single_runnable() || - current_task->is_team_runnable()); - current_task->as_runnable_task().run(single_exec); - queue.complete((*std::move(current_task)).as_runnable_task(), - team_scheduler.team_scheduler_info()); - } - } - } - - void finalize() const {} - - using execution_space = Kokkos::Experimental::HPX; - using scheduler_type = - SimpleTaskScheduler; - using member_type = - TaskTeamMemberAdapter; - using memory_space = Kokkos::HostSpace; - - static void execute(scheduler_type const &scheduler) { - // NOTE: We create an instance so that we can use impl_bulk_setup_finalize. - // This is not necessarily the most efficient, but can be improved later. - TaskQueueSpecialization task_queue; - task_queue.scheduler = &scheduler; - const int num_worker_threads = Kokkos::Experimental::HPX().concurrency(); - Kokkos::Experimental::HPX().impl_bulk_setup_finalize( - true, false, task_queue, num_worker_threads, - hpx::threads::thread_stacksize::nostack); - } - - static uint32_t get_max_team_count(execution_space const &espace) { - return static_cast(espace.concurrency()); - } - - template - static void get_function_pointer(typename TaskType::function_type &ptr, - typename TaskType::destroy_type &dtor) { - ptr = TaskType::apply; - dtor = TaskType::destroy; - } - - private: - const scheduler_type *scheduler; -}; - -template -class TaskQueueSpecializationConstrained< - Scheduler, - std::enable_if_t>> { - public: - void setup() const { - const int num_worker_threads = Kokkos::Experimental::HPX().concurrency(); - - hpx_thread_buffer &buffer = Kokkos::Experimental::HPX().impl_get_buffer(); - buffer.resize(num_worker_threads, 512); - - auto &queue = scheduler->queue(); - queue.initialize_team_queues(num_worker_threads); - } - - void execute_range(int t) const { - // NOTE: This implementation has been simplified based on the - // assumption that team_size = 1. The HPX backend currently only - // supports a team size of 1. - const int num_worker_threads = Kokkos::Experimental::HPX().concurrency(); - - hpx_thread_buffer &buffer = Kokkos::Experimental::HPX().impl_get_buffer(); - - buffer.get(Kokkos::Experimental::HPX::impl_hardware_thread_id()); - HPXTeamMember member( - TeamPolicyInternal( - Kokkos::Experimental::HPX(), num_worker_threads, 1), - 0, t, buffer.get(t), 512); - - using task_base_type = typename scheduler_type::task_base; - using queue_type = typename scheduler_type::queue_type; - - static task_base_type *const end = (task_base_type *)task_base_type::EndTag; - constexpr task_base_type *no_more_tasks_sentinel = nullptr; - - member_type single_exec(*scheduler, member); - member_type &team_exec = single_exec; - - auto &team_queue = team_exec.scheduler().queue(); - task_base_type *task = no_more_tasks_sentinel; - - do { - if (task != no_more_tasks_sentinel && task != end) { - team_queue.complete(task); - } - - if (desul::atomic_load(&team_queue.m_ready_count, - desul::MemoryOrderAcquire(), - desul::MemoryScopeDevice()) > 0) { - task = end; - for (int i = 0; i < queue_type::NumQueue && end == task; ++i) { - for (int j = 0; j < 2 && end == task; ++j) { - task = queue_type::pop_ready_task(&team_queue.m_ready[i][j]); - } - } - } else { - task = team_queue.attempt_to_steal_task(); - } - - if (task != no_more_tasks_sentinel && task != end) { - (*task->m_apply)(task, &single_exec); - } - } while (task != no_more_tasks_sentinel); - } - - void finalize() const {} - - using execution_space = Kokkos::Experimental::HPX; - using scheduler_type = Scheduler; - using member_type = - TaskTeamMemberAdapter; - using memory_space = Kokkos::HostSpace; - - static void iff_single_thread_recursive_execute( - scheduler_type const &scheduler) { - using task_base_type = typename scheduler_type::task_base; - using queue_type = typename scheduler_type::queue_type; - - if (1 == Kokkos::Experimental::HPX().concurrency()) { - task_base_type *const end = (task_base_type *)task_base_type::EndTag; - task_base_type *task = end; - - HPXTeamMember member(TeamPolicyInternal( - Kokkos::Experimental::HPX(), 1, 1), - 0, 0, nullptr, 0); - member_type single_exec(scheduler, member); - - do { - task = end; - - // Loop by priority and then type - for (int i = 0; i < queue_type::NumQueue && end == task; ++i) { - for (int j = 0; j < 2 && end == task; ++j) { - task = - queue_type::pop_ready_task(&scheduler.m_queue->m_ready[i][j]); - } - } - - if (end == task) break; - - (*task->m_apply)(task, &single_exec); - - scheduler.m_queue->complete(task); - - } while (true); - } - } - - static void execute(scheduler_type const &scheduler) { - // NOTE: We create an instance so that we can use impl_bulk_setup_finalize. - // This is not necessarily the most efficient, but can be improved later. - TaskQueueSpecializationConstrained task_queue; - task_queue.scheduler = &scheduler; - const int num_worker_threads = Kokkos::Experimental::HPX().concurrency(); - Kokkos::Experimental::HPX().impl_bulk_setup_finalize( - true, false, task_queue, num_worker_threads, - hpx::threads::thread_stacksize::nostack); - } - - template - static void get_function_pointer(typename TaskType::function_type &ptr, - typename TaskType::destroy_type &dtor) { - ptr = TaskType::apply; - dtor = TaskType::destroy; - } - - private: - const scheduler_type *scheduler; -}; - -extern template class TaskQueue< - Kokkos::Experimental::HPX, - typename Kokkos::Experimental::HPX::memory_space>; - -} // namespace Impl -} // namespace Kokkos - -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS -KOKKOS_IMPL_DISABLE_DEPRECATED_WARNINGS_POP() -#endif - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#endif /* #if defined( KOKKOS_ENABLE_TASKDAG ) */ -#endif /* #ifndef KOKKOS_HPX_TASK_HPP */ diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp index eb4f3da11af0..b2b1a7b20fea 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_HPX_WORKGRAPHPOLICY_HPP #define KOKKOS_HPX_WORKGRAPHPOLICY_HPP diff --git a/packages/kokkos/core/src/KokkosExp_InterOp.hpp b/packages/kokkos/core/src/KokkosExp_InterOp.hpp index 80b380e73816..25470420c3d6 100644 --- a/packages/kokkos/core/src/KokkosExp_InterOp.hpp +++ b/packages/kokkos/core/src/KokkosExp_InterOp.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_CORE_EXP_INTEROP_HPP #define KOKKOS_CORE_EXP_INTEROP_HPP @@ -84,8 +71,7 @@ template struct python_view_type { static_assert(Kokkos::is_view>::value); - using type = - Kokkos::Impl::python_view_type_impl_t; + using type = Kokkos::Impl::python_view_type_impl_t; }; template diff --git a/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp b/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp index 975f511d12b6..f43f61d0e254 100644 --- a/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include @@ -30,21 +17,11 @@ static_assert(false, #include #include #include +#include #include namespace Kokkos { -// ------------------------------------------------------------------ // -// Moved to Kokkos_Layout.hpp for more general accessibility -/* -enum class Iterate -{ - Default, // Default for the device - Left, // Left indices stride fastest - Right, // Right indices stride fastest -}; -*/ - template struct default_outer_direction { using type = Iterate; @@ -58,6 +35,7 @@ struct default_inner_direction { }; namespace Impl { + // NOTE the comparison below is encapsulated to silent warnings about pointless // comparison of unsigned integer with zero template @@ -135,10 +113,10 @@ constexpr NVCC_WONT_LET_ME_CALL_YOU_Array to_array_potentially_narrowing( } struct TileSizeProperties { - int max_threads; - int default_largest_tile_size; - int default_tile_size; + int max_threads; // (per SM, CU) int max_total_tile_size; + // For GPU backends: hardware limits for block dimensions + std::array max_threads_dimensions; }; template @@ -146,12 +124,58 @@ TileSizeProperties get_tile_size_properties(const ExecutionSpace&) { // Host settings TileSizeProperties properties; properties.max_threads = std::numeric_limits::max(); - properties.default_largest_tile_size = 0; - properties.default_tile_size = 2; properties.max_total_tile_size = std::numeric_limits::max(); + properties.max_threads_dimensions[0] = std::numeric_limits::max(); + properties.max_threads_dimensions[1] = std::numeric_limits::max(); + properties.max_threads_dimensions[2] = std::numeric_limits::max(); return properties; } +// Default tile size recommended (for MDRangePolicy) +template +struct TileSizeRecommended { + template + static auto get(Policy const& policy); +}; + +// Recommend tile sizes for each rank of MDRangePolicy. +// Each rank is tiled with a default size of 2, except the innermost rank which +// is set to its full work range length. +template +template +auto TileSizeRecommended::get(Policy const& policy) { + constexpr auto InnerDirection = Policy::inner_direction; + constexpr int Rank = Policy::rank; + + using tile_type = Kokkos::Array; + + tile_type recommended_tile_sizes{}; + int default_tile_size = 2; + int max_total_tile_size = policy.max_total_tile_size(); + + int inner_rank = (InnerDirection == Iterate::Right) ? Rank - 1 : 0; + int outer_bound = (InnerDirection == Iterate::Right) ? -1 : Rank; + int iter_step = (InnerDirection == Iterate::Right) ? -1 : 1; + auto inner_work_range = + policy.m_upper[inner_rank] - policy.m_lower[inner_rank]; + + int prod_tile_size = 1; + for (int i = inner_rank; i != outer_bound; i += iter_step) { + int rank_tile_size = 1; + if (prod_tile_size * default_tile_size <= max_total_tile_size) { + rank_tile_size = default_tile_size; + } else { + rank_tile_size = 1; + } + if (i == inner_rank) { + rank_tile_size = std::max(inner_work_range, 1); + } + prod_tile_size *= rank_tile_size; + recommended_tile_sizes[i] = rank_tile_size; + } + return recommended_tile_sizes; +} + } // namespace Impl // multi-dimensional iteration pattern @@ -168,14 +192,13 @@ struct MDRangePolicy; template struct MDRangePolicy : public Kokkos::Impl::PolicyTraits { - using traits = Kokkos::Impl::PolicyTraits; - using range_policy = RangePolicy; - - typename traits::execution_space m_space; + using traits = Kokkos::Impl::PolicyTraits; + using execution_space = typename traits::execution_space; + using range_policy = RangePolicy; using impl_range_policy = - RangePolicy; + RangePolicy; using execution_policy = MDRangePolicy; // needed for is_execution_policy @@ -210,13 +233,17 @@ struct MDRangePolicy // as template parameter to the MDRangePolicy or static_cast the individual // values - point_type m_lower = {}; - point_type m_upper = {}; - tile_type m_tile = {}; - point_type m_tile_end = {}; - index_type m_num_tiles = 1; - index_type m_prod_tile_dims = 1; - bool m_tune_tile_size = false; + execution_space m_space; + + point_type m_lower = {}; + point_type m_upper = {}; + tile_type m_tile = {}; + point_type m_tile_end = {}; + index_type m_num_tiles = 1; + index_type m_prod_tile_dims = 1; + bool m_tune_tile_size = false; + index_type m_max_total_tile_size = 1; + std::array m_max_threads_dimensions = {1, 1, 1}; static constexpr auto outer_direction = (iteration_pattern::outer_direction != Iterate::Default) @@ -288,7 +315,7 @@ struct MDRangePolicy point_type const& lower, point_type const& upper, tile_type const& tile = tile_type{}) : m_space(work_space), m_lower(lower), m_upper(upper), m_tile(tile) { - init_helper(Impl::get_tile_size_properties(work_space)); + update_tiling_properties(); } template Impl::to_array_potentially_narrowing( tile)) {} + MDRangePolicy(const Impl::PolicyUpdate, const MDRangePolicy& other, + typename traits::execution_space space) + : MDRangePolicy(other) { + this->m_space = std::move(space); + // Reset auto-tuned tiles if the execution space changes since the computed + // tile size may be different + if (this->m_tune_tile_size) { + this->m_tile = {}; + } + update_tiling_properties(); + } + template MDRangePolicy(const MDRangePolicy p) : traits(p), // base class may contain data such as desired occupancy @@ -323,104 +362,116 @@ struct MDRangePolicy m_tile_end(p.m_tile_end), m_num_tiles(p.m_num_tiles), m_prod_tile_dims(p.m_prod_tile_dims), - m_tune_tile_size(p.m_tune_tile_size) {} + m_tune_tile_size(p.m_tune_tile_size), + m_max_total_tile_size(p.m_max_total_tile_size), + m_max_threads_dimensions(p.m_max_threads_dimensions) {} void impl_change_tile_size(const point_type& tile) { - m_tile = tile; - init_helper(Impl::get_tile_size_properties(m_space)); + this->m_tile = tile; + this->update_tiling_properties(); } + bool impl_tune_tile_size() const { return m_tune_tile_size; } tile_type tile_size_recommended() const { - tile_type rec_tile_sizes = {}; - - for (std::size_t i = 0; i < rec_tile_sizes.size(); ++i) { - rec_tile_sizes[i] = tile_size_recommended(i); - } - return rec_tile_sizes; + return Kokkos::Impl::TileSizeRecommended::get(*this); } - int max_total_tile_size() const { - return Impl::get_tile_size_properties(m_space).max_total_tile_size; - } + index_type max_total_tile_size() const { return m_max_total_tile_size; } private: - int tile_size_recommended(const int tile_rank) const { - auto properties = Impl::get_tile_size_properties(m_space); - int last_rank = (inner_direction == Iterate::Right) ? rank - 1 : 0; - int rank_acc = - (inner_direction == Iterate::Right) ? tile_rank + 1 : tile_rank - 1; - int rec_tile_size = (std::pow(properties.default_tile_size, rank_acc) < - properties.max_total_tile_size) - ? properties.default_tile_size - : 1; - - if (tile_rank == last_rank) { - rec_tile_size = tile_size_last_rank( - properties, m_upper[last_rank] - m_lower[last_rank]); + void update_tiling_properties() { + auto properties = Impl::get_tile_size_properties(m_space); + this->m_num_tiles = 1; + this->m_prod_tile_dims = 1; + this->m_max_total_tile_size = + static_cast(properties.max_total_tile_size); + this->m_max_threads_dimensions = properties.max_threads_dimensions; + + index_type effective_max_tile_size = this->m_max_total_tile_size; + + constexpr bool enforce_launch_bounds = +#if defined(KOKKOS_ENABLE_CUDA) + std::is_same_v; +#elif defined(KOKKOS_ENABLE_HIP) + std::is_same_v; +#else + false; +#endif + + if constexpr (enforce_launch_bounds && launch_bounds::maxTperB != 0) { + effective_max_tile_size = + std::min(effective_max_tile_size, + static_cast(launch_bounds::maxTperB)); } - return rec_tile_size; - } - int tile_size_last_rank(const Impl::TileSizeProperties properties, - const index_type length) const { - return properties.default_largest_tile_size == 0 - ? std::max(length, 1) - : properties.default_largest_tile_size; - } + tile_type default_tile = this->tile_size_recommended(); - void init_helper(Impl::TileSizeProperties properties) { - m_prod_tile_dims = 1; - int increment = 1; - int rank_start = 0; - int rank_end = rank; - if (inner_direction == Iterate::Right) { - increment = -1; - rank_start = rank - 1; - rank_end = -1; - } + int inner_rank = (inner_direction == Iterate::Right) ? rank - 1 : 0; + int outer_bound = (inner_direction == Iterate::Right) ? -1 : rank; + int iter_step = (inner_direction == Iterate::Right) ? -1 : 1; - for (int i = rank_start; i != rank_end; i += increment) { - const index_type length = m_upper[i] - m_lower[i]; + for (int i = inner_rank; i != outer_bound; i += iter_step) { + const index_type length = this->m_upper[i] - this->m_lower[i]; - if (m_upper[i] < m_lower[i]) { + if (this->m_upper[i] < this->m_lower[i]) { std::string msg = "Kokkos::MDRangePolicy bounds error: The lower bound (" + - std::to_string(m_lower[i]) + ") is greater than its upper bound (" + - std::to_string(m_upper[i]) + ") in dimension " + std::to_string(i) + - ".\n"; -#if !defined(KOKKOS_ENABLE_DEPRECATED_CODE_4) + std::to_string(this->m_lower[i]) + + ") is greater than its upper bound (" + + std::to_string(this->m_upper[i]) + ") in dimension " + + std::to_string(i) + ".\n"; Kokkos::abort(msg.c_str()); -#elif defined(KOKKOS_ENABLE_DEPRECATION_WARNINGS) - Kokkos::Impl::log_warning(msg); -#endif } - if (m_tile[i] <= 0) { - m_tune_tile_size = true; - if ((inner_direction == Iterate::Right && (i < rank - 1)) || - (inner_direction == Iterate::Left && (i > 0))) { - if (m_prod_tile_dims * properties.default_tile_size < - static_cast(properties.max_total_tile_size)) { - m_tile[i] = properties.default_tile_size; - } else { - m_tile[i] = 1; - } + // If tile size is not specified or <= 0 set to recommended tile size + if (this->m_tile[i] <= 0) { + this->m_tune_tile_size = true; + // Set to recommended tile size if it fits within effective limit + if (this->m_prod_tile_dims * default_tile[i] <= + effective_max_tile_size) { + this->m_tile[i] = default_tile[i]; } else { - m_tile[i] = tile_size_last_rank(properties, length); + // Try to fit within effective limit by reducing tile size + while (default_tile[i] > 1 && + this->m_prod_tile_dims * default_tile[i] > + effective_max_tile_size) { + default_tile[i] >>= 1; + } + this->m_tile[i] = (default_tile[i] > 1) ? default_tile[i] : 1; } } - m_tile_end[i] = - static_cast((length + m_tile[i] - 1) / m_tile[i]); - m_num_tiles *= m_tile_end[i]; - m_prod_tile_dims *= m_tile[i]; + + this->m_tile_end[i] = static_cast( + (length + this->m_tile[i] - 1) / this->m_tile[i]); + this->m_num_tiles *= this->m_tile_end[i]; + this->m_prod_tile_dims *= this->m_tile[i]; } - if (m_prod_tile_dims > static_cast(properties.max_threads)) { - printf(" Product of tile dimensions exceed maximum limit: %d\n", - static_cast(properties.max_threads)); - Kokkos::abort( - "ExecSpace Error: MDRange tile dims exceed maximum number " - "of threads per block - choose smaller tile dims"); + + if constexpr (enforce_launch_bounds && launch_bounds::maxTperB != 0) { + if (static_cast(launch_bounds::maxTperB) < + this->m_prod_tile_dims) { + std::string msg = + "Kokkos::MDRangePolicy tile dimensions error: Product of tile " + "dimensions (" + + std::to_string(static_cast(this->m_prod_tile_dims)) + + ") is greater than the maximum specified via LaunchBounds (" + + std::to_string(launch_bounds::maxTperB) + + ") - choose smaller tile dims\n"; + Kokkos::abort(msg.c_str()); + } + } + + if (this->m_prod_tile_dims > + static_cast(this->m_max_total_tile_size)) { + std::string msg = + "Kokkos::MDRangePolicy tile dimensions error: Product of tile " + "dimensions (" + + std::to_string(static_cast(this->m_prod_tile_dims)) + + ") is greater than the maximum total tile size (" + + std::to_string(static_cast(this->m_max_total_tile_size)) + + ") - choose smaller tile dims\n"; + Kokkos::abort(msg.c_str()); } } }; diff --git a/packages/kokkos/core/src/Kokkos_Abort.hpp b/packages/kokkos/core/src/Kokkos_Abort.hpp index a8f38837ea04..d75a596ed58a 100644 --- a/packages/kokkos/core/src/Kokkos_Abort.hpp +++ b/packages/kokkos/core/src/Kokkos_Abort.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ABORT_HPP #define KOKKOS_ABORT_HPP @@ -28,6 +15,9 @@ #ifdef KOKKOS_ENABLE_SYCL #include #endif +#ifdef KOKKOS_ENABLE_NEXTSILICON +#include +#endif namespace Kokkos { namespace Impl { @@ -55,7 +45,7 @@ namespace Impl { #elif defined(KOKKOS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__) // FIXME_SYCL SYCL doesn't abort #define KOKKOS_IMPL_ABORT_NORETURN -#elif !defined(KOKKOS_ENABLE_OPENMPTARGET) && !defined(KOKKOS_ENABLE_OPENACC) +#elif !defined(KOKKOS_ENABLE_OPENACC) // Host aborts #define KOKKOS_IMPL_ABORT_NORETURN [[noreturn]] #else @@ -72,9 +62,9 @@ namespace Impl { #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE KOKKOS_IMPL_ABORT_NORETURN #endif -#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ - defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \ - defined(KOKKOS_ENABLE_OPENACC) +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENACC) || \ + defined(KOKKOS_ENABLE_NEXTSILICON) KOKKOS_IMPL_ABORT_NORETURN_DEVICE inline KOKKOS_IMPL_DEVICE_FUNCTION void device_abort(const char *const msg) { #if defined(KOKKOS_ENABLE_CUDA) @@ -83,8 +73,10 @@ device_abort(const char *const msg) { ::Kokkos::Impl::hip_abort(msg); #elif defined(KOKKOS_ENABLE_SYCL) ::Kokkos::Impl::sycl_abort(msg); -#elif defined(KOKKOS_ENABLE_OPENMPTARGET) || defined(KOKKOS_ENABLE_OPENACC) - printf("%s", msg); // FIXME_OPENMPTARGET FIXME_OPENACC +#elif defined(KOKKOS_ENABLE_OPENACC) + printf("%s", msg); // FIXME_OPENACC +#elif defined(KOKKOS_ENABLE_NEXTSILICON) + ::Kokkos::Impl::nextsilicon_abort(msg); #else #error faulty logic #endif diff --git a/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp b/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp index 660ee30b7d5e..5d532f5e76c8 100644 --- a/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp +++ b/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include diff --git a/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp b/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp index 62f527aa025c..32bd33423c30 100644 --- a/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include @@ -41,12 +28,7 @@ class AnonymousSpace { using device_type = Kokkos::Device; /**\brief Default memory space instance */ - AnonymousSpace() = default; - AnonymousSpace(AnonymousSpace &&rhs) = default; - AnonymousSpace(const AnonymousSpace &rhs) = default; - AnonymousSpace &operator=(AnonymousSpace &&) = default; - AnonymousSpace &operator=(const AnonymousSpace &) = default; - ~AnonymousSpace() = default; + AnonymousSpace() = default; /**\brief Return Name of the MemorySpace */ static constexpr const char *name() { return "Anonymous"; } diff --git a/packages/kokkos/core/src/Kokkos_Array.hpp b/packages/kokkos/core/src/Kokkos_Array.hpp index bf6400d97ee8..968510b17984 100644 --- a/packages/kokkos/core/src/Kokkos_Array.hpp +++ b/packages/kokkos/core/src/Kokkos_Array.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ARRAY_HPP #define KOKKOS_ARRAY_HPP @@ -35,28 +22,11 @@ namespace Kokkos { #ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK namespace Impl { -template > -struct ArrayBoundsCheck; -template -struct ArrayBoundsCheck { +struct ArrayBoundsCheck { KOKKOS_INLINE_FUNCTION - constexpr ArrayBoundsCheck(Integral i, size_t N) { - if (i < 0) { - char err[128] = "Kokkos::Array: index "; - to_chars_i(err + strlen(err), err + 128, i); - strcat(err, " < 0"); - Kokkos::abort(err); - } - ArrayBoundsCheck(i, N); - } -}; - -template -struct ArrayBoundsCheck { - KOKKOS_INLINE_FUNCTION - constexpr ArrayBoundsCheck(Integral i, size_t N) { - if (size_t(i) >= N) { + constexpr ArrayBoundsCheck(size_t i, size_t N) { + if (i >= N) { char err[128] = "Kokkos::Array: index "; to_chars_i(err + strlen(err), err + 128, i); strcat(err, " >= "); @@ -67,8 +37,7 @@ struct ArrayBoundsCheck { }; } // end namespace Impl -#define KOKKOS_ARRAY_BOUNDS_CHECK(i, N) \ - Kokkos::Impl::ArrayBoundsCheck(i, N) +#define KOKKOS_ARRAY_BOUNDS_CHECK(i, N) Kokkos::Impl::ArrayBoundsCheck(i, N) #else // !defined( KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK ) @@ -79,11 +48,7 @@ struct ArrayBoundsCheck { /**\brief Derived from the C++17 'std::array'. * Dropping the iterator interface. */ -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template -#else template -#endif struct Array { public: /** @@ -103,34 +68,54 @@ struct Array { using pointer = T*; using const_pointer = std::add_const_t*; - KOKKOS_INLINE_FUNCTION static constexpr size_type size() { return N; } - KOKKOS_INLINE_FUNCTION static constexpr bool empty() { return false; } - KOKKOS_INLINE_FUNCTION constexpr size_type max_size() const { return N; } + KOKKOS_INLINE_FUNCTION static constexpr size_type size() noexcept { + return N; + } + KOKKOS_INLINE_FUNCTION static constexpr bool empty() noexcept { + return false; + } + KOKKOS_INLINE_FUNCTION constexpr size_type max_size() const noexcept { + return N; + } - template - KOKKOS_INLINE_FUNCTION constexpr reference operator[](const iType& i) { - static_assert((std::is_integral_v || std::is_enum_v), - "Must be integral argument"); + KOKKOS_INLINE_FUNCTION constexpr reference operator[](size_type i) { KOKKOS_ARRAY_BOUNDS_CHECK(i, N); return m_internal_implementation_private_member_data[i]; } - template KOKKOS_INLINE_FUNCTION constexpr const_reference operator[]( - const iType& i) const { - static_assert((std::is_integral_v || std::is_enum_v), - "Must be integral argument"); + size_type i) const { KOKKOS_ARRAY_BOUNDS_CHECK(i, N); return m_internal_implementation_private_member_data[i]; } - KOKKOS_INLINE_FUNCTION constexpr pointer data() { + KOKKOS_INLINE_FUNCTION constexpr pointer data() noexcept { return &m_internal_implementation_private_member_data[0]; } - KOKKOS_INLINE_FUNCTION constexpr const_pointer data() const { + KOKKOS_INLINE_FUNCTION constexpr const_pointer data() const noexcept { return &m_internal_implementation_private_member_data[0]; } + KOKKOS_INLINE_FUNCTION constexpr pointer begin() noexcept { return data(); } + + KOKKOS_INLINE_FUNCTION constexpr const_pointer begin() const noexcept { + return data(); + } + + KOKKOS_INLINE_FUNCTION constexpr pointer end() noexcept { return data() + N; } + + KOKKOS_INLINE_FUNCTION constexpr const_pointer end() const noexcept { + return data() + N; + } + + KOKKOS_INLINE_FUNCTION constexpr const_pointer cbegin() const noexcept { + return data(); + } + + KOKKOS_INLINE_FUNCTION constexpr const_pointer cend() const noexcept { + return data() + N; + } + friend KOKKOS_FUNCTION constexpr bool operator==(Array const& lhs, Array const& rhs) noexcept { for (size_t i = 0; i != N; ++i) @@ -155,13 +140,8 @@ struct Array { } }; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template -struct Array { -#else template struct Array { -#endif public: using reference = T&; using const_reference = std::add_const_t&; @@ -171,9 +151,13 @@ struct Array { using pointer = T*; using const_pointer = std::add_const_t*; - KOKKOS_INLINE_FUNCTION static constexpr size_type size() { return 0; } - KOKKOS_INLINE_FUNCTION static constexpr bool empty() { return true; } - KOKKOS_INLINE_FUNCTION constexpr size_type max_size() const { return 0; } + KOKKOS_INLINE_FUNCTION static constexpr size_type size() noexcept { + return 0; + } + KOKKOS_INLINE_FUNCTION static constexpr bool empty() noexcept { return true; } + KOKKOS_INLINE_FUNCTION constexpr size_type max_size() const noexcept { + return 0; + } template KOKKOS_INLINE_FUNCTION reference operator[](const iType&) { @@ -191,174 +175,44 @@ struct Array { return *reinterpret_cast(-1); } - KOKKOS_INLINE_FUNCTION constexpr pointer data() { return nullptr; } - KOKKOS_INLINE_FUNCTION constexpr const_pointer data() const { + KOKKOS_INLINE_FUNCTION constexpr pointer data() noexcept { return nullptr; } + KOKKOS_INLINE_FUNCTION constexpr const_pointer data() const noexcept { return nullptr; } - friend KOKKOS_FUNCTION constexpr bool operator==(Array const&, - Array const&) noexcept { - return true; - } - friend KOKKOS_FUNCTION constexpr bool operator!=(Array const&, - Array const&) noexcept { - return false; - } - - private: - friend KOKKOS_INLINE_FUNCTION constexpr void kokkos_swap( - Array&, Array&) noexcept {} -}; - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -namespace Impl { -struct KokkosArrayContiguous {}; -struct KokkosArrayStrided {}; -} // namespace Impl - -template <> -struct KOKKOS_DEPRECATED Array { - using contiguous = Impl::KokkosArrayContiguous; - using strided = Impl::KokkosArrayStrided; -}; - -template -struct KOKKOS_DEPRECATED - Array { - private: - T* m_elem; - size_t m_size; - - public: - using reference = T&; - using const_reference = std::add_const_t&; - using size_type = size_t; - using difference_type = ptrdiff_t; - using value_type = T; - using pointer = T*; - using const_pointer = std::add_const_t*; - - KOKKOS_INLINE_FUNCTION constexpr size_type size() const { return m_size; } - KOKKOS_INLINE_FUNCTION constexpr bool empty() const { return 0 == m_size; } - KOKKOS_INLINE_FUNCTION constexpr size_type max_size() const { return m_size; } + KOKKOS_INLINE_FUNCTION constexpr pointer begin() noexcept { return data(); } - template - KOKKOS_INLINE_FUNCTION reference operator[](const iType& i) { - static_assert((std::is_integral_v || std::is_enum_v), - "Must be integral argument"); - KOKKOS_ARRAY_BOUNDS_CHECK(i, m_size); - return m_elem[i]; - } - - template - KOKKOS_INLINE_FUNCTION const_reference operator[](const iType& i) const { - static_assert((std::is_integral_v || std::is_enum_v), - "Must be integral argument"); - KOKKOS_ARRAY_BOUNDS_CHECK(i, m_size); - return m_elem[i]; + KOKKOS_INLINE_FUNCTION constexpr const_pointer begin() const noexcept { + return data(); } - KOKKOS_INLINE_FUNCTION pointer data() { return m_elem; } - KOKKOS_INLINE_FUNCTION const_pointer data() const { return m_elem; } + KOKKOS_INLINE_FUNCTION constexpr pointer end() noexcept { return data(); } - KOKKOS_DEFAULTED_FUNCTION ~Array() = default; - KOKKOS_INLINE_FUNCTION_DELETED Array() = delete; - KOKKOS_INLINE_FUNCTION_DELETED Array(const Array& rhs) = delete; - - // Some supported compilers are not sufficiently C++11 compliant - // for default move constructor and move assignment operator. - // Array( Array && rhs ) = default ; - // Array & operator = ( Array && rhs ) = delete ; - - KOKKOS_INLINE_FUNCTION - Array& operator=(const Array& rhs) { - if (&rhs == this) return *this; - const size_t n = size() < rhs.size() ? size() : rhs.size(); - for (size_t i = 0; i < n; ++i) m_elem[i] = rhs[i]; - return *this; + KOKKOS_INLINE_FUNCTION constexpr const_pointer end() const noexcept { + return data(); } - template - KOKKOS_INLINE_FUNCTION Array& operator=(const Array& rhs) { - const size_t n = size() < rhs.size() ? size() : rhs.size(); - for (size_t i = 0; i < n; ++i) m_elem[i] = rhs[i]; - return *this; + KOKKOS_INLINE_FUNCTION constexpr const_pointer cbegin() const noexcept { + return data(); } - KOKKOS_INLINE_FUNCTION constexpr Array(pointer arg_ptr, size_type arg_size, - size_type = 0) - : m_elem(arg_ptr), m_size(arg_size) {} -}; - -template -struct KOKKOS_DEPRECATED - Array { - private: - T* m_elem; - size_t m_size; - size_t m_stride; - - public: - using reference = T&; - using const_reference = std::add_const_t&; - using size_type = size_t; - using difference_type = ptrdiff_t; - using value_type = T; - using pointer = T*; - using const_pointer = std::add_const_t*; - - KOKKOS_INLINE_FUNCTION constexpr size_type size() const { return m_size; } - KOKKOS_INLINE_FUNCTION constexpr bool empty() const { return 0 == m_size; } - KOKKOS_INLINE_FUNCTION constexpr size_type max_size() const { return m_size; } - - template - KOKKOS_INLINE_FUNCTION reference operator[](const iType& i) { - static_assert((std::is_integral_v || std::is_enum_v), - "Must be integral argument"); - KOKKOS_ARRAY_BOUNDS_CHECK(i, m_size); - return m_elem[i * m_stride]; + KOKKOS_INLINE_FUNCTION constexpr const_pointer cend() const noexcept { + return data(); } - template - KOKKOS_INLINE_FUNCTION const_reference operator[](const iType& i) const { - static_assert((std::is_integral_v || std::is_enum_v), - "Must be integral argument"); - KOKKOS_ARRAY_BOUNDS_CHECK(i, m_size); - return m_elem[i * m_stride]; - } - - KOKKOS_INLINE_FUNCTION pointer data() { return m_elem; } - KOKKOS_INLINE_FUNCTION const_pointer data() const { return m_elem; } - - KOKKOS_DEFAULTED_FUNCTION ~Array() = default; - KOKKOS_INLINE_FUNCTION_DELETED Array() = delete; - KOKKOS_INLINE_FUNCTION_DELETED Array(const Array&) = delete; - - // Some supported compilers are not sufficiently C++11 compliant - // for default move constructor and move assignment operator. - // Array( Array && rhs ) = default ; - // Array & operator = ( Array && rhs ) = delete ; - - KOKKOS_INLINE_FUNCTION - Array& operator=(const Array& rhs) { - if (&rhs == this) return *this; - const size_t n = size() < rhs.size() ? size() : rhs.size(); - for (size_t i = 0; i < n; ++i) m_elem[i * m_stride] = rhs[i]; - return *this; + friend KOKKOS_FUNCTION constexpr bool operator==(Array const&, + Array const&) noexcept { + return true; } - - template - KOKKOS_INLINE_FUNCTION Array& operator=(const Array& rhs) { - const size_t n = size() < rhs.size() ? size() : rhs.size(); - for (size_t i = 0; i < n; ++i) m_elem[i * m_stride] = rhs[i]; - return *this; + friend KOKKOS_FUNCTION constexpr bool operator!=(Array const&, + Array const&) noexcept { + return false; } - KOKKOS_INLINE_FUNCTION constexpr Array(pointer arg_ptr, size_type arg_size, - size_type arg_stride) - : m_elem(arg_ptr), m_size(arg_size), m_stride(arg_stride) {} + private: + friend KOKKOS_INLINE_FUNCTION constexpr void kokkos_swap( + Array&, Array&) noexcept {} }; -#endif template Array(T, Us...) -> Array; diff --git a/packages/kokkos/core/src/Kokkos_Assert.hpp b/packages/kokkos/core/src/Kokkos_Assert.hpp index 6fea286005e0..e420e7516cfb 100644 --- a/packages/kokkos/core/src/Kokkos_Assert.hpp +++ b/packages/kokkos/core/src/Kokkos_Assert.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_ASSERT_HPP #define KOKKOS_ASSERT_HPP @@ -58,9 +45,7 @@ #else // not debug mode #define KOKKOS_EXPECTS(...) #define KOKKOS_ENSURES(...) -#ifndef KOKKOS_ASSERT #define KOKKOS_ASSERT(...) -#endif // ifndef KOKKOS_ASSERT #endif // end debug mode ifdefs #endif /* #ifndef KOKKOS_ASSERT_HPP */ diff --git a/packages/kokkos/core/src/Kokkos_Atomic.hpp b/packages/kokkos/core/src/Kokkos_Atomic.hpp index ba6113609229..cca71986761a 100644 --- a/packages/kokkos/core/src/Kokkos_Atomic.hpp +++ b/packages/kokkos/core/src/Kokkos_Atomic.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project /// \file Kokkos_Atomic.hpp /// \brief Atomic functions diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp index 384e477f2c97..7a8021ed5e38 100644 --- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp +++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include @@ -21,35 +8,15 @@ static_assert(false, #endif #ifndef KOKKOS_DESUL_ATOMICS_WRAPPER_HPP_ #define KOKKOS_DESUL_ATOMICS_WRAPPER_HPP_ + #include #include -#include // identity_type #include -namespace Kokkos { - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -KOKKOS_DEPRECATED inline const char* atomic_query_version() { - return "KOKKOS_DESUL_ATOMICS"; -} -#endif - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -#if defined(KOKKOS_COMPILER_GNU) && !defined(__PGIC__) && \ - !defined(__CUDA_ARCH__) - -#define KOKKOS_NONTEMPORAL_PREFETCH_LOAD(addr) __builtin_prefetch(addr, 0, 0) -#define KOKKOS_NONTEMPORAL_PREFETCH_STORE(addr) __builtin_prefetch(addr, 1, 0) - -#else - -#define KOKKOS_NONTEMPORAL_PREFETCH_LOAD(addr) ((void)0) -#define KOKKOS_NONTEMPORAL_PREFETCH_STORE(addr) ((void)0) +#include -#endif -#endif -// ============================================================ +namespace Kokkos { #ifdef KOKKOS_ENABLE_ATOMICS_BYPASS #define KOKKOS_DESUL_MEM_SCOPE desul::MemoryScopeCaller() @@ -60,7 +27,7 @@ KOKKOS_DEPRECATED inline const char* atomic_query_version() { namespace Impl { template using not_deduced_atomic_t = - std::add_const_t>>; + std::add_const_t>>; template using enable_if_atomic_t = @@ -78,9 +45,6 @@ KOKKOS_INLINE_FUNCTION void store_fence() { desul::atomic_thread_fence(desul::M // load/store template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_load (T const* ptr) { return desul::atomic_load (const_cast*>(ptr), desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_store(T* ptr, Impl::not_deduced_atomic_t val) { return desul::atomic_store(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template KOKKOS_DEPRECATED_WITH_COMMENT("Use atomic_store() instead!") KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_assign(T* ptr, Impl::not_deduced_atomic_t val) { atomic_store(ptr, val); } -#endif // atomic_fetch_op template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_fetch_add(T* ptr, Impl::not_deduced_atomic_t val) { return desul::atomic_fetch_add(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } @@ -123,26 +87,19 @@ template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_max(T template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_min(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_min(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_mul(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_mul(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_div(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_div(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_mod(T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_fetch_mod(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_and(T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_fetch_and(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_or (T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_fetch_or (const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_xor(T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_fetch_xor(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_nand(T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_nand_fetch(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_lshift(T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_fetch_lshift(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_rshift(T* ptr, Impl::not_deduced_atomic_t val) { (void)desul::atomic_fetch_rshift(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_mod(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_mod(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_and(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_and(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_or (T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_or (const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_xor(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_xor(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_nand(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_nand(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_lshift(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_lshift(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } +template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_rshift(T* ptr, Impl::not_deduced_atomic_t val) { desul::atomic_rshift(const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_inc(T* ptr) { desul::atomic_inc(const_cast*>(ptr), desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_dec(T* ptr) { desul::atomic_dec(const_cast*>(ptr), desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template KOKKOS_DEPRECATED_WITH_COMMENT("Use atomic_inc() instead!") KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_increment(T* ptr) { atomic_inc(ptr); } -template KOKKOS_DEPRECATED_WITH_COMMENT("Use atomic_dec() instead!") KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_decrement(T* ptr) { atomic_dec(ptr); } -#endif // exchange template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_exchange (T* ptr, Impl::not_deduced_atomic_t val) { return desul::atomic_exchange (const_cast*>(ptr), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } template KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_compare_exchange(T* ptr, Impl::not_deduced_atomic_t expected, Impl::not_deduced_atomic_t desired) { return desul::atomic_compare_exchange(const_cast*>(ptr), expected, desired, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 -template KOKKOS_DEPRECATED_WITH_COMMENT("Use atomic_compare_exchange() instead!") KOKKOS_FUNCTION Impl::enable_if_atomic_t atomic_compare_exchange_strong(T* ptr, Impl::not_deduced_atomic_t expected, Impl::not_deduced_atomic_t desired) { return expected == atomic_compare_exchange(ptr, expected, desired); } -#endif // clang-format on } // namespace Kokkos diff --git a/packages/kokkos/core/src/Kokkos_BitManipulation.hpp b/packages/kokkos/core/src/Kokkos_BitManipulation.hpp index f314e3fa4d1c..09f644647050 100644 --- a/packages/kokkos/core/src/Kokkos_BitManipulation.hpp +++ b/packages/kokkos/core/src/Kokkos_BitManipulation.hpp @@ -1,18 +1,5 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 4.0 -// Copyright (2022) 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. -// -// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. -// See https://kokkos.org/LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//@HEADER +// SPDX-FileCopyrightText: Copyright Contributors to the Kokkos project #ifndef KOKKOS_BIT_MANIPULATION_HPP #define KOKKOS_BIT_MANIPULATION_HPP @@ -20,80 +7,287 @@ #include #include #include // CHAR_BIT +#include #include //memcpy #include namespace Kokkos::Impl { -template -KOKKOS_FUNCTION constexpr T byteswap_fallback(T x) { - if constexpr (sizeof(T) > 1) { - using U = std::make_unsigned_t; +template