From 72475be17808cf8f8b4744c8c72ab1e8cb78ec37 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 22 Nov 2022 09:57:38 -0500 Subject: [PATCH] Make Kokkos a required dependency and bundle Kokkos 3.7.00 --- bundled/CMakeLists.txt | 10 + bundled/README.md | 9 + bundled/kokkos-3.7.00/CMakeLists.txt | 73 + bundled/kokkos-3.7.00/Copyright.txt | 41 + bundled/kokkos-3.7.00/LICENSE | 43 + .../algorithms/src/KokkosAlgorithms_dummy.cpp | 1 + .../algorithms/src/Kokkos_Random.hpp | 1601 +++++++ .../algorithms/src/Kokkos_Sort.hpp | 696 +++ .../algorithms/src/Kokkos_StdAlgorithms.hpp | 146 + .../Kokkos_AdjacentDifference.hpp | 188 + .../std_algorithms/Kokkos_AdjacentFind.hpp | 124 + .../src/std_algorithms/Kokkos_AllOf.hpp | 94 + .../src/std_algorithms/Kokkos_AnyOf.hpp | 94 + .../src/std_algorithms/Kokkos_BeginEnd.hpp | 105 + .../src/std_algorithms/Kokkos_Copy.hpp | 97 + .../std_algorithms/Kokkos_CopyBackward.hpp | 95 + .../src/std_algorithms/Kokkos_CopyIf.hpp | 99 + .../src/std_algorithms/Kokkos_CopyN.hpp | 98 + .../src/std_algorithms/Kokkos_Count.hpp | 94 + .../src/std_algorithms/Kokkos_CountIf.hpp | 99 + .../src/std_algorithms/Kokkos_Distance.hpp | 69 + .../src/std_algorithms/Kokkos_Equal.hpp | 198 + .../std_algorithms/Kokkos_ExclusiveScan.hpp | 190 + .../src/std_algorithms/Kokkos_Fill.hpp | 86 + .../src/std_algorithms/Kokkos_FillN.hpp | 91 + .../src/std_algorithms/Kokkos_Find.hpp | 89 + .../src/std_algorithms/Kokkos_FindEnd.hpp | 149 + .../src/std_algorithms/Kokkos_FindFirstOf.hpp | 150 + .../src/std_algorithms/Kokkos_FindIf.hpp | 95 + .../src/std_algorithms/Kokkos_FindIfNot.hpp | 98 + .../src/std_algorithms/Kokkos_ForEach.hpp | 95 + .../src/std_algorithms/Kokkos_ForEachN.hpp | 96 + .../src/std_algorithms/Kokkos_Generate.hpp | 91 + .../src/std_algorithms/Kokkos_GenerateN.hpp | 93 + .../std_algorithms/Kokkos_InclusiveScan.hpp | 223 + .../std_algorithms/Kokkos_IsPartitioned.hpp | 92 + .../src/std_algorithms/Kokkos_IsSorted.hpp | 131 + .../std_algorithms/Kokkos_IsSortedUntil.hpp | 134 + .../src/std_algorithms/Kokkos_IterSwap.hpp | 92 + .../Kokkos_LexicographicalCompare.hpp | 154 + .../src/std_algorithms/Kokkos_MaxElement.hpp | 132 + .../src/std_algorithms/Kokkos_MinElement.hpp | 132 + .../std_algorithms/Kokkos_MinMaxElement.hpp | 133 + .../src/std_algorithms/Kokkos_Mismatch.hpp | 160 + .../src/std_algorithms/Kokkos_Move.hpp | 94 + .../std_algorithms/Kokkos_MoveBackward.hpp | 95 + .../src/std_algorithms/Kokkos_NoneOf.hpp | 94 + .../std_algorithms/Kokkos_PartitionCopy.hpp | 110 + .../std_algorithms/Kokkos_PartitionPoint.hpp | 91 + .../src/std_algorithms/Kokkos_Reduce.hpp | 221 + .../src/std_algorithms/Kokkos_Remove.hpp | 91 + .../src/std_algorithms/Kokkos_RemoveCopy.hpp | 106 + .../std_algorithms/Kokkos_RemoveCopyIf.hpp | 110 + .../src/std_algorithms/Kokkos_RemoveIf.hpp | 92 + .../src/std_algorithms/Kokkos_Replace.hpp | 93 + .../src/std_algorithms/Kokkos_ReplaceCopy.hpp | 107 + .../std_algorithms/Kokkos_ReplaceCopyIf.hpp | 111 + .../src/std_algorithms/Kokkos_ReplaceIf.hpp | 96 + .../src/std_algorithms/Kokkos_Reverse.hpp | 87 + .../src/std_algorithms/Kokkos_ReverseCopy.hpp | 95 + .../src/std_algorithms/Kokkos_Rotate.hpp | 89 + .../src/std_algorithms/Kokkos_RotateCopy.hpp | 100 + .../src/std_algorithms/Kokkos_Search.hpp | 148 + .../src/std_algorithms/Kokkos_SearchN.hpp | 144 + .../src/std_algorithms/Kokkos_ShiftLeft.hpp | 89 + .../src/std_algorithms/Kokkos_ShiftRight.hpp | 89 + .../src/std_algorithms/Kokkos_Swap.hpp | 69 + .../src/std_algorithms/Kokkos_SwapRanges.hpp | 97 + .../src/std_algorithms/Kokkos_Transform.hpp | 166 + .../Kokkos_TransformExclusiveScan.hpp | 131 + .../Kokkos_TransformInclusiveScan.hpp | 190 + .../std_algorithms/Kokkos_TransformReduce.hpp | 283 ++ .../src/std_algorithms/Kokkos_Unique.hpp | 124 + .../src/std_algorithms/Kokkos_UniqueCopy.hpp | 143 + .../impl/Kokkos_AdjacentDifference.hpp | 135 + .../impl/Kokkos_AdjacentFind.hpp | 140 + .../impl/Kokkos_AllOfAnyOfNoneOf.hpp | 77 + .../impl/Kokkos_Constraints.hpp | 237 + .../impl/Kokkos_CopyBackward.hpp | 103 + .../std_algorithms/impl/Kokkos_CopyCopyN.hpp | 116 + .../src/std_algorithms/impl/Kokkos_CopyIf.hpp | 142 + .../impl/Kokkos_CountCountIf.hpp | 112 + .../src/std_algorithms/impl/Kokkos_Equal.hpp | 147 + .../impl/Kokkos_ExclusiveScan.hpp | 232 + .../std_algorithms/impl/Kokkos_FillFillN.hpp | 106 + .../std_algorithms/impl/Kokkos_FindEnd.hpp | 191 + .../impl/Kokkos_FindFirstOf.hpp | 161 + .../impl/Kokkos_FindIfOrNot.hpp | 146 + .../impl/Kokkos_ForEachForEachN.hpp | 113 + .../impl/Kokkos_GenerateGenerateN.hpp | 105 + .../impl/Kokkos_HelperPredicates.hpp | 120 + .../Kokkos_IdentityReferenceUnaryFunctor.hpp | 64 + .../impl/Kokkos_InclusiveScan.hpp | 243 + .../impl/Kokkos_IsPartitioned.hpp | 148 + .../std_algorithms/impl/Kokkos_IsSorted.hpp | 117 + .../impl/Kokkos_IsSortedUntil.hpp | 153 + .../impl/Kokkos_LexicographicalCompare.hpp | 184 + .../impl/Kokkos_MinMaxMinmaxElement.hpp | 167 + .../std_algorithms/impl/Kokkos_Mismatch.hpp | 162 + .../src/std_algorithms/impl/Kokkos_Move.hpp | 100 + .../impl/Kokkos_MoveBackward.hpp | 104 + .../impl/Kokkos_PartitionCopy.hpp | 180 + .../impl/Kokkos_PartitionPoint.hpp | 132 + .../impl/Kokkos_RandomAccessIterator.hpp | 192 + .../src/std_algorithms/impl/Kokkos_Reduce.hpp | 186 + ...cerWithArbitraryJoinerNoNeutralElement.hpp | 113 + .../impl/Kokkos_RemoveAllVariants.hpp | 212 + .../std_algorithms/impl/Kokkos_Replace.hpp | 103 + .../impl/Kokkos_ReplaceCopy.hpp | 122 + .../impl/Kokkos_ReplaceCopyIf.hpp | 123 + .../std_algorithms/impl/Kokkos_ReplaceIf.hpp | 105 + .../std_algorithms/impl/Kokkos_Reverse.hpp | 111 + .../impl/Kokkos_ReverseCopy.hpp | 102 + .../src/std_algorithms/impl/Kokkos_Rotate.hpp | 219 + .../std_algorithms/impl/Kokkos_RotateCopy.hpp | 149 + .../src/std_algorithms/impl/Kokkos_Search.hpp | 191 + .../std_algorithms/impl/Kokkos_SearchN.hpp | 205 + .../std_algorithms/impl/Kokkos_ShiftLeft.hpp | 139 + .../std_algorithms/impl/Kokkos_ShiftRight.hpp | 139 + .../std_algorithms/impl/Kokkos_SwapRanges.hpp | 112 + .../std_algorithms/impl/Kokkos_Transform.hpp | 158 + .../impl/Kokkos_TransformExclusiveScan.hpp | 153 + .../impl/Kokkos_TransformInclusiveScan.hpp | 235 + .../impl/Kokkos_TransformReduce.hpp | 245 + .../src/std_algorithms/impl/Kokkos_Unique.hpp | 193 + .../std_algorithms/impl/Kokkos_UniqueCopy.hpp | 156 + ...Kokkos_ValueWrapperForNoNeutralElement.hpp | 72 + .../containers/src/Kokkos_Bitset.hpp | 456 ++ .../containers/src/Kokkos_DualView.hpp | 1272 +++++ .../containers/src/Kokkos_DynRankView.hpp | 2504 ++++++++++ .../containers/src/Kokkos_DynamicView.hpp | 1101 +++++ .../containers/src/Kokkos_ErrorReporter.hpp | 203 + .../containers/src/Kokkos_Functional.hpp | 183 + .../containers/src/Kokkos_OffsetView.hpp | 2100 +++++++++ .../containers/src/Kokkos_ScatterView.hpp | 1647 +++++++ .../containers/src/Kokkos_StaticCrsGraph.hpp | 507 ++ .../containers/src/Kokkos_UnorderedMap.hpp | 922 ++++ .../containers/src/Kokkos_Vector.hpp | 343 ++ .../src/impl/Kokkos_Bitset_impl.hpp | 100 + .../src/impl/Kokkos_Functional_impl.hpp | 189 + .../impl/Kokkos_StaticCrsGraph_factory.hpp | 210 + .../src/impl/Kokkos_UnorderedMap_impl.cpp | 110 + .../src/impl/Kokkos_UnorderedMap_impl.hpp | 287 ++ .../core/src/Cuda/Kokkos_CudaSpace.cpp | 716 +++ .../core/src/Cuda/Kokkos_Cuda_Alloc.hpp | 153 + .../Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp | 1003 ++++ ...uda_Atomic_Intrinsics_Restore_Builtins.hpp | 68 + .../Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp | 244 + .../core/src/Cuda/Kokkos_Cuda_Error.hpp | 168 + .../src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp | 210 + .../src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp | 103 + .../core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp | 222 + .../src/Cuda/Kokkos_Cuda_Half_Conversion.hpp | 543 +++ .../src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp | 80 + .../core/src/Cuda/Kokkos_Cuda_Instance.cpp | 1010 ++++ .../core/src/Cuda/Kokkos_Cuda_Instance.hpp | 251 + .../src/Cuda/Kokkos_Cuda_KernelLaunch.hpp | 724 +++ .../core/src/Cuda/Kokkos_Cuda_Locks.cpp | 120 + .../core/src/Cuda/Kokkos_Cuda_Locks.hpp | 197 + .../src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp | 37 + .../src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp | 477 ++ .../src/Cuda/Kokkos_Cuda_Parallel_Range.hpp | 1049 +++++ .../src/Cuda/Kokkos_Cuda_Parallel_Team.hpp | 1139 +++++ .../core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp | 753 +++ .../core/src/Cuda/Kokkos_Cuda_Task.cpp | 76 + .../core/src/Cuda/Kokkos_Cuda_Task.hpp | 1241 +++++ .../core/src/Cuda/Kokkos_Cuda_Team.hpp | 935 ++++ .../core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp | 189 + .../src/Cuda/Kokkos_Cuda_Vectorization.hpp | 236 + .../core/src/Cuda/Kokkos_Cuda_View.hpp | 303 ++ .../src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp | 114 + .../core/src/Cuda/Kokkos_Cuda_abort.hpp | 101 + .../core/src/HIP/Kokkos_HIP_Abort.hpp | 85 + .../core/src/HIP/Kokkos_HIP_Atomic.hpp | 618 +++ .../HIP/Kokkos_HIP_BlockSize_Deduction.hpp | 304 ++ .../core/src/HIP/Kokkos_HIP_Error.hpp | 128 + .../src/HIP/Kokkos_HIP_Half_Conversion.hpp | 248 + .../src/HIP/Kokkos_HIP_Half_Impl_Type.hpp | 63 + .../core/src/HIP/Kokkos_HIP_Instance.cpp | 569 +++ .../core/src/HIP/Kokkos_HIP_Instance.hpp | 221 + .../core/src/HIP/Kokkos_HIP_KernelLaunch.hpp | 555 +++ .../core/src/HIP/Kokkos_HIP_Locks.cpp | 117 + .../core/src/HIP/Kokkos_HIP_Locks.hpp | 185 + .../core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp | 38 + .../src/HIP/Kokkos_HIP_Parallel_MDRange.hpp | 451 ++ .../src/HIP/Kokkos_HIP_Parallel_Range.hpp | 771 +++ .../core/src/HIP/Kokkos_HIP_Parallel_Team.hpp | 1082 +++++ .../core/src/HIP/Kokkos_HIP_ReduceScan.hpp | 575 +++ .../src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp | 203 + .../core/src/HIP/Kokkos_HIP_Space.cpp | 634 +++ .../core/src/HIP/Kokkos_HIP_Team.hpp | 929 ++++ .../core/src/HIP/Kokkos_HIP_UniqueToken.hpp | 181 + .../core/src/HIP/Kokkos_HIP_Vectorization.hpp | 202 + .../src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp | 110 + .../kokkos-3.7.00/core/src/HPX/Kokkos_HPX.cpp | 158 + .../core/src/HPX/Kokkos_HPX_Task.cpp | 70 + .../core/src/HPX/Kokkos_HPX_Task.hpp | 306 ++ .../src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp | 122 + .../src/KokkosCore_Config_DeclareBackend.hpp | 50 + .../core/src/KokkosCore_Config_FwdBackend.hpp | 50 + .../src/KokkosCore_Config_PostInclude.hpp | 49 + .../src/KokkosCore_Config_SetupBackend.hpp | 49 + .../core/src/KokkosCore_config.h | 111 + .../core/src/KokkosExp_InterOp.hpp | 155 + .../core/src/KokkosExp_MDRangePolicy.hpp | 408 ++ .../src/Kokkos_AcquireUniqueTokenImpl.hpp | 84 + .../core/src/Kokkos_AnonymousSpace.hpp | 120 + .../kokkos-3.7.00/core/src/Kokkos_Array.hpp | 403 ++ .../kokkos-3.7.00/core/src/Kokkos_Atomic.hpp | 425 ++ .../core/src/Kokkos_Atomics_Desul_Config.hpp | 67 + .../Kokkos_Atomics_Desul_Volatile_Wrapper.hpp | 208 + .../core/src/Kokkos_Atomics_Desul_Wrapper.hpp | 291 ++ .../kokkos-3.7.00/core/src/Kokkos_Complex.hpp | 1004 ++++ .../core/src/Kokkos_Concepts.hpp | 532 +++ .../core/src/Kokkos_CopyViews.hpp | 3962 ++++++++++++++++ .../kokkos-3.7.00/core/src/Kokkos_Core.hpp | 405 ++ .../core/src/Kokkos_Core_fwd.hpp | 439 ++ bundled/kokkos-3.7.00/core/src/Kokkos_Crs.hpp | 438 ++ .../kokkos-3.7.00/core/src/Kokkos_Cuda.hpp | 325 ++ .../core/src/Kokkos_CudaSpace.hpp | 797 ++++ .../core/src/Kokkos_DetectionIdiom.hpp | 124 + .../core/src/Kokkos_ExecPolicy.hpp | 945 ++++ .../kokkos-3.7.00/core/src/Kokkos_Extents.hpp | 183 + .../kokkos-3.7.00/core/src/Kokkos_Future.hpp | 507 ++ .../kokkos-3.7.00/core/src/Kokkos_Graph.hpp | 199 + .../core/src/Kokkos_GraphNode.hpp | 467 ++ .../core/src/Kokkos_Graph_fwd.hpp | 73 + .../core/src/Kokkos_HBWSpace.hpp | 380 ++ bundled/kokkos-3.7.00/core/src/Kokkos_HIP.hpp | 77 + .../core/src/Kokkos_HIP_Space.hpp | 806 ++++ bundled/kokkos-3.7.00/core/src/Kokkos_HPX.hpp | 2395 ++++++++++ .../kokkos-3.7.00/core/src/Kokkos_Half.hpp | 1040 +++++ .../core/src/Kokkos_HostSpace.hpp | 363 ++ .../kokkos-3.7.00/core/src/Kokkos_Layout.hpp | 394 ++ .../core/src/Kokkos_LogicalSpaces.hpp | 445 ++ .../kokkos-3.7.00/core/src/Kokkos_Macros.hpp | 682 +++ .../core/src/Kokkos_MasterLock.hpp | 88 + .../core/src/Kokkos_MathematicalConstants.hpp | 93 + .../core/src/Kokkos_MathematicalFunctions.hpp | 412 ++ .../Kokkos_MathematicalSpecialFunctions.hpp | 1285 +++++ .../core/src/Kokkos_MemoryPool.hpp | 828 ++++ .../core/src/Kokkos_MemoryTraits.hpp | 142 + .../core/src/Kokkos_MinMaxClamp.hpp | 245 + .../core/src/Kokkos_NumericTraits.hpp | 661 +++ .../kokkos-3.7.00/core/src/Kokkos_OpenMP.hpp | 243 + .../core/src/Kokkos_OpenMPTarget.hpp | 173 + .../core/src/Kokkos_OpenMPTargetSpace.hpp | 331 ++ .../kokkos-3.7.00/core/src/Kokkos_Pair.hpp | 526 +++ .../core/src/Kokkos_Parallel.hpp | 586 +++ .../core/src/Kokkos_Parallel_Reduce.hpp | 1805 +++++++ .../core/src/Kokkos_PointerOwnership.hpp | 81 + .../src/Kokkos_Profiling_ProfileSection.hpp | 114 + .../kokkos-3.7.00/core/src/Kokkos_Rank.hpp | 80 + .../kokkos-3.7.00/core/src/Kokkos_SYCL.hpp | 210 + .../core/src/Kokkos_SYCL_Space.hpp | 492 ++ .../core/src/Kokkos_ScratchSpace.hpp | 181 + .../kokkos-3.7.00/core/src/Kokkos_Serial.hpp | 274 ++ .../core/src/Kokkos_TaskPolicy.hpp | 51 + .../core/src/Kokkos_TaskScheduler.hpp | 708 +++ .../core/src/Kokkos_TaskScheduler_fwd.hpp | 242 + .../kokkos-3.7.00/core/src/Kokkos_Threads.hpp | 214 + .../kokkos-3.7.00/core/src/Kokkos_Timer.hpp | 122 + .../kokkos-3.7.00/core/src/Kokkos_Tuners.hpp | 666 +++ .../core/src/Kokkos_UniqueToken.hpp | 188 + .../core/src/Kokkos_Vectorization.hpp | 67 + .../kokkos-3.7.00/core/src/Kokkos_View.hpp | 2001 ++++++++ .../core/src/Kokkos_WorkGraphPolicy.hpp | 278 ++ .../kokkos-3.7.00/core/src/Kokkos_hwloc.hpp | 153 + .../core/src/OpenACC/Kokkos_OpenACC.cpp | 98 + .../core/src/OpenACC/Kokkos_OpenACC.hpp | 126 + .../core/src/OpenACC/Kokkos_OpenACCSpace.cpp | 222 + .../core/src/OpenACC/Kokkos_OpenACCSpace.hpp | 249 + .../src/OpenACC/Kokkos_OpenACC_Instance.cpp | 118 + .../src/OpenACC/Kokkos_OpenACC_Instance.hpp | 79 + .../src/OpenACC/Kokkos_OpenACC_Traits.hpp | 65 + .../src/OpenMP/Kokkos_OpenMP_Instance.cpp | 492 ++ .../src/OpenMP/Kokkos_OpenMP_Instance.hpp | 366 ++ .../src/OpenMP/Kokkos_OpenMP_Parallel.hpp | 1262 +++++ .../core/src/OpenMP/Kokkos_OpenMP_Task.cpp | 114 + .../core/src/OpenMP/Kokkos_OpenMP_Task.hpp | 384 ++ .../core/src/OpenMP/Kokkos_OpenMP_Team.hpp | 359 ++ .../OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp | 99 + .../OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp | 249 + .../Kokkos_OpenMPTarget_Abort.hpp | 63 + .../Kokkos_OpenMPTarget_Error.hpp | 73 + .../OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp | 175 + .../OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp | 1964 ++++++++ .../Kokkos_OpenMPTarget_Instance.cpp | 230 + .../Kokkos_OpenMPTarget_Instance.hpp | 95 + .../Kokkos_OpenMPTarget_Parallel.hpp | 1337 ++++++ .../Kokkos_OpenMPTarget_Parallel_MDRange.hpp | 836 ++++ .../OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp | 279 ++ .../OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp | 347 ++ .../Kokkos_OpenMPTarget_UniqueToken.hpp | 135 + .../core/src/SYCL/Kokkos_SYCL.cpp | 279 ++ .../core/src/SYCL/Kokkos_SYCL_Abort.hpp | 69 + .../core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp | 194 + .../src/SYCL/Kokkos_SYCL_Half_Conversion.hpp | 159 + .../src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp | 67 + .../core/src/SYCL/Kokkos_SYCL_Instance.cpp | 365 ++ .../core/src/SYCL/Kokkos_SYCL_Instance.hpp | 355 ++ .../src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp | 37 + .../src/SYCL/Kokkos_SYCL_Parallel_Range.hpp | 297 ++ .../src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp | 832 ++++ .../src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp | 377 ++ .../src/SYCL/Kokkos_SYCL_Parallel_Team.hpp | 982 ++++ .../core/src/SYCL/Kokkos_SYCL_Space.cpp | 498 ++ .../core/src/SYCL/Kokkos_SYCL_Team.hpp | 919 ++++ .../core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp | 177 + .../core/src/Serial/Kokkos_Serial.cpp | 227 + .../Serial/Kokkos_Serial_Parallel_MDRange.hpp | 213 + .../Serial/Kokkos_Serial_Parallel_Range.hpp | 337 ++ .../Serial/Kokkos_Serial_Parallel_Team.hpp | 424 ++ .../core/src/Serial/Kokkos_Serial_Task.cpp | 70 + .../core/src/Serial/Kokkos_Serial_Task.hpp | 250 + .../src/Serial/Kokkos_Serial_UniqueToken.hpp | 109 + .../Serial/Kokkos_Serial_WorkGraphPolicy.hpp | 94 + .../core/src/Threads/Kokkos_ThreadsExec.cpp | 902 ++++ .../core/src/Threads/Kokkos_ThreadsExec.hpp | 637 +++ .../core/src/Threads/Kokkos_ThreadsTeam.hpp | 1131 +++++ .../Kokkos_Threads_Parallel_MDRange.hpp | 322 ++ .../Threads/Kokkos_Threads_Parallel_Range.hpp | 485 ++ .../Threads/Kokkos_Threads_Parallel_Team.hpp | 279 ++ .../Threads/Kokkos_Threads_UniqueToken.hpp | 157 + .../Kokkos_Threads_WorkGraphPolicy.hpp | 111 + .../core/src/View/Hooks/Kokkos_ViewHooks.hpp | 151 + .../core/src/decl/Kokkos_Declare_CUDA.hpp | 64 + .../core/src/decl/Kokkos_Declare_HBWSpace.hpp | 52 + .../core/src/decl/Kokkos_Declare_HIP.hpp | 52 + .../core/src/decl/Kokkos_Declare_HPX.hpp | 52 + .../core/src/decl/Kokkos_Declare_OPENACC.hpp | 54 + .../core/src/decl/Kokkos_Declare_OPENMP.hpp | 52 + .../src/decl/Kokkos_Declare_OPENMPTARGET.hpp | 54 + .../core/src/decl/Kokkos_Declare_SERIAL.hpp | 52 + .../core/src/decl/Kokkos_Declare_SYCL.hpp | 61 + .../core/src/decl/Kokkos_Declare_THREADS.hpp | 52 + bundled/kokkos-3.7.00/core/src/dummy.cpp | 10 + .../core/src/fwd/Kokkos_Fwd_CUDA.hpp | 67 + .../core/src/fwd/Kokkos_Fwd_HBWSpace.hpp | 57 + .../core/src/fwd/Kokkos_Fwd_HIP.hpp | 58 + .../core/src/fwd/Kokkos_Fwd_HPX.hpp | 55 + .../core/src/fwd/Kokkos_Fwd_OPENACC.hpp | 56 + .../core/src/fwd/Kokkos_Fwd_OPENMP.hpp | 53 + .../core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp | 56 + .../core/src/fwd/Kokkos_Fwd_SERIAL.hpp | 53 + .../core/src/fwd/Kokkos_Fwd_SYCL.hpp | 61 + .../core/src/fwd/Kokkos_Fwd_THREADS.hpp | 53 + .../src/impl/KokkosExp_Host_IterateTile.hpp | 2766 +++++++++++ .../src/impl/KokkosExp_IterateTileGPU.hpp | 1038 +++++ .../core/src/impl/KokkosExp_ViewMapping.hpp | 47 + .../core/src/impl/Kokkos_AnalyzePolicy.hpp | 234 + .../core/src/impl/Kokkos_Atomic_Assembly.hpp | 107 + .../Kokkos_Atomic_Compare_Exchange_Strong.hpp | 437 ++ .../Kokkos_Atomic_Compare_Exchange_Weak.hpp | 408 ++ .../core/src/impl/Kokkos_Atomic_Decrement.hpp | 147 + .../core/src/impl/Kokkos_Atomic_Exchange.hpp | 404 ++ .../core/src/impl/Kokkos_Atomic_Fetch_Add.hpp | 389 ++ .../core/src/impl/Kokkos_Atomic_Fetch_And.hpp | 192 + .../core/src/impl/Kokkos_Atomic_Fetch_Or.hpp | 193 + .../core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp | 323 ++ .../core/src/impl/Kokkos_Atomic_Generic.hpp | 555 +++ .../impl/Kokkos_Atomic_Generic_Secondary.hpp | 86 + .../core/src/impl/Kokkos_Atomic_Increment.hpp | 147 + .../core/src/impl/Kokkos_Atomic_Load.hpp | 228 + .../src/impl/Kokkos_Atomic_Memory_Order.hpp | 121 + .../core/src/impl/Kokkos_Atomic_MinMax.hpp | 319 ++ .../core/src/impl/Kokkos_Atomic_Store.hpp | 224 + .../core/src/impl/Kokkos_Atomic_View.hpp | 384 ++ .../core/src/impl/Kokkos_Atomic_Windows.hpp | 155 + .../core/src/impl/Kokkos_BitOps.hpp | 272 ++ .../core/src/impl/Kokkos_CPUDiscovery.cpp | 124 + .../core/src/impl/Kokkos_CPUDiscovery.hpp | 52 + .../core/src/impl/Kokkos_ChaseLev.hpp | 312 ++ .../core/src/impl/Kokkos_ClockTic.hpp | 138 + .../core/src/impl/Kokkos_Combined_Reducer.hpp | 682 +++ .../src/impl/Kokkos_Command_Line_Parsing.cpp | 292 ++ .../src/impl/Kokkos_Command_Line_Parsing.hpp | 71 + .../core/src/impl/Kokkos_ConcurrentBitset.hpp | 350 ++ .../core/src/impl/Kokkos_Core.cpp | 1162 +++++ .../impl/Kokkos_Default_GraphNodeKernel.hpp | 125 + .../impl/Kokkos_Default_GraphNode_Impl.hpp | 170 + .../src/impl/Kokkos_Default_Graph_Impl.hpp | 197 + .../src/impl/Kokkos_Default_Graph_fwd.hpp | 62 + .../core/src/impl/Kokkos_DeviceManagement.hpp | 62 + .../core/src/impl/Kokkos_EBO.hpp | 327 ++ .../core/src/impl/Kokkos_Error.cpp | 190 + .../core/src/impl/Kokkos_Error.hpp | 293 ++ .../core/src/impl/Kokkos_ExecPolicy.cpp | 76 + .../core/src/impl/Kokkos_ExecSpaceManager.hpp | 162 + .../src/impl/Kokkos_FixedBufferMemoryPool.hpp | 306 ++ .../core/src/impl/Kokkos_FunctorAnalysis.hpp | 1001 ++++ .../core/src/impl/Kokkos_GraphImpl.hpp | 156 + .../src/impl/Kokkos_GraphImpl_Utilities.hpp | 119 + .../core/src/impl/Kokkos_GraphImpl_fwd.hpp | 87 + .../impl/Kokkos_GraphNodeCustomization.hpp | 98 + .../core/src/impl/Kokkos_GraphNodeImpl.hpp | 298 ++ .../core/src/impl/Kokkos_HBWSpace.cpp | 384 ++ .../core/src/impl/Kokkos_HostBarrier.cpp | 95 + .../core/src/impl/Kokkos_HostBarrier.hpp | 257 + .../core/src/impl/Kokkos_HostSharedPtr.hpp | 179 + .../core/src/impl/Kokkos_HostSpace.cpp | 373 ++ .../src/impl/Kokkos_HostSpace_deepcopy.cpp | 170 + .../src/impl/Kokkos_HostSpace_deepcopy.hpp | 66 + .../core/src/impl/Kokkos_HostThreadTeam.cpp | 311 ++ .../core/src/impl/Kokkos_HostThreadTeam.hpp | 1011 ++++ .../impl/Kokkos_InitializationSettings.hpp | 195 + .../core/src/impl/Kokkos_LIFO.hpp | 406 ++ .../core/src/impl/Kokkos_LinkedListNode.hpp | 184 + .../core/src/impl/Kokkos_MemoryPool.cpp | 139 + .../src/impl/Kokkos_MemoryPoolAllocator.hpp | 131 + .../core/src/impl/Kokkos_MemorySpace.cpp | 99 + .../core/src/impl/Kokkos_MemorySpace.hpp | 98 + .../core/src/impl/Kokkos_Memory_Fence.hpp | 111 + .../src/impl/Kokkos_MultipleTaskQueue.hpp | 529 +++ .../core/src/impl/Kokkos_NumericTraits.cpp | 82 + .../core/src/impl/Kokkos_OptionalRef.hpp | 234 + ...ndLineArgumentsAndEnvironmentVariables.hpp | 58 + .../core/src/impl/Kokkos_PhysicalLayout.hpp | 77 + .../core/src/impl/Kokkos_Profiling.cpp | 1296 ++++++ .../core/src/impl/Kokkos_Profiling.hpp | 405 ++ .../src/impl/Kokkos_Profiling_C_Interface.h | 296 ++ .../src/impl/Kokkos_Profiling_DeviceInfo.hpp | 56 + .../src/impl/Kokkos_Profiling_Interface.hpp | 274 ++ .../src/impl/Kokkos_QuadPrecisionMath.hpp | 251 + .../core/src/impl/Kokkos_SharedAlloc.cpp | 377 ++ .../core/src/impl/Kokkos_SharedAlloc.hpp | 539 +++ .../src/impl/Kokkos_SharedAlloc_timpl.hpp | 295 ++ .../src/impl/Kokkos_SimpleTaskScheduler.hpp | 494 ++ .../core/src/impl/Kokkos_SingleTaskQueue.hpp | 186 + .../core/src/impl/Kokkos_Spinwait.cpp | 140 + .../core/src/impl/Kokkos_Spinwait.hpp | 137 + .../core/src/impl/Kokkos_Stacktrace.cpp | 252 + .../core/src/impl/Kokkos_Stacktrace.hpp | 45 + .../src/impl/Kokkos_StringManipulation.hpp | 220 + .../core/src/impl/Kokkos_TaskBase.hpp | 349 ++ .../core/src/impl/Kokkos_TaskNode.hpp | 702 +++ .../core/src/impl/Kokkos_TaskPolicyData.hpp | 172 + .../core/src/impl/Kokkos_TaskQueue.hpp | 242 + .../core/src/impl/Kokkos_TaskQueueCommon.hpp | 508 ++ .../impl/Kokkos_TaskQueueMemoryManager.hpp | 227 + .../src/impl/Kokkos_TaskQueueMultiple.hpp | 272 ++ .../impl/Kokkos_TaskQueueMultiple_impl.hpp | 74 + .../core/src/impl/Kokkos_TaskQueue_impl.hpp | 675 +++ .../core/src/impl/Kokkos_TaskResult.hpp | 143 + .../core/src/impl/Kokkos_TaskTeamMember.hpp | 128 + .../core/src/impl/Kokkos_Timer.hpp | 69 + .../core/src/impl/Kokkos_Tools.hpp | 54 + .../core/src/impl/Kokkos_Tools_Generic.hpp | 490 ++ .../core/src/impl/Kokkos_Traits.hpp | 316 ++ .../core/src/impl/Kokkos_Utilities.hpp | 269 ++ .../core/src/impl/Kokkos_VLAEmulation.hpp | 284 ++ .../core/src/impl/Kokkos_ViewArray.hpp | 636 +++ .../core/src/impl/Kokkos_ViewCtor.hpp | 313 ++ .../core/src/impl/Kokkos_ViewLayoutTiled.hpp | 1453 ++++++ .../core/src/impl/Kokkos_ViewMapping.hpp | 4140 +++++++++++++++++ .../core/src/impl/Kokkos_ViewTracker.hpp | 126 + .../core/src/impl/Kokkos_ViewUniformType.hpp | 121 + .../core/src/impl/Kokkos_Volatile_Load.hpp | 237 + .../core/src/impl/Kokkos_hwloc.cpp | 750 +++ .../core/src/setup/Kokkos_Setup_Cuda.hpp | 133 + .../core/src/setup/Kokkos_Setup_HIP.hpp | 71 + .../core/src/setup/Kokkos_Setup_SYCL.hpp | 67 + .../src/traits/Kokkos_ExecutionSpaceTrait.hpp | 99 + .../src/traits/Kokkos_GraphKernelTrait.hpp | 81 + .../core/src/traits/Kokkos_IndexTypeTrait.hpp | 141 + .../traits/Kokkos_IterationPatternTrait.hpp | 102 + .../src/traits/Kokkos_LaunchBoundsTrait.hpp | 96 + .../traits/Kokkos_OccupancyControlTrait.hpp | 209 + .../src/traits/Kokkos_PolicyTraitAdaptor.hpp | 156 + .../src/traits/Kokkos_PolicyTraitMatcher.hpp | 77 + .../core/src/traits/Kokkos_ScheduleTrait.hpp | 122 + .../core/src/traits/Kokkos_Traits_fwd.hpp | 122 + .../traits/Kokkos_WorkItemPropertyTrait.hpp | 101 + .../core/src/traits/Kokkos_WorkTagTrait.hpp | 128 + .../simd/cmake/Dependencies.cmake | 5 + .../kokkos-3.7.00/simd/src/Kokkos_SIMD.hpp | 161 + .../simd/src/Kokkos_SIMD_AVX512.hpp | 1023 ++++ .../simd/src/Kokkos_SIMD_Common.hpp | 428 ++ .../simd/src/Kokkos_SIMD_Scalar.hpp | 353 ++ .../simd/src/Kokkos_SIMD_dummy.cpp | 7 + .../tpls/desul/include/desul/.clang-format | 3 + .../tpls/desul/include/desul/atomics.hpp | 18 + .../include/desul/atomics/Atomic_Ref.hpp | 541 +++ .../tpls/desul/include/desul/atomics/CUDA.hpp | 664 +++ .../desul/include/desul/atomics/Common.hpp | 205 + .../desul/atomics/Compare_Exchange.hpp | 36 + .../desul/atomics/Compare_Exchange_CUDA.hpp | 283 ++ .../desul/atomics/Compare_Exchange_GCC.hpp | 92 + .../desul/atomics/Compare_Exchange_HIP.hpp | 229 + .../desul/atomics/Compare_Exchange_MSVC.hpp | 237 + .../desul/atomics/Compare_Exchange_OpenMP.hpp | 142 + .../desul/atomics/Compare_Exchange_SYCL.hpp | 99 + .../atomics/Compare_Exchange_ScopeCaller.hpp | 43 + .../desul/atomics/Compare_Exchange_Serial.hpp | 43 + .../tpls/desul/include/desul/atomics/GCC.hpp | 135 + .../desul/include/desul/atomics/Generic.hpp | 766 +++ .../tpls/desul/include/desul/atomics/HIP.hpp | 222 + .../include/desul/atomics/Lock_Array.hpp | 72 + .../include/desul/atomics/Lock_Array_Cuda.hpp | 179 + .../include/desul/atomics/Lock_Array_HIP.hpp | 173 + .../desul/include/desul/atomics/Macros.hpp | 66 + .../desul/include/desul/atomics/OpenMP.hpp | 15 + .../tpls/desul/include/desul/atomics/SYCL.hpp | 64 + .../include/desul/atomics/SYCLConversions.hpp | 101 + .../include/desul/atomics/cuda/CUDA_asm.hpp | 18 + .../desul/atomics/cuda/CUDA_asm_exchange.hpp | 8 + .../desul/atomics/cuda/cuda_cc7_asm.inc | 20 + .../cuda/cuda_cc7_asm_atomic_fetch_op.inc | 18 + ...da_cc7_asm_atomic_fetch_op.inc_forceglobal | 153 + .../cuda_cc7_asm_atomic_fetch_op.inc_generic | 151 + .../cuda_cc7_asm_atomic_fetch_op.inc_isglobal | 208 + ...cuda_cc7_asm_atomic_fetch_op.inc_predicate | 250 + .../atomics/cuda/cuda_cc7_asm_atomic_op.inc | 18 + .../cuda_cc7_asm_atomic_op.inc_forceglobal | 64 + .../cuda/cuda_cc7_asm_atomic_op.inc_generic | 64 + .../cuda/cuda_cc7_asm_atomic_op.inc_isglobal | 88 + .../cuda/cuda_cc7_asm_atomic_op.inc_predicate | 106 + .../atomics/cuda/cuda_cc7_asm_exchange.inc | 20 + .../cuda/cuda_cc7_asm_exchange_memorder.inc | 27 + .../atomics/cuda/cuda_cc7_asm_exchange_op.inc | 40 + .../atomics/cuda/cuda_cc7_asm_memorder.inc | 29 + .../desul/atomics/openmp/OpenMP_40.hpp | 97 + .../desul/atomics/openmp/OpenMP_40_op.inc | 101 + .../tpls/desul/src/Lock_Array_CUDA.cpp | 99 + .../tpls/desul/src/Lock_Array_HIP.cpp | 102 + bundled/setup_bundled.cmake | 12 + cmake/configure/configure_20_trilinos.cmake | 8 + cmake/configure/configure_30_kokkos.cmake | 28 + cmake/modules/FindKOKKOS.cmake | 7 +- doc/developers/packaging.html | 2 +- doc/news/changes/major/20221026Arndt | 3 + doc/readme.html | 6 +- doc/users/cmake_dealii.html | 2 +- include/deal.II/base/config.h.in | 1 + tests/quick_tests/CMakeLists.txt | 3 + tests/quick_tests/kokkos.cc | 40 + 536 files changed, 156354 insertions(+), 5 deletions(-) create mode 100644 bundled/kokkos-3.7.00/CMakeLists.txt create mode 100644 bundled/kokkos-3.7.00/Copyright.txt create mode 100644 bundled/kokkos-3.7.00/LICENSE create mode 100644 bundled/kokkos-3.7.00/algorithms/src/KokkosAlgorithms_dummy.cpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/Kokkos_Random.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/Kokkos_Sort.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/Kokkos_StdAlgorithms.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AllOf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Copy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Count.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CountIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Distance.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Equal.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Fill.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FillN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Find.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEach.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Generate.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinElement.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Move.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reduce.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Remove.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Replace.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reverse.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Rotate.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Search.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SearchN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Swap.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Transform.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Unique.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp create mode 100644 bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_Bitset.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_DualView.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_DynRankView.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_DynamicView.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_ErrorReporter.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_Functional.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_OffsetView.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_ScatterView.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_StaticCrsGraph.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_UnorderedMap.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/Kokkos_Vector.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/impl/Kokkos_Bitset_impl.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/impl/Kokkos_Functional_impl.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp create mode 100644 bundled/kokkos-3.7.00/containers/src/impl/Kokkos_UnorderedMap_impl.cpp create mode 100644 bundled/kokkos-3.7.00/containers/src/impl/Kokkos_UnorderedMap_impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_CudaSpace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Alloc.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Error.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Instance.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Instance.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Locks.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Locks.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Task.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Task.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_View.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Cuda/Kokkos_Cuda_abort.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Abort.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Atomic.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Error.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Instance.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Instance.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Locks.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Locks.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_ReduceScan.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Space.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_Vectorization.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HPX/Kokkos_HPX.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/HPX/Kokkos_HPX_Task.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/HPX/Kokkos_HPX_Task.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosCore_Config_DeclareBackend.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosCore_Config_FwdBackend.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosCore_Config_PostInclude.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosCore_Config_SetupBackend.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosCore_config.h create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosExp_InterOp.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/KokkosExp_MDRangePolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_AcquireUniqueTokenImpl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_AnonymousSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Array.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Atomic.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Atomics_Desul_Config.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Atomics_Desul_Wrapper.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Complex.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Concepts.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_CopyViews.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Core.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Core_fwd.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Crs.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Cuda.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_CudaSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_DetectionIdiom.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_ExecPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Extents.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Future.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Graph.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_GraphNode.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Graph_fwd.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_HBWSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_HIP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_HIP_Space.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_HPX.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Half.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_HostSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Layout.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_LogicalSpaces.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Macros.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MasterLock.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MathematicalConstants.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MathematicalFunctions.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MathematicalSpecialFunctions.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MemoryPool.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MemoryTraits.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_MinMaxClamp.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_NumericTraits.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_OpenMP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_OpenMPTarget.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_OpenMPTargetSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Pair.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Parallel.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Parallel_Reduce.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_PointerOwnership.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Profiling_ProfileSection.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Rank.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_SYCL.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_SYCL_Space.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_ScratchSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Serial.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_TaskPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_TaskScheduler.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_TaskScheduler_fwd.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Threads.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Timer.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Tuners.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_Vectorization.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_View.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Kokkos_hwloc.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACC.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACC.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACCSpace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACCSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_Task.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_Task.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Abort.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Instance.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Instance.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Space.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_Task.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_Task.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_ThreadsExec.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_ThreadsExec.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_ThreadsTeam.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_Threads_UniqueToken.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/View/Hooks/Kokkos_ViewHooks.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_CUDA.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_HBWSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_HIP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_HPX.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_OPENACC.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_OPENMP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_SERIAL.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_SYCL.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/decl/Kokkos_Declare_THREADS.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/dummy.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_CUDA.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_HIP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_HPX.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_OPENACC.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_OPENMP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_SERIAL.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_SYCL.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/fwd/Kokkos_Fwd_THREADS.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/KokkosExp_Host_IterateTile.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/KokkosExp_IterateTileGPU.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/KokkosExp_ViewMapping.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_AnalyzePolicy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Assembly.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Decrement.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Exchange.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Fetch_And.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Generic.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Increment.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Load.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Memory_Order.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_MinMax.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Store.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_View.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Atomic_Windows.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_BitOps.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_CPUDiscovery.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_CPUDiscovery.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ChaseLev.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ClockTic.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Combined_Reducer.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Command_Line_Parsing.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Command_Line_Parsing.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ConcurrentBitset.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Core.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Default_Graph_Impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Default_Graph_fwd.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_DeviceManagement.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_EBO.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Error.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Error.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ExecPolicy.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ExecSpaceManager.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_FunctorAnalysis.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_GraphImpl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_GraphImpl_Utilities.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_GraphImpl_fwd.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_GraphNodeCustomization.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_GraphNodeImpl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HBWSpace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostBarrier.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostBarrier.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostSharedPtr.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostSpace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostSpace_deepcopy.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostSpace_deepcopy.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostThreadTeam.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_HostThreadTeam.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_InitializationSettings.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_LIFO.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_LinkedListNode.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_MemoryPool.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_MemoryPoolAllocator.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_MemorySpace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_MemorySpace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Memory_Fence.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_MultipleTaskQueue.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_NumericTraits.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_OptionalRef.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_PhysicalLayout.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Profiling.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Profiling.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Profiling_C_Interface.h create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Profiling_Interface.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_QuadPrecisionMath.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_SharedAlloc.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_SharedAlloc.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_SharedAlloc_timpl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_SimpleTaskScheduler.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_SingleTaskQueue.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Spinwait.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Spinwait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Stacktrace.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Stacktrace.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_StringManipulation.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskBase.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskNode.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskPolicyData.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskQueue.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskQueueCommon.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskQueueMultiple.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskQueue_impl.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskResult.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_TaskTeamMember.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Timer.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Tools.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Tools_Generic.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Traits.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Utilities.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_VLAEmulation.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ViewArray.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ViewCtor.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ViewLayoutTiled.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ViewMapping.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ViewTracker.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_ViewUniformType.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_Volatile_Load.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/impl/Kokkos_hwloc.cpp create mode 100644 bundled/kokkos-3.7.00/core/src/setup/Kokkos_Setup_Cuda.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/setup/Kokkos_Setup_HIP.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/setup/Kokkos_Setup_SYCL.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_GraphKernelTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_IndexTypeTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_IterationPatternTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_LaunchBoundsTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_OccupancyControlTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_PolicyTraitMatcher.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_ScheduleTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_Traits_fwd.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp create mode 100644 bundled/kokkos-3.7.00/core/src/traits/Kokkos_WorkTagTrait.hpp create mode 100644 bundled/kokkos-3.7.00/simd/cmake/Dependencies.cmake create mode 100644 bundled/kokkos-3.7.00/simd/src/Kokkos_SIMD.hpp create mode 100644 bundled/kokkos-3.7.00/simd/src/Kokkos_SIMD_AVX512.hpp create mode 100644 bundled/kokkos-3.7.00/simd/src/Kokkos_SIMD_Common.hpp create mode 100644 bundled/kokkos-3.7.00/simd/src/Kokkos_SIMD_Scalar.hpp create mode 100644 bundled/kokkos-3.7.00/simd/src/Kokkos_SIMD_dummy.cpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/.clang-format create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Atomic_Ref.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/CUDA.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Common.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/GCC.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Generic.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/HIP.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Lock_Array.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/Macros.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/OpenMP.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/SYCL.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/SYCLConversions.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_forceglobal create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_generic create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_forceglobal create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_generic create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_memorder.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_memorder.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc create mode 100644 bundled/kokkos-3.7.00/tpls/desul/src/Lock_Array_CUDA.cpp create mode 100644 bundled/kokkos-3.7.00/tpls/desul/src/Lock_Array_HIP.cpp create mode 100644 doc/news/changes/major/20221026Arndt create mode 100644 tests/quick_tests/kokkos.cc diff --git a/bundled/CMakeLists.txt b/bundled/CMakeLists.txt index 64ef8f272c..a1e00489ce 100644 --- a/bundled/CMakeLists.txt +++ b/bundled/CMakeLists.txt @@ -37,6 +37,16 @@ IF(FEATURE_BOOST_BUNDLED_CONFIGURED) ENDIF() +IF(FEATURE_KOKKOS_BUNDLED_CONFIGURED) + ADD_SUBDIRECTORY(${KOKKOS_FOLDER}) + + INSTALL(DIRECTORY ${KOKKOS_BUNDLED_INCLUDE_DIRS} + DESTINATION ${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled + COMPONENT library + ) +ENDIF() + + IF(FEATURE_TASKFLOW_BUNDLED_CONFIGURED) INSTALL(DIRECTORY ${TASKFLOW_FOLDER}/include/taskflow DESTINATION ${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled diff --git a/bundled/README.md b/bundled/README.md index 2cd62d7222..1eaa660a51 100644 --- a/bundled/README.md +++ b/bundled/README.md @@ -19,6 +19,15 @@ and licensed under the Boost Software License Version 1.0. See A full version of the library can be downloaded at http://www.boost.org/. +kokkos-* +-------- + +Contains the Kokkos project licensed under the 3-clause BSD license. + +A full version of the Kokkos project can be downloaded at +https://github.com/kokkos/kokkos. + + taskflow-* -------------- diff --git a/bundled/kokkos-3.7.00/CMakeLists.txt b/bundled/kokkos-3.7.00/CMakeLists.txt new file mode 100644 index 0000000000..f0556a90f3 --- /dev/null +++ b/bundled/kokkos-3.7.00/CMakeLists.txt @@ -0,0 +1,73 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2022 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +SET(src_kokkos + #tpls/desul/src/Lock_Array_CUDA.cpp + #tpls/desul/src/Lock_Array_HIP.cpp + core/src/impl/Kokkos_Profiling.cpp + core/src/impl/Kokkos_NumericTraits.cpp + core/src/impl/Kokkos_HostSpace_deepcopy.cpp + core/src/impl/Kokkos_Error.cpp + core/src/impl/Kokkos_Spinwait.cpp + core/src/impl/Kokkos_MemoryPool.cpp + core/src/impl/Kokkos_HostThreadTeam.cpp + core/src/impl/Kokkos_hwloc.cpp + core/src/impl/Kokkos_MemorySpace.cpp + core/src/impl/Kokkos_HBWSpace.cpp + core/src/impl/Kokkos_HostBarrier.cpp + core/src/impl/Kokkos_Core.cpp + core/src/impl/Kokkos_HostSpace.cpp + core/src/impl/Kokkos_CPUDiscovery.cpp + core/src/impl/Kokkos_Stacktrace.cpp + core/src/impl/Kokkos_SharedAlloc.cpp + core/src/impl/Kokkos_Command_Line_Parsing.cpp + core/src/impl/Kokkos_ExecPolicy.cpp + #core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp + #core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp + #core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp + #core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp + #core/src/OpenACC/Kokkos_OpenACCSpace.cpp + #core/src/OpenACC/Kokkos_OpenACC.cpp + #core/src/OpenACC/Kokkos_OpenACC_Instance.cpp + #core/src/Cuda/Kokkos_Cuda_Instance.cpp + #core/src/Cuda/Kokkos_Cuda_Task.cpp + #core/src/Cuda/Kokkos_CudaSpace.cpp + #core/src/Cuda/Kokkos_Cuda_Locks.cpp + #core/src/HPX/Kokkos_HPX_Task.cpp + #core/src/HPX/Kokkos_HPX.cpp + core/src/dummy.cpp + #core/src/Threads/Kokkos_ThreadsExec.cpp + #core/src/HIP/Kokkos_HIP_Instance.cpp + #core/src/HIP/Kokkos_HIP_Space.cpp + #core/src/HIP/Kokkos_HIP_Locks.cpp + #core/src/SYCL/Kokkos_SYCL_Space.cpp + #core/src/SYCL/Kokkos_SYCL.cpp + #core/src/SYCL/Kokkos_SYCL_Instance.cpp + core/src/Serial/Kokkos_Serial.cpp + core/src/Serial/Kokkos_Serial_Task.cpp + #core/src/OpenMP/Kokkos_OpenMP_Instance.cpp + #core/src/OpenMP/Kokkos_OpenMP_Task.cpp + algorithms/src/KokkosAlgorithms_dummy.cpp + simd/src/Kokkos_SIMD_dummy.cpp + containers/src/impl/Kokkos_UnorderedMap_impl.cpp +) +INCLUDE_DIRECTORIES(${KOKKOS_BUNDLED_INCLUDE_DIRS}) + +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-float-conversion) +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-missing-field-initializers) +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-suggest-override) +ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS -Wno-unused-but-set-parameter) + +DEAL_II_ADD_LIBRARY(obj_kokkos OBJECT ${src_kokkos}) diff --git a/bundled/kokkos-3.7.00/Copyright.txt b/bundled/kokkos-3.7.00/Copyright.txt new file mode 100644 index 0000000000..5e2f8d8647 --- /dev/null +++ b/bundled/kokkos-3.7.00/Copyright.txt @@ -0,0 +1,41 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER diff --git a/bundled/kokkos-3.7.00/LICENSE b/bundled/kokkos-3.7.00/LICENSE new file mode 100644 index 0000000000..c6f17087d5 --- /dev/null +++ b/bundled/kokkos-3.7.00/LICENSE @@ -0,0 +1,43 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Kokkos is licensed under 3-clause BSD terms of use: +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER diff --git a/bundled/kokkos-3.7.00/algorithms/src/KokkosAlgorithms_dummy.cpp b/bundled/kokkos-3.7.00/algorithms/src/KokkosAlgorithms_dummy.cpp new file mode 100644 index 0000000000..9c08a088b0 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/KokkosAlgorithms_dummy.cpp @@ -0,0 +1 @@ +void KOKKOS_ALGORITHMS_SRC_DUMMY_PREVENT_LINK_ERROR() {} diff --git a/bundled/kokkos-3.7.00/algorithms/src/Kokkos_Random.hpp b/bundled/kokkos-3.7.00/algorithms/src/Kokkos_Random.hpp new file mode 100644 index 0000000000..1d85ffdfb9 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/Kokkos_Random.hpp @@ -0,0 +1,1601 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_RANDOM_HPP +#define KOKKOS_RANDOM_HPP +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM +#endif + +#include +#include +#include +#include +#include + +/// \file Kokkos_Random.hpp +/// \brief Pseudorandom number generators +/// +/// These generators are based on Vigna, Sebastiano (2014). "An +/// experimental exploration of Marsaglia's xorshift generators, +/// scrambled." See: http://arxiv.org/abs/1402.6246 + +namespace Kokkos { + +// clang-format off + /*Template functions to get equidistributed random numbers from a generator for a specific Scalar type + + template + struct rand{ + + //Max value returned by draw(Generator& gen) + KOKKOS_INLINE_FUNCTION + static Scalar max(); + + //Returns a value between zero and max() + KOKKOS_INLINE_FUNCTION + static Scalar draw(Generator& gen); + + //Returns a value between zero and range() + //Note: for floating point values range can be larger than max() + KOKKOS_INLINE_FUNCTION + static Scalar draw(Generator& gen, const Scalar& range){} + + //Return value between start and end + KOKKOS_INLINE_FUNCTION + static Scalar draw(Generator& gen, const Scalar& start, const Scalar& end); + }; + + The Random number generators themselves have two components a state-pool and the actual generator + A state-pool manages a number of generators, so that each active thread is able to grep its own. + This allows the generation of random numbers which are independent between threads. Note that + in contrast to CuRand none of the functions of the pool (or the generator) are collectives, + i.e. all functions can be called inside conditionals. + + template + class Pool { + public: + //The Kokkos device type + using device_type = Device; + //The actual generator type + using generator_type = Generator; + + //Default constructor: does not initialize a pool + Pool(); + + //Initializing constructor: calls init(seed,Device_Specific_Number); + Pool(unsigned int 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, + //thus the initialization process is platform independent and deterministic. + void init(unsigned int seed, int 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, + //and is thus not deterministic! + generator_type get_state(); + + //Give a state back to the pool. This unlocks the state, and writes the modified + //state of the generator back to the pool. + void free_state(generator_type gen); + + } + + template + class Generator { + public: + //The Kokkos device type + using device_type = DeviceType; + + //Max return values of respective [X]rand[S]() functions + enum {MAX_URAND = 0xffffffffU}; + enum {MAX_URAND64 = 0xffffffffffffffffULL-1}; + enum {MAX_RAND = static_cast(0xffffffffU/2)}; + enum {MAX_RAND64 = static_cast(0xffffffffffffffffULL/2-1)}; + + + //Init with a state and the idx with respect to pool. Note: in serial the + //Generator can be used by just giving it the necessary state arguments + KOKKOS_INLINE_FUNCTION + Generator (STATE_ARGUMENTS, int state_idx = 0); + + //Draw a equidistributed uint32_t in the range [0,MAX_URAND) + KOKKOS_INLINE_FUNCTION + uint32_t urand(); + + //Draw a equidistributed uint64_t in the range [0,MAX_URAND64) + KOKKOS_INLINE_FUNCTION + uint64_t urand64(); + + //Draw a equidistributed uint32_t in the range [0,range) + KOKKOS_INLINE_FUNCTION + uint32_t urand(const uint32_t& range); + + //Draw a equidistributed uint32_t in the range [start,end) + KOKKOS_INLINE_FUNCTION + uint32_t urand(const uint32_t& start, const uint32_t& end ); + + //Draw a equidistributed uint64_t in the range [0,range) + KOKKOS_INLINE_FUNCTION + uint64_t urand64(const uint64_t& range); + + //Draw a equidistributed uint64_t in the range [start,end) + KOKKOS_INLINE_FUNCTION + uint64_t urand64(const uint64_t& start, const uint64_t& end ); + + //Draw a equidistributed int in the range [0,MAX_RAND) + KOKKOS_INLINE_FUNCTION + int rand(); + + //Draw a equidistributed int in the range [0,range) + KOKKOS_INLINE_FUNCTION + int rand(const int& range); + + //Draw a equidistributed int in the range [start,end) + KOKKOS_INLINE_FUNCTION + int rand(const int& start, const int& end ); + + //Draw a equidistributed int64_t in the range [0,MAX_RAND64) + KOKKOS_INLINE_FUNCTION + int64_t rand64(); + + //Draw a equidistributed int64_t in the range [0,range) + KOKKOS_INLINE_FUNCTION + int64_t rand64(const int64_t& range); + + //Draw a equidistributed int64_t in the range [start,end) + KOKKOS_INLINE_FUNCTION + int64_t rand64(const int64_t& start, const int64_t& end ); + + //Draw a equidistributed float in the range [0,1.0) + KOKKOS_INLINE_FUNCTION + float frand(); + + //Draw a equidistributed float in the range [0,range) + KOKKOS_INLINE_FUNCTION + float frand(const float& range); + + //Draw a equidistributed float in the range [start,end) + KOKKOS_INLINE_FUNCTION + float frand(const float& start, const float& end ); + + //Draw a equidistributed double in the range [0,1.0) + KOKKOS_INLINE_FUNCTION + double drand(); + + //Draw a equidistributed double in the range [0,range) + KOKKOS_INLINE_FUNCTION + double drand(const double& range); + + //Draw a equidistributed double in the range [start,end) + KOKKOS_INLINE_FUNCTION + double drand(const double& start, const double& end ); + + //Draw a standard normal distributed double + KOKKOS_INLINE_FUNCTION + double normal() ; + + //Draw a normal distributed double with given mean and standard deviation + KOKKOS_INLINE_FUNCTION + double normal(const double& mean, const double& std_dev=1.0); + } + + //Additional Functions: + + //Fills view with random numbers in the range [0,range) + template + void fill_random(ViewType view, PoolType pool, ViewType::value_type range); + + //Fills view with random numbers in the range [start,end) + template + void fill_random(ViewType view, PoolType pool, + ViewType::value_type start, ViewType::value_type end); + +*/ +// clang-format on + +template +struct rand; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static short max() { return 127; } + KOKKOS_INLINE_FUNCTION + static short draw(Generator& gen) { + return short((gen.rand() & 0xff + 256) % 256); + } + KOKKOS_INLINE_FUNCTION + static short draw(Generator& gen, const char& range) { + return char(gen.rand(range)); + } + KOKKOS_INLINE_FUNCTION + static short draw(Generator& gen, const char& start, const char& end) { + return char(gen.rand(start, end)); + } +}; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static short max() { return 32767; } + KOKKOS_INLINE_FUNCTION + static short draw(Generator& gen) { + return short((gen.rand() & 0xffff + 65536) % 32768); + } + KOKKOS_INLINE_FUNCTION + static short draw(Generator& gen, const short& range) { + return short(gen.rand(range)); + } + KOKKOS_INLINE_FUNCTION + static short draw(Generator& gen, const short& start, const short& end) { + return short(gen.rand(start, end)); + } +}; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static int max() { return Generator::MAX_RAND; } + KOKKOS_INLINE_FUNCTION + static int draw(Generator& gen) { return gen.rand(); } + KOKKOS_INLINE_FUNCTION + static int draw(Generator& gen, const int& range) { return gen.rand(range); } + KOKKOS_INLINE_FUNCTION + static int draw(Generator& gen, const int& start, const int& end) { + return gen.rand(start, end); + } +}; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static unsigned int max() { return Generator::MAX_URAND; } + KOKKOS_INLINE_FUNCTION + static unsigned int draw(Generator& gen) { return gen.urand(); } + KOKKOS_INLINE_FUNCTION + static unsigned int draw(Generator& gen, const unsigned int& range) { + return gen.urand(range); + } + KOKKOS_INLINE_FUNCTION + static unsigned int draw(Generator& gen, const unsigned int& start, + const unsigned int& end) { + return gen.urand(start, end); + } +}; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static long max() { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(long) == 4 ? static_cast(Generator::MAX_RAND) + : static_cast(Generator::MAX_RAND64); + } + KOKKOS_INLINE_FUNCTION + static long draw(Generator& gen) { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(long) == 4 ? static_cast(gen.rand()) + : static_cast(gen.rand64()); + } + KOKKOS_INLINE_FUNCTION + static long draw(Generator& gen, const long& range) { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(long) == 4 + ? static_cast(gen.rand(static_cast(range))) + : static_cast(gen.rand64(range)); + } + KOKKOS_INLINE_FUNCTION + static long draw(Generator& gen, const long& start, const long& end) { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(long) == 4 + ? static_cast( + gen.rand(static_cast(start), static_cast(end))) + : static_cast(gen.rand64(start, end)); + } +}; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static unsigned long max() { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(unsigned long) == 4 + ? static_cast(Generator::MAX_URAND) + : static_cast(Generator::MAX_URAND64); + } + KOKKOS_INLINE_FUNCTION + static unsigned long draw(Generator& gen) { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(unsigned long) == 4 + ? static_cast(gen.urand()) + : static_cast(gen.urand64()); + } + KOKKOS_INLINE_FUNCTION + static unsigned long draw(Generator& gen, const unsigned long& range) { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(unsigned long) == 4 + ? static_cast( + gen.urand(static_cast(range))) + : static_cast(gen.urand64(range)); + } + KOKKOS_INLINE_FUNCTION + static unsigned long draw(Generator& gen, const unsigned long& start, + const unsigned long& end) { + // FIXME (mfh 26 Oct 2014) It would be better to select the + // return value at compile time, using something like enable_if. + return sizeof(unsigned long) == 4 + ? static_cast( + gen.urand(static_cast(start), + static_cast(end))) + : static_cast(gen.urand64(start, end)); + } +}; + +// NOTE (mfh 26 oct 2014) This is a partial specialization for long +// long, a C99 / C++11 signed type which is guaranteed to be at +// least 64 bits. Do NOT write a partial specialization for +// int64_t!!! This is just an alias! It could be either long or +// long long. We don't know which a priori, and I've seen both. +// The types long and long long are guaranteed to differ, so it's +// always safe to specialize for both. +template +struct rand { + KOKKOS_INLINE_FUNCTION + static long long max() { + // FIXME (mfh 26 Oct 2014) It's legal for long long to be > 64 bits. + return Generator::MAX_RAND64; + } + KOKKOS_INLINE_FUNCTION + static long long draw(Generator& gen) { + // FIXME (mfh 26 Oct 2014) It's legal for long long to be > 64 bits. + return gen.rand64(); + } + KOKKOS_INLINE_FUNCTION + static long long draw(Generator& gen, const long long& range) { + // FIXME (mfh 26 Oct 2014) It's legal for long long to be > 64 bits. + return gen.rand64(range); + } + KOKKOS_INLINE_FUNCTION + static long long draw(Generator& gen, const long long& start, + const long long& end) { + // FIXME (mfh 26 Oct 2014) It's legal for long long to be > 64 bits. + return gen.rand64(start, end); + } +}; + +// NOTE (mfh 26 oct 2014) This is a partial specialization for +// unsigned long long, a C99 / C++11 unsigned type which is +// guaranteed to be at least 64 bits. Do NOT write a partial +// specialization for uint64_t!!! This is just an alias! It could +// be either unsigned long or unsigned long long. We don't know +// which a priori, and I've seen both. The types unsigned long and +// unsigned long long are guaranteed to differ, so it's always safe +// to specialize for both. +template +struct rand { + KOKKOS_INLINE_FUNCTION + static unsigned long long max() { + // FIXME (mfh 26 Oct 2014) It's legal for unsigned long long to be > 64 + // bits. + return Generator::MAX_URAND64; + } + KOKKOS_INLINE_FUNCTION + static unsigned long long draw(Generator& gen) { + // FIXME (mfh 26 Oct 2014) It's legal for unsigned long long to be > 64 + // bits. + return gen.urand64(); + } + KOKKOS_INLINE_FUNCTION + static unsigned long long draw(Generator& gen, + const unsigned long long& range) { + // FIXME (mfh 26 Oct 2014) It's legal for long long to be > 64 bits. + return gen.urand64(range); + } + KOKKOS_INLINE_FUNCTION + static unsigned long long draw(Generator& gen, + const unsigned long long& start, + const unsigned long long& end) { + // FIXME (mfh 26 Oct 2014) It's legal for long long to be > 64 bits. + return gen.urand64(start, end); + } +}; + +#if defined(KOKKOS_HALF_T_IS_FLOAT) && !KOKKOS_HALF_T_IS_FLOAT +template +struct rand { + using half = Kokkos::Experimental::half_t; + KOKKOS_INLINE_FUNCTION + static half max() { return half(1.0); } + KOKKOS_INLINE_FUNCTION + static half draw(Generator& gen) { return half(gen.frand()); } + KOKKOS_INLINE_FUNCTION + static half draw(Generator& gen, const half& range) { + return half(gen.frand(float(range))); + } + KOKKOS_INLINE_FUNCTION + static half draw(Generator& gen, const half& start, const half& end) { + return half(gen.frand(float(start), float(end))); + } +}; +#endif // defined(KOKKOS_HALF_T_IS_FLOAT) && !KOKKOS_HALF_T_IS_FLOAT + +#if defined(KOKKOS_BHALF_T_IS_FLOAT) && !KOKKOS_BHALF_T_IS_FLOAT +template +struct rand { + using bhalf = Kokkos::Experimental::bhalf_t; + KOKKOS_INLINE_FUNCTION + static bhalf max() { return bhalf(1.0); } + KOKKOS_INLINE_FUNCTION + static bhalf draw(Generator& gen) { return bhalf(gen.frand()); } + KOKKOS_INLINE_FUNCTION + static bhalf draw(Generator& gen, const bhalf& range) { + return bhalf(gen.frand(float(range))); + } + KOKKOS_INLINE_FUNCTION + static bhalf draw(Generator& gen, const bhalf& start, const bhalf& end) { + return bhalf(gen.frand(float(start), float(end))); + } +}; +#endif // defined(KOKKOS_BHALF_T_IS_FLOAT) && !KOKKOS_BHALF_T_IS_FLOAT + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static float max() { return 1.0f; } + KOKKOS_INLINE_FUNCTION + static float draw(Generator& gen) { return gen.frand(); } + KOKKOS_INLINE_FUNCTION + static float draw(Generator& gen, const float& range) { + return gen.frand(range); + } + KOKKOS_INLINE_FUNCTION + static float draw(Generator& gen, const float& start, const float& end) { + return gen.frand(start, end); + } +}; + +template +struct rand { + KOKKOS_INLINE_FUNCTION + static double max() { return 1.0; } + KOKKOS_INLINE_FUNCTION + static double draw(Generator& gen) { return gen.drand(); } + KOKKOS_INLINE_FUNCTION + static double draw(Generator& gen, const double& range) { + return gen.drand(range); + } + KOKKOS_INLINE_FUNCTION + static double draw(Generator& gen, const double& start, const double& end) { + return gen.drand(start, end); + } +}; + +template +struct rand> { + KOKKOS_INLINE_FUNCTION + static Kokkos::complex max() { + return Kokkos::complex(1.0, 1.0); + } + KOKKOS_INLINE_FUNCTION + static Kokkos::complex draw(Generator& gen) { + const float re = gen.frand(); + const float im = gen.frand(); + return Kokkos::complex(re, im); + } + KOKKOS_INLINE_FUNCTION + static Kokkos::complex draw(Generator& gen, + const Kokkos::complex& range) { + const float re = gen.frand(real(range)); + const float im = gen.frand(imag(range)); + return Kokkos::complex(re, im); + } + KOKKOS_INLINE_FUNCTION + static Kokkos::complex draw(Generator& gen, + const Kokkos::complex& start, + const Kokkos::complex& end) { + const float re = gen.frand(real(start), real(end)); + const float im = gen.frand(imag(start), imag(end)); + return Kokkos::complex(re, im); + } +}; + +template +struct rand> { + KOKKOS_INLINE_FUNCTION + static Kokkos::complex max() { + return Kokkos::complex(1.0, 1.0); + } + KOKKOS_INLINE_FUNCTION + static Kokkos::complex draw(Generator& gen) { + const double re = gen.drand(); + const double im = gen.drand(); + return Kokkos::complex(re, im); + } + KOKKOS_INLINE_FUNCTION + static Kokkos::complex draw(Generator& gen, + const Kokkos::complex& range) { + const double re = gen.drand(real(range)); + const double im = gen.drand(imag(range)); + return Kokkos::complex(re, im); + } + KOKKOS_INLINE_FUNCTION + static Kokkos::complex draw(Generator& gen, + const Kokkos::complex& start, + const Kokkos::complex& end) { + const double re = gen.drand(real(start), real(end)); + const double im = gen.drand(imag(start), imag(end)); + return Kokkos::complex(re, im); + } +}; + +template +class Random_XorShift1024_Pool; + +namespace Impl { + +template +struct Random_XorShift1024_State { + uint64_t state_[16]; + KOKKOS_DEFAULTED_FUNCTION + Random_XorShift1024_State() = default; + + template + KOKKOS_FUNCTION Random_XorShift1024_State(const StateViewType& v, + int state_idx) { + for (int i = 0; i < 16; i++) state_[i] = v(state_idx, i); + } + + KOKKOS_FUNCTION + uint64_t operator[](const int i) const { return state_[i]; } + + KOKKOS_FUNCTION + uint64_t& operator[](const int i) { return state_[i]; } +}; + +template <> +struct Random_XorShift1024_State { + uint64_t* state_; + const int stride_; + KOKKOS_FUNCTION + Random_XorShift1024_State() : state_(nullptr), stride_(1){}; + + template + KOKKOS_FUNCTION Random_XorShift1024_State(const StateViewType& v, + int state_idx) + : state_(&v(state_idx, 0)), stride_(v.stride_1()) {} + + KOKKOS_FUNCTION + uint64_t operator[](const int i) const { return state_[i * stride_]; } + + KOKKOS_FUNCTION + uint64_t& operator[](const int i) { return state_[i * stride_]; } +}; + +template +struct Random_XorShift1024_UseCArrayState : std::true_type {}; + +#ifdef KOKKOS_ENABLE_CUDA +template <> +struct Random_XorShift1024_UseCArrayState : std::false_type {}; +#endif +#ifdef KOKKOS_ENABLE_HIP +template <> +struct Random_XorShift1024_UseCArrayState + : std::false_type {}; +#endif +#ifdef KOKKOS_ENABLE_OPENMPTARGET +template <> +struct Random_XorShift1024_UseCArrayState + : std::false_type {}; +#endif + +template +struct Random_UniqueIndex { + using locks_view_type = View; + KOKKOS_FUNCTION + static int get_state_idx(const locks_view_type) { + KOKKOS_IF_ON_HOST( + (return DeviceType::execution_space::impl_hardware_thread_id();)) + + KOKKOS_IF_ON_DEVICE((return 0;)) + } +}; + +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) + +#if defined(KOKKOS_ENABLE_CUDA) +#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Cuda +#elif defined(KOKKOS_ENABLE_HIP) +#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Experimental::HIP +#endif + +template +struct Random_UniqueIndex< + Kokkos::Device> { + using locks_view_type = + View>; + KOKKOS_FUNCTION + static int get_state_idx(const locks_view_type& locks_) { + KOKKOS_IF_ON_DEVICE(( + const int i_offset = + (threadIdx.x * blockDim.y + threadIdx.y) * blockDim.z + threadIdx.z; + int i = + (((blockIdx.x * gridDim.y + blockIdx.y) * gridDim.z + blockIdx.z) * + blockDim.x * blockDim.y * blockDim.z + + i_offset) % + locks_.extent(0); + while (Kokkos::atomic_compare_exchange(&locks_(i, 0), 0, 1)) { + i += blockDim.x * blockDim.y * blockDim.z; + if (i >= static_cast(locks_.extent(0))) { + i = i_offset; + } + } + + return i;)) + KOKKOS_IF_ON_HOST(((void)locks_; return 0;)) + } +}; + +#undef KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP + +#endif + +#ifdef KOKKOS_ENABLE_SYCL +template +struct Random_UniqueIndex< + Kokkos::Device> { + using locks_view_type = + View>; + KOKKOS_FUNCTION + static int get_state_idx(const locks_view_type& locks_) { + auto item = sycl::ext::oneapi::experimental::this_nd_item<3>(); + std::size_t threadIdx[3] = {item.get_local_id(2), item.get_local_id(1), + item.get_local_id(0)}; + std::size_t blockIdx[3] = {item.get_group(2), item.get_group(1), + item.get_group(0)}; + std::size_t blockDim[3] = {item.get_local_range(2), item.get_local_range(1), + item.get_local_range(0)}; + std::size_t gridDim[3] = { + item.get_global_range(2) / item.get_local_range(2), + item.get_global_range(1) / item.get_local_range(1), + item.get_global_range(0) / item.get_local_range(0)}; + const int i_offset = + (threadIdx[0] * blockDim[1] + threadIdx[1]) * blockDim[2] + + threadIdx[2]; + int i = + (((blockIdx[0] * gridDim[1] + blockIdx[1]) * gridDim[2] + blockIdx[2]) * + blockDim[0] * blockDim[1] * blockDim[2] + + i_offset) % + locks_.extent(0); + while (Kokkos::atomic_compare_exchange(&locks_(i, 0), 0, 1)) { + i += blockDim[0] * blockDim[1] * blockDim[2]; + if (i >= static_cast(locks_.extent(0))) { + i = i_offset; + } + } + return i; + } +}; +#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); + + while (Kokkos::atomic_compare_exchange(&locks(i, 0), 0, 1)) { + i = (i + 1) % lock_size; + } + return i; + } +}; +#endif + +} // namespace Impl + +template +class Random_XorShift64_Pool; + +template +class Random_XorShift64 { + private: + uint64_t state_; + const int state_idx_; + friend class Random_XorShift64_Pool; + + public: + using device_type = DeviceType; + + constexpr static uint32_t MAX_URAND = std::numeric_limits::max(); + constexpr static uint64_t MAX_URAND64 = std::numeric_limits::max(); + constexpr static int32_t MAX_RAND = std::numeric_limits::max(); + constexpr static int64_t MAX_RAND64 = std::numeric_limits::max(); + + KOKKOS_INLINE_FUNCTION + Random_XorShift64(uint64_t state, int state_idx = 0) + : state_(state == 0 ? uint64_t(1318319) : state), state_idx_(state_idx) {} + + KOKKOS_INLINE_FUNCTION + uint32_t urand() { + state_ ^= state_ >> 12; + state_ ^= state_ << 25; + state_ ^= state_ >> 27; + + uint64_t tmp = state_ * 2685821657736338717ULL; + tmp = tmp >> 16; + return static_cast(tmp & MAX_URAND); + } + + KOKKOS_INLINE_FUNCTION + uint64_t urand64() { + state_ ^= state_ >> 12; + state_ ^= state_ << 25; + state_ ^= state_ >> 27; + return (state_ * 2685821657736338717ULL) - 1; + } + + KOKKOS_INLINE_FUNCTION + uint32_t urand(const uint32_t& range) { + const uint32_t max_val = (MAX_URAND / range) * range; + uint32_t tmp = urand(); + while (tmp >= max_val) tmp = urand(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + uint32_t urand(const uint32_t& start, const uint32_t& end) { + return urand(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + uint64_t urand64(const uint64_t& range) { + const uint64_t max_val = (MAX_URAND64 / range) * range; + uint64_t tmp = urand64(); + while (tmp >= max_val) tmp = urand64(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + uint64_t urand64(const uint64_t& start, const uint64_t& end) { + return urand64(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + int rand() { return static_cast(urand() / 2); } + + KOKKOS_INLINE_FUNCTION + int rand(const int& range) { + const int max_val = (MAX_RAND / range) * range; + int tmp = rand(); + while (tmp >= max_val) tmp = rand(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + int rand(const int& start, const int& end) { + return rand(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + int64_t rand64() { return static_cast(urand64() / 2); } + + KOKKOS_INLINE_FUNCTION + int64_t rand64(const int64_t& range) { + const int64_t max_val = (MAX_RAND64 / range) * range; + int64_t tmp = rand64(); + while (tmp >= max_val) tmp = rand64(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + int64_t rand64(const int64_t& start, const int64_t& end) { + return rand64(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + float frand() { return urand64() / static_cast(MAX_URAND64); } + + KOKKOS_INLINE_FUNCTION + float frand(const float& range) { + return range * urand64() / static_cast(MAX_URAND64); + } + + KOKKOS_INLINE_FUNCTION + float frand(const float& start, const float& end) { + return frand(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + double drand() { return urand64() / static_cast(MAX_URAND64); } + + KOKKOS_INLINE_FUNCTION + double drand(const double& range) { + return range * urand64() / static_cast(MAX_URAND64); + } + + KOKKOS_INLINE_FUNCTION + double drand(const double& start, const double& end) { + return drand(end - start) + start; + } + + // Marsaglia polar method for drawing a standard normal distributed random + // number + KOKKOS_INLINE_FUNCTION + double normal() { + double S = 2.0; + double U; + while (S >= 1.0) { + U = 2.0 * drand() - 1.0; + const double V = 2.0 * drand() - 1.0; + S = U * U + V * V; + } + return U * std::sqrt(-2.0 * std::log(S) / S); + } + + KOKKOS_INLINE_FUNCTION + double normal(const double& mean, const double& std_dev = 1.0) { + return mean + normal() * std_dev; + } +}; + +template +class Random_XorShift64_Pool { + public: + using device_type = typename DeviceType::device_type; + + private: + using execution_space = typename device_type::execution_space; + using locks_type = View; + using state_data_type = View; + locks_type locks_; + state_data_type state_; + int num_states_; + int padding_; + + public: + using generator_type = Random_XorShift64; + + KOKKOS_INLINE_FUNCTION + Random_XorShift64_Pool() { + num_states_ = 0; + padding_ = 0; + } + Random_XorShift64_Pool(uint64_t seed) { + num_states_ = 0; + + init(seed, execution_space().concurrency()); + } + + KOKKOS_INLINE_FUNCTION + Random_XorShift64_Pool(const Random_XorShift64_Pool& src) + : locks_(src.locks_), state_(src.state_), num_states_(src.num_states_) {} + + KOKKOS_INLINE_FUNCTION + Random_XorShift64_Pool operator=(const Random_XorShift64_Pool& src) { + locks_ = src.locks_; + state_ = src.state_; + num_states_ = src.num_states_; + padding_ = src.padding_; + return *this; + } + + void init(uint64_t seed, int num_states) { + if (seed == 0) seed = uint64_t(1318319); + // I only want to pad on CPU like archs (less than 1000 threads). 64 is a + // magic number, or random number I just wanted something not too large and + // not too small. 64 sounded fine. + padding_ = num_states < 1000 ? 64 : 1; + num_states_ = num_states; + + locks_ = + locks_type("Kokkos::Random_XorShift64::locks", num_states, padding_); + state_ = state_data_type("Kokkos::Random_XorShift64::state", num_states_, + padding_); + + typename state_data_type::HostMirror h_state = + Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state_); + typename locks_type::HostMirror h_lock = + Kokkos::create_mirror_view(Kokkos::WithoutInitializing, locks_); + + // Execute on the HostMirror's default execution space. + Random_XorShift64 + gen(seed, 0); + for (int i = 0; i < 17; i++) gen.rand(); + for (int i = 0; i < num_states_; i++) { + int n1 = gen.rand(); + int n2 = gen.rand(); + int n3 = gen.rand(); + int n4 = gen.rand(); + h_state(i, 0) = (((static_cast(n1)) & 0xffff) << 00) | + (((static_cast(n2)) & 0xffff) << 16) | + (((static_cast(n3)) & 0xffff) << 32) | + (((static_cast(n4)) & 0xffff) << 48); + h_lock(i, 0) = 0; + } + deep_copy(state_, h_state); + deep_copy(locks_, h_lock); + } + + KOKKOS_INLINE_FUNCTION + Random_XorShift64 get_state() const { + const int i = Impl::Random_UniqueIndex::get_state_idx(locks_); + return Random_XorShift64(state_(i, 0), i); + } + + // NOTE: state_idx MUST be unique and less than num_states + KOKKOS_INLINE_FUNCTION + Random_XorShift64 get_state(const int state_idx) const { + return Random_XorShift64(state_(state_idx, 0), state_idx); + } + + KOKKOS_INLINE_FUNCTION + void free_state(const Random_XorShift64& state) const { + state_(state.state_idx_, 0) = state.state_; + locks_(state.state_idx_, 0) = 0; + } +}; + +template +class Random_XorShift1024 { + using execution_space = typename DeviceType::execution_space; + + private: + int p_; + const int state_idx_; + Impl::Random_XorShift1024_State< + Impl::Random_XorShift1024_UseCArrayState::value> + state_; + friend class Random_XorShift1024_Pool; + + public: + using pool_type = Random_XorShift1024_Pool; + using device_type = DeviceType; + + constexpr static uint32_t MAX_URAND = std::numeric_limits::max(); + constexpr static uint64_t MAX_URAND64 = std::numeric_limits::max(); + constexpr static int32_t MAX_RAND = std::numeric_limits::max(); + constexpr static int64_t MAX_RAND64 = std::numeric_limits::max(); + + KOKKOS_INLINE_FUNCTION + Random_XorShift1024(const typename pool_type::state_data_type& state, int p, + int state_idx = 0) + : p_(p), state_idx_(state_idx), state_(state, state_idx) {} + + KOKKOS_INLINE_FUNCTION + uint32_t urand() { + uint64_t state_0 = state_[p_]; + uint64_t state_1 = state_[p_ = (p_ + 1) & 15]; + state_1 ^= state_1 << 31; + state_1 ^= state_1 >> 11; + state_0 ^= state_0 >> 30; + uint64_t tmp = (state_[p_] = state_0 ^ state_1) * 1181783497276652981ULL; + tmp = tmp >> 16; + return static_cast(tmp & MAX_URAND); + } + + KOKKOS_INLINE_FUNCTION + uint64_t urand64() { + uint64_t state_0 = state_[p_]; + uint64_t state_1 = state_[p_ = (p_ + 1) & 15]; + state_1 ^= state_1 << 31; + state_1 ^= state_1 >> 11; + state_0 ^= state_0 >> 30; + return ((state_[p_] = state_0 ^ state_1) * 1181783497276652981LL) - 1; + } + + KOKKOS_INLINE_FUNCTION + uint32_t urand(const uint32_t& range) { + const uint32_t max_val = (MAX_URAND / range) * range; + uint32_t tmp = urand(); + while (tmp >= max_val) tmp = urand(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + uint32_t urand(const uint32_t& start, const uint32_t& end) { + return urand(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + uint64_t urand64(const uint64_t& range) { + const uint64_t max_val = (MAX_URAND64 / range) * range; + uint64_t tmp = urand64(); + while (tmp >= max_val) tmp = urand64(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + uint64_t urand64(const uint64_t& start, const uint64_t& end) { + return urand64(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + int rand() { return static_cast(urand() / 2); } + + KOKKOS_INLINE_FUNCTION + int rand(const int& range) { + const int max_val = (MAX_RAND / range) * range; + int tmp = rand(); + while (tmp >= max_val) tmp = rand(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + int rand(const int& start, const int& end) { + return rand(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + int64_t rand64() { return static_cast(urand64() / 2); } + + KOKKOS_INLINE_FUNCTION + int64_t rand64(const int64_t& range) { + const int64_t max_val = (MAX_RAND64 / range) * range; + int64_t tmp = rand64(); + while (tmp >= max_val) tmp = rand64(); + return tmp % range; + } + + KOKKOS_INLINE_FUNCTION + int64_t rand64(const int64_t& start, const int64_t& end) { + return rand64(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + float frand() { return urand64() / static_cast(MAX_URAND64); } + + KOKKOS_INLINE_FUNCTION + float frand(const float& range) { + return range * urand64() / static_cast(MAX_URAND64); + } + + KOKKOS_INLINE_FUNCTION + float frand(const float& start, const float& end) { + return frand(end - start) + start; + } + + KOKKOS_INLINE_FUNCTION + double drand() { return urand64() / static_cast(MAX_URAND64); } + + KOKKOS_INLINE_FUNCTION + double drand(const double& range) { + return range * urand64() / static_cast(MAX_URAND64); + } + + KOKKOS_INLINE_FUNCTION + double drand(const double& start, const double& end) { + return drand(end - start) + start; + } + + // Marsaglia polar method for drawing a standard normal distributed random + // number + KOKKOS_INLINE_FUNCTION + double normal() { + double S = 2.0; + double U; + while (S >= 1.0) { + U = 2.0 * drand() - 1.0; + const double V = 2.0 * drand() - 1.0; + S = U * U + V * V; + } + return U * std::sqrt(-2.0 * std::log(S) / S); + } + + KOKKOS_INLINE_FUNCTION + double normal(const double& mean, const double& std_dev = 1.0) { + return mean + normal() * std_dev; + } +}; + +template +class Random_XorShift1024_Pool { + public: + using device_type = typename DeviceType::device_type; + + private: + using execution_space = typename device_type::execution_space; + using locks_type = View; + using int_view_type = View; + using state_data_type = View; + + locks_type locks_; + state_data_type state_; + int_view_type p_; + int num_states_; + int padding_; + friend class Random_XorShift1024; + + public: + using generator_type = Random_XorShift1024; + + KOKKOS_INLINE_FUNCTION + Random_XorShift1024_Pool() { num_states_ = 0; } + + inline Random_XorShift1024_Pool(uint64_t seed) { + num_states_ = 0; + + init(seed, execution_space().concurrency()); + } + + KOKKOS_INLINE_FUNCTION + Random_XorShift1024_Pool(const Random_XorShift1024_Pool& src) + : locks_(src.locks_), + state_(src.state_), + p_(src.p_), + num_states_(src.num_states_) {} + + KOKKOS_INLINE_FUNCTION + Random_XorShift1024_Pool operator=(const Random_XorShift1024_Pool& src) { + locks_ = src.locks_; + state_ = src.state_; + p_ = src.p_; + num_states_ = src.num_states_; + padding_ = src.padding_; + return *this; + } + + inline void init(uint64_t seed, int num_states) { + if (seed == 0) seed = uint64_t(1318319); + // I only want to pad on CPU like archs (less than 1000 threads). 64 is a + // magic number, or random number I just wanted something not too large and + // not too small. 64 sounded fine. + padding_ = num_states < 1000 ? 64 : 1; + num_states_ = num_states; + locks_ = + locks_type("Kokkos::Random_XorShift1024::locks", num_states_, padding_); + state_ = state_data_type("Kokkos::Random_XorShift1024::state", num_states_); + p_ = int_view_type("Kokkos::Random_XorShift1024::p", num_states_, padding_); + + typename state_data_type::HostMirror h_state = + Kokkos::create_mirror_view(Kokkos::WithoutInitializing, state_); + typename locks_type::HostMirror h_lock = + Kokkos::create_mirror_view(Kokkos::WithoutInitializing, locks_); + typename int_view_type::HostMirror h_p = + Kokkos::create_mirror_view(Kokkos::WithoutInitializing, p_); + + // Execute on the HostMirror's default execution space. + Random_XorShift64 + gen(seed, 0); + for (int i = 0; i < 17; i++) gen.rand(); + for (int i = 0; i < num_states_; i++) { + for (int j = 0; j < 16; j++) { + int n1 = gen.rand(); + int n2 = gen.rand(); + int n3 = gen.rand(); + int n4 = gen.rand(); + h_state(i, j) = (((static_cast(n1)) & 0xffff) << 00) | + (((static_cast(n2)) & 0xffff) << 16) | + (((static_cast(n3)) & 0xffff) << 32) | + (((static_cast(n4)) & 0xffff) << 48); + } + h_p(i, 0) = 0; + h_lock(i, 0) = 0; + } + deep_copy(state_, h_state); + deep_copy(locks_, h_lock); + } + + KOKKOS_INLINE_FUNCTION + Random_XorShift1024 get_state() const { + const int i = Impl::Random_UniqueIndex::get_state_idx(locks_); + return Random_XorShift1024(state_, p_(i, 0), i); + }; + + // NOTE: state_idx MUST be unique and less than num_states + KOKKOS_INLINE_FUNCTION + Random_XorShift1024 get_state(const int state_idx) const { + return Random_XorShift1024(state_, p_(state_idx, 0), state_idx); + } + + KOKKOS_INLINE_FUNCTION + void free_state(const Random_XorShift1024& state) const { + for (int i = 0; i < 16; i++) state_(state.state_idx_, i) = state.state_[i]; + p_(state.state_idx_, 0) = state.p_; + locks_(state.state_idx_, 0) = 0; + } +}; + +namespace Impl { + +template +struct fill_random_functor_begin_end; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + a() = Rand::draw(gen, begin, end); + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) + a(idx) = Rand::draw(gen, begin, end); + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType k = 0; k < static_cast(a.extent(1)); k++) + a(idx, k) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType k = 0; k < static_cast(a.extent(1)); k++) + for (IndexType l = 0; l < static_cast(a.extent(2)); l++) + a(idx, k, l) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType k = 0; k < static_cast(a.extent(1)); k++) + for (IndexType l = 0; l < static_cast(a.extent(2)); l++) + for (IndexType m = 0; m < static_cast(a.extent(3)); m++) + a(idx, k, l, m) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType l = 0; l < static_cast(a.extent(1)); l++) + for (IndexType m = 0; m < static_cast(a.extent(2)); m++) + for (IndexType n = 0; n < static_cast(a.extent(3)); n++) + for (IndexType o = 0; o < static_cast(a.extent(4)); + o++) + a(idx, l, m, n, o) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType k = 0; k < static_cast(a.extent(1)); k++) + for (IndexType l = 0; l < static_cast(a.extent(2)); l++) + for (IndexType m = 0; m < static_cast(a.extent(3)); m++) + for (IndexType n = 0; n < static_cast(a.extent(4)); + n++) + for (IndexType o = 0; o < static_cast(a.extent(5)); + o++) + a(idx, k, l, m, n, o) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType k = 0; k < static_cast(a.extent(1)); k++) + for (IndexType l = 0; l < static_cast(a.extent(2)); l++) + for (IndexType m = 0; m < static_cast(a.extent(3)); m++) + for (IndexType n = 0; n < static_cast(a.extent(4)); + n++) + for (IndexType o = 0; o < static_cast(a.extent(5)); + o++) + for (IndexType p = 0; p < static_cast(a.extent(6)); + p++) + a(idx, k, l, m, n, o, p) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +struct fill_random_functor_begin_end { + ViewType a; + RandomPool rand_pool; + typename ViewType::const_value_type begin, end; + + using Rand = rand; + + fill_random_functor_begin_end(ViewType a_, RandomPool rand_pool_, + typename ViewType::const_value_type begin_, + typename ViewType::const_value_type end_) + : a(a_), rand_pool(rand_pool_), begin(begin_), end(end_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(IndexType i) const { + typename RandomPool::generator_type gen = rand_pool.get_state(); + for (IndexType j = 0; j < loops; j++) { + const IndexType idx = i * loops + j; + if (idx < static_cast(a.extent(0))) { + for (IndexType k = 0; k < static_cast(a.extent(1)); k++) + for (IndexType l = 0; l < static_cast(a.extent(2)); l++) + for (IndexType m = 0; m < static_cast(a.extent(3)); m++) + for (IndexType n = 0; n < static_cast(a.extent(4)); + n++) + for (IndexType o = 0; o < static_cast(a.extent(5)); + o++) + for (IndexType p = 0; p < static_cast(a.extent(6)); + p++) + for (IndexType q = 0; + q < static_cast(a.extent(7)); q++) + a(idx, k, l, m, n, o, p, q) = Rand::draw(gen, begin, end); + } + } + rand_pool.free_state(gen); + } +}; + +template +void fill_random(const ExecutionSpace& exec, ViewType a, RandomPool g, + typename ViewType::const_value_type begin, + typename ViewType::const_value_type end) { + int64_t LDA = a.extent(0); + if (LDA > 0) + parallel_for( + "Kokkos::fill_random", + Kokkos::RangePolicy(exec, 0, (LDA + 127) / 128), + Impl::fill_random_functor_begin_end( + a, g, begin, end)); +} + +} // namespace Impl + +template +void fill_random(const ExecutionSpace& exec, ViewType a, RandomPool g, + typename ViewType::const_value_type begin, + typename ViewType::const_value_type end) { + Impl::apply_to_view_of_static_rank( + [&](auto dst) { Kokkos::Impl::fill_random(exec, dst, g, begin, end); }, + a); +} + +template +void fill_random(const ExecutionSpace& exec, ViewType a, RandomPool g, + typename ViewType::const_value_type range) { + fill_random(exec, a, g, 0, range); +} + +template +void fill_random(ViewType a, RandomPool g, + typename ViewType::const_value_type begin, + typename ViewType::const_value_type end) { + fill_random(typename ViewType::execution_space{}, a, g, begin, end); +} + +template +void fill_random(ViewType a, RandomPool g, + typename ViewType::const_value_type range) { + fill_random(typename ViewType::execution_space{}, a, g, 0, range); +} + +} // namespace Kokkos + +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_RANDOM +#endif +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/Kokkos_Sort.hpp b/bundled/kokkos-3.7.00/algorithms/src/Kokkos_Sort.hpp new file mode 100644 index 0000000000..ad0c2d47b6 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/Kokkos_Sort.hpp @@ -0,0 +1,696 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_SORT_HPP_ +#define KOKKOS_SORT_HPP_ +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SORT +#endif + +#include + +#include + +namespace Kokkos { + +namespace Impl { + +template +struct CopyOp; + +template +struct CopyOp { + KOKKOS_INLINE_FUNCTION + static void copy(DstViewType const& dst, size_t i_dst, SrcViewType const& src, + size_t i_src) { + dst(i_dst) = src(i_src); + } +}; + +template +struct CopyOp { + KOKKOS_INLINE_FUNCTION + static void copy(DstViewType const& dst, size_t i_dst, SrcViewType const& src, + size_t i_src) { + for (int j = 0; j < (int)dst.extent(1); j++) dst(i_dst, j) = src(i_src, j); + } +}; + +template +struct CopyOp { + KOKKOS_INLINE_FUNCTION + static void copy(DstViewType const& dst, size_t i_dst, SrcViewType const& src, + size_t i_src) { + for (int j = 0; j < dst.extent(1); j++) + for (int k = 0; k < dst.extent(2); k++) + dst(i_dst, j, k) = src(i_src, j, k); + } +}; +} // namespace Impl + +//---------------------------------------------------------------------------- + +template +class BinSort { + public: + template + struct copy_functor { + using src_view_type = typename SrcViewType::const_type; + + using copy_op = Impl::CopyOp; + + DstViewType dst_values; + src_view_type src_values; + int dst_offset; + + copy_functor(DstViewType const& dst_values_, int const& dst_offset_, + SrcViewType const& src_values_) + : dst_values(dst_values_), + src_values(src_values_), + dst_offset(dst_offset_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const int& i) const { + copy_op::copy(dst_values, i + dst_offset, src_values, i); + } + }; + + template + struct copy_permute_functor { + // If a Kokkos::View then can generate constant random access + // otherwise can only use the constant type. + + using src_view_type = std::conditional_t< + Kokkos::is_view::value, + Kokkos::View >, + typename SrcViewType::const_type>; + + using perm_view_type = typename PermuteViewType::const_type; + + using copy_op = Impl::CopyOp; + + DstViewType dst_values; + perm_view_type sort_order; + src_view_type src_values; + int src_offset; + + copy_permute_functor(DstViewType const& dst_values_, + PermuteViewType const& sort_order_, + SrcViewType const& src_values_, int const& src_offset_) + : dst_values(dst_values_), + sort_order(sort_order_), + src_values(src_values_), + src_offset(src_offset_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const int& i) const { + copy_op::copy(dst_values, i, src_values, src_offset + sort_order(i)); + } + }; + + // Naming this alias "execution_space" would be problematic since it would be + // considered as execution space for the various functors which might use + // another execution space through sort() or create_permute_vector(). + using exec_space = typename Space::execution_space; + using bin_op_type = BinSortOp; + + struct bin_count_tag {}; + struct bin_offset_tag {}; + struct bin_binning_tag {}; + struct bin_sort_bins_tag {}; + + public: + using size_type = SizeType; + using value_type = size_type; + + using offset_type = Kokkos::View; + using bin_count_type = Kokkos::View; + + using const_key_view_type = typename KeyViewType::const_type; + + // If a Kokkos::View then can generate constant random access + // otherwise can only use the constant type. + + using const_rnd_key_view_type = std::conditional_t< + Kokkos::is_view::value, + Kokkos::View >, + const_key_view_type>; + + using non_const_key_scalar = typename KeyViewType::non_const_value_type; + using const_key_scalar = typename KeyViewType::const_value_type; + + using bin_count_atomic_type = + Kokkos::View >; + + private: + const_key_view_type keys; + const_rnd_key_view_type keys_rnd; + + public: + BinSortOp bin_op; + offset_type bin_offsets; + bin_count_atomic_type bin_count_atomic; + bin_count_type bin_count_const; + offset_type sort_order; + + int range_begin; + int range_end; + bool sort_within_bins; + + public: + BinSort() = default; + + //---------------------------------------- + // Constructor: takes the keys, the binning_operator and optionally whether to + // sort within bins (default false) + template + BinSort(const ExecutionSpace& exec, const_key_view_type keys_, + int range_begin_, int range_end_, BinSortOp bin_op_, + bool sort_within_bins_ = false) + : keys(keys_), + keys_rnd(keys_), + bin_op(bin_op_), + bin_offsets(), + bin_count_atomic(), + bin_count_const(), + sort_order(), + range_begin(range_begin_), + range_end(range_end_), + sort_within_bins(sort_within_bins_) { + static_assert( + Kokkos::SpaceAccessibility::accessible, + "The provided execution space must be able to access the memory space " + "BinSort was initialized with!"); + if (bin_op.max_bins() <= 0) + Kokkos::abort( + "The number of bins in the BinSortOp object must be greater than 0!"); + bin_count_atomic = Kokkos::View( + "Kokkos::SortImpl::BinSortFunctor::bin_count", bin_op.max_bins()); + bin_count_const = bin_count_atomic; + bin_offsets = + offset_type(view_alloc(exec, WithoutInitializing, + "Kokkos::SortImpl::BinSortFunctor::bin_offsets"), + bin_op.max_bins()); + sort_order = + offset_type(view_alloc(exec, WithoutInitializing, + "Kokkos::SortImpl::BinSortFunctor::sort_order"), + range_end - range_begin); + } + + BinSort(const_key_view_type keys_, int range_begin_, int range_end_, + BinSortOp bin_op_, bool sort_within_bins_ = false) + : BinSort(exec_space{}, keys_, range_begin_, range_end_, bin_op_, + sort_within_bins_) {} + + template + BinSort(const ExecutionSpace& exec, const_key_view_type keys_, + BinSortOp bin_op_, bool sort_within_bins_ = false) + : BinSort(exec, keys_, 0, keys_.extent(0), bin_op_, sort_within_bins_) {} + + BinSort(const_key_view_type keys_, BinSortOp bin_op_, + bool sort_within_bins_ = false) + : BinSort(exec_space{}, keys_, bin_op_, sort_within_bins_) {} + + //---------------------------------------- + // Create the permutation vector, the bin_offset array and the bin_count + // array. Can be called again if keys changed + template + void create_permute_vector(const ExecutionSpace& exec = exec_space{}) { + static_assert( + Kokkos::SpaceAccessibility::accessible, + "The provided execution space must be able to access the memory space " + "BinSort was initialized with!"); + + const size_t len = range_end - range_begin; + Kokkos::parallel_for( + "Kokkos::Sort::BinCount", + Kokkos::RangePolicy(exec, 0, len), + *this); + Kokkos::parallel_scan("Kokkos::Sort::BinOffset", + Kokkos::RangePolicy( + exec, 0, bin_op.max_bins()), + *this); + + Kokkos::deep_copy(exec, bin_count_atomic, 0); + Kokkos::parallel_for( + "Kokkos::Sort::BinBinning", + Kokkos::RangePolicy(exec, 0, len), + *this); + + if (sort_within_bins) + Kokkos::parallel_for( + "Kokkos::Sort::BinSort", + Kokkos::RangePolicy( + exec, 0, bin_op.max_bins()), + *this); + } + + // Sort a subset of a view with respect to the first dimension using the + // permutation array + template + void sort(const ExecutionSpace& exec, ValuesViewType const& values, + int values_range_begin, int values_range_end) const { + static_assert( + Kokkos::SpaceAccessibility::accessible, + "The provided execution space must be able to access the memory space " + "BinSort was initialized with!"); + static_assert( + Kokkos::SpaceAccessibility< + ExecutionSpace, typename ValuesViewType::memory_space>::accessible, + "The provided execution space must be able to access the memory space " + "of the View argument!"); + + using scratch_view_type = + Kokkos::View; + + const size_t len = range_end - range_begin; + const size_t values_len = values_range_end - values_range_begin; + if (len != values_len) { + Kokkos::abort( + "BinSort::sort: values range length != permutation vector length"); + } + + scratch_view_type sorted_values( + view_alloc(exec, WithoutInitializing, + "Kokkos::SortImpl::BinSortFunctor::sorted_values"), + values.rank_dynamic > 0 ? len : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 1 ? values.extent(1) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 2 ? values.extent(2) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 3 ? values.extent(3) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 4 ? values.extent(4) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 5 ? values.extent(5) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 6 ? values.extent(6) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG, + values.rank_dynamic > 7 ? values.extent(7) + : KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + { + copy_permute_functor + functor(sorted_values, sort_order, values, + values_range_begin - range_begin); + + parallel_for("Kokkos::Sort::CopyPermute", + Kokkos::RangePolicy(exec, 0, len), functor); + } + + { + copy_functor functor( + values, range_begin, sorted_values); + + parallel_for("Kokkos::Sort::Copy", + Kokkos::RangePolicy(exec, 0, len), functor); + } + } + + // Sort a subset of a view with respect to the first dimension using the + // permutation array + template + void sort(ValuesViewType const& values, int values_range_begin, + int values_range_end) const { + exec_space exec; + sort(exec, values, values_range_begin, values_range_end); + exec.fence("Kokkos::Sort: fence after sorting"); + } + + template + void sort(ExecutionSpace const& exec, ValuesViewType const& values) const { + this->sort(exec, values, 0, /*values.extent(0)*/ range_end - range_begin); + } + + template + void sort(ValuesViewType const& values) const { + this->sort(values, 0, /*values.extent(0)*/ range_end - range_begin); + } + + // Get the permutation vector + KOKKOS_INLINE_FUNCTION + offset_type get_permute_vector() const { return sort_order; } + + // Get the start offsets for each bin + KOKKOS_INLINE_FUNCTION + offset_type get_bin_offsets() const { return bin_offsets; } + + // Get the count for each bin + KOKKOS_INLINE_FUNCTION + bin_count_type get_bin_count() const { return bin_count_const; } + + public: + KOKKOS_INLINE_FUNCTION + void operator()(const bin_count_tag& /*tag*/, const int i) const { + const int j = range_begin + i; + bin_count_atomic(bin_op.bin(keys, j))++; + } + + KOKKOS_INLINE_FUNCTION + void operator()(const bin_offset_tag& /*tag*/, const int i, + value_type& offset, const bool& final) const { + if (final) { + bin_offsets(i) = offset; + } + offset += bin_count_const(i); + } + + KOKKOS_INLINE_FUNCTION + void operator()(const bin_binning_tag& /*tag*/, const int i) const { + const int j = range_begin + i; + const int bin = bin_op.bin(keys, j); + const int count = bin_count_atomic(bin)++; + + sort_order(bin_offsets(bin) + count) = j; + } + + KOKKOS_INLINE_FUNCTION + void operator()(const bin_sort_bins_tag& /*tag*/, const int i) const { + auto bin_size = bin_count_const(i); + if (bin_size <= 1) return; + int upper_bound = bin_offsets(i) + bin_size; + bool sorted = false; + while (!sorted) { + sorted = true; + int old_idx = sort_order(bin_offsets(i)); + int new_idx = 0; + for (int k = bin_offsets(i) + 1; k < upper_bound; k++) { + new_idx = sort_order(k); + + if (!bin_op(keys_rnd, old_idx, new_idx)) { + sort_order(k - 1) = new_idx; + sort_order(k) = old_idx; + sorted = false; + } else { + old_idx = new_idx; + } + } + upper_bound--; + } + } +}; + +//---------------------------------------------------------------------------- + +template +struct BinOp1D { + int max_bins_ = {}; + double mul_ = {}; + double min_ = {}; + + BinOp1D() = default; + + // Construct BinOp with number of bins, minimum value and maximum value + BinOp1D(int max_bins__, typename KeyViewType::const_value_type min, + typename KeyViewType::const_value_type max) + : max_bins_(max_bins__ + 1), + // Cast to double to avoid possible overflow when using integer + mul_(static_cast(max_bins__) / + (static_cast(max) - static_cast(min))), + min_(static_cast(min)) { + // For integral types the number of bins may be larger than the range + // in which case we can exactly have one unique value per bin + // and then don't need to sort bins. + if (std::is_integral::value && + (static_cast(max) - static_cast(min)) <= + static_cast(max_bins__)) { + mul_ = 1.; + } + } + + // Determine bin index from key value + template + KOKKOS_INLINE_FUNCTION int bin(ViewType& keys, const int& i) const { + return static_cast(mul_ * (static_cast(keys(i)) - min_)); + } + + // Return maximum bin index + 1 + KOKKOS_INLINE_FUNCTION + int max_bins() const { return max_bins_; } + + // Compare to keys within a bin if true new_val will be put before old_val + template + KOKKOS_INLINE_FUNCTION bool operator()(ViewType& keys, iType1& i1, + iType2& i2) const { + return keys(i1) < keys(i2); + } +}; + +template +struct BinOp3D { + int max_bins_[3] = {}; + double mul_[3] = {}; + double min_[3] = {}; + + BinOp3D() = default; + + BinOp3D(int max_bins__[], typename KeyViewType::const_value_type min[], + typename KeyViewType::const_value_type max[]) { + max_bins_[0] = max_bins__[0]; + max_bins_[1] = max_bins__[1]; + max_bins_[2] = max_bins__[2]; + mul_[0] = static_cast(max_bins__[0]) / + (static_cast(max[0]) - static_cast(min[0])); + mul_[1] = static_cast(max_bins__[1]) / + (static_cast(max[1]) - static_cast(min[1])); + mul_[2] = static_cast(max_bins__[2]) / + (static_cast(max[2]) - static_cast(min[2])); + min_[0] = static_cast(min[0]); + min_[1] = static_cast(min[1]); + min_[2] = static_cast(min[2]); + } + + template + KOKKOS_INLINE_FUNCTION int bin(ViewType& keys, const int& i) const { + return int((((int(mul_[0] * (keys(i, 0) - min_[0])) * max_bins_[1]) + + int(mul_[1] * (keys(i, 1) - min_[1]))) * + max_bins_[2]) + + int(mul_[2] * (keys(i, 2) - min_[2]))); + } + + KOKKOS_INLINE_FUNCTION + int max_bins() const { return max_bins_[0] * max_bins_[1] * max_bins_[2]; } + + template + KOKKOS_INLINE_FUNCTION bool operator()(ViewType& keys, iType1& i1, + iType2& i2) const { + if (keys(i1, 0) > keys(i2, 0)) + return true; + else if (keys(i1, 0) == keys(i2, 0)) { + if (keys(i1, 1) > keys(i2, 1)) + return true; + else if (keys(i1, 1) == keys(i2, 1)) { + if (keys(i1, 2) > keys(i2, 2)) return true; + } + } + return false; + } +}; + +namespace Impl { + +template +bool try_std_sort(ViewType view, const ExecutionSpace& exec) { + bool possible = true; + size_t stride[8] = {view.stride_0(), view.stride_1(), view.stride_2(), + view.stride_3(), view.stride_4(), view.stride_5(), + view.stride_6(), view.stride_7()}; + possible = possible && + SpaceAccessibility::accessible; + possible = possible && (ViewType::Rank == 1); + possible = possible && (stride[0] == 1); + if (possible) { + exec.fence("Kokkos::sort: Fence before sorting on the host"); + std::sort(view.data(), view.data() + view.extent(0)); + } + return possible; +} + +template +struct min_max_functor { + using minmax_scalar = + Kokkos::MinMaxScalar; + + ViewType view; + min_max_functor(const ViewType& view_) : view(view_) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const size_t& i, minmax_scalar& minmax) const { + if (view(i) < minmax.min_val) minmax.min_val = view(i); + if (view(i) > minmax.max_val) minmax.max_val = view(i); + } +}; + +} // namespace Impl + +template +std::enable_if_t::value> sort( + const ExecutionSpace& exec, ViewType const& view) { + using CompType = BinOp1D; + + Kokkos::MinMaxScalar result; + Kokkos::MinMax reducer(result); + parallel_reduce("Kokkos::Sort::FindExtent", + Kokkos::RangePolicy( + exec, 0, view.extent(0)), + Impl::min_max_functor(view), reducer); + if (result.min_val == result.max_val) return; + // For integral types the number of bins may be larger than the range + // in which case we can exactly have one unique value per bin + // and then don't need to sort bins. + bool sort_in_bins = true; + // TODO: figure out better max_bins then this ... + int64_t max_bins = view.extent(0) / 2; + if (std::is_integral::value) { + // Cast to double to avoid possible overflow when using integer + auto const max_val = static_cast(result.max_val); + auto const min_val = static_cast(result.min_val); + // using 10M as the cutoff for special behavior (roughly 40MB for the count + // array) + if ((max_val - min_val) < 10000000) { + max_bins = max_val - min_val + 1; + sort_in_bins = false; + } + } + if (std::is_floating_point::value) { + KOKKOS_ASSERT(std::isfinite(static_cast(result.max_val) - + static_cast(result.min_val))); + } + + BinSort bin_sort( + view, CompType(max_bins, result.min_val, result.max_val), sort_in_bins); + bin_sort.create_permute_vector(exec); + bin_sort.sort(exec, view); +} + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 +template +KOKKOS_DEPRECATED_WITH_COMMENT( + "Use the overload not taking bool always_use_kokkos_sort") +std::enable_if_t::value> sort( + const ExecutionSpace& exec, ViewType const& view, + bool const always_use_kokkos_sort) { + if (!always_use_kokkos_sort && Impl::try_std_sort(view, exec)) { + return; + } else { + sort(exec, view); + } +} +#endif + +template +void sort(ViewType const& view) { + typename ViewType::execution_space exec; + sort(exec, view); + exec.fence("Kokkos::Sort: fence after sorting"); +} + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 +template +KOKKOS_DEPRECATED_WITH_COMMENT( + "Use the overload not taking bool always_use_kokkos_sort") +void sort(ViewType const& view, bool const always_use_kokkos_sort) { + typename ViewType::execution_space exec; + sort(exec, view, always_use_kokkos_sort); + exec.fence("Kokkos::Sort: fence after sorting"); +} +#endif + +template +std::enable_if_t::value> sort( + const ExecutionSpace& exec, ViewType view, size_t const begin, + size_t const end) { + using range_policy = Kokkos::RangePolicy; + using CompType = BinOp1D; + + Kokkos::MinMaxScalar result; + Kokkos::MinMax reducer(result); + + parallel_reduce("Kokkos::Sort::FindExtent", range_policy(exec, begin, end), + Impl::min_max_functor(view), reducer); + + if (result.min_val == result.max_val) return; + + BinSort bin_sort( + exec, view, begin, end, + CompType((end - begin) / 2, result.min_val, result.max_val), true); + + bin_sort.create_permute_vector(exec); + bin_sort.sort(exec, view, begin, end); +} + +template +void sort(ViewType view, size_t const begin, size_t const end) { + typename ViewType::execution_space exec; + sort(exec, view, begin, end); + exec.fence("Kokkos::Sort: fence after sorting"); +} + +} // namespace Kokkos + +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SORT +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_SORT +#endif +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/Kokkos_StdAlgorithms.hpp b/bundled/kokkos-3.7.00/algorithms/src/Kokkos_StdAlgorithms.hpp new file mode 100644 index 0000000000..3e0f731cf0 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/Kokkos_StdAlgorithms.hpp @@ -0,0 +1,146 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_HPP +#define KOKKOS_STD_ALGORITHMS_HPP +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STD_ALGORITHMS +#endif + +/// \file Kokkos_StdAlgorithms.hpp +/// \brief Kokkos counterparts for Standard C++ Library algorithms + +#include "std_algorithms/impl/Kokkos_Constraints.hpp" +#include "std_algorithms/impl/Kokkos_RandomAccessIterator.hpp" +#include "std_algorithms/Kokkos_BeginEnd.hpp" + +// distance +#include "std_algorithms/Kokkos_Distance.hpp" + +// note that we categorize below the headers +// following the std classification. + +// modifying ops +#include "std_algorithms/Kokkos_Swap.hpp" +#include "std_algorithms/Kokkos_IterSwap.hpp" + +// non-modifying sequence +#include "std_algorithms/Kokkos_AdjacentFind.hpp" +#include "std_algorithms/Kokkos_Count.hpp" +#include "std_algorithms/Kokkos_CountIf.hpp" +#include "std_algorithms/Kokkos_AllOf.hpp" +#include "std_algorithms/Kokkos_AnyOf.hpp" +#include "std_algorithms/Kokkos_NoneOf.hpp" +#include "std_algorithms/Kokkos_Equal.hpp" +#include "std_algorithms/Kokkos_Find.hpp" +#include "std_algorithms/Kokkos_FindIf.hpp" +#include "std_algorithms/Kokkos_FindIfNot.hpp" +#include "std_algorithms/Kokkos_FindEnd.hpp" +#include "std_algorithms/Kokkos_FindFirstOf.hpp" +#include "std_algorithms/Kokkos_ForEach.hpp" +#include "std_algorithms/Kokkos_ForEachN.hpp" +#include "std_algorithms/Kokkos_LexicographicalCompare.hpp" +#include "std_algorithms/Kokkos_Mismatch.hpp" +#include "std_algorithms/Kokkos_Search.hpp" +#include "std_algorithms/Kokkos_SearchN.hpp" + +// modifying sequence +#include "std_algorithms/Kokkos_Fill.hpp" +#include "std_algorithms/Kokkos_FillN.hpp" +#include "std_algorithms/Kokkos_Replace.hpp" +#include "std_algorithms/Kokkos_ReplaceIf.hpp" +#include "std_algorithms/Kokkos_ReplaceCopyIf.hpp" +#include "std_algorithms/Kokkos_ReplaceCopy.hpp" +#include "std_algorithms/Kokkos_Copy.hpp" +#include "std_algorithms/Kokkos_CopyN.hpp" +#include "std_algorithms/Kokkos_CopyBackward.hpp" +#include "std_algorithms/Kokkos_CopyIf.hpp" +#include "std_algorithms/Kokkos_Transform.hpp" +#include "std_algorithms/Kokkos_Generate.hpp" +#include "std_algorithms/Kokkos_GenerateN.hpp" +#include "std_algorithms/Kokkos_Reverse.hpp" +#include "std_algorithms/Kokkos_ReverseCopy.hpp" +#include "std_algorithms/Kokkos_Move.hpp" +#include "std_algorithms/Kokkos_MoveBackward.hpp" +#include "std_algorithms/Kokkos_SwapRanges.hpp" +#include "std_algorithms/Kokkos_Unique.hpp" +#include "std_algorithms/Kokkos_UniqueCopy.hpp" +#include "std_algorithms/Kokkos_Rotate.hpp" +#include "std_algorithms/Kokkos_RotateCopy.hpp" +#include "std_algorithms/Kokkos_Remove.hpp" +#include "std_algorithms/Kokkos_RemoveIf.hpp" +#include "std_algorithms/Kokkos_RemoveCopy.hpp" +#include "std_algorithms/Kokkos_RemoveCopyIf.hpp" +#include "std_algorithms/Kokkos_ShiftLeft.hpp" +#include "std_algorithms/Kokkos_ShiftRight.hpp" + +// sorting +#include "std_algorithms/Kokkos_IsSortedUntil.hpp" +#include "std_algorithms/Kokkos_IsSorted.hpp" + +// min/max element +#include "std_algorithms/Kokkos_MinElement.hpp" +#include "std_algorithms/Kokkos_MaxElement.hpp" +#include "std_algorithms/Kokkos_MinMaxElement.hpp" + +// partitioning +#include "std_algorithms/Kokkos_IsPartitioned.hpp" +#include "std_algorithms/Kokkos_PartitionCopy.hpp" +#include "std_algorithms/Kokkos_PartitionPoint.hpp" + +// numeric +#include "std_algorithms/Kokkos_AdjacentDifference.hpp" +#include "std_algorithms/Kokkos_Reduce.hpp" +#include "std_algorithms/Kokkos_TransformReduce.hpp" +#include "std_algorithms/Kokkos_ExclusiveScan.hpp" +#include "std_algorithms/Kokkos_TransformExclusiveScan.hpp" +#include "std_algorithms/Kokkos_InclusiveScan.hpp" +#include "std_algorithms/Kokkos_TransformInclusiveScan.hpp" + +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STD_ALGORITHMS +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_STD_ALGORITHMS +#endif +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp new file mode 100644 index 0000000000..0a7cf06f5b --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp @@ -0,0 +1,188 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP +#define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP + +#include "impl/Kokkos_AdjacentDifference.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +std::enable_if_t::value, + OutputIteratorType> +adjacent_difference(const ExecutionSpace& ex, InputIteratorType first_from, + InputIteratorType last_from, + OutputIteratorType first_dest) { + using value_type1 = typename InputIteratorType::value_type; + using value_type2 = typename OutputIteratorType::value_type; + using binary_op = + Impl::StdAdjacentDifferenceDefaultBinaryOpFunctor; + return Impl::adjacent_difference_impl( + "Kokkos::adjacent_difference_iterator_api", ex, first_from, last_from, + first_dest, binary_op()); +} + +template +std::enable_if_t::value, + OutputIteratorType> +adjacent_difference(const ExecutionSpace& ex, InputIteratorType first_from, + InputIteratorType last_from, OutputIteratorType first_dest, + BinaryOp bin_op) { + return Impl::adjacent_difference_impl( + "Kokkos::adjacent_difference_iterator_api", ex, first_from, last_from, + first_dest, bin_op); +} + +template +std::enable_if_t::value, + OutputIteratorType> +adjacent_difference(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first_from, InputIteratorType last_from, + OutputIteratorType first_dest) { + using value_type1 = typename InputIteratorType::value_type; + using value_type2 = typename OutputIteratorType::value_type; + using binary_op = + Impl::StdAdjacentDifferenceDefaultBinaryOpFunctor; + return Impl::adjacent_difference_impl(label, ex, first_from, last_from, + first_dest, binary_op()); +} + +template +std::enable_if_t::value, + OutputIteratorType> +adjacent_difference(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first_from, InputIteratorType last_from, + OutputIteratorType first_dest, BinaryOp bin_op) { + return Impl::adjacent_difference_impl(label, ex, first_from, last_from, + first_dest, bin_op); +} + +template +auto adjacent_difference( + const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + + using view_type1 = ::Kokkos::View; + using view_type2 = ::Kokkos::View; + using value_type1 = typename view_type1::value_type; + using value_type2 = typename view_type2::value_type; + using binary_op = + Impl::StdAdjacentDifferenceDefaultBinaryOpFunctor; + return Impl::adjacent_difference_impl( + "Kokkos::adjacent_difference_view_api", ex, KE::cbegin(view_from), + KE::cend(view_from), KE::begin(view_dest), binary_op()); +} + +template +auto adjacent_difference( + const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp bin_op) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + return Impl::adjacent_difference_impl( + "Kokkos::adjacent_difference_view_api", ex, KE::cbegin(view_from), + KE::cend(view_from), KE::begin(view_dest), bin_op); +} + +template +auto adjacent_difference( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + + using view_type1 = ::Kokkos::View; + using view_type2 = ::Kokkos::View; + using value_type1 = typename view_type1::value_type; + using value_type2 = typename view_type2::value_type; + using binary_op = + Impl::StdAdjacentDifferenceDefaultBinaryOpFunctor; + + return Impl::adjacent_difference_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), + KE::begin(view_dest), binary_op()); +} + +template +auto adjacent_difference( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp bin_op) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + return Impl::adjacent_difference_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), + KE::begin(view_dest), bin_op); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp new file mode 100644 index 0000000000..332f9dd369 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp @@ -0,0 +1,124 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP +#define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP + +#include "impl/Kokkos_AdjacentFind.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set1 +template +IteratorType adjacent_find(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::adjacent_find_impl("Kokkos::adjacent_find_iterator_api_default", + ex, first, last); +} + +template +IteratorType adjacent_find(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::adjacent_find_impl(label, ex, first, last); +} + +template +auto adjacent_find(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl("Kokkos::adjacent_find_view_api_default", ex, + KE::begin(v), KE::end(v)); +} + +template +auto adjacent_find(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl(label, ex, KE::begin(v), KE::end(v)); +} + +// overload set2 +template +IteratorType adjacent_find(const ExecutionSpace& ex, IteratorType first, + IteratorType last, BinaryPredicateType pred) { + return Impl::adjacent_find_impl("Kokkos::adjacent_find_iterator_api_default", + ex, first, last, pred); +} + +template +IteratorType adjacent_find(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + BinaryPredicateType pred) { + return Impl::adjacent_find_impl(label, ex, first, last, pred); +} + +template +auto adjacent_find(const ExecutionSpace& ex, + const ::Kokkos::View& v, + BinaryPredicateType pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl("Kokkos::adjacent_find_view_api_default", ex, + KE::begin(v), KE::end(v), pred); +} + +template +auto adjacent_find(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + BinaryPredicateType pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::adjacent_find_impl(label, ex, KE::begin(v), KE::end(v), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AllOf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AllOf.hpp new file mode 100644 index 0000000000..66a49541f3 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AllOf.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_HPP +#define KOKKOS_STD_ALGORITHMS_ALL_OF_HPP + +#include "impl/Kokkos_AllOfAnyOfNoneOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool all_of(const ExecutionSpace& ex, InputIterator first, InputIterator last, + Predicate predicate) { + return Impl::all_of_impl("Kokkos::all_of_iterator_api_default", ex, first, + last, predicate); +} + +template +bool all_of(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate predicate) { + return Impl::all_of_impl(label, ex, first, last, predicate); +} + +template +bool all_of(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::all_of_impl("Kokkos::all_of_view_api_default", ex, KE::cbegin(v), + KE::cend(v), std::move(predicate)); +} + +template +bool all_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::all_of_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp new file mode 100644 index 0000000000..e50e90f6da --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ANY_OF_HPP +#define KOKKOS_STD_ALGORITHMS_ANY_OF_HPP + +#include "impl/Kokkos_AllOfAnyOfNoneOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool any_of(const ExecutionSpace& ex, InputIterator first, InputIterator last, + Predicate predicate) { + return Impl::any_of_impl("Kokkos::any_of_view_api_default", ex, first, last, + predicate); +} + +template +bool any_of(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate predicate) { + return Impl::any_of_impl(label, ex, first, last, predicate); +} + +template +bool any_of(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::any_of_impl("Kokkos::any_of_view_api_default", ex, KE::cbegin(v), + KE::cend(v), std::move(predicate)); +} + +template +bool any_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::any_of_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp new file mode 100644 index 0000000000..5449196192 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp @@ -0,0 +1,105 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_BEGIN_END_HPP +#define KOKKOS_BEGIN_END_HPP + +#include +#include "impl/Kokkos_RandomAccessIterator.hpp" +#include "impl/Kokkos_Constraints.hpp" + +/// \file Kokkos_BeginEnd.hpp +/// \brief Kokkos begin, end, cbegin, cend + +namespace Kokkos { +namespace Experimental { + +template +KOKKOS_INLINE_FUNCTION auto begin( + const Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + using it_t = + Impl::RandomAccessIterator>; + return it_t(v); +} + +template +KOKKOS_INLINE_FUNCTION auto end( + const Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + using it_t = + Impl::RandomAccessIterator>; + return it_t(v, v.extent(0)); +} + +template +KOKKOS_INLINE_FUNCTION auto cbegin( + const Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + using ViewConstType = + typename Kokkos::View::const_type; + const ViewConstType cv = v; + using it_t = Impl::RandomAccessIterator; + return it_t(cv); +} + +template +KOKKOS_INLINE_FUNCTION auto cend( + const Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + using ViewConstType = + typename Kokkos::View::const_type; + const ViewConstType cv = v; + using it_t = Impl::RandomAccessIterator; + return it_t(cv, cv.extent(0)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Copy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Copy.hpp new file mode 100644 index 0000000000..b3237041b7 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Copy.hpp @@ -0,0 +1,97 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_HPP + +#include "impl/Kokkos_CopyCopyN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator copy(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first) { + return Impl::copy_impl("Kokkos::copy_iterator_api_default", ex, first, last, + d_first); +} + +template +OutputIterator copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first) { + return Impl::copy_impl(label, ex, first, last, d_first); +} + +template +auto copy(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_impl("Kokkos::copy_view_api_default", ex, + KE::cbegin(source), KE::cend(source), KE::begin(dest)); +} + +template +auto copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_impl(label, ex, KE::cbegin(source), KE::cend(source), + KE::begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp new file mode 100644 index 0000000000..83efd96672 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP + +#include "impl/Kokkos_CopyBackward.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType2 copy_backward(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 d_last) { + return Impl::copy_backward_impl("Kokkos::copy_backward_iterator_api_default", + ex, first, last, d_last); +} + +template +IteratorType2 copy_backward(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 d_last) { + return Impl::copy_backward_impl(label, ex, first, last, d_last); +} + +template +auto copy_backward(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_backward_impl("Kokkos::copy_backward_view_api_default", ex, + cbegin(source), cend(source), end(dest)); +} + +template +auto copy_backward(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_backward_impl(label, ex, cbegin(source), cend(source), + end(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp new file mode 100644 index 0000000000..c83cc29886 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp @@ -0,0 +1,99 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_IF_HPP + +#include "impl/Kokkos_CopyIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator copy_if(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first, + Predicate pred) { + return Impl::copy_if_impl("Kokkos::copy_if_iterator_api_default", ex, first, + last, d_first, std::move(pred)); +} + +template +OutputIterator copy_if(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first, Predicate pred) { + return Impl::copy_if_impl(label, ex, first, last, d_first, std::move(pred)); +} + +template +auto copy_if(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest, Predicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_if_impl("Kokkos::copy_if_view_api_default", ex, + cbegin(source), cend(source), begin(dest), + std::move(pred)); +} + +template +auto copy_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest, Predicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::copy_if_impl(label, ex, cbegin(source), cend(source), + begin(dest), std::move(pred)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyN.hpp new file mode 100644 index 0000000000..7f3b9374c7 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CopyN.hpp @@ -0,0 +1,98 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_N_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_N_HPP + +#include "impl/Kokkos_CopyCopyN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator copy_n(const ExecutionSpace& ex, InputIterator first, Size count, + OutputIterator result) { + return Impl::copy_n_impl("Kokkos::copy_n_iterator_api_default", ex, first, + count, result); +} + +template +OutputIterator copy_n(const std::string& label, const ExecutionSpace& ex, + InputIterator first, Size count, OutputIterator result) { + return Impl::copy_n_impl(label, ex, first, count, result); +} + +template +auto copy_n(const ExecutionSpace& ex, + const ::Kokkos::View& source, Size count, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_n_impl("Kokkos::copy_n_view_api_default", ex, + KE::cbegin(source), count, KE::begin(dest)); +} + +template +auto copy_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, Size count, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + namespace KE = ::Kokkos::Experimental; + return Impl::copy_n_impl(label, ex, KE::cbegin(source), count, + KE::begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Count.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Count.hpp new file mode 100644 index 0000000000..a885ee4ad2 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Count.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COUNT_HPP +#define KOKKOS_STD_ALGORITHMS_COUNT_HPP + +#include "impl/Kokkos_CountCountIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +typename IteratorType::difference_type count(const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + const T& value) { + return Impl::count_impl("Kokkos::count_iterator_api_default", ex, first, last, + value); +} + +template +typename IteratorType::difference_type count(const std::string& label, + const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + const T& value) { + return Impl::count_impl(label, ex, first, last, value); +} + +template +auto count(const ExecutionSpace& ex, + const ::Kokkos::View& v, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_impl("Kokkos::count_view_api_default", ex, KE::cbegin(v), + KE::cend(v), value); +} + +template +auto count(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_impl(label, ex, KE::cbegin(v), KE::cend(v), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CountIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CountIf.hpp new file mode 100644 index 0000000000..98b9d74c4c --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_CountIf.hpp @@ -0,0 +1,99 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP +#define KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP + +#include "impl/Kokkos_CountCountIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +typename IteratorType::difference_type count_if(const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + Predicate predicate) { + return Impl::count_if_impl("Kokkos::count_if_iterator_api_default", ex, first, + last, std::move(predicate)); +} + +template +typename IteratorType::difference_type count_if(const std::string& label, + const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + Predicate predicate) { + return Impl::count_if_impl(label, ex, first, last, std::move(predicate)); +} + +template +auto count_if(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_if_impl("Kokkos::count_if_view_api_default", ex, + KE::cbegin(v), KE::cend(v), std::move(predicate)); +} + +template +auto count_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::count_if_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Distance.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Distance.hpp new file mode 100644 index 0000000000..4e148642b1 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Distance.hpp @@ -0,0 +1,69 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_DISTANCE_HPP +#define KOKKOS_STD_ALGORITHMS_DISTANCE_HPP + +#include "impl/Kokkos_Constraints.hpp" +#include "impl/Kokkos_RandomAccessIterator.hpp" + +namespace Kokkos { +namespace Experimental { + +template +KOKKOS_INLINE_FUNCTION constexpr typename IteratorType::difference_type +distance(IteratorType first, IteratorType last) { + static_assert( + ::Kokkos::Experimental::Impl::are_random_access_iterators< + IteratorType>::value, + "Kokkos::Experimental::distance: only implemented for random access " + "iterators."); + + return last - first; +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Equal.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Equal.hpp new file mode 100644 index 0000000000..8634019fad --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Equal.hpp @@ -0,0 +1,198 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_EQUAL_HPP +#define KOKKOS_STD_ALGORITHMS_EQUAL_HPP + +#include "impl/Kokkos_Equal.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2) { + return Impl::equal_impl(label, ex, first1, last1, first2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, BinaryPredicateType predicate) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2, std::move(predicate)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + BinaryPredicateType predicate) { + return Impl::equal_impl(label, ex, first1, last1, first2, + std::move(predicate)); +} + +template +bool equal(const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl("Kokkos::equal_view_api_default", ex, + KE::cbegin(view1), KE::cend(view1), + KE::cbegin(view2)); +} + +template +bool equal(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl(label, ex, KE::cbegin(view1), KE::cend(view1), + KE::cbegin(view2)); +} + +template +bool equal(const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, + BinaryPredicateType predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl("Kokkos::equal_view_api_default", ex, + KE::cbegin(view1), KE::cend(view1), KE::cbegin(view2), + std::move(predicate)); +} + +template +bool equal(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, + BinaryPredicateType predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::equal_impl(label, ex, KE::cbegin(view1), KE::cend(view1), + KE::cbegin(view2), std::move(predicate)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2, last2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, IteratorType2 last2) { + return Impl::equal_impl(label, ex, first1, last1, first2, last2); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2, + BinaryPredicateType predicate) { + return Impl::equal_impl("Kokkos::equal_iterator_api_default", ex, first1, + last1, first2, last2, std::move(predicate)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + IteratorType1, IteratorType2>::value, + bool> +equal(const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, IteratorType2 last2, + BinaryPredicateType predicate) { + return Impl::equal_impl(label, ex, first1, last1, first2, last2, + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp new file mode 100644 index 0000000000..b97710f24f --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp @@ -0,0 +1,190 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP +#define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP + +#include "impl/Kokkos_ExclusiveScan.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + ValueType init_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_default_op_impl( + "Kokkos::exclusive_scan_default_functors_iterator_api", ex, first, last, + first_dest, init_value); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, ValueType init_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_default_op_impl(label, ex, first, last, + first_dest, init_value); +} + +template +auto exclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_default_op_impl( + "Kokkos::exclusive_scan_default_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + init_value); +} + +template +auto exclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_default_op_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), + KE::begin(view_dest), init_value); +} + +// overload set 2 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + ValueType init_value, BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_custom_op_impl( + "Kokkos::exclusive_scan_custom_functors_iterator_api", ex, first, last, + first_dest, init_value, bop); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +exclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, ValueType init_value, + BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + return Impl::exclusive_scan_custom_op_impl(label, ex, first, last, first_dest, + init_value, bop); +} + +template +auto exclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value, BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_custom_op_impl( + "Kokkos::exclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + init_value, bop); +} + +template +auto exclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + ValueType init_value, BinaryOpType bop) { + Impl::static_assert_is_not_openmptarget(ex); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::exclusive_scan_custom_op_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), init_value, bop); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Fill.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Fill.hpp new file mode 100644 index 0000000000..200e03b9dc --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Fill.hpp @@ -0,0 +1,86 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FILL_HPP +#define KOKKOS_STD_ALGORITHMS_FILL_HPP + +#include "impl/Kokkos_FillFillN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void fill(const ExecutionSpace& ex, IteratorType first, IteratorType last, + const T& value) { + Impl::fill_impl("Kokkos::fill_iterator_api_default", ex, first, last, value); +} + +template +void fill(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, const T& value) { + Impl::fill_impl(label, ex, first, last, value); +} + +template +void fill(const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::fill_impl("Kokkos::fill_view_api_default", ex, begin(view), end(view), + value); +} + +template +void fill(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::fill_impl(label, ex, begin(view), end(view), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FillN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FillN.hpp new file mode 100644 index 0000000000..2e814dc55f --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FillN.hpp @@ -0,0 +1,91 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FILL_N_HPP +#define KOKKOS_STD_ALGORITHMS_FILL_N_HPP + +#include "impl/Kokkos_FillFillN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType fill_n(const ExecutionSpace& ex, IteratorType first, SizeType n, + const T& value) { + return Impl::fill_n_impl("Kokkos::fill_n_iterator_api_default", ex, first, n, + value); +} + +template +IteratorType fill_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, SizeType n, const T& value) { + return Impl::fill_n_impl(label, ex, first, n, value); +} + +template +auto fill_n(const ExecutionSpace& ex, + const ::Kokkos::View& view, SizeType n, + const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::fill_n_impl("Kokkos::fill_n_view_api_default", ex, begin(view), + n, value); +} + +template +auto fill_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, SizeType n, + const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::fill_n_impl(label, ex, begin(view), n, value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Find.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Find.hpp new file mode 100644 index 0000000000..6758f00ce4 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Find.hpp @@ -0,0 +1,89 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_HPP + +#include "impl/Kokkos_FindIfOrNot.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +InputIterator find(const ExecutionSpace& ex, InputIterator first, + InputIterator last, const T& value) { + return Impl::find_impl("Kokkos::find_iterator_api_default", ex, first, last, + value); +} + +template +InputIterator find(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, const T& value) { + return Impl::find_impl(label, ex, first, last, value); +} + +template +auto find(const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_impl("Kokkos::find_view_api_default", ex, KE::begin(view), + KE::end(view), value); +} + +template +auto find(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, const T& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_impl(label, ex, KE::begin(view), KE::end(view), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp new file mode 100644 index 0000000000..61b54c8225 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp @@ -0,0 +1,149 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_END_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_END_HPP + +#include "impl/Kokkos_FindEnd.hpp" +#include "Kokkos_Equal.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1: no binary predicate passed +template +IteratorType1 find_end(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last) { + return Impl::find_end_impl("Kokkos::find_end_iterator_api_default", ex, first, + last, s_first, s_last); +} + +template +IteratorType1 find_end(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last) { + return Impl::find_end_impl(label, ex, first, last, s_first, s_last); +} + +template +auto find_end(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl("Kokkos::find_end_view_api_default", ex, + KE::begin(view), KE::end(view), KE::begin(s_view), + KE::end(s_view)); +} + +template +auto find_end(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +// overload set 2: binary predicate passed +template +IteratorType1 find_end(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last, const BinaryPredicateType& pred) { + return Impl::find_end_impl("Kokkos::find_end_iterator_api_default", ex, first, + last, s_first, s_last, pred); +} + +template +IteratorType1 find_end(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::find_end_impl(label, ex, first, last, s_first, s_last, pred); +} + +template +auto find_end(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl("Kokkos::find_end_view_api_default", ex, + KE::begin(view), KE::end(view), KE::begin(s_view), + KE::end(s_view), pred); +} + +template +auto find_end(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_end_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp new file mode 100644 index 0000000000..b8c27cb272 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp @@ -0,0 +1,150 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP + +#include "impl/Kokkos_FindFirstOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1: no binary predicate passed +template +IteratorType1 find_first_of(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last) { + return Impl::find_first_of_impl("Kokkos::find_first_of_iterator_api_default", + ex, first, last, s_first, s_last); +} + +template +IteratorType1 find_first_of(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last) { + return Impl::find_first_of_impl(label, ex, first, last, s_first, s_last); +} + +template +auto find_first_of(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl("Kokkos::find_first_of_view_api_default", ex, + KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +template +auto find_first_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +// overload set 2: binary predicate passed +template +IteratorType1 find_first_of(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::find_first_of_impl("Kokkos::find_first_of_iterator_api_default", + ex, first, last, s_first, s_last, pred); +} + +template +IteratorType1 find_first_of(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::find_first_of_impl(label, ex, first, last, s_first, s_last, + pred); +} + +template +auto find_first_of(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl("Kokkos::find_first_of_view_api_default", ex, + KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +template +auto find_first_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_first_of_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIf.hpp new file mode 100644 index 0000000000..54896da117 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIf.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_IF_HPP + +#include "impl/Kokkos_FindIfOrNot.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType find_if(const ExecutionSpace& ex, IteratorType first, + IteratorType last, PredicateType predicate) { + return Impl::find_if_or_not_impl("Kokkos::find_if_iterator_api_default", + ex, first, last, std::move(predicate)); +} + +template +IteratorType find_if(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + PredicateType predicate) { + return Impl::find_if_or_not_impl(label, ex, first, last, + std::move(predicate)); +} + +template +auto find_if(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl("Kokkos::find_if_view_api_default", ex, + KE::begin(v), KE::end(v), + std::move(predicate)); +} + +template +auto find_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl(label, ex, KE::begin(v), KE::end(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp new file mode 100644 index 0000000000..cfe6bb84d8 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp @@ -0,0 +1,98 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP + +#include "impl/Kokkos_FindIfOrNot.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType find_if_not(const ExecutionSpace& ex, IteratorType first, + IteratorType last, Predicate predicate) { + return Impl::find_if_or_not_impl( + "Kokkos::find_if_not_iterator_api_default", ex, first, last, + std::move(predicate)); +} + +template +IteratorType find_if_not(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + Predicate predicate) { + return Impl::find_if_or_not_impl(label, ex, first, last, + std::move(predicate)); +} + +template +auto find_if_not(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl( + "Kokkos::find_if_not_view_api_default", ex, KE::begin(v), KE::end(v), + std::move(predicate)); +} + +template +auto find_if_not(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::find_if_or_not_impl(label, ex, KE::begin(v), KE::end(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEach.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEach.hpp new file mode 100644 index 0000000000..8a2f90e82b --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEach.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP +#define KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP + +#include "impl/Kokkos_ForEachForEachN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +UnaryFunctorType for_each(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + UnaryFunctorType functor) { + return Impl::for_each_impl(label, ex, first, last, std::move(functor)); +} + +template +UnaryFunctorType for_each(const ExecutionSpace& ex, IteratorType first, + IteratorType last, UnaryFunctorType functor) { + return Impl::for_each_impl("Kokkos::for_each_iterator_api_default", ex, first, + last, std::move(functor)); +} + +template +UnaryFunctorType for_each(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_impl(label, ex, KE::begin(v), KE::end(v), + std::move(functor)); +} + +template +UnaryFunctorType for_each(const ExecutionSpace& ex, + const ::Kokkos::View& v, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_impl("Kokkos::for_each_view_api_default", ex, + KE::begin(v), KE::end(v), std::move(functor)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp new file mode 100644 index 0000000000..dd917a33e8 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp @@ -0,0 +1,96 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP +#define KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP + +#include "impl/Kokkos_ForEachForEachN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType for_each_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, SizeType n, + UnaryFunctorType functor) { + return Impl::for_each_n_impl(label, ex, first, n, std::move(functor)); +} + +template +IteratorType for_each_n(const ExecutionSpace& ex, IteratorType first, + SizeType n, UnaryFunctorType functor) { + return Impl::for_each_n_impl("Kokkos::for_each_n_iterator_api_default", ex, + first, n, std::move(functor)); +} + +template +auto for_each_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, SizeType n, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_n_impl(label, ex, KE::begin(v), n, std::move(functor)); +} + +template +auto for_each_n(const ExecutionSpace& ex, + const ::Kokkos::View& v, SizeType n, + UnaryFunctorType functor) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::for_each_n_impl("Kokkos::for_each_n_view_api_default", ex, + KE::begin(v), n, std::move(functor)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Generate.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Generate.hpp new file mode 100644 index 0000000000..955cb42d4b --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Generate.hpp @@ -0,0 +1,91 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_GENERATE_HPP +#define KOKKOS_STD_ALGORITHMS_GENERATE_HPP + +#include "impl/Kokkos_GenerateGenerateN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void generate(const ExecutionSpace& ex, IteratorType first, IteratorType last, + Generator g) { + Impl::generate_impl("Kokkos::generate_iterator_api_default", ex, first, last, + std::move(g)); +} + +template +void generate(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, Generator g) { + Impl::generate_impl(label, ex, first, last, std::move(g)); +} + +template +void generate(const ExecutionSpace& ex, + const ::Kokkos::View& view, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::generate_impl("Kokkos::generate_view_api_default", ex, begin(view), + end(view), std::move(g)); +} + +template +void generate(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + Impl::generate_impl(label, ex, begin(view), end(view), std::move(g)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp new file mode 100644 index 0000000000..470edb1596 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp @@ -0,0 +1,93 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP +#define KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP + +#include "impl/Kokkos_GenerateGenerateN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType generate_n(const ExecutionSpace& ex, IteratorType first, + Size count, Generator g) { + Impl::generate_n_impl("Kokkos::generate_n_iterator_api_default", ex, first, + count, std::move(g)); + return first + count; +} + +template +IteratorType generate_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, Size count, Generator g) { + Impl::generate_n_impl(label, ex, first, count, std::move(g)); + return first + count; +} + +template +auto generate_n(const ExecutionSpace& ex, + const ::Kokkos::View& view, Size count, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::generate_n_impl("Kokkos::generate_n_view_api_default", ex, + begin(view), count, std::move(g)); +} + +template +auto generate_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, Size count, + Generator g) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::generate_n_impl(label, ex, begin(view), count, std::move(g)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp new file mode 100644 index 0000000000..c34b5f43c9 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp @@ -0,0 +1,223 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP +#define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP + +#include "impl/Kokkos_InclusiveScan.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest) { + return Impl::inclusive_scan_default_op_impl( + "Kokkos::inclusive_scan_default_functors_iterator_api", ex, first, last, + first_dest); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest) { + return Impl::inclusive_scan_default_op_impl(label, ex, first, last, + first_dest); +} + +template +auto inclusive_scan( + const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_default_op_impl( + "Kokkos::inclusive_scan_default_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest)); +} + +template +auto inclusive_scan( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_default_op_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), + KE::begin(view_dest)); +} + +// overload set 2 (accepting custom binary op) +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + BinaryOp binary_op) { + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_iterator_api", ex, first, last, + first_dest, binary_op); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, BinaryOp binary_op) { + return Impl::inclusive_scan_custom_binary_op_impl(label, ex, first, last, + first_dest, binary_op); +} + +template +auto inclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + binary_op); +} + +template +auto inclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), binary_op); +} + +// overload set 3 +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const ExecutionSpace& ex, InputIteratorType first, + InputIteratorType last, OutputIteratorType first_dest, + BinaryOp binary_op, ValueType init_value) { + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_iterator_api", ex, first, last, + first_dest, binary_op, init_value); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +inclusive_scan(const std::string& label, const ExecutionSpace& ex, + InputIteratorType first, InputIteratorType last, + OutputIteratorType first_dest, BinaryOp binary_op, + ValueType init_value) { + return Impl::inclusive_scan_custom_binary_op_impl( + label, ex, first, last, first_dest, binary_op, init_value); +} + +template +auto inclusive_scan(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op, ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + "Kokkos::inclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + binary_op, init_value); +} + +template +auto inclusive_scan(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + BinaryOp binary_op, ValueType init_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::inclusive_scan_custom_binary_op_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), binary_op, init_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp new file mode 100644 index 0000000000..8a2ca207ae --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp @@ -0,0 +1,92 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP +#define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP + +#include "impl/Kokkos_IsPartitioned.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool is_partitioned(const ExecutionSpace& ex, IteratorType first, + IteratorType last, PredicateType p) { + return Impl::is_partitioned_impl( + "Kokkos::is_partitioned_iterator_api_default", ex, first, last, + std::move(p)); +} + +template +bool is_partitioned(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, PredicateType p) { + return Impl::is_partitioned_impl(label, ex, first, last, std::move(p)); +} + +template +bool is_partitioned(const ExecutionSpace& ex, + const ::Kokkos::View& v, + PredicateType p) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::is_partitioned_impl("Kokkos::is_partitioned_view_api_default", + ex, cbegin(v), cend(v), std::move(p)); +} + +template +bool is_partitioned(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + PredicateType p) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::is_partitioned_impl(label, ex, cbegin(v), cend(v), std::move(p)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp new file mode 100644 index 0000000000..0ab466f338 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp @@ -0,0 +1,131 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP +#define KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP + +#include "impl/Kokkos_IsSorted.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool is_sorted(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::is_sorted_impl("Kokkos::is_sorted_iterator_api_default", ex, + first, last); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::is_sorted_impl(label, ex, first, last); +} + +template +bool is_sorted(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl("Kokkos::is_sorted_view_api_default", ex, + KE::cbegin(view), KE::cend(view)); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl(label, ex, KE::cbegin(view), KE::cend(view)); +} + +template +bool is_sorted(const ExecutionSpace& ex, IteratorType first, IteratorType last, + ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + return Impl::is_sorted_impl("Kokkos::is_sorted_iterator_api_default", ex, + first, last, std::move(comp)); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + return Impl::is_sorted_impl(label, ex, first, last, std::move(comp)); +} + +template +bool is_sorted(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl("Kokkos::is_sorted_view_api_default", ex, + KE::cbegin(view), KE::cend(view), + std::move(comp)); +} + +template +bool is_sorted(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_impl(label, ex, KE::cbegin(view), KE::cend(view), + std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp new file mode 100644 index 0000000000..c480d9ee5a --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp @@ -0,0 +1,134 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP +#define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP + +#include "impl/Kokkos_IsSortedUntil.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType is_sorted_until(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::is_sorted_until_impl( + "Kokkos::is_sorted_until_iterator_api_default", ex, first, last); +} + +template +IteratorType is_sorted_until(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::is_sorted_until_impl(label, ex, first, last); +} + +template +auto is_sorted_until(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl("Kokkos::is_sorted_until_view_api_default", + ex, KE::begin(view), KE::end(view)); +} + +template +auto is_sorted_until(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl(label, ex, KE::begin(view), KE::end(view)); +} + +template +IteratorType is_sorted_until(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + return Impl::is_sorted_until_impl( + "Kokkos::is_sorted_until_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +IteratorType is_sorted_until(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::is_sorted_until_impl(label, ex, first, last, std::move(comp)); +} + +template +auto is_sorted_until(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl("Kokkos::is_sorted_until_view_api_default", + ex, KE::begin(view), KE::end(view), + std::move(comp)); +} + +template +auto is_sorted_until(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_not_openmptarget(ex); + + namespace KE = ::Kokkos::Experimental; + return Impl::is_sorted_until_impl(label, ex, KE::begin(view), KE::end(view), + std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp new file mode 100644 index 0000000000..1174740a5b --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp @@ -0,0 +1,92 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP +#define KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP + +#include +#include "impl/Kokkos_Constraints.hpp" +#include "Kokkos_Swap.hpp" + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdIterSwapFunctor { + IteratorType1 m_a; + IteratorType2 m_b; + + KOKKOS_FUNCTION + void operator()(int i) const { + (void)i; + ::Kokkos::Experimental::swap(*m_a, *m_b); + } + + KOKKOS_FUNCTION + StdIterSwapFunctor(IteratorType1 _a, IteratorType2 _b) + : m_a(std::move(_a)), m_b(std::move(_b)) {} +}; + +template +void iter_swap_impl(IteratorType1 a, IteratorType2 b) { + // is there a better way to do this maybe? + ::Kokkos::parallel_for( + 1, StdIterSwapFunctor(a, b)); + Kokkos::DefaultExecutionSpace().fence( + "Kokkos::iter_swap: fence after operation"); +} +} // namespace Impl +//---------------------------------------------------------------------------- + +// iter_swap +template +void iter_swap(IteratorType1 a, IteratorType2 b) { + Impl::iter_swap_impl(a, b); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp new file mode 100644 index 0000000000..4704a9ec56 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp @@ -0,0 +1,154 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP +#define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP + +#include "impl/Kokkos_LexicographicalCompare.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool lexicographical_compare(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + IteratorType2 last2) { + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_iterator_api_default", ex, first1, last1, + first2, last2); +} + +template +bool lexicographical_compare(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2) { + return Impl::lexicographical_compare_impl(label, ex, first1, last1, first2, + last2); +} + +template +bool lexicographical_compare( + const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_view_api_default", ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), KE::cend(view2)); +} + +template +bool lexicographical_compare( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl(label, ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), + KE::cend(view2)); +} + +template +bool lexicographical_compare(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + IteratorType2 last2, ComparatorType comp) { + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_iterator_api_default", ex, first1, last1, + first2, last2, comp); +} + +template +bool lexicographical_compare(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2, + ComparatorType comp) { + return Impl::lexicographical_compare_impl(label, ex, first1, last1, first2, + last2, comp); +} + +template +bool lexicographical_compare( + const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl( + "Kokkos::lexicographical_compare_view_api_default", ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), KE::cend(view2), comp); +} + +template +bool lexicographical_compare( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + ::Kokkos::View& view2, ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::lexicographical_compare_impl(label, ex, KE::cbegin(view1), + KE::cend(view1), KE::cbegin(view2), + KE::cend(view2), comp); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp new file mode 100644 index 0000000000..5f6e5cbf62 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp @@ -0,0 +1,132 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP +#define KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP + +#include "impl/Kokkos_MinMaxMinmaxElement.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +auto max_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::min_or_max_element_impl( + "Kokkos::max_element_iterator_api_default", ex, first, last); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::min_or_max_element_impl(label, ex, first, last); +} + +template +auto max_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::max_element_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, first, last, std::move(comp)); +} + +template +auto max_element(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl( + "Kokkos::max_element_view_api_default", ex, begin(v), end(v)); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl(label, ex, begin(v), + end(v)); +} + +template +auto max_element(const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::max_element_view_api_default", ex, begin(v), end(v), + std::move(comp)); +} + +template +auto max_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, begin(v), end(v), std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinElement.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinElement.hpp new file mode 100644 index 0000000000..63cc548960 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinElement.hpp @@ -0,0 +1,132 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP +#define KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP + +#include "impl/Kokkos_MinMaxMinmaxElement.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +auto min_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::min_or_max_element_impl( + "Kokkos::min_element_iterator_api_default", ex, first, last); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::min_or_max_element_impl(label, ex, first, last); +} + +template +auto min_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::min_element_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, first, last, std::move(comp)); +} + +template +auto min_element(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl( + "Kokkos::min_element_view_api_default", ex, begin(v), end(v)); +} + +template +auto min_element(const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + "Kokkos::min_element_view_api_default", ex, begin(v), end(v), + std::move(comp)); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::min_or_max_element_impl(label, ex, begin(v), + end(v)); +} + +template +auto min_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::min_or_max_element_impl( + label, ex, begin(v), end(v), std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp new file mode 100644 index 0000000000..07cdefcc05 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp @@ -0,0 +1,133 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP +#define KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP + +#include "impl/Kokkos_MinMaxMinmaxElement.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +auto minmax_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::minmax_element_impl( + "Kokkos::minmax_element_iterator_api_default", ex, first, last); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + return Impl::minmax_element_impl(label, ex, first, last); +} + +template +auto minmax_element(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + "Kokkos::minmax_element_iterator_api_default", ex, first, last, + std::move(comp)); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ComparatorType comp) { + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + label, ex, first, last, std::move(comp)); +} + +template +auto minmax_element(const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::minmax_element_impl( + "Kokkos::minmax_element_view_api_default", ex, begin(v), end(v)); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + return Impl::minmax_element_impl(label, ex, begin(v), + end(v)); +} + +template +auto minmax_element(const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + "Kokkos::minmax_element_view_api_default", ex, begin(v), end(v), + std::move(comp)); +} + +template +auto minmax_element(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + ComparatorType comp) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + Impl::static_assert_is_not_openmptarget(ex); + + return Impl::minmax_element_impl( + label, ex, begin(v), end(v), std::move(comp)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp new file mode 100644 index 0000000000..3418e048a9 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp @@ -0,0 +1,160 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_HPP +#define KOKKOS_STD_ALGORITHMS_MISMATCH_HPP + +#include "impl/Kokkos_Mismatch.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// FIXME: add mismatch overloads accepting 3 iterators. +// An overload consistent with other algorithms: +// +// auto mismatch(const ExecSpace& ex, It1 first1, It1 last1, It2 first2) {...} +// +// makes API ambiguous (with the overload accepting views). + +template +::Kokkos::pair mismatch(const ExecutionSpace& ex, + IteratorType1 first1, + IteratorType1 last1, + IteratorType2 first2, + IteratorType2 last2) { + return Impl::mismatch_impl("Kokkos::mismatch_iterator_api_default", ex, + first1, last1, first2, last2); +} + +template +::Kokkos::pair mismatch( + const ExecutionSpace& ex, IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2, + BinaryPredicateType&& predicate) { + return Impl::mismatch_impl("Kokkos::mismatch_iterator_api_default", ex, + first1, last1, first2, last2, + std::forward(predicate)); +} + +template +::Kokkos::pair mismatch( + const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, IteratorType2 last2) { + return Impl::mismatch_impl(label, ex, first1, last1, first2, last2); +} + +template +::Kokkos::pair mismatch( + const std::string& label, const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, IteratorType2 last2, + BinaryPredicateType&& predicate) { + return Impl::mismatch_impl(label, ex, first1, last1, first2, last2, + std::forward(predicate)); +} + +template +auto mismatch(const ExecutionSpace& ex, + const ::Kokkos::View& view1, + const ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::mismatch_impl("Kokkos::mismatch_view_api_default", ex, + KE::begin(view1), KE::end(view1), KE::begin(view2), + KE::end(view2)); +} + +template +auto mismatch(const ExecutionSpace& ex, + const ::Kokkos::View& view1, + const ::Kokkos::View& view2, + BinaryPredicateType&& predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::mismatch_impl("Kokkos::mismatch_view_api_default", ex, + KE::begin(view1), KE::end(view1), KE::begin(view2), + KE::end(view2), + std::forward(predicate)); +} + +template +auto mismatch(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + const ::Kokkos::View& view2) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::mismatch_impl(label, ex, KE::begin(view1), KE::end(view1), + KE::begin(view2), KE::end(view2)); +} + +template +auto mismatch(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view1, + const ::Kokkos::View& view2, + BinaryPredicateType&& predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view2); + + namespace KE = ::Kokkos::Experimental; + return Impl::mismatch_impl(label, ex, KE::begin(view1), KE::end(view1), + KE::begin(view2), KE::end(view2), + std::forward(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Move.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Move.hpp new file mode 100644 index 0000000000..c2ce4655fa --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Move.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MOVE_HPP +#define KOKKOS_STD_ALGORITHMS_MOVE_HPP + +#include "impl/Kokkos_Move.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator move(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first) { + return Impl::move_impl("Kokkos::move_iterator_api_default", ex, first, last, + d_first); +} + +template +OutputIterator move(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first) { + return Impl::move_impl(label, ex, first, last, d_first); +} + +template +auto move(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::move_impl("Kokkos::move_view_api_default", ex, begin(source), + end(source), begin(dest)); +} + +template +auto move(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::move_impl(label, ex, begin(source), end(source), begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp new file mode 100644 index 0000000000..f7462d52d8 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP +#define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP + +#include "impl/Kokkos_MoveBackward.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType2 move_backward(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 d_last) { + return Impl::move_backward_impl("Kokkos::move_backward_iterator_api_default", + ex, first, last, d_last); +} + +template +auto move_backward(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::move_backward_impl("Kokkos::move_backward_view_api_default", ex, + begin(source), end(source), end(dest)); +} + +template +IteratorType2 move_backward(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 d_last) { + return Impl::move_backward_impl(label, ex, first, last, d_last); +} + +template +auto move_backward(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::move_backward_impl(label, ex, begin(source), end(source), + end(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp new file mode 100644 index 0000000000..30ffb52442 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp @@ -0,0 +1,94 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_NONE_OF_HPP +#define KOKKOS_STD_ALGORITHMS_NONE_OF_HPP + +#include "impl/Kokkos_AllOfAnyOfNoneOf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +bool none_of(const ExecutionSpace& ex, IteratorType first, IteratorType last, + Predicate predicate) { + return Impl::none_of_impl("Kokkos::none_of_iterator_api_default", ex, first, + last, predicate); +} + +template +bool none_of(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, Predicate predicate) { + return Impl::none_of_impl(label, ex, first, last, predicate); +} + +template +bool none_of(const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::none_of_impl("Kokkos::none_of_view_api_default", ex, + KE::cbegin(v), KE::cend(v), std::move(predicate)); +} + +template +bool none_of(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + Predicate predicate) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + + namespace KE = ::Kokkos::Experimental; + return Impl::none_of_impl(label, ex, KE::cbegin(v), KE::cend(v), + std::move(predicate)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp new file mode 100644 index 0000000000..5b00669fd1 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp @@ -0,0 +1,110 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP + +#include "impl/Kokkos_PartitionCopy.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +::Kokkos::pair partition_copy( + const ExecutionSpace& ex, InputIteratorType from_first, + InputIteratorType from_last, OutputIteratorTrueType to_first_true, + OutputIteratorFalseType to_first_false, PredicateType p) { + return Impl::partition_copy_impl( + "Kokkos::partition_copy_iterator_api_default", ex, from_first, from_last, + to_first_true, to_first_false, std::move(p)); +} + +template +::Kokkos::pair partition_copy( + const std::string& label, const ExecutionSpace& ex, + InputIteratorType from_first, InputIteratorType from_last, + OutputIteratorTrueType to_first_true, + OutputIteratorFalseType to_first_false, PredicateType p) { + return Impl::partition_copy_impl(label, ex, from_first, from_last, + to_first_true, to_first_false, std::move(p)); +} + +template +auto partition_copy( + const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest_true, + const ::Kokkos::View& view_dest_false, + PredicateType p) { + return Impl::partition_copy_impl("Kokkos::partition_copy_view_api_default", + ex, cbegin(view_from), cend(view_from), + begin(view_dest_true), + begin(view_dest_false), std::move(p)); +} + +template +auto partition_copy( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest_true, + const ::Kokkos::View& view_dest_false, + PredicateType p) { + return Impl::partition_copy_impl(label, ex, cbegin(view_from), + cend(view_from), begin(view_dest_true), + begin(view_dest_false), std::move(p)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp new file mode 100644 index 0000000000..b714d5a271 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp @@ -0,0 +1,91 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP +#define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP + +#include "impl/Kokkos_PartitionPoint.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType partition_point(const ExecutionSpace& ex, IteratorType first, + IteratorType last, UnaryPredicate p) { + return Impl::partition_point_impl( + "Kokkos::partitioned_point_iterator_api_default", ex, first, last, + std::move(p)); +} + +template +IteratorType partition_point(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + UnaryPredicate p) { + return Impl::partition_point_impl(label, ex, first, last, std::move(p)); +} + +template +auto partition_point(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& v, + UnaryPredicate p) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + return Impl::partition_point_impl(label, ex, begin(v), end(v), std::move(p)); +} + +template +auto partition_point(const ExecutionSpace& ex, + const ::Kokkos::View& v, + UnaryPredicate p) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(v); + return Impl::partition_point_impl("Kokkos::partition_point_view_api_default", + ex, begin(v), end(v), std::move(p)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reduce.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reduce.hpp new file mode 100644 index 0000000000..3cf9153202 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reduce.hpp @@ -0,0 +1,221 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REDUCE_HPP +#define KOKKOS_STD_ALGORITHMS_REDUCE_HPP + +#include "impl/Kokkos_Reduce.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// +// overload set 1 +// +template +typename IteratorType::value_type reduce(const ExecutionSpace& ex, + IteratorType first, + IteratorType last) { + return Impl::reduce_default_functors_impl( + "Kokkos::reduce_default_functors_iterator_api", ex, first, last, + typename IteratorType::value_type()); +} + +template +typename IteratorType::value_type reduce(const std::string& label, + const ExecutionSpace& ex, + IteratorType first, + IteratorType last) { + return Impl::reduce_default_functors_impl( + label, ex, first, last, typename IteratorType::value_type()); +} + +template +auto reduce(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + using view_type = ::Kokkos::View; + using value_type = typename view_type::value_type; + + return Impl::reduce_default_functors_impl( + "Kokkos::reduce_default_functors_view_api", ex, KE::cbegin(view), + KE::cend(view), value_type()); +} + +template +auto reduce(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + using view_type = ::Kokkos::View; + using value_type = typename view_type::value_type; + + return Impl::reduce_default_functors_impl(label, ex, KE::cbegin(view), + KE::cend(view), value_type()); +} + +// +// overload set2: +// +template +ValueType reduce(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ValueType init_reduction_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::reduce_default_functors_impl( + "Kokkos::reduce_default_functors_iterator_api", ex, first, last, + init_reduction_value); +} + +template +ValueType reduce(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ValueType init_reduction_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::reduce_default_functors_impl(label, ex, first, last, + init_reduction_value); +} + +template +ValueType reduce(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ValueType init_reduction_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::reduce_default_functors_impl( + "Kokkos::reduce_default_functors_view_api", ex, KE::cbegin(view), + KE::cend(view), init_reduction_value); +} + +template +ValueType reduce(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ValueType init_reduction_value) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::reduce_default_functors_impl( + label, ex, KE::cbegin(view), KE::cend(view), init_reduction_value); +} + +// +// overload set 3 +// +template +ValueType reduce(const ExecutionSpace& ex, IteratorType first, + IteratorType last, ValueType init_reduction_value, + BinaryOp joiner) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::reduce_custom_functors_impl( + "Kokkos::reduce_default_functors_iterator_api", ex, first, last, + init_reduction_value, joiner); +} + +template +ValueType reduce(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ValueType init_reduction_value, BinaryOp joiner) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::reduce_custom_functors_impl(label, ex, first, last, + init_reduction_value, joiner); +} + +template +ValueType reduce(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ValueType init_reduction_value, BinaryOp joiner) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::reduce_custom_functors_impl( + "Kokkos::reduce_custom_functors_view_api", ex, KE::cbegin(view), + KE::cend(view), init_reduction_value, joiner); +} + +template +ValueType reduce(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ValueType init_reduction_value, BinaryOp joiner) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::reduce_custom_functors_impl(label, ex, KE::cbegin(view), + KE::cend(view), init_reduction_value, + joiner); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Remove.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Remove.hpp new file mode 100644 index 0000000000..d8d7c999b6 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Remove.hpp @@ -0,0 +1,91 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REMOVE_HPP +#define KOKKOS_STD_ALGORITHMS_REMOVE_HPP + +#include "impl/Kokkos_RemoveAllVariants.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +Iterator remove(const ExecutionSpace& ex, Iterator first, Iterator last, + const ValueType& value) { + return Impl::remove_impl("Kokkos::remove_iterator_api_default", ex, first, + last, value); +} + +template +Iterator remove(const std::string& label, const ExecutionSpace& ex, + Iterator first, Iterator last, const ValueType& value) { + return Impl::remove_impl(label, ex, first, last, value); +} + +template +auto remove(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ValueType& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::remove_impl("Kokkos::remove_iterator_api_default", ex, + ::Kokkos::Experimental::begin(view), + ::Kokkos::Experimental::end(view), value); +} + +template +auto remove(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ValueType& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::remove_impl(label, ex, ::Kokkos::Experimental::begin(view), + ::Kokkos::Experimental::end(view), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp new file mode 100644 index 0000000000..7d5c163af9 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp @@ -0,0 +1,106 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP + +#include "impl/Kokkos_RemoveAllVariants.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator remove_copy(const ExecutionSpace& ex, InputIterator first_from, + InputIterator last_from, OutputIterator first_dest, + const ValueType& value) { + return Impl::remove_copy_impl("Kokkos::remove_copy_iterator_api_default", ex, + first_from, last_from, first_dest, value); +} + +template +OutputIterator remove_copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first_from, InputIterator last_from, + OutputIterator first_dest, const ValueType& value) { + return Impl::remove_copy_impl(label, ex, first_from, last_from, first_dest, + value); +} + +template +auto remove_copy(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + const ValueType& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + + return Impl::remove_copy_impl("Kokkos::remove_copy_iterator_api_default", ex, + ::Kokkos::Experimental::cbegin(view_from), + ::Kokkos::Experimental::cend(view_from), + ::Kokkos::Experimental::begin(view_dest), + value); +} + +template +auto remove_copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + const ValueType& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + + return Impl::remove_copy_impl( + label, ex, ::Kokkos::Experimental::cbegin(view_from), + ::Kokkos::Experimental::cend(view_from), + ::Kokkos::Experimental::begin(view_dest), value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp new file mode 100644 index 0000000000..8a9a3e4c14 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp @@ -0,0 +1,110 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP +#define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP + +#include "impl/Kokkos_RemoveAllVariants.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator remove_copy_if(const ExecutionSpace& ex, + InputIterator first_from, InputIterator last_from, + OutputIterator first_dest, + const UnaryPredicate& pred) { + return Impl::remove_copy_if_impl( + "Kokkos::remove_copy_if_iterator_api_default", ex, first_from, last_from, + first_dest, pred); +} + +template +OutputIterator remove_copy_if(const std::string& label, + const ExecutionSpace& ex, + InputIterator first_from, InputIterator last_from, + OutputIterator first_dest, + const UnaryPredicate& pred) { + return Impl::remove_copy_if_impl(label, ex, first_from, last_from, first_dest, + pred); +} + +template +auto remove_copy_if(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + const UnaryPredicate& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + + return Impl::remove_copy_if_impl( + "Kokkos::remove_copy_if_iterator_api_default", ex, + ::Kokkos::Experimental::cbegin(view_from), + ::Kokkos::Experimental::cend(view_from), + ::Kokkos::Experimental::begin(view_dest), pred); +} + +template +auto remove_copy_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + const UnaryPredicate& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + + return Impl::remove_copy_if_impl( + label, ex, ::Kokkos::Experimental::cbegin(view_from), + ::Kokkos::Experimental::cend(view_from), + ::Kokkos::Experimental::begin(view_dest), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp new file mode 100644 index 0000000000..e4171ca917 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp @@ -0,0 +1,92 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP +#define KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP + +#include "impl/Kokkos_RemoveAllVariants.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +Iterator remove_if(const ExecutionSpace& ex, Iterator first, Iterator last, + UnaryPredicate pred) { + return Impl::remove_if_impl("Kokkos::remove_if_iterator_api_default", ex, + first, last, pred); +} + +template +Iterator remove_if(const std::string& label, const ExecutionSpace& ex, + Iterator first, Iterator last, UnaryPredicate pred) { + return Impl::remove_if_impl(label, ex, first, last, pred); +} + +template +auto remove_if(const ExecutionSpace& ex, + const ::Kokkos::View& view, + UnaryPredicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::remove_if_impl("Kokkos::remove_if_iterator_api_default", ex, + ::Kokkos::Experimental::begin(view), + ::Kokkos::Experimental::end(view), pred); +} + +template +auto remove_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + UnaryPredicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::remove_if_impl(label, ex, ::Kokkos::Experimental::begin(view), + ::Kokkos::Experimental::end(view), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Replace.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Replace.hpp new file mode 100644 index 0000000000..10ca46af25 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Replace.hpp @@ -0,0 +1,93 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REPLACE_HPP +#define KOKKOS_STD_ALGORITHMS_REPLACE_HPP + +#include "impl/Kokkos_Replace.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void replace(const ExecutionSpace& ex, Iterator first, Iterator last, + const ValueType& old_value, const ValueType& new_value) { + return Impl::replace_impl("Kokkos::replace_iterator_api", ex, first, last, + old_value, new_value); +} + +template +void replace(const std::string& label, const ExecutionSpace& ex, Iterator first, + Iterator last, const ValueType& old_value, + const ValueType& new_value) { + return Impl::replace_impl(label, ex, first, last, old_value, new_value); +} + +template +void replace(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ValueType& old_value, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_impl("Kokkos::replace_view_api", ex, KE::begin(view), + KE::end(view), old_value, new_value); +} + +template +void replace(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ValueType& old_value, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_impl(label, ex, KE::begin(view), KE::end(view), + old_value, new_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp new file mode 100644 index 0000000000..f5136eb438 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp @@ -0,0 +1,107 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP + +#include "impl/Kokkos_ReplaceCopy.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator replace_copy(const ExecutionSpace& ex, InputIterator first_from, + InputIterator last_from, OutputIterator first_dest, + const ValueType& old_value, + const ValueType& new_value) { + return Impl::replace_copy_impl("Kokkos::replace_copy_iterator_api", ex, + first_from, last_from, first_dest, old_value, + new_value); +} + +template +OutputIterator replace_copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first_from, InputIterator last_from, + OutputIterator first_dest, + const ValueType& old_value, + const ValueType& new_value) { + return Impl::replace_copy_impl(label, ex, first_from, last_from, first_dest, + old_value, new_value); +} + +template +auto replace_copy(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + const ValueType& old_value, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_copy_impl("Kokkos::replace_copy_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), old_value, new_value); +} + +template +auto replace_copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + const ValueType& old_value, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_copy_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), KE::begin(view_dest), + old_value, new_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp new file mode 100644 index 0000000000..a3f3fe69ab --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp @@ -0,0 +1,111 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP +#define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP + +#include "impl/Kokkos_ReplaceCopyIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator replace_copy_if(const ExecutionSpace& ex, + InputIterator first_from, + InputIterator last_from, + OutputIterator first_dest, PredicateType pred, + const ValueType& new_value) { + return Impl::replace_copy_if_impl("Kokkos::replace_copy_if_iterator_api", ex, + first_from, last_from, first_dest, pred, + new_value); +} + +template +OutputIterator replace_copy_if(const std::string& label, + const ExecutionSpace& ex, + InputIterator first_from, + InputIterator last_from, + OutputIterator first_dest, PredicateType pred, + const ValueType& new_value) { + return Impl::replace_copy_if_impl(label, ex, first_from, last_from, + first_dest, pred, new_value); +} + +template +auto replace_copy_if(const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + PredicateType pred, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_copy_if_impl("Kokkos::replace_copy_if_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), pred, new_value); +} + +template +auto replace_copy_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view_from, + const ::Kokkos::View& view_dest, + PredicateType pred, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_from); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view_dest); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_copy_if_impl(label, ex, KE::cbegin(view_from), + KE::cend(view_from), KE::begin(view_dest), + pred, new_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp new file mode 100644 index 0000000000..bdb59f28af --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp @@ -0,0 +1,96 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP +#define KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP + +#include "impl/Kokkos_ReplaceIf.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void replace_if(const ExecutionSpace& ex, InputIterator first, + InputIterator last, Predicate pred, + const ValueType& new_value) { + return Impl::replace_if_impl("Kokkos::replace_if_iterator_api", ex, first, + last, pred, new_value); +} + +template +void replace_if(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate pred, + const ValueType& new_value) { + return Impl::replace_if_impl(label, ex, first, last, pred, new_value); +} + +template +void replace_if(const ExecutionSpace& ex, + const ::Kokkos::View& view, + Predicate pred, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_if_impl("Kokkos::replace_if_view_api", ex, + KE::begin(view), KE::end(view), pred, new_value); +} + +template +void replace_if(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + Predicate pred, const ValueType& new_value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + namespace KE = ::Kokkos::Experimental; + return Impl::replace_if_impl(label, ex, KE::begin(view), KE::end(view), pred, + new_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reverse.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reverse.hpp new file mode 100644 index 0000000000..4848b20f66 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Reverse.hpp @@ -0,0 +1,87 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REVERSE_HPP +#define KOKKOS_STD_ALGORITHMS_REVERSE_HPP + +#include "impl/Kokkos_Reverse.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +void reverse(const ExecutionSpace& ex, InputIterator first, + InputIterator last) { + return Impl::reverse_impl("Kokkos::reverse_iterator_api_default", ex, first, + last); +} + +template +void reverse(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last) { + return Impl::reverse_impl(label, ex, first, last); +} + +template +void reverse(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + namespace KE = ::Kokkos::Experimental; + return Impl::reverse_impl("Kokkos::reverse_view_api_default", ex, + KE::begin(view), KE::end(view)); +} + +template +void reverse(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + namespace KE = ::Kokkos::Experimental; + return Impl::reverse_impl(label, ex, KE::begin(view), KE::end(view)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp new file mode 100644 index 0000000000..bb4462bf41 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp @@ -0,0 +1,95 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP + +#include "impl/Kokkos_ReverseCopy.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator reverse_copy(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first) { + return Impl::reverse_copy_impl("Kokkos::reverse_copy_iterator_api_default", + ex, first, last, d_first); +} + +template +OutputIterator reverse_copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first) { + return Impl::reverse_copy_impl(label, ex, first, last, d_first); +} + +template +auto reverse_copy(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::reverse_copy_impl("Kokkos::reverse_copy_view_api_default", ex, + cbegin(source), cend(source), begin(dest)); +} + +template +auto reverse_copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::reverse_copy_impl(label, ex, cbegin(source), cend(source), + begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Rotate.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Rotate.hpp new file mode 100644 index 0000000000..39975811a4 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Rotate.hpp @@ -0,0 +1,89 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ROTATE_HPP +#define KOKKOS_STD_ALGORITHMS_ROTATE_HPP + +#include "impl/Kokkos_Rotate.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType rotate(const ExecutionSpace& ex, IteratorType first, + IteratorType n_first, IteratorType last) { + return Impl::rotate_impl("Kokkos::rotate_iterator_api_default", ex, first, + n_first, last); +} + +template +IteratorType rotate(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType n_first, + IteratorType last) { + return Impl::rotate_impl(label, ex, first, n_first, last); +} + +template +auto rotate(const ExecutionSpace& ex, + const ::Kokkos::View& view, + std::size_t n_location) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::rotate_impl("Kokkos::rotate_view_api_default", ex, begin(view), + begin(view) + n_location, end(view)); +} + +template +auto rotate(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + std::size_t n_location) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::rotate_impl(label, ex, begin(view), begin(view) + n_location, + end(view)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp new file mode 100644 index 0000000000..f98686ab63 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp @@ -0,0 +1,100 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP + +#include "impl/Kokkos_RotateCopy.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +OutputIterator rotate_copy(const ExecutionSpace& ex, InputIterator first, + InputIterator n_first, InputIterator last, + OutputIterator d_first) { + return Impl::rotate_copy_impl("Kokkos::rotate_copy_iterator_api_default", ex, + first, n_first, last, d_first); +} + +template +OutputIterator rotate_copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator n_first, + InputIterator last, OutputIterator d_first) { + return Impl::rotate_copy_impl(label, ex, first, n_first, last, d_first); +} + +template +auto rotate_copy(const ExecutionSpace& ex, + const ::Kokkos::View& source, + std::size_t n_location, + const ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::rotate_copy_impl("Kokkos::rotate_copy_view_api_default", ex, + cbegin(source), cbegin(source) + n_location, + cend(source), begin(dest)); +} + +template +auto rotate_copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + std::size_t n_location, + const ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::rotate_copy_impl(label, ex, cbegin(source), + cbegin(source) + n_location, cend(source), + begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Search.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Search.hpp new file mode 100644 index 0000000000..ce656da31c --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Search.hpp @@ -0,0 +1,148 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_SEARCH_HPP +#define KOKKOS_STD_ALGORITHMS_SEARCH_HPP + +#include "impl/Kokkos_Search.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1: no binary predicate passed +template +IteratorType1 search(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last) { + return Impl::search_impl("Kokkos::search_iterator_api_default", ex, first, + last, s_first, s_last); +} + +template +IteratorType1 search(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last) { + return Impl::search_impl(label, ex, first, last, s_first, s_last); +} + +template +auto search(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_impl("Kokkos::search_view_api_default", ex, + KE::begin(view), KE::end(view), KE::begin(s_view), + KE::end(s_view)); +} + +template +auto search(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view)); +} + +// overload set 2: binary predicate passed +template +IteratorType1 search(const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last, const BinaryPredicateType& pred) { + return Impl::search_impl("Kokkos::search_iterator_api_default", ex, first, + last, s_first, s_last, pred); +} + +template +IteratorType1 search(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + const BinaryPredicateType& pred) { + return Impl::search_impl(label, ex, first, last, s_first, s_last, pred); +} + +template +auto search(const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_impl("Kokkos::search_view_api_default", ex, + KE::begin(view), KE::end(view), KE::begin(s_view), + KE::end(s_view), pred); +} + +template +auto search(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + const ::Kokkos::View& s_view, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(s_view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_impl(label, ex, KE::begin(view), KE::end(view), + KE::begin(s_view), KE::end(s_view), pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SearchN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SearchN.hpp new file mode 100644 index 0000000000..854d911e76 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SearchN.hpp @@ -0,0 +1,144 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP +#define KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP + +#include "impl/Kokkos_SearchN.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1: no binary predicate passed +template +IteratorType search_n(const ExecutionSpace& ex, IteratorType first, + IteratorType last, SizeType count, + const ValueType& value) { + return Impl::search_n_impl("Kokkos::search_n_iterator_api_default", ex, first, + last, count, value); +} + +template +IteratorType search_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, SizeType count, + const ValueType& value) { + return Impl::search_n_impl(label, ex, first, last, count, value); +} + +template +auto search_n(const ExecutionSpace& ex, + const ::Kokkos::View& view, + SizeType count, const ValueType& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_n_impl("Kokkos::search_n_view_api_default", ex, + KE::begin(view), KE::end(view), count, value); +} + +template +auto search_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + SizeType count, const ValueType& value) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_n_impl(label, ex, KE::begin(view), KE::end(view), count, + value); +} + +// overload set 2: binary predicate passed +template +IteratorType search_n(const ExecutionSpace& ex, IteratorType first, + IteratorType last, SizeType count, const ValueType& value, + const BinaryPredicateType& pred) { + return Impl::search_n_impl("Kokkos::search_n_iterator_api_default", ex, first, + last, count, value, pred); +} + +template +IteratorType search_n(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, SizeType count, + const ValueType& value, const BinaryPredicateType& pred) { + return Impl::search_n_impl(label, ex, first, last, count, value, pred); +} + +template +auto search_n(const ExecutionSpace& ex, + const ::Kokkos::View& view, + SizeType count, const ValueType& value, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_n_impl("Kokkos::search_n_view_api_default", ex, + KE::begin(view), KE::end(view), count, value, + pred); +} + +template +auto search_n(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + SizeType count, const ValueType& value, + const BinaryPredicateType& pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + namespace KE = ::Kokkos::Experimental; + return Impl::search_n_impl(label, ex, KE::begin(view), KE::end(view), count, + value, pred); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp new file mode 100644 index 0000000000..cee111af98 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp @@ -0,0 +1,89 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP +#define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP + +#include "impl/Kokkos_ShiftLeft.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType shift_left(const ExecutionSpace& ex, IteratorType first, + IteratorType last, + typename IteratorType::difference_type n) { + return Impl::shift_left_impl("Kokkos::shift_left_iterator_api_default", ex, + first, last, n); +} + +template +IteratorType shift_left(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + typename IteratorType::difference_type n) { + return Impl::shift_left_impl(label, ex, first, last, n); +} + +template +auto shift_left(const ExecutionSpace& ex, + const ::Kokkos::View& view, + typename decltype(begin(view))::difference_type n) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::shift_left_impl("Kokkos::shift_left_view_api_default", ex, + begin(view), end(view), n); +} + +template +auto shift_left(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + typename decltype(begin(view))::difference_type n) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::shift_left_impl(label, ex, begin(view), end(view), n); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp new file mode 100644 index 0000000000..f104d2bd7a --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp @@ -0,0 +1,89 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP +#define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP + +#include "impl/Kokkos_ShiftRight.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType shift_right(const ExecutionSpace& ex, IteratorType first, + IteratorType last, + typename IteratorType::difference_type n) { + return Impl::shift_right_impl("Kokkos::shift_right_iterator_api_default", ex, + first, last, n); +} + +template +IteratorType shift_right(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + typename IteratorType::difference_type n) { + return Impl::shift_right_impl(label, ex, first, last, n); +} + +template +auto shift_right(const ExecutionSpace& ex, + const ::Kokkos::View& view, + typename decltype(begin(view))::difference_type n) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::shift_right_impl("Kokkos::shift_right_view_api_default", ex, + begin(view), end(view), n); +} + +template +auto shift_right(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + typename decltype(begin(view))::difference_type n) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::shift_right_impl(label, ex, begin(view), end(view), n); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Swap.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Swap.hpp new file mode 100644 index 0000000000..9006aa9167 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Swap.hpp @@ -0,0 +1,69 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_SWAP_HPP +#define KOKKOS_STD_ALGORITHMS_SWAP_HPP + +#include + +namespace Kokkos { +namespace Experimental { + +// swap +template +KOKKOS_INLINE_FUNCTION void swap(T& a, T& b) noexcept { + static_assert( + std::is_move_assignable::value && std::is_move_constructible::value, + "Kokkos::Experimental::swap arguments must be move assignable " + "and move constructible"); + + T tmp = std::move(a); + a = std::move(b); + b = std::move(tmp); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp new file mode 100644 index 0000000000..2997cdab4b --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp @@ -0,0 +1,97 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP +#define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP + +#include "impl/Kokkos_SwapRanges.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +IteratorType2 swap_ranges(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2) { + return Impl::swap_ranges_impl("Kokkos::swap_ranges_iterator_api_default", ex, + first1, last1, first2); +} + +template +auto swap_ranges(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + assert(source.extent(0) == dest.extent(0)); + return Impl::swap_ranges_impl("Kokkos::swap_ranges_view_api_default", ex, + begin(source), end(source), begin(dest)); +} + +template +IteratorType2 swap_ranges(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2) { + return Impl::swap_ranges_impl(label, ex, first1, last1, first2); +} + +template +auto swap_ranges(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + assert(source.extent(0) == dest.extent(0)); + return Impl::swap_ranges_impl(label, ex, begin(source), end(source), + begin(dest)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Transform.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Transform.hpp new file mode 100644 index 0000000000..6dfb83a8c0 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Transform.hpp @@ -0,0 +1,166 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP +#define KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP + +#include "impl/Kokkos_Transform.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + InputIterator, OutputIterator>::value, + OutputIterator> +transform(const ExecutionSpace& ex, InputIterator first1, InputIterator last1, + OutputIterator d_first, UnaryOperation unary_op) { + return Impl::transform_impl("Kokkos::transform_iterator_api_default", ex, + first1, last1, d_first, std::move(unary_op)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + InputIterator, OutputIterator>::value, + OutputIterator> +transform(const std::string& label, const ExecutionSpace& ex, + InputIterator first1, InputIterator last1, OutputIterator d_first, + UnaryOperation unary_op) { + return Impl::transform_impl(label, ex, first1, last1, d_first, + std::move(unary_op)); +} + +template +auto transform(const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest, + UnaryOperation unary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::transform_impl("Kokkos::transform_view_api_default", ex, + begin(source), end(source), begin(dest), + std::move(unary_op)); +} + +template +auto transform(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + ::Kokkos::View& dest, + UnaryOperation unary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::transform_impl(label, ex, begin(source), end(source), + begin(dest), std::move(unary_op)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + InputIterator1, InputIterator2, OutputIterator>::value, + OutputIterator> +transform(const ExecutionSpace& ex, InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, OutputIterator d_first, + BinaryOperation binary_op) { + return Impl::transform_impl("Kokkos::transform_iterator_api_default", ex, + first1, last1, first2, d_first, + std::move(binary_op)); +} + +template +std::enable_if_t< ::Kokkos::Experimental::Impl::are_iterators< + InputIterator1, InputIterator2, OutputIterator>::value, + OutputIterator> +transform(const std::string& label, const ExecutionSpace& ex, + InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, + OutputIterator d_first, BinaryOperation binary_op) { + return Impl::transform_impl(label, ex, first1, last1, first2, d_first, + std::move(binary_op)); +} + +template +auto transform(const ExecutionSpace& ex, + const ::Kokkos::View& source1, + const ::Kokkos::View& source2, + ::Kokkos::View& dest, + BinaryOperation binary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source2); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::transform_impl("Kokkos::transform_view_api_default", ex, + begin(source1), end(source1), begin(source2), + begin(dest), std::move(binary_op)); +} + +template +auto transform(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source1, + const ::Kokkos::View& source2, + ::Kokkos::View& dest, + BinaryOperation binary_op) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source1); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source2); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::transform_impl(label, ex, begin(source1), end(source1), + begin(source2), begin(dest), + std::move(binary_op)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp new file mode 100644 index 0000000000..d0073599b0 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp @@ -0,0 +1,131 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP +#define KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP + +#include "impl/Kokkos_TransformExclusiveScan.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + 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::value, + "ValueType must be move constructible."); + return Impl::transform_exclusive_scan_impl( + "Kokkos::transform_exclusive_scan_custom_functors_iterator_api", ex, + first, last, first_dest, init_value, binary_op, unary_op); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + 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::value, + "ValueType must be move constructible."); + return Impl::transform_exclusive_scan_impl(label, ex, first, last, first_dest, + init_value, binary_op, unary_op); +} + +template +auto transform_exclusive_scan( + const ExecutionSpace& ex, + 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::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::transform_exclusive_scan_impl( + "Kokkos::transform_exclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + init_value, binary_op, unary_op); +} + +template +auto transform_exclusive_scan( + const std::string& label, const ExecutionSpace& ex, + 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::value, + "ValueType must be move constructible."); + namespace KE = ::Kokkos::Experimental; + return Impl::transform_exclusive_scan_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), init_value, binary_op, unary_op); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp new file mode 100644 index 0000000000..088e162adb --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp @@ -0,0 +1,190 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP +#define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP + +#include "impl/Kokkos_TransformInclusiveScan.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set 1 (no init value) +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + OutputIteratorType> +transform_inclusive_scan(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_impl( + "Kokkos::transform_inclusive_scan_custom_functors_iterator_api", ex, + first, last, first_dest, binary_op, unary_op); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + 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_impl(label, ex, first, last, first_dest, + binary_op, unary_op); +} + +template +auto transform_inclusive_scan( + const ExecutionSpace& ex, + 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; + return Impl::transform_inclusive_scan_impl( + "Kokkos::transform_inclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + binary_op, unary_op); +} + +template +auto transform_inclusive_scan( + const std::string& label, const ExecutionSpace& ex, + 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; + return Impl::transform_inclusive_scan_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), binary_op, unary_op); +} + +// overload set 2 (init value) +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + 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); + return Impl::transform_inclusive_scan_impl( + "Kokkos::transform_inclusive_scan_custom_functors_iterator_api", ex, + first, last, first_dest, binary_op, unary_op, init_value); +} + +template +std::enable_if_t<::Kokkos::Experimental::Impl::are_iterators< + InputIteratorType, OutputIteratorType>::value, + 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); + return Impl::transform_inclusive_scan_impl(label, ex, first, last, first_dest, + binary_op, unary_op, init_value); +} + +template +auto transform_inclusive_scan( + const ExecutionSpace& ex, + 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); + namespace KE = ::Kokkos::Experimental; + return Impl::transform_inclusive_scan_impl( + "Kokkos::transform_inclusive_scan_custom_functors_view_api", ex, + KE::cbegin(view_from), KE::cend(view_from), KE::begin(view_dest), + binary_op, unary_op, init_value); +} + +template +auto transform_inclusive_scan( + const std::string& label, const ExecutionSpace& ex, + 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); + namespace KE = ::Kokkos::Experimental; + return Impl::transform_inclusive_scan_impl( + label, ex, KE::cbegin(view_from), KE::cend(view_from), + KE::begin(view_dest), binary_op, unary_op, init_value); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp new file mode 100644 index 0000000000..5caced5917 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp @@ -0,0 +1,283 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP +#define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP + +#include "impl/Kokkos_TransformReduce.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// ---------------------------- +// overload set1: +// no custom functors passed, so equivalent to +// transform_reduce(first1, last1, first2, init, plus<>(), multiplies<>()); +// ---------------------------- +template +ValueType transform_reduce(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + ValueType init_reduction_value) { + return Impl::transform_reduce_default_functors_impl( + "Kokkos::transform_reduce_default_functors_iterator_api", ex, first1, + last1, first2, std::move(init_reduction_value)); +} + +template +ValueType transform_reduce(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, + ValueType init_reduction_value) { + return Impl::transform_reduce_default_functors_impl( + label, ex, first1, last1, first2, std::move(init_reduction_value)); +} + +// overload1 accepting views +template +ValueType transform_reduce( + const ExecutionSpace& ex, + const ::Kokkos::View& first_view, + const ::Kokkos::View& second_view, + ValueType init_reduction_value) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(second_view); + + return Impl::transform_reduce_default_functors_impl( + "Kokkos::transform_reduce_default_functors_iterator_api", ex, + KE::cbegin(first_view), KE::cend(first_view), KE::cbegin(second_view), + std::move(init_reduction_value)); +} + +template +ValueType transform_reduce( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& first_view, + const ::Kokkos::View& second_view, + ValueType init_reduction_value) { + namespace KE = ::Kokkos::Experimental; + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(second_view); + + return Impl::transform_reduce_default_functors_impl( + label, ex, KE::cbegin(first_view), KE::cend(first_view), + KE::cbegin(second_view), std::move(init_reduction_value)); +} + +// +// overload set2: +// accepts a custom transform and joiner functor +// + +// Note the std refers to the arg BinaryReductionOp +// but in the Kokkos naming convention, it corresponds +// to a "joiner" that knows how to join two values +// NOTE: "joiner/transformer" need to be commutative. + +// https://en.cppreference.com/w/cpp/algorithm/transform_reduce + +// api accepting iterators +template +ValueType transform_reduce(const ExecutionSpace& ex, IteratorType1 first1, + IteratorType1 last1, IteratorType2 first2, + ValueType init_reduction_value, + BinaryJoinerType joiner, + BinaryTransform transformer) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::transform_reduce_custom_functors_impl( + "Kokkos::transform_reduce_custom_functors_iterator_api", ex, first1, + last1, first2, std::move(init_reduction_value), std::move(joiner), + std::move(transformer)); +} + +template +ValueType transform_reduce(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, ValueType init_reduction_value, + BinaryJoinerType joiner, + BinaryTransform transformer) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::transform_reduce_custom_functors_impl( + label, ex, first1, last1, first2, std::move(init_reduction_value), + std::move(joiner), std::move(transformer)); +} + +// accepting views +template +ValueType transform_reduce( + const ExecutionSpace& ex, + const ::Kokkos::View& first_view, + const ::Kokkos::View& second_view, + ValueType init_reduction_value, BinaryJoinerType joiner, + BinaryTransform transformer) { + namespace KE = ::Kokkos::Experimental; + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(second_view); + + return Impl::transform_reduce_custom_functors_impl( + "Kokkos::transform_reduce_custom_functors_view_api", ex, + KE::cbegin(first_view), KE::cend(first_view), KE::cbegin(second_view), + std::move(init_reduction_value), std::move(joiner), + std::move(transformer)); +} + +template +ValueType transform_reduce( + const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& first_view, + const ::Kokkos::View& second_view, + ValueType init_reduction_value, BinaryJoinerType joiner, + BinaryTransform transformer) { + namespace KE = ::Kokkos::Experimental; + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(first_view); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(second_view); + + return Impl::transform_reduce_custom_functors_impl( + label, ex, KE::cbegin(first_view), KE::cend(first_view), + KE::cbegin(second_view), std::move(init_reduction_value), + std::move(joiner), std::move(transformer)); +} + +// +// overload set3: +// +// accepting iterators +template +// need this to avoid ambiguous call +std::enable_if_t< + ::Kokkos::Experimental::Impl::are_iterators::value, ValueType> +transform_reduce(const ExecutionSpace& ex, IteratorType first1, + IteratorType last1, ValueType init_reduction_value, + BinaryJoinerType joiner, UnaryTransform transformer) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::transform_reduce_custom_functors_impl( + "Kokkos::transform_reduce_custom_functors_iterator_api", ex, first1, + last1, std::move(init_reduction_value), std::move(joiner), + std::move(transformer)); +} + +template +// need this to avoid ambiguous call +std::enable_if_t< + ::Kokkos::Experimental::Impl::are_iterators::value, ValueType> +transform_reduce(const std::string& label, const ExecutionSpace& ex, + IteratorType first1, IteratorType last1, + ValueType init_reduction_value, BinaryJoinerType joiner, + UnaryTransform transformer) { + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + return Impl::transform_reduce_custom_functors_impl( + label, ex, first1, last1, std::move(init_reduction_value), + std::move(joiner), std::move(transformer)); +} + +// accepting views +template +ValueType transform_reduce(const ExecutionSpace& ex, + const ::Kokkos::View& view, + ValueType init_reduction_value, + BinaryJoinerType joiner, + UnaryTransform transformer) { + namespace KE = ::Kokkos::Experimental; + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::transform_reduce_custom_functors_impl( + "Kokkos::transform_reduce_custom_functors_view_api", ex, KE::cbegin(view), + KE::cend(view), std::move(init_reduction_value), std::move(joiner), + std::move(transformer)); +} + +template +ValueType transform_reduce(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + ValueType init_reduction_value, + BinaryJoinerType joiner, + UnaryTransform transformer) { + namespace KE = ::Kokkos::Experimental; + static_assert(std::is_move_constructible::value, + "ValueType must be move constructible."); + + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + + return Impl::transform_reduce_custom_functors_impl( + label, ex, KE::cbegin(view), KE::cend(view), + std::move(init_reduction_value), std::move(joiner), + std::move(transformer)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Unique.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Unique.hpp new file mode 100644 index 0000000000..aeb54a6ffe --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_Unique.hpp @@ -0,0 +1,124 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_HPP +#define KOKKOS_STD_ALGORITHMS_UNIQUE_HPP + +#include "impl/Kokkos_Unique.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// note: the enable_if below is to avoid "call to ... is ambiguous" +// for example in the unit test when using a variadic function + +// overload set1 +template +std::enable_if_t::value, IteratorType> unique( + const ExecutionSpace& ex, IteratorType first, IteratorType last) { + return Impl::unique_impl("Kokkos::unique_iterator_api_default", ex, first, + last); +} + +template +std::enable_if_t::value, IteratorType> unique( + const std::string& label, const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + return Impl::unique_impl(label, ex, first, last); +} + +template +auto unique(const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return ::Kokkos::Experimental::unique("Kokkos::unique_view_api_default", ex, + begin(view), end(view)); +} + +template +auto unique(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return ::Kokkos::Experimental::unique(label, ex, begin(view), end(view)); +} + +// overload set2 +template +IteratorType unique(const ExecutionSpace& ex, IteratorType first, + IteratorType last, BinaryPredicate pred) { + return Impl::unique_impl("Kokkos::unique_iterator_api_default", ex, first, + last, pred); +} + +template +IteratorType unique(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + BinaryPredicate pred) { + return Impl::unique_impl(label, ex, first, last, pred); +} + +template +auto unique(const ExecutionSpace& ex, + const ::Kokkos::View& view, + BinaryPredicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::unique_impl("Kokkos::unique_view_api_default", ex, begin(view), + end(view), std::move(pred)); +} + +template +auto unique(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& view, + BinaryPredicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(view); + return Impl::unique_impl(label, ex, begin(view), end(view), std::move(pred)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp new file mode 100644 index 0000000000..632b560fa8 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp @@ -0,0 +1,143 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP +#define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP + +#include "impl/Kokkos_UniqueCopy.hpp" +#include "Kokkos_BeginEnd.hpp" + +namespace Kokkos { +namespace Experimental { + +// overload set1 +template +std::enable_if_t::value, OutputIterator> +unique_copy(const ExecutionSpace& ex, InputIterator first, InputIterator last, + OutputIterator d_first) { + return Impl::unique_copy_impl("Kokkos::unique_copy_iterator_api_default", ex, + first, last, d_first); +} + +template +std::enable_if_t::value, OutputIterator> +unique_copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, OutputIterator d_first) { + return Impl::unique_copy_impl(label, ex, first, last, d_first); +} + +template +auto unique_copy(const ExecutionSpace& ex, + const ::Kokkos::View& source, + const ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return ::Kokkos::Experimental::unique_copy( + "Kokkos::unique_copy_view_api_default", ex, cbegin(source), cend(source), + begin(dest)); +} + +template +auto unique_copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + const ::Kokkos::View& dest) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return ::Kokkos::Experimental::unique_copy(label, ex, cbegin(source), + cend(source), begin(dest)); +} + +// overload set2 +template +OutputIterator unique_copy(const ExecutionSpace& ex, InputIterator first, + InputIterator last, OutputIterator d_first, + BinaryPredicate pred) { + return Impl::unique_copy_impl("Kokkos::unique_copy_iterator_api_default", ex, + first, last, d_first, pred); +} + +template +OutputIterator unique_copy(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first, BinaryPredicate pred) { + return Impl::unique_copy_impl(label, ex, first, last, d_first, pred); +} + +template +auto unique_copy(const ExecutionSpace& ex, + const ::Kokkos::View& source, + const ::Kokkos::View& dest, + BinaryPredicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::unique_copy_impl("Kokkos::unique_copy_view_api_default", ex, + cbegin(source), cend(source), begin(dest), + std::move(pred)); +} + +template +auto unique_copy(const std::string& label, const ExecutionSpace& ex, + const ::Kokkos::View& source, + const ::Kokkos::View& dest, + BinaryPredicate pred) { + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(source); + Impl::static_assert_is_admissible_to_kokkos_std_algorithms(dest); + + return Impl::unique_copy_impl(label, ex, cbegin(source), cend(source), + begin(dest), std::move(pred)); +} + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp new file mode 100644 index 0000000000..35c78b86bf --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp @@ -0,0 +1,135 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdAdjacentDifferenceDefaultBinaryOpFunctor { + KOKKOS_FUNCTION + constexpr RetType operator()(const ValueType1& a, const ValueType2& b) const { + return a - b; + } +}; + +template +struct StdAdjacentDiffFunctor { + using index_type = typename InputIteratorType::difference_type; + + const InputIteratorType m_first_from; + const OutputIteratorType m_first_dest; + BinaryOperator m_op; + + KOKKOS_FUNCTION + void operator()(const index_type i) const { + const auto& my_value = m_first_from[i]; + if (i == 0) { + m_first_dest[i] = my_value; + } else { + const auto& left_value = m_first_from[i - 1]; + m_first_dest[i] = m_op(my_value, left_value); + } + } + + KOKKOS_FUNCTION + StdAdjacentDiffFunctor(InputIteratorType first_from, + OutputIteratorType first_dest, BinaryOperator op) + : m_first_from(std::move(first_from)), + m_first_dest(std::move(first_dest)), + m_op(std::move(op)) {} +}; + +template +OutputIteratorType adjacent_difference_impl(const std::string& label, + const ExecutionSpace& ex, + InputIteratorType first_from, + InputIteratorType last_from, + OutputIteratorType first_dest, + BinaryOp bin_op) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first_from, first_dest); + Impl::static_assert_iterators_have_matching_difference_type(first_from, + first_dest); + Impl::expect_valid_range(first_from, last_from); + + if (first_from == last_from) { + return first_dest; + } + + // aliases + using value_type = typename OutputIteratorType::value_type; + using aux_view_type = ::Kokkos::View; + using functor_t = + StdAdjacentDiffFunctor; + + // run + const auto num_elements = + Kokkos::Experimental::distance(first_from, last_from); + aux_view_type aux_view("aux_view", num_elements); + ::Kokkos::parallel_for(label, + RangePolicy(ex, 0, num_elements), + functor_t(first_from, first_dest, bin_op)); + ex.fence("Kokkos::adjacent_difference: fence after operation"); + + // return + return first_dest + num_elements; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp new file mode 100644 index 0000000000..155f6c7bb8 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp @@ -0,0 +1,140 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdAdjacentFindFunctor { + using red_value_type = typename ReducerType::value_type; + + IteratorType m_first; + ReducerType m_reducer; + PredicateType m_p; + + KOKKOS_FUNCTION + void operator()(const IndexType i, red_value_type& red_value) const { + const auto& my_value = m_first[i]; + const auto& next_value = m_first[i + 1]; + const bool are_equal = m_p(my_value, next_value); + + auto rv = + are_equal + ? red_value_type{i} + : red_value_type{::Kokkos::reduction_identity::min()}; + + m_reducer.join(red_value, rv); + } + + KOKKOS_FUNCTION + StdAdjacentFindFunctor(IteratorType first, ReducerType reducer, + PredicateType p) + : m_first(std::move(first)), + m_reducer(std::move(reducer)), + m_p(std::move(p)) {} +}; + +template +IteratorType adjacent_find_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType first, + IteratorType last, PredicateType pred) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + const auto num_elements = Kokkos::Experimental::distance(first, last); + + if (num_elements <= 1) { + return last; + } + + using index_type = typename IteratorType::difference_type; + using reducer_type = FirstLoc; + using reduction_value_type = typename reducer_type::value_type; + using func_t = StdAdjacentFindFunctor; + + reduction_value_type red_result; + reducer_type reducer(red_result); + + // note that we use below num_elements-1 because + // each index i in the reduction checks i and (i+1). + ::Kokkos::parallel_reduce( + label, RangePolicy(ex, 0, num_elements - 1), + func_t(first, reducer, pred), reducer); + + // fence not needed because reducing into scalar + if (red_result.min_loc_true == + ::Kokkos::reduction_identity::min()) { + return last; + } else { + return first + red_result.min_loc_true; + } +} + +template +IteratorType adjacent_find_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + using value_type = typename IteratorType::value_type; + using default_pred_t = StdAlgoEqualBinaryPredicate; + return adjacent_find_impl(label, ex, first, last, default_pred_t()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp new file mode 100644 index 0000000000..dd8ae4f5b4 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp @@ -0,0 +1,77 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP + +#include "Kokkos_FindIfOrNot.hpp" + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +bool all_of_impl(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate predicate) { + return (find_if_or_not_impl(label, ex, first, last, predicate) == + last); +} + +template +bool any_of_impl(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, Predicate predicate) { + return (find_if_or_not_impl(label, ex, first, last, predicate) != last); +} + +template +bool none_of_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, Predicate predicate) { + return (find_if_or_not_impl(label, ex, first, last, predicate) == last); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp new file mode 100644 index 0000000000..ec54cd1900 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp @@ -0,0 +1,237 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_ +#define KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_ + +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct is_admissible_to_kokkos_std_algorithms : std::false_type {}; + +template +struct is_admissible_to_kokkos_std_algorithms< + T, std::enable_if_t< ::Kokkos::is_view::value && T::rank == 1 && + (std::is_same::value || + std::is_same::value || + std::is_same::value)> > + : std::true_type {}; + +template +KOKKOS_INLINE_FUNCTION constexpr void +static_assert_is_admissible_to_kokkos_std_algorithms( + const ViewType& /* view */) { + static_assert(is_admissible_to_kokkos_std_algorithms::value, + "Currently, Kokkos standard algorithms only accept 1D Views."); +} + +// +// is_iterator +// +template +using iterator_category_t = typename T::iterator_category; + +template +using is_iterator = Kokkos::is_detected; + +// +// are_iterators +// +template +struct are_iterators; + +template +struct are_iterators { + static constexpr bool value = is_iterator::value; +}; + +template +struct are_iterators { + static constexpr bool value = + are_iterators::value && are_iterators::value; +}; + +// +// are_random_access_iterators +// +template +struct are_random_access_iterators; + +template +struct are_random_access_iterators { + static constexpr bool value = + is_iterator::value && + std::is_base_of::value; +}; + +template +struct are_random_access_iterators { + static constexpr bool value = are_random_access_iterators::value && + are_random_access_iterators::value; +}; + +// +// iterators_are_accessible_from +// +template +struct iterators_are_accessible_from; + +template +struct iterators_are_accessible_from { + using view_type = typename IteratorType::view_type; + static constexpr bool value = + SpaceAccessibility::accessible; +}; + +template +struct iterators_are_accessible_from { + static constexpr bool value = + iterators_are_accessible_from::value && + iterators_are_accessible_from::value; +}; + +template +KOKKOS_INLINE_FUNCTION constexpr void +static_assert_random_access_and_accessible(const ExecutionSpace& /* ex */, + IteratorTypes... /* iterators */) { + static_assert( + are_random_access_iterators::value, + "Currently, Kokkos standard algorithms require random access iterators."); + static_assert( + iterators_are_accessible_from::value, + "Incompatible view/iterator and execution space"); +} + +// +// have matching difference_type +// +template +struct iterators_have_matching_difference_type; + +template +struct iterators_have_matching_difference_type { + static constexpr bool value = true; +}; + +template +struct iterators_have_matching_difference_type { + static constexpr bool value = + std::is_same::value; +}; + +template +struct iterators_have_matching_difference_type { + static constexpr bool value = + iterators_have_matching_difference_type::value && + iterators_have_matching_difference_type::value; +}; + +template +KOKKOS_INLINE_FUNCTION constexpr void +static_assert_iterators_have_matching_difference_type(IteratorType1 /* it1 */, + IteratorType2 /* it2 */) { + static_assert(iterators_have_matching_difference_type::value, + "Iterators do not have matching difference_type"); +} + +template +KOKKOS_INLINE_FUNCTION constexpr void +static_assert_iterators_have_matching_difference_type(IteratorType1 it1, + IteratorType2 it2, + IteratorType3 it3) { + static_assert_iterators_have_matching_difference_type(it1, it2); + 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 ExecutionSpace&) { + static_assert(not_openmptarget::value, + "Currently, Kokkos standard algorithms do not support custom " + "comparators in OpenMPTarget"); +} + +// +// valid range +// +template +void expect_valid_range(IteratorType first, IteratorType last) { + // this is a no-op for release + KOKKOS_EXPECTS(last >= first); + // avoid compiler complaining when KOKKOS_EXPECTS is no-op + (void)first; + (void)last; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp new file mode 100644 index 0000000000..18f614094c --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp @@ -0,0 +1,103 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdCopyBackwardFunctor { + static_assert(std::is_signed::value, + "Kokkos: StdCopyBackwardFunctor requires signed index type"); + + IteratorType1 m_last; + IteratorType2 m_dest_last; + + KOKKOS_FUNCTION + void operator()(IndexType i) const { m_dest_last[-i - 1] = m_last[-i - 1]; } + + KOKKOS_FUNCTION + StdCopyBackwardFunctor(IteratorType1 _last, IteratorType2 _dest_last) + : m_last(std::move(_last)), m_dest_last(std::move(_dest_last)) {} +}; + +template +IteratorType2 copy_backward_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 d_last) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first, d_last); + Impl::static_assert_iterators_have_matching_difference_type(first, d_last); + Impl::expect_valid_range(first, last); + + // aliases + using index_type = typename IteratorType1::difference_type; + using func_t = + StdCopyBackwardFunctor; + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_for(label, + RangePolicy(ex, 0, num_elements), + func_t(last, d_last)); + ex.fence("Kokkos::copy_backward: fence after operation"); + + // return + return d_last - num_elements; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp new file mode 100644 index 0000000000..03b6fc6eca --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp @@ -0,0 +1,116 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdCopyFunctor { + InputIterator m_first; + OutputIterator m_dest_first; + + KOKKOS_FUNCTION + void operator()(IndexType i) const { m_dest_first[i] = m_first[i]; } + + KOKKOS_FUNCTION + StdCopyFunctor(InputIterator _first, OutputIterator _dest_first) + : m_first(std::move(_first)), m_dest_first(std::move(_dest_first)) {} +}; + +template +OutputIterator copy_impl(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first, d_first); + Impl::static_assert_iterators_have_matching_difference_type(first, d_first); + Impl::expect_valid_range(first, last); + + // aliases + using index_type = typename InputIterator::difference_type; + using func_t = StdCopyFunctor; + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_for(label, + RangePolicy(ex, 0, num_elements), + func_t(first, d_first)); + ex.fence("Kokkos::copy: fence after operation"); + + // return + return d_first + num_elements; +} + +template +OutputIterator copy_n_impl(const std::string& label, const ExecutionSpace& ex, + InputIterator first_from, Size count, + OutputIterator first_dest) { + // 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); + + if (count > 0) { + return copy_impl(label, ex, first_from, first_from + count, first_dest); + } else { + return first_dest; + } +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp new file mode 100644 index 0000000000..aebb5a9a46 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp @@ -0,0 +1,142 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdCopyIfFunctor { + FirstFrom m_first_from; + FirstDest m_first_dest; + PredType m_pred; + + KOKKOS_FUNCTION + StdCopyIfFunctor(FirstFrom first_from, FirstDest first_dest, PredType pred) + : m_first_from(std::move(first_from)), + m_first_dest(std::move(first_dest)), + m_pred(std::move(pred)) {} + + KOKKOS_FUNCTION + void operator()(const IndexType i, IndexType& update, + const bool final_pass) const { + const auto& myval = m_first_from[i]; + if (final_pass) { + if (m_pred(myval)) { + m_first_dest[update] = myval; + } + } + + if (m_pred(myval)) { + update += 1; + } + } +}; + +template +OutputIterator copy_if_impl(const std::string& label, const ExecutionSpace& ex, + InputIterator first, InputIterator last, + OutputIterator d_first, PredicateType pred) { + /* + To explain the impl, suppose that our data is: + + | 1 | 1 | 2 | 2 | 3 | -2 | 4 | 4 | 4 | 5 | 7 | -10 | + + and we want to copy only the even entries, + We can use an exclusive scan where the "update" + is incremented only for the elements that satisfy the predicate. + This way, the update allows us to track where in the destination + we need to copy the elements: + + In this case, counting only the even entries, the exlusive scan + during the final pass would yield: + + | 0 | 0 | 0 | 1 | 2 | 2 | 3 | 4 | 5 | 6 | 6 | 6 | + * * * * * * * + + which provides the indexing in the destination where + each starred (*) element needs to be copied to since + the starred elements are those that satisfy the predicate. + */ + + // checks + Impl::static_assert_random_access_and_accessible(ex, first, d_first); + Impl::static_assert_iterators_have_matching_difference_type(first, d_first); + Impl::expect_valid_range(first, last); + + if (first == last) { + return d_first; + } else { + // aliases + using index_type = typename InputIterator::difference_type; + using func_type = StdCopyIfFunctor; + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + index_type count = 0; + ::Kokkos::parallel_scan(label, + RangePolicy(ex, 0, num_elements), + func_type(first, d_first, pred), count); + + // fence not needed because of the scan accumulating into count + return d_first + count; + } +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp new file mode 100644 index 0000000000..982ac40464 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp @@ -0,0 +1,112 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdCountIfFunctor { + using index_type = typename IteratorType::difference_type; + IteratorType m_first; + Predicate m_predicate; + + KOKKOS_FUNCTION + void operator()(index_type i, index_type& lsum) const { + if (m_predicate(m_first[i])) { + lsum++; + } + } + + KOKKOS_FUNCTION + StdCountIfFunctor(IteratorType _first, Predicate _predicate) + : m_first(std::move(_first)), m_predicate(std::move(_predicate)) {} +}; + +template +typename IteratorType::difference_type count_if_impl(const std::string& label, + const ExecutionSpace& ex, + IteratorType first, + IteratorType last, + Predicate predicate) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + // aliases + using func_t = StdCountIfFunctor; + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + typename IteratorType::difference_type count = 0; + ::Kokkos::parallel_reduce(label, + RangePolicy(ex, 0, num_elements), + func_t(first, predicate), count); + ex.fence("Kokkos::count_if: fence after operation"); + + return count; +} + +template +auto count_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, const T& value) { + return count_if_impl( + label, ex, first, last, + ::Kokkos::Experimental::Impl::StdAlgoEqualsValUnaryPredicate(value)); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp new file mode 100644 index 0000000000..9482917abb --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp @@ -0,0 +1,147 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdEqualFunctor { + IteratorType1 m_first1; + IteratorType2 m_first2; + BinaryPredicateType m_predicate; + + KOKKOS_FUNCTION + void operator()(IndexType i, std::size_t& lsum) const { + if (!m_predicate(m_first1[i], m_first2[i])) { + lsum = 1; + } + } + + KOKKOS_FUNCTION + StdEqualFunctor(IteratorType1 _first1, IteratorType2 _first2, + BinaryPredicateType _predicate) + : m_first1(std::move(_first1)), + m_first2(std::move(_first2)), + m_predicate(std::move(_predicate)) {} +}; + +template +bool equal_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, IteratorType2 first2, + BinaryPredicateType predicate) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first1, first2); + Impl::static_assert_iterators_have_matching_difference_type(first1, first2); + Impl::expect_valid_range(first1, last1); + + // aliases + using index_type = typename IteratorType1::difference_type; + using func_t = StdEqualFunctor; + + // run + const auto num_elements = Kokkos::Experimental::distance(first1, last1); + std::size_t different = 0; + ::Kokkos::parallel_reduce(label, + RangePolicy(ex, 0, num_elements), + func_t(first1, first2, predicate), different); + ex.fence("Kokkos::equal: fence after operation"); + + return !different; +} + +template +bool equal_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2) { + using value_type1 = typename IteratorType1::value_type; + using value_type2 = typename IteratorType2::value_type; + using pred_t = StdAlgoEqualBinaryPredicate; + return equal_impl(label, ex, first1, last1, first2, pred_t()); +} + +template +bool equal_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, IteratorType2 first2, + IteratorType2 last2, BinaryPredicateType predicate) { + const auto d1 = ::Kokkos::Experimental::distance(first1, last1); + const auto d2 = ::Kokkos::Experimental::distance(first2, last2); + if (d1 != d2) { + return false; + } + + return equal_impl(label, ex, first1, last1, first2, predicate); +} + +template +bool equal_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, IteratorType2 first2, + IteratorType2 last2) { + Impl::expect_valid_range(first1, last1); + Impl::expect_valid_range(first2, last2); + + using value_type1 = typename IteratorType1::value_type; + using value_type2 = typename IteratorType2::value_type; + using pred_t = StdAlgoEqualBinaryPredicate; + return equal_impl(label, ex, first1, last1, first2, last2, pred_t()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp new file mode 100644 index 0000000000..0ae4651c6a --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp @@ -0,0 +1,232 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include "Kokkos_ValueWrapperForNoNeutralElement.hpp" +#include "Kokkos_IdentityReferenceUnaryFunctor.hpp" +#include +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct ExclusiveScanDefaultFunctorForKnownNeutralElement { + using execution_space = ExeSpace; + + ValueType m_init_value; + FirstFrom m_first_from; + FirstDest m_first_dest; + + KOKKOS_FUNCTION + ExclusiveScanDefaultFunctorForKnownNeutralElement(ValueType init, + FirstFrom first_from, + FirstDest first_dest) + : m_init_value(std::move(init)), + m_first_from(std::move(first_from)), + m_first_dest(std::move(first_dest)) {} + + KOKKOS_FUNCTION + void operator()(const IndexType i, ValueType& update, + const bool final_pass) const { + if (final_pass) m_first_dest[i] = update + m_init_value; + update += m_first_from[i]; + } +}; + +template +struct ExclusiveScanDefaultFunctor { + using execution_space = ExeSpace; + using value_type = + ::Kokkos::Experimental::Impl::ValueWrapperForNoNeutralElement; + + ValueType m_init_value; + FirstFrom m_first_from; + FirstDest m_first_dest; + + KOKKOS_FUNCTION + ExclusiveScanDefaultFunctor(ValueType init, FirstFrom first_from, + FirstDest first_dest) + : m_init_value(std::move(init)), + m_first_from(std::move(first_from)), + m_first_dest(std::move(first_dest)) {} + + KOKKOS_FUNCTION + void operator()(const IndexType i, value_type& update, + const bool final_pass) const { + if (final_pass) { + if (i == 0) { + m_first_dest[i] = m_init_value; + } else { + m_first_dest[i] = update.val + m_init_value; + } + } + + const auto tmp = value_type{m_first_from[i], false}; + this->join(update, tmp); + } + + KOKKOS_FUNCTION + void init(value_type& update) const { + update.val = {}; + update.is_initial = true; + } + + KOKKOS_FUNCTION + void join(value_type& update, const value_type& input) const { + if (update.is_initial) { + update.val = input.val; + update.is_initial = false; + } else { + update.val = update.val + input.val; + } + } +}; + +template +OutputIteratorType exclusive_scan_custom_op_impl( + const std::string& label, const ExecutionSpace& ex, + InputIteratorType first_from, InputIteratorType last_from, + OutputIteratorType first_dest, ValueType init_value, BinaryOpType bop) { + // 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); + + // aliases + using index_type = typename InputIteratorType::difference_type; + using unary_op_type = StdNumericScanIdentityReferenceUnaryFunctor; + using func_type = + TransformExclusiveScanFunctor; + + // run + const auto num_elements = + Kokkos::Experimental::distance(first_from, last_from); + ::Kokkos::parallel_scan( + label, RangePolicy(ex, 0, num_elements), + func_type(init_value, first_from, first_dest, bop, unary_op_type())); + ex.fence("Kokkos::exclusive_scan_custom_op: fence after operation"); + + // return + return first_dest + num_elements; +} + +template +using ex_scan_has_reduction_identity_sum_t = + decltype(Kokkos::reduction_identity::sum()); + +template +OutputIteratorType exclusive_scan_default_op_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>, + ExclusiveScanDefaultFunctor>; + + // run + const auto num_elements = + Kokkos::Experimental::distance(first_from, last_from); + ::Kokkos::parallel_scan(label, + RangePolicy(ex, 0, num_elements), + func_type(init_value, first_from, first_dest)); + + ex.fence("Kokkos::exclusive_scan_default_op: fence after operation"); + + return first_dest + num_elements; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp new file mode 100644 index 0000000000..843771b6b1 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp @@ -0,0 +1,106 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdFillFunctor { + using index_type = typename InputIterator::difference_type; + InputIterator m_first; + T m_value; + + KOKKOS_FUNCTION + void operator()(index_type i) const { m_first[i] = m_value; } + + KOKKOS_FUNCTION + StdFillFunctor(InputIterator _first, T _value) + : m_first(std::move(_first)), m_value(std::move(_value)) {} +}; + +template +void fill_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, const T& value) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_for(label, + RangePolicy(ex, 0, num_elements), + StdFillFunctor(first, value)); + ex.fence("Kokkos::fill: fence after operation"); +} + +template +IteratorType fill_n_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, SizeType n, const T& value) { + auto last = first + n; + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + if (n <= 0) { + return first; + } + + fill_impl(label, ex, first, last, value); + return last; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp new file mode 100644 index 0000000000..35a6c4b4ac --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp @@ -0,0 +1,191 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdFindEndFunctor { + using red_value_type = typename ReducerType::value_type; + + IteratorType1 m_first; + IteratorType1 m_last; + IteratorType2 m_s_first; + IteratorType2 m_s_last; + ReducerType m_reducer; + PredicateType m_p; + + KOKKOS_FUNCTION + void operator()(const IndexType i, red_value_type& red_value) const { + namespace KE = ::Kokkos::Experimental; + auto myit = m_first + i; + bool found = true; + + const auto search_count = KE::distance(m_s_first, m_s_last); + for (IndexType k = 0; k < search_count; ++k) { + // note that we add this EXPECT to check if we are in a valid range + // but I think we can remvoe this beceause the guarantee we don't go + // out of bounds is taken care of at the calling site + // where we launch the par-reduce. + KOKKOS_EXPECTS((myit + k) < m_last); + + if (!m_p(myit[k], m_s_first[k])) { + found = false; + break; + } + } + + const auto rv = + found ? red_value_type{i} + : red_value_type{::Kokkos::reduction_identity::max()}; + + m_reducer.join(red_value, rv); + } + + KOKKOS_FUNCTION + StdFindEndFunctor(IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + ReducerType reducer, PredicateType p) + : m_first(std::move(first)), + m_last(std::move(last)), + m_s_first(std::move(s_first)), + m_s_last(std::move(s_last)), + m_reducer(std::move(reducer)), + m_p(std::move(p)) {} +}; + +template +IteratorType1 find_end_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last, + const BinaryPredicateType& pred) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first, s_first); + Impl::static_assert_iterators_have_matching_difference_type(first, s_first); + Impl::expect_valid_range(first, last); + Impl::expect_valid_range(s_first, s_last); + + // the target sequence should not be larger than the range [first, last) + namespace KE = ::Kokkos::Experimental; + const auto num_elements = KE::distance(first, last); + const auto s_count = KE::distance(s_first, s_last); + KOKKOS_EXPECTS(num_elements >= s_count); + (void)s_count; // needed when macro above is a no-op + + if (s_first == s_last) { + return last; + } + + if (first == last) { + return last; + } + + // special case where the two ranges have equal size + if (num_elements == s_count) { + const auto equal_result = equal_impl(label, ex, first, last, s_first, pred); + return (equal_result) ? first : last; + } else { + using index_type = typename IteratorType1::difference_type; + using reducer_type = LastLoc; + using reduction_value_type = typename reducer_type::value_type; + using func_t = StdFindEndFunctor; + + // run + reduction_value_type red_result; + reducer_type reducer(red_result); + + // decide the size of the range policy of the par_red: + // note that the last feasible index to start looking is the index + // whose distance from the "last" is equal to the sequence count. + // the +1 is because we need to include that location too. + const auto range_size = num_elements - s_count + 1; + + // run par reduce + ::Kokkos::parallel_reduce( + label, RangePolicy(ex, 0, range_size), + func_t(first, last, s_first, s_last, reducer, pred), reducer); + + // fence not needed because reducing into scalar + + // decide and return + if (red_result.max_loc_true == + ::Kokkos::reduction_identity::max()) { + // if here, a subrange has not been found + return last; + } else { + // a location has been found + return first + red_result.max_loc_true; + } + } +} + +template +IteratorType1 find_end_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType1 first, IteratorType1 last, + IteratorType2 s_first, IteratorType2 s_last) { + using value_type1 = typename IteratorType1::value_type; + using value_type2 = typename IteratorType2::value_type; + using predicate_type = StdAlgoEqualBinaryPredicate; + return find_end_impl(label, ex, first, last, s_first, s_last, + predicate_type()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp new file mode 100644 index 0000000000..6907bbdbc3 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp @@ -0,0 +1,161 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdFindFirstOfFunctor { + using red_value_type = typename ReducerType::value_type; + + IteratorType1 m_first; + IteratorType2 m_s_first; + IteratorType2 m_s_last; + ReducerType m_reducer; + PredicateType m_p; + + KOKKOS_FUNCTION + void operator()(const IndexType i, red_value_type& red_value) const { + namespace KE = ::Kokkos::Experimental; + const auto& myvalue = m_first[i]; + bool found = false; + + const auto search_count = KE::distance(m_s_first, m_s_last); + for (IndexType k = 0; k < search_count; ++k) { + if (m_p(myvalue, m_s_first[k])) { + found = true; + break; + } + } + + const auto rv = + found ? red_value_type{i} + : red_value_type{::Kokkos::reduction_identity::min()}; + + m_reducer.join(red_value, rv); + } + + KOKKOS_FUNCTION + StdFindFirstOfFunctor(IteratorType1 first, IteratorType2 s_first, + IteratorType2 s_last, ReducerType reducer, + PredicateType p) + : m_first(std::move(first)), + m_s_first(std::move(s_first)), + m_s_last(std::move(s_last)), + m_reducer(std::move(reducer)), + m_p(std::move(p)) {} +}; + +template +IteratorType1 find_first_of_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last, + const BinaryPredicateType& pred) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first, s_first); + Impl::static_assert_iterators_have_matching_difference_type(first, s_first); + Impl::expect_valid_range(first, last); + Impl::expect_valid_range(s_first, s_last); + + if ((s_first == s_last) || (first == last)) { + return last; + } + + using index_type = typename IteratorType1::difference_type; + using reducer_type = FirstLoc; + using reduction_value_type = typename reducer_type::value_type; + using func_t = StdFindFirstOfFunctor; + + // run + reduction_value_type red_result; + reducer_type reducer(red_result); + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_reduce( + label, RangePolicy(ex, 0, num_elements), + func_t(first, s_first, s_last, reducer, pred), reducer); + + // fence not needed because reducing into scalar + + // decide and return + if (red_result.min_loc_true == + ::Kokkos::reduction_identity::min()) { + // if here, nothing found + return last; + } else { + // a location has been found + return first + red_result.min_loc_true; + } +} + +template +IteratorType1 find_first_of_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType1 first, + IteratorType1 last, IteratorType2 s_first, + IteratorType2 s_last) { + using value_type1 = typename IteratorType1::value_type; + using value_type2 = typename IteratorType2::value_type; + using predicate_type = StdAlgoEqualBinaryPredicate; + return find_first_of_impl(label, ex, first, last, s_first, s_last, + predicate_type()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp new file mode 100644 index 0000000000..c79c4b5216 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp @@ -0,0 +1,146 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdFindIfOrNotFunctor { + using red_value_type = typename ReducerType::value_type; + + IteratorType m_first; + ReducerType m_reducer; + PredicateType m_p; + + KOKKOS_FUNCTION + void operator()(const IndexType i, red_value_type& red_value) const { + const auto& my_value = m_first[i]; + + // if doing find_if, look for when predicate is true + // if doing find_if_not, look for when predicate is false + const bool found_condition = is_find_if ? m_p(my_value) : !m_p(my_value); + + auto rv = + found_condition + ? red_value_type{i} + : red_value_type{::Kokkos::reduction_identity::min()}; + + m_reducer.join(red_value, rv); + } + + KOKKOS_FUNCTION + StdFindIfOrNotFunctor(IteratorType first, ReducerType reducer, + PredicateType p) + : m_first(std::move(first)), + m_reducer(std::move(reducer)), + m_p(std::move(p)) {} +}; + +template +IteratorType find_if_or_not_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType first, + IteratorType last, PredicateType pred) { + // checks + Impl::static_assert_random_access_and_accessible( + ex, first); // only need one It per type + Impl::expect_valid_range(first, last); + + if (first == last) { + return last; + } + + // aliases + using index_type = typename IteratorType::difference_type; + using reducer_type = FirstLoc; + using reduction_value_type = typename reducer_type::value_type; + using func_t = StdFindIfOrNotFunctor; + + // run + reduction_value_type red_result; + reducer_type reducer(red_result); + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_reduce(label, + RangePolicy(ex, 0, num_elements), + func_t(first, reducer, pred), reducer); + + // fence not needed because reducing into scalar + + // decide and return + if (red_result.min_loc_true == + ::Kokkos::reduction_identity::min()) { + // here, it means a valid loc has not been found, + return last; + } else { + // a location has been found + return first + red_result.min_loc_true; + } +} + +template +InputIterator find_impl(const std::string& label, ExecutionSpace ex, + InputIterator first, InputIterator last, + const T& value) { + return find_if_or_not_impl( + label, ex, first, last, + ::Kokkos::Experimental::Impl::StdAlgoEqualsValUnaryPredicate(value)); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp new file mode 100644 index 0000000000..8bd37b13bc --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp @@ -0,0 +1,113 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdForEachFunctor { + using index_type = typename IteratorType::difference_type; + IteratorType m_first; + UnaryFunctorType m_functor; + + KOKKOS_FUNCTION + void operator()(index_type i) const { m_functor(m_first[i]); } + + KOKKOS_FUNCTION + StdForEachFunctor(IteratorType _first, UnaryFunctorType _functor) + : m_first(std::move(_first)), m_functor(std::move(_functor)) {} +}; + +template +UnaryFunctorType for_each_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType first, + IteratorType last, UnaryFunctorType functor) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_for( + label, RangePolicy(ex, 0, num_elements), + StdForEachFunctor(first, functor)); + ex.fence("Kokkos::for_each: fence after operation"); + + return functor; +} + +template +IteratorType for_each_n_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, SizeType n, + UnaryFunctorType functor) { + auto last = first + n; + Impl::static_assert_random_access_and_accessible(ex, first, last); + Impl::expect_valid_range(first, last); + + if (n == 0) { + return first; + } + + for_each_impl(label, ex, first, last, std::move(functor)); + // no neeed to fence since for_each_impl fences already + + return last; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp new file mode 100644 index 0000000000..f01d9bfb55 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp @@ -0,0 +1,105 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdGenerateFunctor { + using index_type = typename IteratorType::difference_type; + IteratorType m_first; + Generator m_generator; + + KOKKOS_FUNCTION + void operator()(index_type i) const { m_first[i] = m_generator(); } + + KOKKOS_FUNCTION + StdGenerateFunctor(IteratorType _first, Generator _g) + : m_first(std::move(_first)), m_generator(std::move(_g)) {} +}; + +template +void generate_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, Generator g) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + // aliases + using func_t = StdGenerateFunctor; + + // run + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_for(label, + RangePolicy(ex, 0, num_elements), + func_t(first, g)); + ex.fence("Kokkos::generate: fence after operation"); +} + +template +IteratorType generate_n_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, Size count, Generator g) { + if (count <= 0) { + return first; + } + + generate_impl(label, ex, first, first + count, g); + return first + count; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp new file mode 100644 index 0000000000..244bce48e4 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp @@ -0,0 +1,120 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP +#define KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP + +#include + +// naming convetion: +// StdAlgoSomeExpressiveNameUnaryPredicate +// StdAlgoSomeExpressiveNameBinaryPredicate + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +// ------------------ +// UNARY PREDICATES +// ------------------ +template +struct StdAlgoEqualsValUnaryPredicate { + T m_value; + + KOKKOS_FUNCTION + constexpr bool operator()(const T& val) const { return val == m_value; } + + KOKKOS_FUNCTION + constexpr explicit StdAlgoEqualsValUnaryPredicate(const T& _value) + : m_value(_value) {} +}; + +template +struct StdAlgoNotEqualsValUnaryPredicate { + T m_value; + + KOKKOS_FUNCTION + constexpr bool operator()(const T& val) const { return !(val == m_value); } + + KOKKOS_FUNCTION + constexpr explicit StdAlgoNotEqualsValUnaryPredicate(const T& _value) + : m_value(_value) {} +}; + +template +struct StdAlgoNegateUnaryPredicateWrapper { + PredicateType m_pred; + + KOKKOS_FUNCTION + constexpr bool operator()(const ValueType& val) const { return !m_pred(val); } + + KOKKOS_FUNCTION + constexpr explicit StdAlgoNegateUnaryPredicateWrapper( + const PredicateType& pred) + : m_pred(pred) {} +}; + +// ------------------ +// BINARY PREDICATES +// ------------------ +template +struct StdAlgoEqualBinaryPredicate { + KOKKOS_FUNCTION + constexpr bool operator()(const ValueType1& a, const ValueType2& b) const { + return a == b; + } +}; + +template +struct StdAlgoLessThanBinaryPredicate { + KOKKOS_FUNCTION + constexpr bool operator()(const ValueType1& a, const ValueType2& b) const { + return a < b; + } +}; + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp new file mode 100644 index 0000000000..f41e567c9b --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp @@ -0,0 +1,64 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP +#define KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP + +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdNumericScanIdentityReferenceUnaryFunctor { + KOKKOS_FUNCTION + constexpr const ValueType& operator()(const ValueType& a) const { return a; } +}; + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp new file mode 100644 index 0000000000..2088ebd439 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp @@ -0,0 +1,243 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +using in_scan_has_reduction_identity_sum_t = + decltype(Kokkos::reduction_identity::sum()); + +template +struct InclusiveScanDefaultFunctorForKnownIdentityElement { + using execution_space = ExeSpace; + + FirstFrom m_first_from; + FirstDest m_first_dest; + + KOKKOS_FUNCTION + InclusiveScanDefaultFunctorForKnownIdentityElement(FirstFrom first_from, + FirstDest first_dest) + : m_first_from(std::move(first_from)), + m_first_dest(std::move(first_dest)) {} + + KOKKOS_FUNCTION + void operator()(const IndexType i, ValueType& update, + const bool final_pass) const { + update += m_first_from[i]; + + if (final_pass) { + m_first_dest[i] = update; + } + } +}; + +template +struct InclusiveScanDefaultFunctor { + using execution_space = ExeSpace; + using value_type = ValueWrapperForNoNeutralElement; + + FirstFrom m_first_from; + FirstDest m_first_dest; + + KOKKOS_FUNCTION + InclusiveScanDefaultFunctor(FirstFrom first_from, FirstDest first_dest) + : m_first_from(std::move(first_from)), + m_first_dest(std::move(first_dest)) {} + + KOKKOS_FUNCTION + void operator()(const IndexType i, value_type& update, + const bool final_pass) const { + const auto tmp = value_type{m_first_from[i], false}; + this->join(update, tmp); + + if (final_pass) { + m_first_dest[i] = update.val; + } + } + + KOKKOS_FUNCTION + void init(value_type& update) const { + update.val = {}; + update.is_initial = true; + } + + KOKKOS_FUNCTION + void join(value_type& update, const value_type& input) const { + if (update.is_initial) { + update.val = input.val; + } else { + update.val = update.val + input.val; + } + update.is_initial = false; + } +}; + +template +OutputIteratorType inclusive_scan_default_op_impl( + const std::string& label, const ExecutionSpace& ex, + InputIteratorType first_from, InputIteratorType last_from, + OutputIteratorType first_dest) { + // 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); + + // aliases + using index_type = typename InputIteratorType::difference_type; + using value_type = + std::remove_const_t; + using func_type = std::conditional_t< + ::Kokkos::is_detected::value, + InclusiveScanDefaultFunctorForKnownIdentityElement< + ExecutionSpace, index_type, value_type, InputIteratorType, + OutputIteratorType>, + InclusiveScanDefaultFunctor>; + + // run + const auto num_elements = + Kokkos::Experimental::distance(first_from, last_from); + ::Kokkos::parallel_scan(label, + RangePolicy(ex, 0, num_elements), + func_type(first_from, first_dest)); + ex.fence("Kokkos::inclusive_scan_default_op: fence after operation"); + + // return + return first_dest + num_elements; +} + +// ------------------------------------------------------------- +// inclusive_scan_custom_binary_op_impl +// ------------------------------------------------------------- +template +OutputIteratorType inclusive_scan_custom_binary_op_impl( + const std::string& label, const ExecutionSpace& ex, + InputIteratorType first_from, InputIteratorType last_from, + OutputIteratorType first_dest, BinaryOpType binary_op) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first_from, first_dest); + Impl::static_assert_iterators_have_matching_difference_type(first_from, + first_dest); + Impl::expect_valid_range(first_from, last_from); + + // aliases + using index_type = typename InputIteratorType::difference_type; + using value_type = + std::remove_const_t; + using unary_op_type = StdNumericScanIdentityReferenceUnaryFunctor; + using func_type = TransformInclusiveScanNoInitValueFunctor< + ExecutionSpace, index_type, value_type, InputIteratorType, + OutputIteratorType, BinaryOpType, unary_op_type>; + + // run + const auto num_elements = + Kokkos::Experimental::distance(first_from, last_from); + ::Kokkos::parallel_scan( + label, RangePolicy(ex, 0, num_elements), + func_type(first_from, first_dest, binary_op, unary_op_type())); + ex.fence("Kokkos::inclusive_scan_custom_binary_op: fence after operation"); + + // return + return first_dest + num_elements; +} + +// ------------------------------------------------------------- +// inclusive_scan_custom_binary_op_impl with init_value +// ------------------------------------------------------------- +template +OutputIteratorType inclusive_scan_custom_binary_op_impl( + const std::string& label, const ExecutionSpace& ex, + InputIteratorType first_from, InputIteratorType last_from, + OutputIteratorType first_dest, BinaryOpType binary_op, + 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); + + // aliases + using index_type = typename InputIteratorType::difference_type; + using unary_op_type = StdNumericScanIdentityReferenceUnaryFunctor; + using func_type = TransformInclusiveScanWithInitValueFunctor< + ExecutionSpace, index_type, ValueType, InputIteratorType, + OutputIteratorType, BinaryOpType, unary_op_type>; + + // run + const auto num_elements = + Kokkos::Experimental::distance(first_from, last_from); + ::Kokkos::parallel_scan(label, + RangePolicy(ex, 0, num_elements), + func_type(first_from, first_dest, binary_op, + unary_op_type(), init_value)); + ex.fence("Kokkos::inclusive_scan_custom_binary_op: fence after operation"); + + // return + return first_dest + num_elements; +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp new file mode 100644 index 0000000000..0f00bebb6d --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp @@ -0,0 +1,148 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdIsPartitionedFunctor { + using red_value_type = typename ReducerType::value_type; + using index_type = typename IteratorType::difference_type; + + IteratorType m_first; + ReducerType m_reducer; + PredicateType m_p; + + KOKKOS_FUNCTION + void operator()(const index_type i, red_value_type& redValue) const { + const auto predicate_value = m_p(m_first[i]); + constexpr index_type m_red_id_min = + ::Kokkos::reduction_identity::min(); + constexpr index_type m_red_id_max = + ::Kokkos::reduction_identity::max(); + auto rv = predicate_value ? red_value_type{i, m_red_id_min} + : red_value_type{m_red_id_max, i}; + + m_reducer.join(redValue, rv); + } + + KOKKOS_FUNCTION + StdIsPartitionedFunctor(IteratorType first, ReducerType reducer, + PredicateType p) + : m_first(std::move(first)), + m_reducer(std::move(reducer)), + m_p(std::move(p)) {} +}; + +template +bool is_partitioned_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + PredicateType pred) { + // true if all elements in the range [first, last) that satisfy + // the predicate "pred" appear before all elements that don't. + // Also returns true if [first, last) is empty. + // also true if all elements satisfy the predicate. + + // we implement it by finding: + // - the max location where predicate is true (max_loc_true) + // - the min location where predicate is false (min_loc_false) + // so the range is partitioned if max_loc_true < (min_loc_false) + + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + // trivial case + if (first == last) { + return true; + } + + // aliases + using index_type = typename IteratorType::difference_type; + using reducer_type = StdIsPartitioned; + using reduction_value_type = typename reducer_type::value_type; + using func_t = + StdIsPartitionedFunctor; + + // run + reduction_value_type red_result; + reducer_type reducer(red_result); + const auto num_elements = Kokkos::Experimental::distance(first, last); + ::Kokkos::parallel_reduce(label, + RangePolicy(ex, 0, num_elements), + func_t(first, reducer, pred), reducer); + + // fence not needed because reducing into scalar + + // decide and return + constexpr index_type red_id_min = + ::Kokkos::reduction_identity::min(); + constexpr index_type red_id_max = + ::Kokkos::reduction_identity::max(); + + if (red_result.max_loc_true != red_id_max && + red_result.min_loc_false != red_id_min) { + return red_result.max_loc_true < red_result.min_loc_false; + } else if (first + red_result.max_loc_true == --last) { + return true; + } else { + return false; + } +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp new file mode 100644 index 0000000000..4e36ae3890 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp @@ -0,0 +1,117 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdIsSortedFunctor { + using index_type = typename IteratorType::difference_type; + IteratorType m_first; + ComparatorType m_comparator; + + KOKKOS_FUNCTION + void operator()(const index_type i, std::size_t& update) const { + const auto& val_i = m_first[i]; + const auto& val_ip1 = m_first[i + 1]; + + if (m_comparator(val_ip1, val_i)) { + ++update; + } + } + + KOKKOS_FUNCTION + StdIsSortedFunctor(IteratorType _first1, ComparatorType comparator) + : m_first(std::move(_first1)), m_comparator(std::move(comparator)) {} +}; + +template +bool is_sorted_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last, + ComparatorType comp) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + const auto num_elements = Kokkos::Experimental::distance(first, last); + if (num_elements <= 1) { + return true; + } + + // use num_elements-1 because each index handles i and i+1 + const auto num_elements_minus_one = num_elements - 1; + using functor_type = StdIsSortedFunctor; + + // result is incremented by one if sorting breaks at index i + std::size_t result = 0; + ::Kokkos::parallel_reduce( + label, RangePolicy(ex, 0, num_elements_minus_one), + functor_type(first, std::move(comp)), result); + + return result == 0; +} + +template +bool is_sorted_impl(const std::string& label, const ExecutionSpace& ex, + IteratorType first, IteratorType last) { + using value_type = typename IteratorType::value_type; + using pred_t = Impl::StdAlgoLessThanBinaryPredicate; + return is_sorted_impl(label, ex, first, last, pred_t()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp new file mode 100644 index 0000000000..4e99c301b2 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp @@ -0,0 +1,153 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdIsSortedUntilFunctor { + using index_type = typename IteratorType::difference_type; + IteratorType m_first; + IndicatorViewType m_indicator; + ComparatorType m_comparator; + + KOKKOS_FUNCTION + void operator()(const index_type i, int& update, const bool final) const { + const auto& val_i = m_first[i]; + const auto& val_ip1 = m_first[i + 1]; + + if (m_comparator(val_ip1, val_i)) { + ++update; + } + + if (final) { + m_indicator(i) = update; + } + } + + KOKKOS_FUNCTION + StdIsSortedUntilFunctor(IteratorType _first1, IndicatorViewType indicator, + ComparatorType comparator) + : m_first(std::move(_first1)), + m_indicator(std::move(indicator)), + m_comparator(std::move(comparator)) {} +}; + +template +IteratorType is_sorted_until_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType first, + IteratorType last, ComparatorType comp) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first); + Impl::expect_valid_range(first, last); + + const auto num_elements = Kokkos::Experimental::distance(first, last); + + // trivial case + if (num_elements <= 1) { + return last; + } + + /* + use scan and a helper "indicator" view + such that we scan the data and fill the indicator with + partial sum that is always 0 unless we find a pair that + breaks the sorting, so in that case the indicator will + have a 1 starting at the location where the sorting breaks. + So finding that 1 means finding the location we want. + */ + + // aliases + using indicator_value_type = std::size_t; + using indicator_view_type = + ::Kokkos::View; + using functor_type = + StdIsSortedUntilFunctor; + + // do scan + // use num_elements-1 because each index handles i and i+1 + const auto num_elements_minus_one = num_elements - 1; + indicator_view_type indicator("is_sorted_until_indicator_helper", + num_elements_minus_one); + ::Kokkos::parallel_scan( + label, RangePolicy(ex, 0, num_elements_minus_one), + functor_type(first, indicator, std::move(comp))); + + // try to find the first sentinel value, which indicates + // where the sorting condition breaks + namespace KE = ::Kokkos::Experimental; + constexpr indicator_value_type sentinel_value = 1; + auto r = + KE::find(ex, KE::cbegin(indicator), KE::cend(indicator), sentinel_value); + const auto shift = r - ::Kokkos::Experimental::cbegin(indicator); + + return first + (shift + 1); +} + +template +IteratorType is_sorted_until_impl(const std::string& label, + const ExecutionSpace& ex, IteratorType first, + IteratorType last) { + using value_type = typename IteratorType::value_type; + using pred_t = Impl::StdAlgoLessThanBinaryPredicate; + return is_sorted_until_impl(label, ex, first, last, pred_t()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp new file mode 100644 index 0000000000..c3dd13e6b5 --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp @@ -0,0 +1,184 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdCompareFunctor { + IteratorType1 m_it1; + IteratorType2 m_it2; + ComparatorType m_predicate; + + KOKKOS_FUNCTION + void operator()(IndexType /* i is unused */, int& lsum) const { + if (m_predicate(*m_it1, *m_it2)) { + lsum = 1; + } + } + + KOKKOS_FUNCTION + StdCompareFunctor(IteratorType1 _it1, IteratorType2 _it2, + ComparatorType _predicate) + : m_it1(std::move(_it1)), + m_it2(std::move(_it2)), + m_predicate(std::move(_predicate)) {} +}; + +template +struct StdLexicographicalCompareFunctor { + using red_value_type = typename ReducerType::value_type; + IteratorType1 m_first1; + IteratorType2 m_first2; + ReducerType m_reducer; + ComparatorType m_comparator; + + KOKKOS_FUNCTION + void operator()(const IndexType i, red_value_type& red_value) const { + const auto& my_value1 = m_first1[i]; + const auto& my_value2 = m_first2[i]; + + bool different = m_comparator(my_value1, my_value2) || + m_comparator(my_value2, my_value1); + auto rv = + different + ? red_value_type{i} + : red_value_type{::Kokkos::reduction_identity::min()}; + + m_reducer.join(red_value, rv); + } + + KOKKOS_FUNCTION + StdLexicographicalCompareFunctor(IteratorType1 _first1, IteratorType2 _first2, + ReducerType _reducer, ComparatorType _comp) + : m_first1(std::move(_first1)), + m_first2(std::move(_first2)), + m_reducer(std::move(_reducer)), + m_comparator(std::move(_comp)) {} +}; + +template +bool lexicographical_compare_impl(const std::string& label, + const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2, + ComparatorType comp) { + // checks + Impl::static_assert_random_access_and_accessible(ex, first1, first2); + Impl::static_assert_iterators_have_matching_difference_type(first1, first2); + Impl::expect_valid_range(first1, last1); + Impl::expect_valid_range(first2, last2); + + // aliases + using index_type = typename IteratorType1::difference_type; + using reducer_type = FirstLoc; + using reduction_value_type = typename reducer_type::value_type; + + // run + const auto d1 = Kokkos::Experimental::distance(first1, last1); + const auto d2 = Kokkos::Experimental::distance(first2, last2); + const auto range = Kokkos::min(d1, d2); + reduction_value_type red_result; + reducer_type reducer(red_result); + using func1_t = + StdLexicographicalCompareFunctor; + + ::Kokkos::parallel_reduce(label, RangePolicy(ex, 0, range), + func1_t(first1, first2, reducer, comp), reducer); + + // fence not needed because reducing into scalar + // no mismatch + if (red_result.min_loc_true == + ::Kokkos::reduction_identity::min()) { + auto new_last1 = first1 + range; + auto new_last2 = first2 + range; + bool is_prefix = (new_last1 == last1) && (new_last2 != last2); + return is_prefix; + } + + // check mismatched + int less = 0; + auto it1 = first1 + red_result.min_loc_true; + auto it2 = first2 + red_result.min_loc_true; + using func2_t = StdCompareFunctor; + ::Kokkos::parallel_reduce(label, RangePolicy(ex, 0, 1), + func2_t(it1, it2, comp), less); + + // fence not needed because reducing into scalar + return static_cast(less); +} + +template +bool lexicographical_compare_impl(const std::string& label, + const ExecutionSpace& ex, + IteratorType1 first1, IteratorType1 last1, + IteratorType2 first2, IteratorType2 last2) { + using value_type_1 = typename IteratorType1::value_type; + using value_type_2 = typename IteratorType2::value_type; + using predicate_t = + Impl::StdAlgoLessThanBinaryPredicate; + return lexicographical_compare_impl(label, ex, first1, last1, first2, last2, + predicate_t()); +} + +} // namespace Impl +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp new file mode 100644 index 0000000000..0a9d41b9bb --- /dev/null +++ b/bundled/kokkos-3.7.00/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp @@ -0,0 +1,167 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 3.0 +// Copyright (2020) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP +#define KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP + +#include +#include "Kokkos_Constraints.hpp" +#include "Kokkos_HelperPredicates.hpp" +#include +#include + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +template +struct StdMinOrMaxElemFunctor { + using index_type = typename IteratorType::difference_type; + using red_value_type = typename ReducerType::value_type; + + IteratorType m_first; + ReducerType m_reducer; + + KOKKOS_FUNCTION + void operator()(const index_type i, red_value_type& red_value) const { + m_reducer.join(red_value, red_value_type{m_first[i], i}); + } + + KOKKOS_FUNCTION + StdMinOrMaxElemFunctor(IteratorType first, ReducerType reducer) + : m_first(std::move(first)), m_reducer(std::move(reducer)) {} +}; + +template +struct StdMinMaxElemFunctor { + using index_type = typename IteratorType::difference_type; + using red_value_type = typename ReducerType::value_type; + IteratorType m_first; + ReducerType m_reducer; + + KOKKOS_FUNCTION + void operator()(const index_type i, red_value_type& red_value) const { + const auto& my_value = m_first[i]; + m_reducer.join(red_value, red_value_type{my_value, my_value, i, i}); + } + + KOKKOS_FUNCTION + StdMinMaxElemFunctor(IteratorType first, ReducerType reducer) + : m_first(std::move(first)), m_reducer(std::move(reducer)) {} +}; + +template