├── wiki-md-files-to-port ├── Kokkos::MemoryTraits.md ├── Kokkos-Concepts.pdf ├── API-Reference │ ├── Kokkos::is_space.md │ ├── Kokkos::is_reducer.md │ ├── Kokkos::is_array_layout.md │ ├── Kokkos::is_memory_space.md │ ├── Kokkos::is_memory_traits.md │ ├── Kokkos::is_execution_policy.md │ ├── API-Algorithms.md │ ├── API-Reference.md │ ├── Kokkos::abort.md │ ├── API-Utilities.md │ ├── Kokkos::Cuda.md │ ├── Kokkos::CudaSpace.md │ ├── Kokkos::Serial.md │ ├── Kokkos::HPX.md │ ├── Kokkos::OpenMP.md │ ├── Kokkos::HostSpace.md │ ├── Kokkos::OpenMPTarget.md │ ├── Kokkos::CudaUVMSpace.md │ ├── Kokkos::CudaHostPinnedSpace.md │ ├── Kokkos::atomic_load.md │ ├── Kokkos::atomic_store.md │ ├── Kokkos::ParallelForTag.md │ ├── Kokkos::ParallelScanTag.md │ ├── Kokkos::ParallelReduceTag.md │ ├── Kokkos::StaticCrsGraph.md │ ├── Numerics.md │ ├── STL-Compatibility.md │ ├── API-Containers.md │ ├── Kokkos::atomic_exchange.md │ ├── Kokkos::kokkos_free.md │ ├── API-Core.md │ ├── Kokkos::ValLocScalar.md │ ├── Kokkos::Timer.md │ ├── Kokkos::MinMaxScalar.md │ ├── Kokkos::atomic_compare_exchange.md │ ├── Kokkos::atomic_compare_exchange_strong.md │ ├── API-View.md │ ├── Kokkos::finalize.md │ ├── Execution-Policies.md │ ├── API-Spaces.md │ ├── Kokkos::MinMaxLocScalar.md │ ├── Kokkos::kokkos_realloc.md │ ├── Kokkos::view_alloc.md │ ├── Kokkos::kokkos_malloc.md │ ├── Kokkos::ScopeGuard.md │ ├── Data-Parallelism.md │ ├── Kokkos::fence.md │ ├── Kokkos::LayoutLeft.md │ ├── Initialization-API.md │ ├── Kokkos::LayoutRight.md │ ├── Mathematical-Constants.md │ └── Kokkos::subview.md ├── API-Algorithms.md ├── ProgrammingGuide │ ├── figures │ │ ├── DOEbwlogo.pdf │ │ ├── kokkos-node.pdf │ │ ├── task-dispatch.png │ │ ├── kokkos-node-doc.png │ │ ├── kokkos-abstractions.pdf │ │ ├── kokkos-memory-space.pdf │ │ ├── parallel-dispatch.png │ │ ├── SNL_Stacked_Black_Blue.jpg │ │ ├── kokkos-abstractions-doc.png │ │ ├── kokkos-execution-space.pdf │ │ ├── kokkos-memory-space-doc.png │ │ └── kokkos-execution-space-doc.png │ ├── ContentContainers.md │ ├── The-Kokkos-Programming-Guide.md │ ├── Programming-Guide:-Core.md │ └── Programming-Guide:-Custom-Reductions.md ├── UseCases │ ├── VirtualFunctions-VTables.png │ ├── VirtualFunctions-VPointers.png │ ├── VirtualFunctions-DeviceVTable.png │ └── VirtualFunctions-DeviceVPointer.png ├── A-Guide-to-Kokkos-Testing-Processes.md ├── ViewLike.md ├── Views.md ├── Sort.md ├── Overview.md ├── Testing-Processes.md ├── ExecutionPolicyConcept.md ├── Initialize-and-Finalize.md ├── Requirements-Issues-and-Feedback.md ├── Random-Number.md ├── Custom-Reductions:-Built-In-Reducers-with-Custom-Scalar-Types.md └── SoA-and-AoSoA-with-Cabana.md ├── docs ├── source │ ├── ProgrammingGuide │ │ ├── figures │ │ │ ├── DOEbwlogo.pdf │ │ │ ├── kokkos-node.pdf │ │ │ ├── task-dispatch.png │ │ │ ├── kokkos-node-doc.png │ │ │ ├── kokkos-abstractions.pdf │ │ │ ├── kokkos-memory-space.pdf │ │ │ ├── parallel-dispatch.png │ │ │ ├── SNL_Stacked_Black_Blue.jpg │ │ │ ├── kokkos-abstractions-doc.png │ │ │ ├── kokkos-execution-space.pdf │ │ │ ├── kokkos-memory-space-doc.png │ │ │ └── kokkos-execution-space-doc.png │ │ ├── Custom-Reductions.rst │ │ └── Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.md │ ├── usecases │ │ ├── VirtualFunctions-VTables.png │ │ ├── VirtualFunctions-VPointers.png │ │ ├── VirtualFunctions-DeviceVTable.png │ │ ├── VirtualFunctions-DeviceVPointer.png │ │ └── SoA-and-AoSoA-with-Cabana.md │ ├── API │ │ ├── algorithms │ │ │ ├── std-algorithms │ │ │ │ ├── StdSorting.rst │ │ │ │ ├── StdMinMaxElement.rst │ │ │ │ ├── StdPartioningOps.rst │ │ │ │ ├── StdNumeric.rst │ │ │ │ ├── StdModSeq.rst │ │ │ │ └── all │ │ │ │ │ ├── StdReverse.md │ │ │ │ │ ├── StdShiftRight.md │ │ │ │ │ ├── StdGenerate_n.md │ │ │ │ │ ├── StdPartitionPoint.md │ │ │ │ │ ├── StdMoveBackward.md │ │ │ │ │ ├── StdGenerate.md │ │ │ │ │ ├── StdShiftLeft.md │ │ │ │ │ ├── StdFill.md │ │ │ │ │ ├── StdFill_n.md │ │ │ │ │ ├── StdSwapRanges.md │ │ │ │ │ ├── StdCopy_n.md │ │ │ │ │ ├── StdRemove.md │ │ │ │ │ ├── StdMove.md │ │ │ │ │ └── StdRotate.md │ │ │ ├── std-algorithms-index.rst │ │ │ └── Sort.md │ │ ├── core │ │ │ ├── Spaces.rst │ │ │ ├── Utilities.rst │ │ │ ├── utilities │ │ │ │ ├── abort.md │ │ │ │ ├── experimental.md │ │ │ │ ├── all.md │ │ │ │ └── timer.md │ │ │ ├── atomics.rst │ │ │ ├── c_style_memory_management.rst │ │ │ ├── atomics │ │ │ │ ├── atomic_load.md │ │ │ │ ├── atomic_store.md │ │ │ │ ├── atomic_exchange.md │ │ │ │ ├── atomic_compare_exchange.md │ │ │ │ └── atomic_compare_exchange_strong.md │ │ │ ├── STL-Compatibility.rst │ │ │ ├── builtinreducers │ │ │ │ ├── ReductionScalarTypes.rst │ │ │ │ ├── ValLocScalar.md │ │ │ │ ├── MinMaxScalar.md │ │ │ │ └── MinMaxLocScalar.md │ │ │ ├── parallel-dispatch │ │ │ │ ├── ParallelForTag.md │ │ │ │ ├── ParallelScanTag.md │ │ │ │ ├── ParallelReduceTag.md │ │ │ │ └── fence.md │ │ │ ├── Traits.md │ │ │ ├── view │ │ │ │ ├── view_like.rst │ │ │ │ ├── Subview.md │ │ │ │ ├── view_alloc.md │ │ │ │ ├── layoutLeft.md │ │ │ │ ├── layoutRight.md │ │ │ │ └── subview.md │ │ │ ├── Numerics.rst │ │ │ ├── c_style_memory_management │ │ │ │ ├── free.md │ │ │ │ ├── realloc.md │ │ │ │ └── malloc.md │ │ │ ├── initialize_finalize │ │ │ │ ├── InitArguments.md │ │ │ │ └── finalize.md │ │ │ ├── ParallelDispatch.rst │ │ │ ├── View.rst │ │ │ ├── policies │ │ │ │ └── ExecutionPolicyConcept.md │ │ │ ├── builtin_reducers.rst │ │ │ ├── Initialize-and-Finalize.rst │ │ │ └── numerics │ │ │ │ └── mathematical-constants.md │ │ ├── algorithms-index.rst │ │ ├── containers │ │ │ └── StaticCrsGraph.md │ │ ├── containers-index.rst │ │ └── core-index.rst │ ├── testing-and-issue-tracking.rst │ ├── usecases.rst │ ├── programmingguide.rst │ ├── contributing.rst │ ├── mydefs.rst │ ├── testing-and-issue-tracking │ │ ├── Testing-Processes.md │ │ └── Requirements-Issues-and-Feedback.md │ ├── citation.rst │ ├── hacks.css │ ├── license.rst │ ├── conf.py │ └── requirements.rst └── Makefile ├── .gitignore ├── README.md └── .github └── workflows └── deploy_docs.yml /wiki-md-files-to-port/Kokkos::MemoryTraits.md: -------------------------------------------------------------------------------- 1 | TBD... -------------------------------------------------------------------------------- /wiki-md-files-to-port/Kokkos-Concepts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/Kokkos-Concepts.pdf -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::is_space.md: -------------------------------------------------------------------------------- 1 | Boolean type trait to detect types that model the [Space concept](Kokkos%3A%3ASpaceConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::is_reducer.md: -------------------------------------------------------------------------------- 1 | Boolean type trait to detect types that model the [Reducer concept](Kokkos%3A%3AReducerConcept). -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/DOEbwlogo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/DOEbwlogo.pdf -------------------------------------------------------------------------------- /docs/source/usecases/VirtualFunctions-VTables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/usecases/VirtualFunctions-VTables.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::is_array_layout.md: -------------------------------------------------------------------------------- 1 | Boolean type trait to detect types that model the [Layout concept](Kokkos%3A%3ALayoutConcept). -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-node.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-node.pdf -------------------------------------------------------------------------------- /docs/source/usecases/VirtualFunctions-VPointers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/usecases/VirtualFunctions-VPointers.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::is_memory_space.md: -------------------------------------------------------------------------------- 1 | Boolean type trait to detect types that model [MemorySpace concept](Kokkos%3A%3AMemorySpaceConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::is_memory_traits.md: -------------------------------------------------------------------------------- 1 | Boolean type trait to detect specializations of [Kokkos::MemoryTraits](Kokkos%3A%3AMemoryTraits). -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | html: 2 | sphinx-build -b html ./source/ ./generated_docs/ 3 | python3 ./source/edit_button_handler.py 4 | 5 | clean: 6 | rm -rf ./generated_docs/ 7 | -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/task-dispatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/task-dispatch.png -------------------------------------------------------------------------------- /docs/source/usecases/VirtualFunctions-DeviceVTable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/usecases/VirtualFunctions-DeviceVTable.png -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-node-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-node-doc.png -------------------------------------------------------------------------------- /docs/source/usecases/VirtualFunctions-DeviceVPointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/usecases/VirtualFunctions-DeviceVPointer.png -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-abstractions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-abstractions.pdf -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-memory-space.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-memory-space.pdf -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/parallel-dispatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/parallel-dispatch.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Algorithms.md: -------------------------------------------------------------------------------- 1 | ### 1. **[[Sort|Sort-API]]** 2 | Kokkos View Sort Algorithms. 3 | ### 2. **[[Random|Random-API]]** 4 | Kokkos Random Number Generators. -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::is_execution_policy.md: -------------------------------------------------------------------------------- 1 | Boolean type trait to detect types that model [ExecutionPolicy concept](Kokkos%3A%3AExecutionPolicyConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/DOEbwlogo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/DOEbwlogo.pdf -------------------------------------------------------------------------------- /wiki-md-files-to-port/UseCases/VirtualFunctions-VTables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/UseCases/VirtualFunctions-VTables.png -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/StdSorting.rst: -------------------------------------------------------------------------------- 1 | 2 | Sorting 3 | ####### 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | ./all/StdIsSorted 9 | ./all/StdIsSortedUntil -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-node.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-node.pdf -------------------------------------------------------------------------------- /wiki-md-files-to-port/UseCases/VirtualFunctions-VPointers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/UseCases/VirtualFunctions-VPointers.png -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/SNL_Stacked_Black_Blue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/SNL_Stacked_Black_Blue.jpg -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-abstractions-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-abstractions-doc.png -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-execution-space.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-execution-space.pdf -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-memory-space-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-memory-space-doc.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/task-dispatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/task-dispatch.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/UseCases/VirtualFunctions-DeviceVTable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/UseCases/VirtualFunctions-DeviceVTable.png -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/figures/kokkos-execution-space-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/docs/source/ProgrammingGuide/figures/kokkos-execution-space-doc.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-node-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-node-doc.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/UseCases/VirtualFunctions-DeviceVPointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/UseCases/VirtualFunctions-DeviceVPointer.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-abstractions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-abstractions.pdf -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-memory-space.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-memory-space.pdf -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/parallel-dispatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/parallel-dispatch.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Python Virtual Environment 2 | /venv 3 | # PyCharm files 4 | /.idea 5 | # Rendered html files 6 | /html 7 | # Doc trees 8 | /doctrees 9 | # Generated docs 10 | /docs/generated_docs 11 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/SNL_Stacked_Black_Blue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/SNL_Stacked_Black_Blue.jpg -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-abstractions-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-abstractions-doc.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-execution-space.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-execution-space.pdf -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-memory-space-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-memory-space-doc.png -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-Algorithms.md: -------------------------------------------------------------------------------- 1 | ### 1. **[[Sort|Sorting]]** 2 | View Type Sort Operations. 3 | ### 2. **[[Random Numbers|Random-Number]]** 4 | Kokkos Random Number Generators and Samplers. -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-execution-space-doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NERSC/kokkos-core-wiki/main/wiki-md-files-to-port/ProgrammingGuide/figures/kokkos-execution-space-doc.png -------------------------------------------------------------------------------- /docs/source/API/core/Spaces.rst: -------------------------------------------------------------------------------- 1 | Spaces 2 | ====== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | ./execution_spaces 8 | ./spaces/partition_space 9 | ./memory_spaces 10 | ./SpaceAccessibility 11 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-Reference.md: -------------------------------------------------------------------------------- 1 | ## [Alphabetical](API-Alphabetical) 2 | 3 | ## [Core Library](API-Core) 4 | 5 | ## [Containers Library](API-Containers) 6 | 7 | ## [Algorithms Library](API-Algorithms) 8 | -------------------------------------------------------------------------------- /docs/source/API/algorithms-index.rst: -------------------------------------------------------------------------------- 1 | API: Algorithms 2 | ############### 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./algorithms/Random-Number 8 | ./algorithms/Sort 9 | ./algorithms/std-algorithms-index 10 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/StdMinMaxElement.rst: -------------------------------------------------------------------------------- 1 | Minimum/maximum 2 | ############### 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./all/StdMinElement 8 | ./all/StdMaxElement 9 | ./all/StdMinMaxElement 10 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/StdPartioningOps.rst: -------------------------------------------------------------------------------- 1 | 2 | Partitioning 3 | ############ 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | ./all/StdIsPartitioned 9 | ./all/StdPartitionPoint 10 | ./all/StdPartitionCopy -------------------------------------------------------------------------------- /docs/source/API/core/Utilities.rst: -------------------------------------------------------------------------------- 1 | Utilities 2 | ========= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./utilities/abort 8 | ./utilities/all 9 | ./utilities/complex 10 | ./utilities/timer 11 | ./utilities/experimental 12 | -------------------------------------------------------------------------------- /docs/source/API/core/utilities/abort.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::abort` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | KOKKOS_FUNCTION void abort(const char *const msg); 7 | ``` 8 | 9 | Causes abnormal program termination with error explanatory string being printed. 10 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::abort.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::abort` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | KOKKOS_FUNCTION void abort(const char *const msg); 7 | ``` 8 | 9 | Causes abnormal program termination with error explanatory string being printed. 10 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/StdNumeric.rst: -------------------------------------------------------------------------------- 1 | Numeric 2 | ####### 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./all/StdAdjacentDifference 8 | ./all/StdReduce 9 | ./all/StdExclusiveScan 10 | ./all/StdInclusiveScan 11 | ./all/StdTransformReduce 12 | ./all/StdTransformExclusiveScan 13 | ./all/StdTransformInclusiveScan 14 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-Utilities.md: -------------------------------------------------------------------------------- 1 | |Utility |Description | 2 | |:---------|:----------------------------| 3 | |[Timer](Kokkos%3A%3ATimer) | A basic timer returning seconds | 4 | |[Complex](Kokkos%3A%3AComplex) | Complex numbers which work on host and device | 5 | |[abort](Kokkos%3A%3Aabort) | Causes abnormal program termination | 6 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/ContentContainers.md: -------------------------------------------------------------------------------- 1 | 1. **[Bitset](Kokkos%3A%3ABitset)** 2 | 2. **[Dual View](Kokkos%3A%3ADualView)** 3 | 3. **[Dynamic Rank View](Kokkos%3A%3ADynRankView)** 4 | 4. **[Dynamic Length View](Kokkos%3A%3ADynamicView)** 5 | 5. **[Offset View](Offset-View)** 6 | 6. **[Unordered Map](Unordered-Map)** 7 | 7. **[vector](Kokkos%3A%3Avector)** 8 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::Cuda.md: -------------------------------------------------------------------------------- 1 | 2 | `Kokkos::Cuda` is an [`ExecutionSpace` type](ExecutionSpaceConcept) representing execution on a Cuda device. Except in rare instances, it should not be used directly, but instead should be used generically as an execution space. For details, see [the documentation on the `ExecutionSpace` concept](ExecutionSpaceConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::CudaSpace.md: -------------------------------------------------------------------------------- 1 | 2 | `Kokkos::CudaSpace` is a [`MemorySpace` type](MemorySpaceConcept) representing device memory on a Cuda-capable GPU. Except in rare instances, it should not be used directly, but instead should be used generically as an memory space. For details, see [the documentation on the `MemorySpace` concept](MemorySpaceConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::Serial.md: -------------------------------------------------------------------------------- 1 | 2 | `Kokkos::Serial` is an [`ExecutionSpace` type](ExecutionSpaceConcept) representing serial execution the CPU. Except in rare instances, it should not be used directly, but instead should be used generically as an execution space. For details, see [the documentation on the `ExecutionSpace` concept](ExecutionSpaceConcept). -------------------------------------------------------------------------------- /docs/source/API/core/atomics.rst: -------------------------------------------------------------------------------- 1 | Atomics 2 | ======= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./atomics/atomic_compare_exchange 8 | ./atomics/atomic_compare_exchange_strong 9 | ./atomics/atomic_exchange 10 | ./atomics/atomic_fetch_op 11 | ./atomics/atomic_load 12 | ./atomics/atomic_op 13 | ./atomics/atomic_op_fetch 14 | ./atomics/atomic_store 15 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::HPX.md: -------------------------------------------------------------------------------- 1 | 2 | `Kokkos::HPX` is an [`ExecutionSpace` type](ExecutionSpaceConcept) representing execution with the HPX runtime system. Except in rare instances, it should not be used directly, but instead should be used generically as an execution space. For details, see [the documentation on the `ExecutionSpace` concept](ExecutionSpaceConcept). 3 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::OpenMP.md: -------------------------------------------------------------------------------- 1 | 2 | `Kokkos::OpenMP` is an [`ExecutionSpace` type](ExecutionSpaceConcept) representing execution with the OpenMP runtime system. Except in rare instances, it should not be used directly, but instead should be used generically as an execution space. For details, see [the documentation on the `ExecutionSpace` concept](ExecutionSpaceConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::HostSpace.md: -------------------------------------------------------------------------------- 1 | `Kokkos::HostSpace` is a [`MemorySpace` type](MemorySpaceConcept) representing traditional random access memory accessible from the CPU. Except in rare instances, it should not be used directly, but instead should be used generically as an memory space. For details, see [the documentation on the `MemorySpace` concept](MemorySpaceConcept). 2 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms-index.rst: -------------------------------------------------------------------------------- 1 | Std Algorithms 2 | ############## 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./std-algorithms/Iterators 8 | ./std-algorithms/StdMinMaxElement 9 | ./std-algorithms/StdModSeq 10 | ./std-algorithms/StdNonModSeq 11 | ./std-algorithms/StdNumeric 12 | ./std-algorithms/StdPartioningOps 13 | ./std-algorithms/StdSorting 14 | -------------------------------------------------------------------------------- /docs/source/testing-and-issue-tracking.rst: -------------------------------------------------------------------------------- 1 | Testing and Issue Tracking 2 | ########################## 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./testing-and-issue-tracking/Requirements-Issues-and-Feedback 8 | ./testing-and-issue-tracking/Testing-Process-Details 9 | ./testing-and-issue-tracking/Testing-Processes 10 | ./testing-and-issue-tracking/Testing-Workflow-Components 11 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::OpenMPTarget.md: -------------------------------------------------------------------------------- 1 | 2 | `Kokkos::OpenMPTarget` is an [`ExecutionSpace` type](ExecutionSpaceConcept) representing execution using the target offloading feature of the OpenMP runtime system. Except in rare instances, it should not be used directly, but instead should be used generically as an execution space. For details, see [the documentation on the `ExecutionSpace` concept](ExecutionSpaceConcept). -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::CudaUVMSpace.md: -------------------------------------------------------------------------------- 1 | `Kokkos::CudaUVMSpace` is a [`MemorySpace` type](MemorySpaceConcept) representing unified virtual memory on a Cuda-capable GPU system. Unified virtual memory is also accessible from most host execution spaces. Except in rare instances, it should not be used directly, but instead should be used generically as an memory space. For details, see [the documentation on the `MemorySpace` concept](MemorySpaceConcept). -------------------------------------------------------------------------------- /docs/source/usecases.rst: -------------------------------------------------------------------------------- 1 | Use Cases and Examples 2 | ###################### 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./usecases/MPI-Halo-Exchange 8 | ./usecases/Average-To-Nodes 9 | ./usecases/MDRangePolicy 10 | ./usecases/VirtualFunctions 11 | ./usecases/TaggedOperators 12 | ./usecases/OverlappingHostAndDeviceWork 13 | ./usecases/Tasking 14 | ./usecases/Kokkos-Fortran-Interoperability 15 | ./usecases/SoA-and-AoSoA-with-Cabana 16 | -------------------------------------------------------------------------------- /docs/source/API/core/utilities/experimental.md: -------------------------------------------------------------------------------- 1 | (ExperimentalNamespace)= 2 | # `Kokkos::Experimental` 3 | 4 | Defined in header `` 5 | 6 | ```c++ 7 | namespace Kokkos { 8 | namespace Experimental { 9 | ... 10 | } 11 | } 12 | ``` 13 | 14 | Namespace inside main `Kokkos` namespace that contains features that are not yet part of the public API. Anything contained might be subject to any change, removal, or extension without anouncement. No guarantees are given. 15 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/A-Guide-to-Kokkos-Testing-Processes.md: -------------------------------------------------------------------------------- 1 | The Guide to Kokkos Testing Processes is a description of the components of a team-based testing workflow. It touches on the many components of the workflow and provides copious details for the multiple and wide-ranging set of Kokkos test activities. 2 | 3 | 1. **[[Testing Processes|Testing Processes]]** 4 | 2. **[[Testing Workflow Components|Testing Workflow Components]]** 5 | 3. **[[Testing Process Details|Testing Process Details]]** -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::CudaHostPinnedSpace.md: -------------------------------------------------------------------------------- 1 | `Kokkos::CudaHostPinnedSpace` is a [`MemorySpace` type](MemorySpaceConcept) representing host-side pinned memory on a accessible from a Cuda-capable GPU. This memory is typically accessible by both host and device execution spaces. Except in rare instances, it should not be used directly, but instead should be used generically as an memory space. For details, see [the documentation on the `MemorySpace` concept](MemorySpaceConcept). -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kokkos-core-documentation-website 2 | Welcome to the Kokkos Documentation repository. This is the source for https://kokkos.github.io/kokkos-core-wiki/. 3 | 4 | ## Requirements to build html page locally 5 | 6 | This is needed just for local render of documentation, so it can be checked before push. 7 | Requirements are in `build_requirements.txt` 8 | Could be installed with: `pip install -r build_requirements.txt` 9 | 10 | ## Build 11 | 12 | ``` 13 | cd docs 14 | make html 15 | ``` 16 | 17 | To clean: 18 | ``` 19 | cd docs 20 | make clean 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/source/API/core/utilities/all.md: -------------------------------------------------------------------------------- 1 | (KokkosALL)= 2 | # `Kokkos::ALL` 3 | 4 | Defined in header `` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | constexpr UNSPECIFIED-TYPE ALL = IMPLEMENTATION-DETAIL; 9 | } 10 | ``` 11 | 12 | `Kokkos::ALL` is a constant of unspecified type that is used to select all elements in a dimension. 13 | 14 | 15 | ## Examples 16 | 17 | ```c++ 18 | Kokkos::View a("A",N0,N1); 19 | 20 | auto s = Kokkos::subview(a, 21 | 5, 22 | Kokkos::ALL, 23 | Kokkos::ALL); 24 | ``` 25 | -------------------------------------------------------------------------------- /docs/source/API/core/c_style_memory_management.rst: -------------------------------------------------------------------------------- 1 | C-style memory management 2 | ========================= 3 | 4 | Functions 5 | --------- 6 | Defined in ```` 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | ./c_style_memory_management/malloc 12 | 13 | allocates memory 14 | 15 | .. toctree:: 16 | :maxdepth: 1 17 | 18 | ./c_style_memory_management/realloc 19 | 20 | expands or shrinks previously allocated memory block 21 | 22 | .. toctree:: 23 | :maxdepth: 1 24 | 25 | ./c_style_memory_management/free 26 | 27 | deallocates previously allocated memory 28 | -------------------------------------------------------------------------------- /docs/source/API/core/atomics/atomic_load.md: -------------------------------------------------------------------------------- 1 | # `atomic_load` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | value = atomic_load(ptr_to_value); 8 | ``` 9 | 10 | Atomically reads the value at the address given by `ptr_to_value`. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | T atomic_load(T* const ptr_to_value); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | T atomic_load(T* const ptr_to_value); 24 | ``` 25 | 26 | Atomically executes `value = *ptr_to_value; return value;`. 27 | * `ptr_to_value`: address of the to be updated value. 28 | * `value`: value at address `ptr_to_value`. 29 | -------------------------------------------------------------------------------- /docs/source/API/core/STL-Compatibility.rst: -------------------------------------------------------------------------------- 1 | STL Compatibility Issues 2 | ======================== 3 | 4 | Kokkos developers strive to implement the Kokkos macros in a manner compatible with the latest versions of the 5 | C++ language and with the C++ Standard Library (STL). However deviations from this approach occur when necessary, 6 | as is the case for the following STL classes ``(std::*)``. The STL class does not work properly on GPUs so parallel Kokkos 7 | classes have been developed. This section documents the specific deviations and provides usage guidance for developers. 8 | Select the links below to see the details. 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | 13 | ./stl-compat/pair 14 | -------------------------------------------------------------------------------- /docs/source/programmingguide.rst: -------------------------------------------------------------------------------- 1 | Programming Guide 2 | ################# 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | ./ProgrammingGuide/Introduction 8 | ./ProgrammingGuide/Machine-Model 9 | ./ProgrammingGuide/ProgrammingModel 10 | ./ProgrammingGuide/Compiling 11 | ./ProgrammingGuide/Initialization 12 | ./ProgrammingGuide/View 13 | ./ProgrammingGuide/ParallelDispatch 14 | ./ProgrammingGuide/HierarchicalParallelism 15 | ./ProgrammingGuide/Custom-Reductions 16 | ./ProgrammingGuide/Atomic-Operations 17 | ./ProgrammingGuide/Subviews 18 | ./ProgrammingGuide/Compatibility 19 | ./ProgrammingGuide/Interoperability 20 | ./ProgrammingGuide/Kokkos-and-Virtual-Functions 21 | -------------------------------------------------------------------------------- /docs/source/API/core/atomics/atomic_store.md: -------------------------------------------------------------------------------- 1 | # `atomic_store` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | atomic_store(ptr_to_value,new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value`. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | void atomic_store(T* const ptr_to_value, const T new_value); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | void atomic_store(T* const ptr_to_value, const T new_value); 24 | ``` 25 | 26 | Atomically executes `*ptr_to_value = new_value;`. 27 | * `ptr_to_value`: address of the to be updated value. 28 | * `new_value`: new value. 29 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::atomic_load.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::atomic_load` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | value = atomic_load(ptr_to_value); 8 | ``` 9 | 10 | Atomically reads the value at the address given by `ptr_to_value`. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | T atomic_load(T* const ptr_to_value); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | T atomic_load(T* const ptr_to_value); 24 | ``` 25 | 26 | Atomically executes `value = *ptr_to_value; return value;`. 27 | * `ptr_to_value`: address of the to be updated value. 28 | * `value`: value at address `ptr_to_value`. 29 | 30 | 31 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/The-Kokkos-Programming-Guide.md: -------------------------------------------------------------------------------- 1 | The Kokkos Programming Guide consists of three separate documents describing 2 | 3 | * [[The Core Library|Programming Guide: Core]] 4 | * [[The Containers Library|ContentContainers]] 5 | * [[The Algorithms Library|ContentAlgorihtms]] 6 | 7 | 8 | --- 9 | 10 | ### Acknowledgements 11 | 12 | Sandia National Laboratories report **SAND2017-11710 W** 13 | _Sandia National Laboratories is a multi-mission laboratory managed and operated by National Technology and Engineering Solutions of Sandia, LLC., a wholly owned subsidiary of Honeywell International, Inc., for the U.S. Department of Energy's National Nuclear Security Administration under contract DE-NA0003525._ 14 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::atomic_store.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::atomic_store` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | atomic_store(ptr_to_value,new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value`. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | void atomic_store(T* const ptr_to_value, const T new_value); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | void atomic_store(T* const ptr_to_value, const T new_value); 24 | ``` 25 | 26 | Atomically executes `*ptr_to_value = new_value;`. 27 | * `ptr_to_value`: address of the to be updated value. 28 | * `new_value`: new value. 29 | 30 | 31 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::ParallelForTag.md: -------------------------------------------------------------------------------- 1 | # Kokkos::ParallelForTag 2 | 3 | Header File: `Kokkos_ExecPolicy.hpp` 4 | 5 | A tag used in team size calculation functions to indicate that the functor for which a team size is being requested is being used in a `parallel_for` 6 | 7 | Usage: 8 | ```c++ 9 | using PolicyType = Kokkos::TeamPolicy<>; 10 | PolicyType policy; 11 | int recommended_team_size = policy.team_size_recommended( 12 | Functor, Kokkos::ParallelForTag()); 13 | ``` 14 | 15 | ## Synopsis 16 | ```c++ 17 | struct ParallelForTag{}; 18 | ``` 19 | 20 | ## Public Class Members 21 | 22 | None 23 | 24 | ### Typedefs 25 | 26 | None 27 | 28 | ### Constructors 29 | 30 | Default 31 | 32 | ### Functions 33 | 34 | None 35 | -------------------------------------------------------------------------------- /docs/source/API/core/builtinreducers/ReductionScalarTypes.rst: -------------------------------------------------------------------------------- 1 | Reduction Scalar Types 2 | ###################### 3 | 4 | .. list-table:: 5 | :widths: 25 75 6 | :header-rows: 1 7 | 8 | * - Class 9 | - Description 10 | * - `MinMaxLocScalar `__ 11 | - Template class for storing the min and max values with indices for min/max location reducers. 12 | * - `MinMaxScalar `__ 13 | - Template class for storing the min and max values for min/max reducers. 14 | * - `ValLocScalar `__ 15 | - Template class for storing a value plus index for min/max location reducers. 16 | 17 | .. toctree:: 18 | :hidden: 19 | :maxdepth: 1 20 | 21 | MinMaxLocScalar 22 | MinMaxScalar 23 | ValLocScalar 24 | -------------------------------------------------------------------------------- /docs/source/contributing.rst: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | We are open and try to encourage contributions from external developers. 5 | To do so please first open an issue describing the contribution and then 6 | issue a pull request against the develop branch. 7 | For larger features it may be good to get guidance from 8 | the core development team first through the github issue. 9 | 10 | Note that Kokkos Core is licensed under standard 3-clause BSD terms of use. 11 | Which means contributing to Kokkos allows anyone else to use your contributions 12 | not just for public purposes but also for closed source commercial projects. 13 | For specifics see the `LICENSE `__. 14 | 15 | Open an issue/feature req. `ISSUES `_ 16 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::ParallelScanTag.md: -------------------------------------------------------------------------------- 1 | # Kokkos::ParallelScanTag 2 | 3 | Header File: `Kokkos_ExecPolicy.hpp` 4 | 5 | A tag used in team size calculation functions to indicate that the functor for which a team size is being requested is being used in a `parallel_scan` 6 | 7 | Usage: 8 | ```c++ 9 | using PolicyType = Kokkos::TeamPolicy<>; 10 | PolicyType policy; 11 | int recommended_team_size = policy.team_size_recommended( 12 | Functor, Kokkos::ParallelScanTag()); 13 | ``` 14 | 15 | ## Synopsis 16 | ```c++ 17 | struct ParallelScanTag{}; 18 | ``` 19 | 20 | ## Public Class Members 21 | 22 | None 23 | 24 | ### Typedefs 25 | 26 | None 27 | 28 | ### Constructors 29 | 30 | Default 31 | 32 | ### Functions 33 | 34 | None 35 | -------------------------------------------------------------------------------- /docs/source/API/core/parallel-dispatch/ParallelForTag.md: -------------------------------------------------------------------------------- 1 | # `ParallelForTag()` 2 | 3 | Header File: `Kokkos_ExecPolicy.hpp` 4 | 5 | A tag used in team size calculation functions to indicate that the functor for which a team size is being requested is being used in a [`parallel_for`](../parallel-dispatch/parallel_for) 6 | 7 | Usage: 8 | ```c++ 9 | using PolicyType = Kokkos::TeamPolicy<>; 10 | PolicyType policy; 11 | int recommended_team_size = policy.team_size_recommended( 12 | Functor, Kokkos::ParallelForTag()); 13 | ``` 14 | 15 | ## Synopsis 16 | ```c++ 17 | struct ParallelForTag{}; 18 | ``` 19 | 20 | ## Public Class Members 21 | 22 | None 23 | 24 | ### Typedefs 25 | 26 | None 27 | 28 | ### Constructors 29 | 30 | Default 31 | 32 | ### Functions 33 | 34 | None 35 | -------------------------------------------------------------------------------- /docs/source/API/core/parallel-dispatch/ParallelScanTag.md: -------------------------------------------------------------------------------- 1 | # `ParallelScanTag()` 2 | 3 | Header File: `Kokkos_ExecPolicy.hpp` 4 | 5 | A tag used in team size calculation functions to indicate that the functor for which a team size is being requested is being used in a [`parallel_scan`](../parallel-dispatch/parallel_scan) 6 | 7 | Usage: 8 | ```c++ 9 | using PolicyType = Kokkos::TeamPolicy<>; 10 | PolicyType policy; 11 | int recommended_team_size = policy.team_size_recommended( 12 | Functor, Kokkos::ParallelScanTag()); 13 | ``` 14 | 15 | ## Synopsis 16 | ```c++ 17 | struct ParallelScanTag{}; 18 | ``` 19 | 20 | ## Public Class Members 21 | 22 | None 23 | 24 | ### Typedefs 25 | 26 | None 27 | 28 | ### Constructors 29 | 30 | Default 31 | 32 | ### Functions 33 | 34 | None 35 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::ParallelReduceTag.md: -------------------------------------------------------------------------------- 1 | # Kokkos::ParallelReduceTag 2 | 3 | Header File: `Kokkos_ExecPolicy.hpp` 4 | 5 | A tag used in team size calculation functions to indicate that the functor for which a team size is being requested is being used in a `parallel_reduce` 6 | 7 | Usage: 8 | ```c++ 9 | using PolicyType = Kokkos::TeamPolicy<>; 10 | PolicyType policy; 11 | int recommended_team_size = policy.team_size_recommended( 12 | Functor, Kokkos::ParallelReduceTag()); 13 | ``` 14 | 15 | ## Synopsis 16 | ```c++ 17 | struct ParallelReduceTag{}; 18 | ``` 19 | 20 | ## Public Class Members 21 | 22 | None 23 | 24 | ### Typedefs 25 | 26 | None 27 | 28 | ### Constructors 29 | 30 | Default 31 | 32 | ### Functions 33 | 34 | None 35 | -------------------------------------------------------------------------------- /docs/source/API/containers/StaticCrsGraph.md: -------------------------------------------------------------------------------- 1 | # `StaticCrsGraph` 2 | 3 | The StaticCrsGraph is a Compressed row storage array with the row map, the column indices and the non-zero entries stored in 3 different Kokkos::Views. Appropriate types and functions are provided to simplify manipulation and access to CRS data on either a host or device. 4 | 5 | Usage: 6 | 7 | ```C++ 8 | using StaticCrsGraphType = Kokkos::StaticCrsGraph; 9 | StaticCrsGraphType graph(); 10 | 11 | const int begin = graph.row_map[0]; 12 | const int end = graph.row_map[1]; 13 | 14 | double sum = 0; 15 | for (int i = begin; i < end; i++) { 16 | Kokkos::View v(graph.entries(i)); 17 | for (int j = 0; j < v.extent(0); j++) { 18 | sum += v(j); 19 | } 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/source/API/core/parallel-dispatch/ParallelReduceTag.md: -------------------------------------------------------------------------------- 1 | # `ParallelReduceTag()` 2 | 3 | Header File: `Kokkos_ExecPolicy.hpp` 4 | 5 | A tag used in team size calculation functions to indicate that the functor for which a team size is being requested is being used in a [`parallel_reduce`](../parallel-dispatch/parallel_reduce) 6 | 7 | Usage: 8 | ```c++ 9 | using PolicyType = Kokkos::TeamPolicy<>; 10 | PolicyType policy; 11 | int recommended_team_size = policy.team_size_recommended( 12 | Functor, Kokkos::ParallelReduceTag()); 13 | ``` 14 | 15 | ## Synopsis 16 | ```c++ 17 | struct ParallelReduceTag{}; 18 | ``` 19 | 20 | ## Public Class Members 21 | 22 | None 23 | 24 | ### Typedefs 25 | 26 | None 27 | 28 | ### Constructors 29 | 30 | Default 31 | 32 | ### Functions 33 | 34 | None 35 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ViewLike.md: -------------------------------------------------------------------------------- 1 | View-like Types 2 | =============== 3 | 4 | View-like types are loosely defined as the set of class templates that behave like [Kokkos::View](Kokkos%3A%3AView) from an interface perspective. There is not a full formal definition of what this means yet, which means there is no way for users to add to this list in a way that the new class is recognized by Kokkos facilities operating on View-like things. In Kokkos these class templates are considered View-like: 5 | * [Kokkos::View](Kokkos%3A%3AView) 6 | * [Kokkos::DynRankView](Kokkos%3A%3ADynRankView) 7 | * [Kokkos::OffsetView](Kokkos%3A%3AOffsetView) 8 | * [Kokkos::DynamicView](Kokkos%3A%3ADynamicView) 9 | 10 | Notably, [Kokkos::DualView](Kokkos%3A%3ADualView) and [Kokkos::ScatterView](Kokkos%3A%3AScatterView) are **not** included in this category. -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::StaticCrsGraph.md: -------------------------------------------------------------------------------- 1 | # Kokkos::StaticCrsGraph 2 | 3 | The StaticCrsGraph is a Compressed row storage array with the row map, the column indices and the non-zero entries stored in 3 different Kokkos::Views. Appropriate types and functions are provided to simplify manipulation and access to CRS data on either a host or device. 4 | 5 | Usage: 6 | 7 | ```C++ 8 | using StaticCrsGraphType = Kokkos::StaticCrsGraph; 9 | StaticCrsGraphType graph(); 10 | 11 | const int begin = graph.row_map[0]; 12 | const int end = graph.row_map[1]; 13 | 14 | double sum = 0; 15 | for (int i = begin; i < end; i++) { 16 | Kokkos::View v(graph.entries(i)); 17 | for (int j = 0; j < v.extent(0); j++) { 18 | sum += v(j); 19 | } 20 | } 21 | 22 | ``` -------------------------------------------------------------------------------- /wiki-md-files-to-port/Views.md: -------------------------------------------------------------------------------- 1 | |View |Description | 2 | |:---------|:----------------------------| 3 | |[CreateMirror](Kokkos%3A%3ARangePolicy) | Each iterate is an integer in a contiguous range | 4 | |[DeepCopy](Kokkos%3A%3AMDRangePolicy) | Each iterate for each rank is an integer in a contiguous range | 5 | |[DualView](Kokkos%3A%3ATeamPolicy) | Assigns to each iterate in a contiguous range a team of threads | 6 | |[DynRankView](Kokkos%3A%3ADynRankView) | A potentially reference counted multi-dimensional array with dynamically determined rank | 7 | |[Layout](Kokkos%3A%3ANestedPolicies) | Used inside of a TeamPolicy kernel to perform nested parallel loops | 8 | |[Subview](Kokkos%3A%3ARangePolicy) | Each iterate is an integer in a contiguous range | 9 | |[View](Kokkos%3A%3AView) | Each iterate for each rank is an integer in a contiguous range | 10 | 11 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/StdModSeq.rst: -------------------------------------------------------------------------------- 1 | 2 | Modifying Sequence 3 | ################## 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | ./all/StdCopy 9 | ./all/StdCopyIf 10 | ./all/StdCopy_n 11 | ./all/StdCopyBackward 12 | ./all/StdMove 13 | ./all/StdMoveBackward 14 | ./all/StdFill 15 | ./all/StdFill_n 16 | ./all/StdTransform 17 | ./all/StdGenerate 18 | ./all/StdGenerate_n 19 | ./all/StdRemove 20 | ./all/StdRemoveIf 21 | ./all/StdRemoveCopy 22 | ./all/StdRemoveCopyIf 23 | ./all/StdReplace 24 | ./all/StdReplaceIf 25 | ./all/StdReplaceCopy 26 | ./all/StdReplaceCopyIf 27 | ./all/StdSwapRanges 28 | ./all/StdReverse 29 | ./all/StdReverseCopy 30 | ./all/StdRotate 31 | ./all/StdRotateCopy 32 | ./all/StdShiftLeft 33 | ./all/StdShiftRight 34 | ./all/StdUnique 35 | ./all/StdUniqueCopy 36 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Numerics.md: -------------------------------------------------------------------------------- 1 | # Numerics 2 | 3 | **[Common mathematical functions](Mathematical-Functions)** 4 | The header `` provides a consistent and 5 | portable overload set for standard C library mathematical functions, such as 6 | `fabs`, `sqrt`, and `sin`. 7 | 8 | **Mathematical special functions** 9 | Work in progress 10 | 11 | **[Mathematical constants](Mathematical-Constants)** 12 | The header `` is a backport of the C++20 13 | standard library header `` and provides several mathematical 14 | constants, such as `pi` or `sqrt2`. 15 | 16 | **[Numeric traits](Numeric-Traits)** 17 | The header `` implements a new facility that 18 | is being added to the C++23 standard library and is intended as a 19 | replacement for `std::numeric_limits`. 20 | -------------------------------------------------------------------------------- /docs/source/API/core/Traits.md: -------------------------------------------------------------------------------- 1 | # Traits 2 | 3 | (is_array_layout)= 4 | ## is_array_layout 5 | 6 | Boolean type trait to detect types that model the Layout concept. 7 | 8 | (is_execution_policy)= 9 | ## is_execution_policy 10 | 11 | Boolean type trait to detect types that model [ExecutionPolicy concept](policies/ExecutionPolicyConcept). 12 | 13 | (is_memory_space)= 14 | ## is_memory_space 15 | 16 | Boolean type trait to detect types that model [MemorySpace concept](MemorySpaceConcept). 17 | 18 | (is_memory_traits)= 19 | ## is_memory_traits 20 | 21 | Boolean type trait to detect specializations of `Kokkos::MemoryTraits`. 22 | 23 | (is_reducer)= 24 | ## is_reducer 25 | 26 | Boolean type trait to detect types that model the [Reducer concept](builtinreducers/ReducerConcept). 27 | 28 | (is_space)= 29 | ## is_space 30 | 31 | Boolean type trait to detect types that model the Space concept. 32 | -------------------------------------------------------------------------------- /docs/source/API/core/view/view_like.rst: -------------------------------------------------------------------------------- 1 | View-like Types 2 | =============== 3 | 4 | View-like types are loosely defined as the set of class templates that behave like `Kokkos::View `__ from an interface perspective. There is not a full formal definition of what this means yet, which means there is no way for users to add to this list in a way that the new class is recognized by Kokkos facilities operating on View-like things. In Kokkos these class templates are considered View-like: 5 | 6 | * `Kokkos::View `_ 7 | * `Kokkos::DynRankView <../../containers/DynRankView.html>`_ 8 | * `Kokkos::OffsetView <../../containers/Offset-View.html>`_ 9 | * `Kokkos::DynamicView <../../containers/DynamicView.html>`_ 10 | 11 | Notably, `Kokkos::DualView <../../containers/DualView.html>`_ and `Kokkos::ScatterView <../../containers/ScatterView.html>`_ are **not** included in this category. 12 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/STL-Compatibility.md: -------------------------------------------------------------------------------- 1 | ## STL Compatibility Issues 2 | 3 | Kokkos developers strive to implement the Kokkos macros in a manner compatible with the latest versions of the C++ language and with the C++ Standard Library (STL). However deviations from this approach occur when necessary, as is the case for the following STL classes (std::*). The STL class does not work properly on GPUs so parallel Kokkos classes have been developed. This section documents the specific deviations and provides usage guidance for developers. Select the links below to see the details. 4 | 5 | ---------- 6 | 7 | |Type |Description | 8 | |:-----|:----------------------------| 9 | |[Kokkos::Array](Kokkos%3A%3AArray) | Kokkos::Array Usage | 10 | |[Kokkos::Complex](Kokkos%3A%3AComplex) | Kokkos::Complex Usage | 11 | |[Kokkos::pair](Kokkos%3A%3Apair) | Kokkos::pair Usage | 12 | -------------------------------------------------------------------------------- /docs/source/API/core/atomics/atomic_exchange.md: -------------------------------------------------------------------------------- 1 | # `atomic_exchange` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | old_val = atomic_exchange(ptr_to_value,new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value` and returns the previously stored value at the address. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | T atomic_exchange(T* const ptr_to_value, const T new_value); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | T atomic_exchange(T* const ptr_to_value, const T new_value); 24 | ``` 25 | 26 | Atomically executes `old_value = *ptr_to_value; *ptr_to_value = new_value; return old_value;`. 27 | * `ptr_to_value`: address of the to be updated value. 28 | * `new_value`: new value. 29 | * `old_value`: value at address `ptr_to_value` before doing the exchange. 30 | -------------------------------------------------------------------------------- /docs/source/API/core/Numerics.rst: -------------------------------------------------------------------------------- 1 | Numerics 2 | ========= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | numerics/mathematical-constants.md 8 | 9 | The header ```` is a backport of the C++20 standard library header ```` and 10 | provides several mathematical constants, such as ``pi`` or ``sqrt2``. 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | numerics/mathematical-functions.md 16 | 17 | The header ```` provides a consistent and portable overload set for standard C 18 | library mathematical functions, such as ``fabs``, ``sqrt``, and ``sin``. 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | 23 | numerics/numeric-traits.md 24 | 25 | The header ```` implements a new facility that is being added to the C++23 standard library and 26 | is intended as a replacement for ``std::numeric_limits``. 27 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-Containers.md: -------------------------------------------------------------------------------- 1 | ### 1. **[Bitset](Kokkos%3A%3ABitset)** 2 | A concurrent Bitset class. 3 | ### 2. **[DualView](Kokkos%3A%3ADualView)** 4 | Container to manage access to mirrored views in different memory spaces 5 | ### 3. **[[DynamicView|dynamicView-path]]** 6 | DynamicView comment. 7 | ### 4. **[[DynRankView|Kokkos::DynRankView]]** 8 | Kokkos Runtime-determined-dimension DynRankView class. 9 | ### 5. **[[Functional|functional-path]]** 10 | Functional comment. 11 | ### 6. **[[OffsetView|offsetview-path]]** 12 | OffsetView comment. 13 | ### 7. **[[ScatterView|scatterview-path]]** 14 | ScatterView comment. 15 | ### 8. **[[StaticCrsGraph|graph-path]]** 16 | StaticCrsGraph comment. 17 | ### 9. **[[UnorderedMap|Unordered-Map]]** 18 | UnorderedMap comment. 19 | ### 10. **[vector](Kokkos%3A%3Avector)** 20 | std::vector compatible implementation that works with non-host memory spaces. 21 | -------------------------------------------------------------------------------- /docs/source/API/core/builtinreducers/ValLocScalar.md: -------------------------------------------------------------------------------- 1 | # `ValLocScalar` 2 | 3 | Template class for storing a value plus index for min/max location reducers. Should be accessed via `::value_type` defined for particular reducer. 4 | 5 | Header File: `Kokkos_Core.hpp` 6 | 7 | Usage: 8 | ```c++ 9 | MaxLoc::value_type result; 10 | parallel_reduce(N,Functor,MaxLoc(result)); 11 | T resultValue = result.val; 12 | I resultIndex = result.loc; 13 | ``` 14 | 15 | ## Synopsis 16 | 17 | ```c++ 18 | template 19 | struct ValLocScalar{ 20 | Scalar val; 21 | Index loc; 22 | 23 | void operator = (const ValLocScalar& rhs); 24 | }; 25 | ``` 26 | 27 | ## Public Members 28 | 29 | ### Variables 30 | 31 | * `val`: Scalar Value. 32 | * `loc`: Scalar index. 33 | 34 | ### Assignment operators 35 | 36 | * `void operator = (const ValLocScalar& rhs);` 37 | assign `val` and `loc` from `rhs`; 38 | -------------------------------------------------------------------------------- /docs/source/API/core/builtinreducers/MinMaxScalar.md: -------------------------------------------------------------------------------- 1 | # `MinMaxScalar` 2 | 3 | Template class for storing the min and max values for min/max reducers. Should be accessed via `::value_type` defined for particular reducer. 4 | 5 | Header File: `Kokkos_Core.hpp` 6 | 7 | Usage: 8 | ```c++ 9 | MinMax::value_type result; 10 | parallel_reduce(N,Functor,MinMax(result)); 11 | T minValue = result.min_val; 12 | T maxValue = result.max_val; 13 | ``` 14 | 15 | ## Synopsis 16 | 17 | ```c++ 18 | template 19 | struct MinMaxScalar{ 20 | Scalar min_val; 21 | Scalar max_val; 22 | 23 | void operator = (const MinMaxScalar& rhs); 24 | }; 25 | ``` 26 | 27 | ## Public Members 28 | 29 | ### Variables 30 | 31 | * `min_val`: Scalar minimum Value. 32 | * `max_val`: Scalar maximum Value. 33 | 34 | ### Assignment operators 35 | 36 | * `void operator = (const MinMaxScalar& rhs);` 37 | assign `min_val` and `max_val` from `rhs`; 38 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::atomic_exchange.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::atomic_exchange` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | old_val = atomic_exchange(ptr_to_value,new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value` and returns the previously stored value at the address. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | T atomic_exchange(T* const ptr_to_value, const T new_value); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | T atomic_exchange(T* const ptr_to_value, const T new_value); 24 | ``` 25 | 26 | Atomically executes `old_value = *ptr_to_value; *ptr_to_value = new_value; return old_value;`. 27 | * `ptr_to_value`: address of the to be updated value. 28 | * `new_value`: new value. 29 | * `old_value`: value at address `ptr_to_value` before doing the exchange. 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/source/API/core/c_style_memory_management/free.md: -------------------------------------------------------------------------------- 1 | # `kokkos_free` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | template 7 | void kokkos_free(void* ptr); 8 | ``` 9 | 10 | Deallocates the space previously allocated by [`Kokkos::kokkos_malloc()`](./malloc) or [`Kokkos::kokkos_realloc()`](./realloc) on the specified memory space `MemorySpace`. 11 | 12 | If `ptr` is a null pointer, the function does nothing. 13 | 14 | ## Parameters 15 | 16 | `ptr`: The pointer to the memory to deallocate on the specified memory space. 17 | 18 | ## Template parameters 19 | 20 | * `MemorySpace`: Controls the storage location. If omitted the memory space of the default execution space is used (i.e. `Kokkos::DefaultExecutionSpace::memory_space`). 21 | 22 | ## Return value 23 | 24 | (none) 25 | ## Exceptions 26 | 27 | Throws `std::runtime_error` on failure to deallocate. 28 | 29 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::kokkos_free.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::kokkos_free` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | template 7 | void kokkos_free(void* ptr); 8 | ``` 9 | 10 | Deallocates the space previously allocated by [`Kokkos::kokkos_malloc()`](Kokkos%3A%3Akokkos_malloc) or [`Kokkos::kokkos_realloc()`](Kokkos%3A%3Akokkos_realloc) on the specified memory space `MemorySpace`. 11 | 12 | If `ptr` is a null pointer, the function does nothing. 13 | 14 | ## Parameters 15 | 16 | `ptr`: The pointer to the memory to deallocate on the specified memory space. 17 | 18 | ## Template parameters 19 | 20 | * `MemorySpace`: Controls the storage location. If omitted the memory space of the default execution space is used (i.e. `Kokkos::DefaultExecutionSpace::memory_space`). 21 | 22 | ## Return value 23 | 24 | (none) 25 | ## Exceptions 26 | 27 | Throws `std::runtime_error` on failure to deallocate. 28 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/Sort.md: -------------------------------------------------------------------------------- 1 | 2 | # Sort 3 | 4 | template< class DstViewType , class SrcViewType > 5 | struct copy_functor { } 6 | 7 | template< class DstViewType, class PermuteViewType, class SrcViewType> 8 | struct copy_permute_functor { } 9 | 10 | class BinSort { 11 | 12 | * template< class DstViewType , class SrcViewType > struct copy_functor { } 13 | 14 | * template< class DstViewType, class PermuteViewType, class SrcViewType > struct copy_permute_functor { } 15 | 16 | 17 | * template void sort( ValuesViewType const & values, int values_range_begin, int values_range_end) const { } 18 | 19 | * template void sort( ValuesViewType const & values ) const { } 20 | 21 | } 22 | 23 | 24 | template struct BinOp1D { } 25 | 26 | template struct BinOp3D { } 27 | 28 | 29 | template void sort( ViewType const & view ) { } 30 | 31 | template void sort( ViewType view, size_t const begin, size_t const end ) { } 32 | -------------------------------------------------------------------------------- /docs/source/mydefs.rst: -------------------------------------------------------------------------------- 1 | .. Color profiles for Sphinx. 2 | .. Has to be used with hacks.css 3 | .. (https://bitbucket.org/lbesson/web-sphinx/src/master/.static/hacks.css) 4 | 5 | .. role:: black 6 | .. role:: gray 7 | .. role:: grey 8 | .. role:: silver 9 | .. role:: white 10 | .. role:: maroon 11 | .. role:: red 12 | .. role:: magenta 13 | .. role:: fuchsia 14 | .. role:: pink 15 | .. role:: orange 16 | .. role:: yellow 17 | .. role:: lime 18 | .. role:: green 19 | .. role:: olive 20 | .. role:: teal 21 | .. role:: cyan 22 | .. role:: aqua 23 | .. role:: blue 24 | .. role:: navy 25 | .. role:: purple 26 | 27 | .. role:: under 28 | .. role:: over 29 | .. role:: blink 30 | .. role:: line 31 | .. role:: strike 32 | 33 | .. role:: it 34 | .. role:: ob 35 | 36 | .. role:: small 37 | .. role:: medium 38 | .. role:: large 39 | 40 | .. role:: packnameindexpage 41 | .. role:: summarylineindexpage 42 | 43 | .. role:: center 44 | .. role:: left 45 | .. role:: right 46 | 47 | .. Adapted from (c) Lilian Besson, 2011-2016, https://bitbucket.org/lbesson/web-sphinx/ 48 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-Core.md: -------------------------------------------------------------------------------- 1 | ### 1. **[[Initialization and Finalization|Initialize and Finalize]]** 2 | Initialization and finalization of Kokkos. 3 | ### 2. **[[View|API-View]]** 4 | Kokkos MultiDimensional View class and related free functions. 5 | ### 3. **[[Data Parallelism|Data-Parallelism]]** 6 | Parallel Execution Dispatch. 7 | ### 4. **[[Execution Policies|Execution-Policies]]** 8 | Execution policies. 9 | ### 5. **[[Spaces|API-Spaces]]** 10 | Description of Memory and Execution Spaces. 11 | ### 6. **[[Task Parallelism|Task-Parallelism]]** 12 | Creating and dispatching Task Graphs. 13 | ### 7. **[[Utilities|API-Utilities]]** 14 | Utility functionality part of Kokkos Core. 15 | ### 8. **[[STL Compatibility |STL-Compatibility]]** 16 | Ports of standard C++ capabilities, which otherwise do not work on various hardware platforms. 17 | ### 9. **[[Numerics]]** 18 | Common mathematical functions, mathematical constants, numeric traits. 19 | ### 10. **[[Macros]]** 20 | Global macros defined by Kokkos, used for architectures, general settings, etc. 21 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Sort.md: -------------------------------------------------------------------------------- 1 | template< class DstViewType , class SrcViewType > 2 | struct copy_functor { } 3 | 4 | template< class DstViewType, class PermuteViewType, class SrcViewType> 5 | struct copy_permute_functor { } 6 | 7 | class BinSort { 8 | 9 | * template< class DstViewType , class SrcViewType > struct copy_functor { } 10 | 11 | * template< class DstViewType, class PermuteViewType, class SrcViewType > struct copy_permute_functor { } 12 | 13 | 14 | * template void sort( ValuesViewType const & values, int values_range_begin, int values_range_end) const { } 15 | 16 | * template void sort( ValuesViewType const & values ) const { } 17 | 18 | } 19 | 20 | 21 | template struct BinOp1D { } 22 | 23 | template struct BinOp3D { } 24 | 25 | 26 | template void sort( ViewType const & view , bool const always_use_kokkos_sort = false) { } 27 | 28 | template void sort( ViewType view, size_t const begin, size_t const end ) { } 29 | -------------------------------------------------------------------------------- /docs/source/API/core/utilities/timer.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::Timer` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | Kokkos::Timer timer; 8 | double time = timer.seconds(); 9 | timer.reset(); 10 | ``` 11 | 12 | Timer is a simple construct to measure time. 13 | 14 | ## Synopsis 15 | ```c++ 16 | class Timer { 17 | typedef Timer execution_policy; 18 | 19 | //Constructors 20 | Timer(); 21 | Timer(Timer&&) = default; 22 | Timer(const Timer&) = default; 23 | ~Timer() = default; 24 | 25 | //Member functions 26 | double seconds(); 27 | void reset(); 28 | }; 29 | ``` 30 | 31 | ## Public Class Members 32 | 33 | ### Constructors 34 | 35 | * `Timer()`: Default Constructor. Sets the start time. 36 | * `void reset()`: Resets the start time. 37 | * `double seconds()`: Returns the number of seconds since last call to `reset()` or construction. 38 | 39 | ## Examples 40 | 41 | ```c++ 42 | Timer timer; 43 | // ... 44 | double time1 = timer.seconds(); 45 | timer.reset(); 46 | // ... 47 | double time2 = timer.seconds(); 48 | ``` 49 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::ValLocScalar.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::ValLocScalar` 2 | 3 | Template class for storing a value plus index for min/max location reducers. Should be accessed via ::value_type defined for particular reducer. 4 | 5 | Header File: `Kokkos_Core.hpp` 6 | 7 | Usage: 8 | ```c++ 9 | MaxLoc::value_type result; 10 | parallel_reduce(N,Functor,MaxLoc(result)); 11 | T resultValue = result.val; 12 | I resultIndex = result.loc; 13 | ``` 14 | . 15 | 16 | ## Synopsis 17 | ```c++ 18 | template 19 | struct ValLocScalar{ 20 | Scalar val; 21 | Index loc; 22 | 23 | void operator = (const ValLocScalar& rhs); 24 | void operator = (const volatile ValLocScalar& rhs); 25 | }; 26 | 27 | ## Public Members 28 | 29 | ### Variables 30 | 31 | * `val`: Scalar Value. 32 | * `loc`: Scalar index. 33 | 34 | ### Assignment operators 35 | 36 | * `void operator = (const ValLocScalar& rhs);` 37 | assign `val` and `loc` from `rhs`; 38 | 39 | * `void operator = (const volatile ValLocScalar& rhs);` 40 | assign `val` and `loc` from `rhs`; -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::Timer.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::Timer` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | Kokkos::Timer timer; 8 | double time = timer.seconds(); 9 | timer.reset(); 10 | ``` 11 | 12 | Timer is a simple construct to measure time. 13 | 14 | ## Synopsis 15 | ```c++ 16 | class Timer { 17 | typedef Timer execution_policy; 18 | 19 | //Constructors 20 | Timer(); 21 | Timer(Timer&&) = default; 22 | Timer(const Timer&) = default; 23 | ~Timer() = default; 24 | 25 | //Member functions 26 | double seconds(); 27 | void reset(); 28 | }; 29 | ``` 30 | 31 | ## Public Class Members 32 | 33 | ### Constructors 34 | 35 | * `Timer()`: Default Constructor. Sets the start time. 36 | * `void reset()`: Resets the start time. 37 | * `double seconds()`: Returns the number of seconds since last call to `reset()` or construction. 38 | 39 | ## Examples 40 | 41 | ```c++ 42 | Timer timer; 43 | // ... 44 | double time1 = timer.seconds(); 45 | timer.reset(); 46 | // ... 47 | double time2 = timer.seconds(); 48 | ``` 49 | 50 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::MinMaxScalar.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::MinMaxScalar` 2 | 3 | Template class for storing the min and max values for min/max reducers. Should be accessed via ::value_type defined for particular reducer. 4 | 5 | Header File: `Kokkos_Core.hpp` 6 | 7 | Usage: 8 | ```c++ 9 | MinMax::value_type result; 10 | parallel_reduce(N,Functor,MinMax(result)); 11 | T minValue = result.min_val; 12 | T maxValue = result.max_val; 13 | ``` 14 | . 15 | 16 | ## Synopsis 17 | ```c++ 18 | template 19 | struct MinMaxScalar{ 20 | Scalar min_val; 21 | Scalar max_val; 22 | 23 | void operator = (const MinMaxScalar& rhs); 24 | void operator = (const volatile MinMaxScalar& rhs); 25 | }; 26 | 27 | ## Public Members 28 | 29 | ### Variables 30 | 31 | * `min_val`: Scalar minimum Value. 32 | * `max_val`: Scalar maximum Value. 33 | 34 | ### Assignment operators 35 | 36 | * `void operator = (const MinMaxScalar& rhs);` 37 | assign `min_val` and `max_val` from `rhs`; 38 | 39 | * `void operator = (const volatile MinMaxScalar& rhs);` 40 | assign `min_val` and `max_val` from `rhs`; -------------------------------------------------------------------------------- /docs/source/API/core/atomics/atomic_compare_exchange.md: -------------------------------------------------------------------------------- 1 | # `atomic_compare_exchange` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | old_val = atomic_compare_exchange(ptr_to_value,comparison_value, new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value` if the current value at `ptr_to_value` 11 | is equal to `comparison_value`, and returns the previously stored value at the address independent on whether 12 | the exchange has happened. 13 | 14 | ## Synopsis 15 | 16 | ```c++ 17 | template 18 | T atomic_compare_exchange(T* const ptr_to_value, const T comparison_value, const T new_value); 19 | ``` 20 | 21 | ## Description 22 | 23 | * ```c++ 24 | template 25 | T atomic_compare_exchange(T* const ptr_to_value, const T comparison_value, const T new_value); 26 | ``` 27 | 28 | Atomically executes `old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value;`. 29 | * `ptr_to_value`: address of the to be updated value. 30 | * `comparison_value`: value to be compared to. 31 | * `new_value`: new value. 32 | * `old_value`: value at address `ptr_to_value` before doing the exchange. 33 | -------------------------------------------------------------------------------- /docs/source/API/core/atomics/atomic_compare_exchange_strong.md: -------------------------------------------------------------------------------- 1 | # `atomic_compare_exchange_strong` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | was_exchanged = atomic_compare_exchange_strong(ptr_to_value,comparison_value, new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value` if the current value at `ptr_to_value` 11 | is equal to `comparison_value`, and returns true if the exchange has happened. 12 | 13 | ## Synopsis 14 | 15 | ```c++ 16 | template 17 | bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); 18 | ``` 19 | 20 | ## Description 21 | 22 | * ```c++ 23 | template 24 | bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); 25 | ``` 26 | 27 | Atomically executes `old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value==comparison_value;`. 28 | * `ptr_to_value`: address of the to be updated value. 29 | * `comparison_value`: value to be comapred to. 30 | * `new_value`: new value. 31 | * `old_value`: value at address `ptr_to_value` before doing the exchange. 32 | -------------------------------------------------------------------------------- /docs/source/API/core/builtinreducers/MinMaxLocScalar.md: -------------------------------------------------------------------------------- 1 | # `MinMaxLocScalar` 2 | 3 | Template class for storing the min and max values with indices for min/max location reducers. Should be accessed via `::value_type` defined for particular reducer. 4 | 5 | Header File: `Kokkos_Core.hpp` 6 | 7 | Usage: 8 | 9 | ```c++ 10 | MinMaxLoc::value_type result; 11 | parallel_reduce(N,Functor,MinMaxLoc(result)); 12 | T minValue = result.min_val; 13 | T maxValue = result.max_val; 14 | I minLoc = result.min_loc; 15 | I maxLoc = result.max_loc; 16 | ``` 17 | 18 | ## Synopsis 19 | 20 | ```c++ 21 | template 22 | struct MinMaxLocScalar{ 23 | Scalar min_val; 24 | Scalar max_val; 25 | Index min_loc; 26 | Index max_loc; 27 | 28 | void operator = (const MinMaxLocScalar& rhs); 29 | }; 30 | ``` 31 | 32 | ## Public Members 33 | 34 | ### Variables 35 | 36 | * `min_val`: Scalar minimum Value. 37 | * `max_val`: Scalar maximum Value. 38 | * `min_loc`: minimum location(Index). 39 | * `max_loc`: maximum location(Index). 40 | 41 | ### Assignment operators 42 | 43 | * `void operator = (const MinMaxLocScalar& rhs);` 44 | assign `min_val`, `max_val`, `min_loc` and `max_loc` from `rhs`; 45 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Overview.md: -------------------------------------------------------------------------------- 1 | # Kokkos Testing Processes 2 | 3 | Kokkos is a library of C++ templated macros that enable the construction of thread-scalable parallel patterns for data on many machine architectures. Kokkos is designed for integration into the flow of computationally intensive host software that will be compiled for usage on modern computer architectures; the goal is improved performance of the computational kernels. Tuned implementation and some degree of code refactoring are generally needed to realize significant performance benefits. Supporting the development of the Kokkos macros and the expected performance benefits is an extensive software test program. 4 | 5 | This document outlines Kokkos testing activities in its variety and extent; some aspects will be described in greater detail than others, particularly promotion testing. The emphasis on promotion testing is based on its importance to the integrity of the Kokkos software library. Included in the test activity descriptions are specific hardware platforms, supported software compilers, Kokkos backends, test scripts, important repository management commands, required computer accounts, test descriptions, and testing important at various stages in the software life-cycle. 6 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::atomic_compare_exchange.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::atomic_compare_exchange` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | old_val = atomic_compare_exchange(ptr_to_value,comparison_value, new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value` if the current value at `ptr_to_value` 11 | is equal to `comparison_value`, and returns the previously stored value at the address independent on whether 12 | the exchange has happened. 13 | 14 | ## Synopsis 15 | 16 | ```c++ 17 | template 18 | T atomic_compare_exchange(T* const ptr_to_value, const T comparison_value, const T new_value); 19 | ``` 20 | 21 | ## Description 22 | 23 | * ```c++ 24 | template 25 | T atomic_compare_exchange(T* const ptr_to_value, const T comparison_value, const T new_value); 26 | ``` 27 | 28 | Atomically executes `old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value;`. 29 | * `ptr_to_value`: address of the to be updated value. 30 | * `comparison_value`: value to be compared to. 31 | * `new_value`: new value. 32 | * `old_value`: value at address `ptr_to_value` before doing the exchange. 33 | 34 | 35 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::atomic_compare_exchange_strong.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::atomic_compare_exchange_strong` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | was_exchanged = atomic_compare_exchange_strong(ptr_to_value,comparison_value, new_value); 8 | ``` 9 | 10 | Atomically sets the value at the address given by `ptr_to_value` to `new_value` if the current value at `ptr_to_value` 11 | is equal to `comparison_value`, and returns true if the exchange has happened. 12 | 13 | ## Synopsis 14 | 15 | ```c++ 16 | template 17 | bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); 18 | ``` 19 | 20 | ## Description 21 | 22 | * ```c++ 23 | template 24 | bool atomic_compare_exchange_strong(T* const ptr_to_value, const T comparison_value, const T new_value); 25 | ``` 26 | 27 | Atomically executes `old_value = *ptr_to_value; if(old_value==comparison_value) *ptr_to_value = new_value; return old_value==comparison_value;`. 28 | * `ptr_to_value`: address of the to be updated value. 29 | * `comparison_value`: value to be comapred to. 30 | * `new_value`: new value. 31 | * `old_value`: value at address `ptr_to_value` before doing the exchange. 32 | 33 | 34 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-View.md: -------------------------------------------------------------------------------- 1 | Data management is a critical part of any program. The main facility in Kokkos is the `Kokkos::View`. 2 | The following facilities are available: 3 | 4 | * [`View`](Kokkos%3A%3AView): The main Kokkos data structure, a multi dimensional memory space and layout aware array. 5 | * [`view_alloc`](Kokkos%3A%3Aview_alloc): Create View allocation parameter bundle from argument list. 6 | * [`deep_copy`](Kokkos%3A%3Adeep_copy): Copying data between views and scalars. 7 | * [`subview`](Kokkos%3A%3Asubview): Getting slices from a `Kokkos::View`. 8 | * [`realloc`](Kokkos%3A%3Arealloc): Reallocating a `Kokkos::View`. 9 | * [`resize`](Kokkos%3A%3Aresize): Resizing a `Kokkos::View`. 10 | * [`create_mirror`](Kokkos%3A%3Acreate_mirror): Creating a copy of a `Kokkos::View` in a different memory space. 11 | * [`create_mirror_view`](Kokkos%3A%3Acreate_mirror): Creating a copy of a `Kokkos::View` in a different memory space, if the original view is not accessible in that space. 12 | * [`LayoutLeft`](Kokkos%3A%3ALayoutLeft): Memory Layout matching Fortran 13 | * [`LayoutRight`](Kokkos%3A%3ALayoutRight): Memory Layout matching C 14 | * [`LayoutStride`](Kokkos%3A%3ALayoutStride): Memory Layout for arbitrary strides 15 | 16 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::finalize.md: -------------------------------------------------------------------------------- 1 | # Kokkos::finalize 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Shut down all enabled Kokkos backends and free all associated resources. 6 | This function should be called after calling all other Kokkos API functions, 7 | *including Kokkos object destructors*. 8 | 9 | Programs are ill-formed if they do not call this function after calling `Kokkos::initialize`. 10 | 11 | 12 | Usage: 13 | ```c++ 14 | Kokkos::finalize(); 15 | ``` 16 | 17 | ## Interface 18 | 19 | 20 | ```cpp 21 | Kokkos::finalize(); 22 | ``` 23 | 24 | ### Parameters: 25 | 26 | * None 27 | 28 | ### Requirements 29 | * `Kokkos::finalize` must be called before `MPI_Finalize` if Kokkos is used in an MPI context. 30 | * `Kokkos::finalize` must be called after user initialized Kokkos objects are out of scope. 31 | 32 | ### Semantics 33 | 34 | * `Kokkos::is_initialized()` should return false after calling `Kokkos::finalize` 35 | 36 | ### Example 37 | 38 | ```c++ 39 | int main(int argc, char** argv) { 40 | Kokkos::initialize(argc, argv); 41 | 42 | // add scoping to ensure my_view destructor is called before Kokkos::finalize 43 | { 44 | Kokkos::View my_view("my_view", 10); 45 | } 46 | 47 | Kokkos::finalize(); 48 | 49 | } 50 | ``` -------------------------------------------------------------------------------- /docs/source/API/core/initialize_finalize/InitArguments.md: -------------------------------------------------------------------------------- 1 | # InitArguments 2 | 3 | Defined in `` header. 4 | 5 | ## Interface 6 | ```C++ 7 | struct InitArguments { // (deprecated since 3.7) 8 | int num_threads; 9 | int num_numa; 10 | int device_id; 11 | int ndevices; 12 | int skip_device; 13 | bool disable_warnings; 14 | InitArguments(); 15 | }; 16 | ``` 17 | 18 | **DEPRECATED: use `Kokkos::InitializationSettings` instead** 19 | `InitArguments` is a struct that can be used to programmatically define the 20 | arguments passed to [`Kokkos::initialize`](initialize). It was deprecated in 21 | version 3.7 in favor of 22 | [`Kokkos::InitializationSettings`](InitializationSettings). 23 | One of the main reasons for replacing it was that user-specified data members 24 | cannot be distinguished from defaulted ones. 25 | 26 | 27 | ### Example 28 | ```C++ 29 | #include 30 | 31 | int main() { 32 | Kokkos::InitArguments arguments; 33 | arguments.num_threads = 2; 34 | arguments.device_id = 1; 35 | arguments.disable_warnings = true; 36 | Kokkos::initialize(arguments); 37 | // ... 38 | Kokkos::finalize(); 39 | } 40 | ``` 41 | 42 | ### See also 43 | * [`Kokkos::InitializationSettings`](InitializationSettings) 44 | * [`Kokkos::initialize`](initialize) 45 | -------------------------------------------------------------------------------- /docs/source/API/core/view/Subview.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::Subview` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Alias template to deduce the type that is returned by a call to the subview function with given arguments. 6 | 7 | Usage: 8 | ```c++ 9 | Kokkos::Subview subView; 10 | ``` 11 | 12 | ## Description 13 | 14 | ```c++ 15 | template 16 | using Subview = IMPL_DETAIL; // deduce subview type from source view traits 17 | ``` 18 | Type of a `Kokkos::View` viewing a subset of `ViewType` specified by `Args...`. 19 | Same type as returned by a call to the subview function with corresponding arguments. 20 | For restrictions on Args see [`Kokkos::subview`](Kokkos%3A%3Asubview) documentation. 21 | 22 | ## Examples 23 | 24 | ```c++ 25 | 26 | using view_type = Kokkos::View; 27 | view_type a("A",N0,N1,N2); 28 | 29 | struct subViewHolder { 30 | Kokkos::Subview, 32 | int, 33 | Kokkos::ALL,int> s; 34 | } subViewHolder; 35 | 36 | subViewHolder.s = Kokkos::subview(a, 37 | std::pair(3,15), 38 | 5, 39 | Kokkos::ALL, 40 | 3); 41 | 42 | ``` 43 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Execution-Policies.md: -------------------------------------------------------------------------------- 1 | ## Top Level Execution Policies 2 | 3 | |Policy |Description | 4 | |:---------|:----------------------------| 5 | |[RangePolicy](Kokkos%3A%3ARangePolicy) | Each iterate is an integer in a contiguous range | 6 | |[MDRangePolicy](Kokkos%3A%3AMDRangePolicy) | Each iterate for each rank is an integer in a contiguous range | 7 | |[TeamPolicy](Kokkos%3A%3ATeamPolicy) | Assigns to each iterate in a contiguous range a team of threads | 8 | 9 | ## Nested Execution Policies 10 | 11 | Nested Execution Policies are used to dispatch parallel work inside of an already executing parallel region either dispatched with a [TeamPolicy](Kokkos%3A%3ATeamPolicy) or a 12 | task policy. 13 | 14 | |Policy |Description | 15 | |:---------|:----------------------------| 16 | |[TeamThreadRange](Kokkos%3A%3ATeamThreadRange) | Used inside of a TeamPolicy kernel to perform nested parallel loops split over threads of a team. | 17 | |[TeamVectorRange](Kokkos%3A%3ATeamVectorRange) | Used inside of a TeamPolicy kernel to perform nested parallel loops split over threads of a team and their vector lanes. | 18 | |[ThreadVectorRange](Kokkos%3A%3AThreadVectorRange) | Used inside of a TeamPolicy kernel to perform nested parallel loops with vector lanes of a thread. | 19 | -------------------------------------------------------------------------------- /.github/workflows/deploy_docs.yml: -------------------------------------------------------------------------------- 1 | name: Deploy docs 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | 7 | jobs: 8 | build-and-deploy-docs: 9 | runs-on: ubuntu-latest 10 | env: 11 | docs-directory: /home/runner/work/kokkos-core-wiki/kokkos-core-wiki/docs 12 | python-version: '3.10' 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Set up Python ${{ env.python-version }} 17 | uses: actions/setup-python@v4 18 | with: 19 | python-version: ${{ env.python-version }} 20 | architecture: 'x64' 21 | - name: Install Python dependencies 22 | run: | 23 | pip3 install -r build_requirements.txt 24 | - name: Build documentation 25 | working-directory: ${{ env.docs-directory }} 26 | run: | 27 | make html 28 | # .nojekyll file is needed for GitHub Pages to know it's getting a ready webpage 29 | # and there is no need to generate anything 30 | - name: Generate nojekyll file 31 | working-directory: ${{ env.docs-directory }}/generated_docs 32 | run: touch .nojekyll 33 | # This action moves the content of `generated_docs` to the `deploy-doc-site` branch 34 | - name: Deploy docs 35 | uses: JamesIves/github-pages-deploy-action@v4 36 | with: 37 | branch: deploy-doc-site 38 | folder: ${{ env.docs-directory }}/generated_docs 39 | clean: true 40 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/API-Spaces.md: -------------------------------------------------------------------------------- 1 | Kokkos contains two `Space` Concepts: [`MemorySpace`](Kokkos%3A%3AMemorySpaceConcept) and [`ExecutionSpace`](Kokkos%3A%3AExecutionSpaceConcept). 2 | Concrete instances of these two concepts are used to allocate data and dispatch work. Their relationship is described through 3 | the [`Kokkos::SpaceAccessibility`](Kokkos%3A%3ASpaceAccessibility) trait. 4 | 5 | ## Execution Spaces 6 | 7 | The Concept is documented in [`ExecutionSpace`](Kokkos%3A%3AExecutionSpaceConcept). 8 | 9 | * [`Cuda`](Kokkos%3A%3ACuda) 10 | * [`HPX`](Kokkos%3A%3AHPX) 11 | * [`OpenMP`](Kokkos%3A%3AOpenMP) 12 | * [`Serial`](Kokkos%3A%3ASerial) 13 | * [`Threads`](Kokkos%3A%3AThreads) 14 | 15 | ## Memory Spaces 16 | 17 | The Concept is documented in [`MemorySpace`](Kokkos%3A%3AMemorySpaceConcept). 18 | 19 | * [`CudaSpace`](Kokkos%3A%3ACudaSpace) 20 | * [`CudaHostPinnedSpace`](Kokkos%3A%3ACudaHostPinnedSpace) 21 | * [`CudaUVMSpace`](Kokkos%3A%3ACudaUVMSpace) 22 | * [`HostSpace`](Kokkos%3A%3AHostSpace) 23 | 24 | ## Facilities 25 | 26 | * [`is_execution_space`](Kokkos%3A%3AExecutionSpaceConcept) 27 | * [`is_memory_space`](Kokkos%3A%3AMemorySpaceConcept) 28 | * [`SpaceAccessibility`](Kokkos%3A%3ASpaceAccessibility) 29 | 30 | ## C-style memory management 31 | * [`kokkos_malloc`](Kokkos%3A%3Akokkos_malloc) 32 | * [`kokkos_realloc`](Kokkos%3A%3Akokkos_realloc) 33 | * [`kokkos_free`](Kokkos%3A%3Akokkos_free) 34 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::MinMaxLocScalar.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::MinMaxLocScalar` 2 | 3 | Template class for storing the min and max values with indices for min/max location reducers. Should be accessed via ::value_type defined for particular reducer. 4 | 5 | Header File: `Kokkos_Core.hpp` 6 | 7 | Usage: 8 | ```c++ 9 | MinMaxLoc::value_type result; 10 | parallel_reduce(N,Functor,MinMaxLoc(result)); 11 | T minValue = result.min_val; 12 | T maxValue = result.max_val; 13 | I minLoc = result.min_loc; 14 | I maxLoc = result.max_loc; 15 | ``` 16 | . 17 | 18 | ## Synopsis 19 | ```c++ 20 | template 21 | struct MinMaxLocScalar{ 22 | Scalar min_val; 23 | Scalar max_val; 24 | Index min_loc; 25 | Index max_loc; 26 | 27 | void operator = (const MinMaxLocScalar& rhs); 28 | void operator = (const volatile MinMaxLocScalar& rhs); 29 | }; 30 | 31 | ## Public Members 32 | 33 | ### Variables 34 | 35 | * `min_val`: Scalar minimum Value. 36 | * `max_val`: Scalar maximum Value. 37 | * `min_loc`: minimum location(Index). 38 | * `max_loc`: maximum location(Index). 39 | 40 | ### Assignment operators 41 | 42 | * `void operator = (const MinMaxLocScalar& rhs);` 43 | assign `min_val`, `max_val`, `min_loc` and `max_loc` from `rhs`; 44 | 45 | * `void operator = (const volatile MinMaxLocScalar& rhs);` 46 | assign `min_val`, `max_val`, `min_loc` and `max_loc` from `rhs`; -------------------------------------------------------------------------------- /docs/source/API/containers-index.rst: -------------------------------------------------------------------------------- 1 | API: Containers 2 | ############### 3 | 4 | .. list-table:: 5 | :widths: 25 75 6 | :header-rows: 1 7 | 8 | * - Container 9 | - Description 10 | * - `Bitset `__ 11 | - A concurrent Bitset class. 12 | * - `DualView `__ 13 | - Container to manage access to mirrored views in different memory spaces. 14 | * - `DynamicView `__ 15 | - DynamicView comment. 16 | * - `DynRankView `__ 17 | - Kokkos Runtime-determined-dimension DynRankView class. 18 | * - `Offset-View `__ 19 | - OffsetView comment. 20 | * - `ScatterView `__ 21 | - ScatterView comment. 22 | * - `StaticCrsGraph `__ 23 | - StaticCrsGraph comment. 24 | * - `Unordered-Map `__ 25 | - UnorderedMap comment. 26 | * - `vector `__ 27 | - std::vector compatible implementation that works with non-host memory spaces. 28 | 29 | .. toctree:: 30 | :hidden: 31 | :maxdepth: 1 32 | 33 | ./containers/Bitset 34 | ./containers/DualView 35 | ./containers/DynamicView 36 | ./containers/DynRankView 37 | ./containers/Offset-View 38 | ./containers/ScatterView 39 | ./containers/StaticCrsGraph 40 | ./containers/Unordered-Map 41 | ./containers/vector 42 | -------------------------------------------------------------------------------- /docs/source/API/core/initialize_finalize/finalize.md: -------------------------------------------------------------------------------- 1 | # finalize 2 | 3 | Defined in header `` 4 | 5 | Usage: 6 | ```C++ 7 | Kokkos::finalize(); 8 | ``` 9 | 10 | Terminates the Kokkos execution environment. 11 | This functions cleans up all Kokkos states and released the associated 12 | resources. 13 | Once this function is called, no Kokkos API functions (not even 14 | [`Kokkos::initialize`](initialize)) may be called, except for 15 | `Kokkos::is_initialized` or `Kokkos::is_finalized`. 16 | The user must ensure that all Kokkos objects (e.g. `Kokkos::View`) are detroyed 17 | before `Kokkos::finalize` before `Kokkos::finalize` gets called. 18 | 19 | Programs are ill-formed if they do not call this function after calling [`Kokkos::initialize`](initialize). 20 | 21 | ## Interface 22 | 23 | ```C++ 24 | Kokkos::finalize(); 25 | ``` 26 | 27 | ### Requirements 28 | * `Kokkos::finalize` must be called before `MPI_Finalize` if Kokkos is used in an MPI context. 29 | * `Kokkos::finalize` must be called after user initialized Kokkos objects are out of scope. 30 | 31 | ### Semantics 32 | 33 | * `Kokkos::is_initialized()` should return false after calling `Kokkos::finalize` 34 | 35 | ### Example 36 | 37 | ```C++ 38 | #include 39 | 40 | int main(int argc, char* argv[]) { 41 | Kokkos::initialize(argc, argv); 42 | { // scope to ensure that my_view destructor is called before Kokkos::finalize 43 | Kokkos::View my_view("my_view", 10); 44 | } // scope of my_view ends here 45 | Kokkos::finalize(); 46 | } 47 | ``` 48 | -------------------------------------------------------------------------------- /docs/source/API/core/view/view_alloc.md: -------------------------------------------------------------------------------- 1 | # `view_alloc()` 2 | 3 | Header File: `Kokkos_View.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | Kokkos::view_alloc(exec_space, Kokkos::WithoutInitializing, "ViewString"); 8 | Kokkos::view_wrap(pointer_to_wrapping_memory); 9 | ``` 10 | 11 | Create View allocation parameter bundle from argument list. Valid argument list members are: 12 | * label as `C`-string or `std::string` 13 | * memory space instance of the `View::memory_space` type 14 | * execution space instance able to access `View::memory_space` 15 | * `Kokkos::WithoutInitializing` to bypass initialization 16 | * `Kokkos::AllowPadding` to allow allocation to pad dimensions for memory alignment 17 | * a pointer to create an unmanaged View wrapping that pointer 18 | 19 | ## Synopsis 20 | 21 | ```c++ 22 | template 23 | **implementation-detail** 24 | view_alloc(Args const&... args); 25 | 26 | template 27 | KOKKOS_FUNCTION 28 | **implementation-detail** 29 | view_wrap(Args const&... args); 30 | ``` 31 | 32 | ## Description 33 | 34 | * ```c++ 35 | template 36 | **implementation-detail** 37 | view_alloc(Args const&... args); 38 | ``` 39 | Create View allocation parameter bundle from argument list. 40 | 41 | Restrictions: 42 | * `args`: Cannot contain a pointer to memory. 43 | 44 | * ```c++ 45 | template 46 | **implementation-detail** 47 | view_alloc(Args const&... args); 48 | ``` 49 | Create View allocation parameter bundle from argument list. 50 | 51 | Restrictions: 52 | * `args`: Can only be a pointer to memory. 53 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::kokkos_realloc.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::kokkos_realloc` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | template 7 | void* kokkos_realloc(void* ptr, size_t new_size); 8 | ``` 9 | 10 | Reallocates the given area of memory. It must be previously allocated by [`Kokkos::kokkos_malloc()`](Kokkos%3A%3Akokkos_malloc) or [`Kokkos::kokkos_realloc()`](Kokkos%3A%3Akokkos_realloc) on the same memory space `MemorySpace` and not yet freed with [`Kokkos::kokkos_free()`](Kokkos%3A%3Akokkos_free), otherwise, the results are undefined. 11 | 12 | ## Parameters 13 | 14 | `ptr`: The pointer to the memory area to be reallocated. 15 | `new_size`: The new size in bytes. 16 | 17 | ## Template parameters 18 | 19 | * `MemorySpace`: Controls the storage location. If omitted the memory space of the default execution space is used (i.e. `Kokkos::DefaultExecutionSpace::memory_space`). 20 | 21 | ## Return value 22 | 23 | On success, returns a pointer to the beginning of the newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with [`Kokkos::kokkos_free()`](Kokkos%3A%3Akokkos_free), the original pointer `ptr` is invalidated and any access to it is undefined behavior (even if reallocation was in-place). 24 | 25 | On failure, returns a null pointer. The original pointer ptr remains valid and may need to be deallocated with [`Kokkos::kokkos_free()`](Kokkos%3A%3Akokkos_free). 26 | 27 | ## Exceptions 28 | 29 | On failure, throws `Kokkos::Experimental::RawMemoryAllocationFailure`. 30 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/Programming-Guide:-Core.md: -------------------------------------------------------------------------------- 1 | 1. **[[Introduction|Introduction]]** 2 | 2. **[[Machine Model|Machine-Model]]** 3 | 1. **[[Motivations|Machine-Model#21-motivations]]** 4 | 2. **[[Kokkos Spaces|Machine-Model#22-kokkos-spaces]]** 5 | 1. Execution Spaces 6 | 2. Memory Spaces 7 | 3. Space Instances 8 | 3. **[[Program Execution|Machine-Model#23-program-execution]]** 9 | 3. **[[Programming Model|ProgrammingModel]]** 10 | 1. Execution Spaces 11 | 2. Execution Patterns 12 | 3. Execution Policies 13 | 1. Range Policy 14 | 2. Team Policy 15 | 3. Task Policy 16 | 4. Nested Policies 17 | 4. Memory Spaces 18 | 5. Memory Layout 19 | 6. Memory Traits 20 | 4. **[[Compiling|Compiling]]** 21 | 1. General Information 22 | 2. Using Kokkos' Makefile system 23 | 3. Using Kokkos' CMake support 24 | 4. Using Trilinos' CMake system 25 | 5. Building with NVIDA NVCC Compiler 26 | 5. **[[Initialization|Initialization]]** 27 | 1. Command-line arguments 28 | 2. Initialization Struct 29 | 3. Finalization 30 | 6. **[[View|View]]** 31 | 7. **[[Parallel Dispatch|ParallelDispatch]]** 32 | 8. **[[Hierarchical Parallelism|HierarchicalParallelism]]** 33 | 9. **[[Custom Reductions|Programming Guide: Custom Reductions]]** 34 | 1. Build-In Reducers with standard scalar types 35 | 2. Build-In Reducers with custom scalar types 36 | 3. Writing your own Reducer 37 | 10. **[[Atomic Operations|Atomic Operations]]** 38 | 11. **[[Subviews|Subviews]]** 39 | 12. **[[Interoperability|Interoperability]]** -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::view_alloc.md: -------------------------------------------------------------------------------- 1 | # Kokkos::view_alloc() 2 | 3 | Header File: `Kokkos_View.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | Kokkos::view_alloc(exec_space, Kokkos::WithoutInitializing, "ViewString"); 8 | Kokkos::view_wrap(pointer_to_wrapping_memory); 9 | ``` 10 | 11 | Create View allocation parameter bundle from argument list. Valid argument list members are: 12 | * label as `C`-string or `std::string` 13 | * memory space instance of the `View::memory_space` type 14 | * execution space instance able to access `View::memory_space` 15 | * `Kokkos::WithoutInitializing` to bypass initialization 16 | * `Kokkos::AllowPadding` to allow allocation to pad dimensions for memory alignment 17 | * a pointer to create an unmanaged View wrapping that pointer 18 | 19 | ## Synopsis 20 | 21 | ```cpp 22 | template 23 | **implementation-detail** 24 | view_alloc(Args const&... args); 25 | 26 | template 27 | KOKKOS_FUNCTION 28 | **implementation-detail** 29 | view_wrap(Args const&... args); 30 | ``` 31 | 32 | ## Description 33 | 34 | * ```cpp 35 | template 36 | **implementation-detail** 37 | view_alloc(Args const&... args); 38 | ``` 39 | Create View allocation parameter bundle from argument list. 40 | 41 | Restrictions: 42 | * `args`: Cannot contain a pointer to memory. 43 | 44 | * ```cpp 45 | template 46 | **implementation-detail** 47 | view_alloc(Args const&... args); 48 | ``` 49 | Create View allocation parameter bundle from argument list. 50 | 51 | Restrictions: 52 | * `args`: Can only be a pointer to memory. 53 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ProgrammingGuide/Programming-Guide:-Custom-Reductions.md: -------------------------------------------------------------------------------- 1 | # Chapter 9 2 | 3 | # Custom Reductions 4 | 5 | As described previously Kokkos reductions perform a "sum" reduction by default. But while that is the most common type of reduction it is not the only one required by more complex applications. Kokkos provides the "Reducer" concept to accommodate custom reductions. 6 | 7 | A Reducer is a class which provides the necessary information to join (reduce) two values, knows how to initialize thread private variables and where to store the final result of a reduction. Depending on your situation, you may need to write more or less code specialization for a custom reduction. 8 | 9 | ## **[[Built-In Reducers|Custom Reductions: Built-In Reducers]]** 10 | To perform a common operation, such as finding the minimum for an intrinsic C++ type, no custom code is required. Kokkos::complex is also supported with Built-in reducers without any custom additions. Click the heading for more detail. 11 | 12 | ## **[[Built-In Reducers with Custom Scalar Types|Custom-Reductions:-Built-In-Reducers-with-Custom-Scalar-Types]]** 13 | If your application requires a custom scalar types, the scalar type must be copy constructible and provide the necessary operators for the reduction (for example comparison operators are required for minmax-reductions). A specialization of the reduction_identity class is also required. Click the heading for more detail. 14 | 15 | ## **[[Custom Reducers|Custom Reductions: Custom Reducers]]** 16 | For completely arbitrary reductions, you must provide an implementation of a Reducer class. Click the heading for more detail and an example. -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::kokkos_malloc.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::kokkos_malloc` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | template 7 | void* kokkos_malloc(const std:string& label, size_t size); 8 | ``` 9 | 10 | ```c++ 11 | template 12 | void* kokkos_malloc(size_t size); 13 | ``` 14 | 15 | Allocate `size` bytes of uninitialized storage on the specified memory space `MemorySpace` plus some extra space for meta data such as the label. 16 | 17 | If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any scalar type. 18 | 19 | If allocation fails, an exception of type `Kokkos::Experimental::RawMemoryAllocationFailure` is thrown. 20 | 21 | ## Parameters 22 | 23 | `label`: A user provided string which is used in profiling and debugging tools via the KokkosP Profiling Tools. 24 | `size`: The number of bytes to allocate. 25 | 26 | ## Template parameters 27 | 28 | * `MemorySpace`: Controls the storage location. If omitted the memory space of the default execution space is used (i.e. `Kokkos::DefaultExecutionSpace::memory_space`). 29 | 30 | ## Return value 31 | 32 | On success, returns the pointer to the beginning of newly allocated memory. 33 | To avoid a memory leak, the returned pointer must be deallocated with [`Kokkos::kokkos_free()`](Kokkos%3A%3Akokkos_free) or [`Kokkos::realloc()`](Kokkos%3A%3Akokkos_realloc). 34 | 35 | ## Exceptions 36 | 37 | On failure, throws `Kokkos::Experimental::RawMemoryAllocationFailure`. 38 | -------------------------------------------------------------------------------- /docs/source/API/core/c_style_memory_management/realloc.md: -------------------------------------------------------------------------------- 1 | # `kokkos_realloc` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | template 7 | void* kokkos_realloc(void* ptr, size_t new_size); 8 | ``` 9 | 10 | Reallocates the given area of memory. It must be previously allocated by [`Kokkos::kokkos_malloc()`](malloc) or [`Kokkos::kokkos_realloc()`](realloc) on the same memory space [`MemorySpace`](../memory_spaces) and not yet freed with [`Kokkos::kokkos_free()`](free), otherwise, the results are undefined. 11 | 12 | WARNING: calling any function that manipulates the behavior of the memory (e.g. `memAdvise`) on memory managed by `Kokkos` results in undefined behavior. 13 | 14 | ## Parameters 15 | 16 | `ptr`: The pointer to the memory area to be reallocated. 17 | `new_size`: The new size in bytes. 18 | 19 | ## Template parameters 20 | 21 | * `MemorySpace`: Controls the storage location. If omitted the memory space of the default execution space is used (i.e. `Kokkos::DefaultExecutionSpace::memory_space`). 22 | 23 | ## Return value 24 | 25 | On success, returns a pointer to the beginning of the newly allocated memory. To avoid a memory leak, the returned pointer must be deallocated with [`Kokkos::kokkos_free()`](free), the original pointer `ptr` is invalidated and any access to it is undefined behavior (even if reallocation was in-place). 26 | 27 | On failure, returns a null pointer. The original pointer ptr remains valid and may need to be deallocated with [`Kokkos::kokkos_free()`](free). 28 | 29 | ## Exceptions 30 | 31 | On failure, throws `Kokkos::Experimental::RawMemoryAllocationFailure`. 32 | 33 | -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/Custom-Reductions.rst: -------------------------------------------------------------------------------- 1 | 9. Custom Reductions 2 | ==================== 3 | 4 | As described previously Kokkos reductions perform a "sum" reduction by default. But while that is the most common type of reduction it is not the only one required by more complex applications. Kokkos provides the "Reducer" concept to accommodate custom reductions. 5 | 6 | A Reducer is a class which provides the necessary information to join (reduce) two values, knows how to initialize thread private variables and where to store the final result of a reduction. Depending on your situation, you may need to write more or less code specialization for a custom reduction. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | Custom-Reductions-Built-In-Reducers 12 | 13 | To perform a common operation, such as finding the minimum for an intrinsic C++ type, no custom code is required. Kokkos::complex is also supported with Built-in reducers without any custom additions. Click the heading for more detail. 14 | 15 | .. toctree:: 16 | :maxdepth: 1 17 | 18 | Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types 19 | 20 | If your application requires a custom scalar types, the scalar type must be copy constructible and provide the necessary operators for the reduction (for example comparison operators are required for minmax-reductions). A specialization of the reduction_identity class is also required. Click the heading for more detail. 21 | 22 | .. toctree:: 23 | :maxdepth: 1 24 | 25 | Custom-Reductions-Custom-Reducers 26 | 27 | For completely arbitrary reductions, you must provide an implementation of a Reducer class. Click the heading for more detail and an example. 28 | -------------------------------------------------------------------------------- /docs/source/API/core/ParallelDispatch.rst: -------------------------------------------------------------------------------- 1 | Parallel Execution/Dispatch 2 | =========================== 3 | 4 | Parallel patterns 5 | ----------------- 6 | 7 | Parallel execution patterns for composing algorithms. 8 | 9 | .. list-table:: 10 | :widths: 25 75 11 | :header-rows: 1 12 | 13 | * - Function 14 | - Description 15 | * - `parallel_for `__ 16 | - Executes user code in parallel 17 | * - `parallel_reduce `__ 18 | - Executes user code to perform a reduction in parallel 19 | * - `parallel_scan `__ 20 | - Executes user code to generate a prefix sum in parallel 21 | * - `fence `__ 22 | - Fences execution spaces 23 | 24 | Tags for Team Policy Calculations 25 | --------------------------------- 26 | 27 | The following parallel pattern tags are used to call the correct overload for team size calculations (team_size_max,team_size_recommended): 28 | 29 | .. list-table:: 30 | :widths: 25 75 31 | :header-rows: 1 32 | 33 | * - Tag 34 | - Pattern 35 | * - `ParallelForTag `__ 36 | - parallel_for 37 | * - `ParallelReduceTag `__ 38 | - parallel_reduce 39 | * - `ParallelScanTag `__ 40 | - parallel_scan 41 | 42 | .. toctree:: 43 | :hidden: 44 | :maxdepth: 1 45 | 46 | ./parallel-dispatch/parallel_for 47 | ./parallel-dispatch/parallel_reduce 48 | ./parallel-dispatch/parallel_scan 49 | ./parallel-dispatch/fence 50 | ./parallel-dispatch/ParallelForTag 51 | ./parallel-dispatch/ParallelReduceTag 52 | ./parallel-dispatch/ParallelScanTag 53 | -------------------------------------------------------------------------------- /docs/source/API/core/c_style_memory_management/malloc.md: -------------------------------------------------------------------------------- 1 | # `kokkos_malloc` 2 | 3 | Defined in header `` 4 | 5 | ```c++ 6 | template 7 | void* kokkos_malloc(const std:string& label, size_t size); 8 | ``` 9 | 10 | ```c++ 11 | template 12 | void* kokkos_malloc(size_t size); 13 | ``` 14 | 15 | Allocate `size` bytes of uninitialized storage on the specified memory space [`MemorySpace`](../memory_spaces) plus some extra space for metadata such as the label. 16 | 17 | If allocation succeeds, returns a pointer to the lowest (first) byte in the allocated memory block that is suitably aligned for any scalar type. 18 | 19 | If allocation fails, an exception of type `Kokkos::Experimental::RawMemoryAllocationFailure` is thrown. 20 | 21 | WARNING: calling any function that manipulates the behavior of the memory (e.g. `memAdvise`) on memory managed by `Kokkos` results in undefined behavior. 22 | 23 | ## Parameters 24 | 25 | `label`: A user provided string which is used in profiling and debugging tools via the KokkosP Profiling Tools. 26 | `size`: The number of bytes to allocate. 27 | 28 | ## Template parameters 29 | 30 | * `MemorySpace`: Controls the storage location. If omitted the memory space of the default execution space is used (i.e. `Kokkos::DefaultExecutionSpace::memory_space`). 31 | 32 | ## Return value 33 | 34 | On success, returns the pointer to the beginning of newly allocated memory. 35 | To avoid a memory leak, the returned pointer must be deallocated with [`Kokkos::kokkos_free()`](free) or [`Kokkos::realloc()`](realloc). 36 | 37 | ## Exceptions 38 | 39 | On failure, throws `Kokkos::Experimental::RawMemoryAllocationFailure`. 40 | 41 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Testing-Processes.md: -------------------------------------------------------------------------------- 1 | # Kokkos Testing Processes and Change Process 2 | 3 | Kokkos testing falls into three categories: 4 | 5 | - Pull Request Testing 6 | - Nightly Testing 7 | - Integration Testing (Release Testing) 8 | 9 | ## Pull Request Testing 10 | 11 | All changes to Kokkos are introduced via pull requests against the github.com develop branch of Kokkos. 12 | In order to be merged two conditions must be met: 13 | 14 | 1) Automatic testing of the pull request must pass. 15 | 2) A Kokkos core developer must approve the pull request, after checking the changes for alignment with Kokkos developer standards. 16 | 17 | The tested configurations in Pull Request testing cover the major deployment systems 18 | and are executed via jenkins and travis at various institutions. 19 | Pull request testing also includes verification that the formatting meets 20 | the clang-format style specified in the repository. 21 | Test configurations are defined in the `kokkos/.jenkins` and `kokkos/.travis.yml` files. 22 | The clang-format style file is `kokkos/.clang-format`. 23 | 24 | ## Nightly Testing 25 | 26 | Nightly testing covers a wider range of compilers and configuration of Kokkos 27 | on an extensive list of platforms. 28 | Test configurations are given in `kokkos/scripts/testings/test_all_sandia`. 29 | Executing this script on the (in it) specified platforms will meet full testing requirements. 30 | Nightly tests are set up via Jenkins and execute this script in stages. 31 | 32 | ## Integration Testing (Release Testing) 33 | 34 | In order for a new Kokkos version to be released full integration testing is performed. 35 | A release is then formed by merging the Kokkos develop branch into its master branch, 36 | and creating a git tag with the version number. 37 | Details of the process are described in Testing Process Details. 38 | 39 | -------------------------------------------------------------------------------- /docs/source/testing-and-issue-tracking/Testing-Processes.md: -------------------------------------------------------------------------------- 1 | # Kokkos Testing Processes and Change Process 2 | 3 | Kokkos testing falls into three categories: 4 | 5 | - Pull Request Testing 6 | - Nightly Testing 7 | - Integration Testing (Release Testing) 8 | 9 | ## Pull Request Testing 10 | 11 | All changes to Kokkos are introduced via pull requests against the github.com develop branch of Kokkos. 12 | In order to be merged two conditions must be met: 13 | 14 | 1) Automatic testing of the pull request must pass. 15 | 2) A Kokkos core developer must approve the pull request, after checking the changes for alignment with Kokkos developer standards. 16 | 17 | The tested configurations in Pull Request testing cover the major deployment systems 18 | and are executed via jenkins and travis at various institutions. 19 | Pull request testing also includes verification that the formatting meets 20 | the clang-format style specified in the repository. 21 | Test configurations are defined in the `kokkos/.jenkins` and `kokkos/.travis.yml` files. 22 | The clang-format style file is `kokkos/.clang-format`. 23 | 24 | ## Nightly Testing 25 | 26 | Nightly testing covers a wider range of compilers and configuration of Kokkos 27 | on an extensive list of platforms. 28 | Test configurations are given in `kokkos/scripts/testings/test_all_sandia`. 29 | Executing this script on the (in it) specified platforms will meet full testing requirements. 30 | Nightly tests are set up via Jenkins and execute this script in stages. 31 | 32 | ## Integration Testing (Release Testing) 33 | 34 | In order for a new Kokkos version to be released full integration testing is performed. 35 | A release is then formed by merging the Kokkos develop branch into its master branch, 36 | and creating a git tag with the version number. 37 | Details of the process are described in Testing Process Details. 38 | -------------------------------------------------------------------------------- /docs/source/API/core/View.rst: -------------------------------------------------------------------------------- 1 | View and related 2 | ================ 3 | 4 | Data management is a critical part of any program. The main facility in Kokkos is the ``Kokkos::View``. 5 | The following facilities are available: 6 | 7 | .. list-table:: 8 | :widths: 25 75 9 | :header-rows: 1 10 | 11 | * - Class 12 | - Description 13 | * - `create_mirror[_view] `__ 14 | - Creating a copy of a ``Kokkos::View`` in a different memory space. 15 | * - `deep_copy() `__ 16 | - Copying data between views and scalars. 17 | * - `LayoutLeft `__ 18 | - Memory Layout matching Fortran. 19 | * - `LayoutRight `__ 20 | - Memory Layout matching C. 21 | * - `LayoutStride `__ 22 | - Memory Layout for arbitrary strides. 23 | * - `realloc `__ 24 | - Reallocating a ``Kokkos::View``. 25 | * - `resize `__ 26 | - Resizing a ``Kokkos::View``. 27 | * - `subview `__ 28 | - Getting slices from a ``Kokkos::View``. 29 | * - `View `__ 30 | - The main Kokkos data structure, a multidimensional memory space and layout aware array. 31 | * - `view_alloc() `__ 32 | - Create View allocation parameter bundle from argument list. 33 | * - `View-like Types `__ 34 | - Loosely defined as the set of class templates that behave like ``Kokkos::View``. 35 | 36 | .. toctree:: 37 | :hidden: 38 | :maxdepth: 1 39 | 40 | ./view/create_mirror 41 | ./view/deep_copy 42 | ./view/layoutLeft 43 | ./view/layoutRight 44 | ./view/layoutStride 45 | ./view/realloc 46 | ./view/resize 47 | ./view/subview 48 | ./view/Subview 49 | ./view/view 50 | ./view/view_alloc 51 | ./view/view_like 52 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/ExecutionPolicyConcept.md: -------------------------------------------------------------------------------- 1 | The concept of an `ExecutionPolicy` is the fundamental abstraction to represent "how" the execution of a Kokkos parallel pattern takes place. This page talks practically about how to *use* the common features of execution policies in Kokkos; for a more formal and theoretical treatment, see [this document](Kokkos-Concepts). 2 | 3 | > *Disclaimer*: There is nothing new about the term "concept" in C++; anyone who has ever used templates in C++ has used concepts whether they knew it or not. Please do not be confused by the word "concept" itself, which is now more often associated with a shiny new C++20 language feature. Here, "concept" just means "what you're allowed to do with a type that is a template parameter in certain places". 4 | 5 | What is an `ExecutionPolicy`? 6 | ============================= 7 | 8 | The dominant parallel dispatch mechanism in Kokkos, described [elsewhere in the programming guide](ParallelDispatch), involves a `parallel_pattern` (e.g., something like `Kokkos::parallel_for` or `Kokkos::parallel_reduce`), an `ExecutionPolicy`, and a `Functor`. In a hand-wavy sense: 9 | 10 | ```c++ 11 | parallel_pattern( 12 | ExecutionPolicy(), 13 | Functor() 14 | ); 15 | ``` 16 | 17 | The most basic ("beginner") case is actually a shortcut: 18 | 19 | ```c++ 20 | Kokkos::parallel_for( 21 | 42, 22 | KOKKOS_LAMBDA (int n) { /* ... */ } 23 | ); 24 | ``` 25 | 26 | is a "shortcut" for 27 | 28 | ```c++ 29 | Kokkos::parallel_for( 30 | Kokkos::RangePolicy( 31 | Kokkos::DefaultExecutionSpace(), 0, 42 32 | ), 33 | KOKKOS_LAMBDA(int n) { /* ... */ } 34 | ); 35 | ``` 36 | 37 | In this example, `Kokkos::RangePolicy` is the `ExecutionPolicy` type. 38 | 39 | Functionality 40 | ------------- 41 | 42 | All `ExecutionPolicy` types provide a nested type named `index_type`. 43 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Initialize-and-Finalize.md: -------------------------------------------------------------------------------- 1 | # Initialize and Finalize 2 | 3 | ## Kokkos::initialize 4 | 5 | Initializes Kokkos internal objects and all enabled Kokkos backends. 6 | 7 | See [Kokkos::initialize](Kokkos%3A%3Ainitialize) for details. 8 | 9 | 10 | ## Kokkos::finalize 11 | 12 | Shutdown Kokkos initialized execution spaces and release internally managed resources. 13 | 14 | See [Kokkos::finalize](Kokkos%3A%3Afinalize) for details. 15 | 16 | 17 | ## Kokkos::ScopeGuard 18 | 19 | `Kokkos::ScopeGuard` is a class which aggregates the resources managed by Kokkos. ScopeGuard will call `Kokkos::initialize` when constructed and `Kokkos::finalize` when destructed, thus the Kokkos context is automatically managed via the scope of the ScopeGuard object. 20 | 21 | See [Kokkos::ScopeGuard](Kokkos%3A%3AScopeGuard) for details. 22 | 23 | ScopeGuard aids in the following common mistake which is allowing Kokkos objects to live past `Kokkos::finalize`: 24 | ```c++ 25 | int main(int argc, char** argv) { 26 | Kokkos::initialize(argc, argv); 27 | Kokkos::View my_view("my_view", 10); 28 | Kokkos::finalize(); 29 | // my_view destructor called after Kokkos::finalize ! 30 | } 31 | ``` 32 | 33 | Switching to `Kokkos::ScopeGuard` fixes it: 34 | ```c++ 35 | int main(int argc, char** argv) { 36 | Kokkos::ScopeGuard kokkos(argc, argv); 37 | Kokkos::View my_view("my_view", 10); 38 | // my_view destructor called before Kokkos::finalize 39 | // ScopeGuard destructor called, calls Kokkos::finalize 40 | } 41 | ``` 42 | 43 | In the above example, `my_view` will not go out of scope until the end of the main() function. Without `ScopeGuard`, `Kokkos::finalize` will be called before `my_view` is out of scope. With `ScopeGuard`, `ScopeGuard` will be dereferenced (subsequently calling `Kokkos::finalize`) after `my_view` is dereferenced, which ensures the proper order during shutdown. 44 | -------------------------------------------------------------------------------- /docs/source/API/core/parallel-dispatch/fence.md: -------------------------------------------------------------------------------- 1 | # `fence()` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | 7 | ```c++ 8 | Kokkos::fence(); 9 | ``` 10 | 11 | Blocks on completion of all outstanding asynchronous Kokkos operations. 12 | That includes parallel dispatch (e.g. [parallel_for()](parallel_for), [parallel_reduce()](parallel_reduce) 13 | and [parallel_scan()](parallel_scan)) as well as asynchronous data operations such as three-argument [deep_copy](../view/deep_copy). 14 | 15 | Note: there is a execution space instance specific `fence` too: [ExecutionSpaceConcept](ExecutionSpaceConcept) 16 | 17 | ## Interface 18 | 19 | ```c++ 20 | void Kokkos::fence(); 21 | ``` 22 | 23 | ```c++ 24 | void Kokkos::fence(const std::string& label); 25 | ``` 26 | 27 | ### Parameters 28 | 29 | - `label`: A label to identify a specific fence in fence profiling operations. `label` does not have to be unique. 30 | 31 | ### Requirements 32 | 33 | - `Kokkos::fence()` cannot be called inside an existing parallel region (i.e. inside the `operator()` of a functor or lambda). 34 | 35 | ## Semantics 36 | 37 | - Blocks on completion of all outstanding asynchronous works. Side effects of outstanding work will be observable upon completion of the `fence` call - that means `Kokkos::fence()` implies a memory fence. 38 | 39 | ## Examples 40 | 41 | ### Timing kernels 42 | ```c++ 43 | Kokkos::Timer timer; 44 | // This operation is asynchronous, without a fence 45 | // one would time only the launch overhead 46 | Kokkos::parallel_for("Test", N, functor); 47 | Kokkos::fence(); 48 | double time = timer.seconds(); 49 | ``` 50 | 51 | ### Use with asynchronous deep copy 52 | 53 | ```c++ 54 | Kokkos::deep_copy(exec1, a,b); 55 | Kokkos::deep_copy(exec2, a,b); 56 | // do some stuff which doesn't touch a or b 57 | Kokkos::parallel_for("Test", N, functor); 58 | 59 | // wait for all three operations to finish 60 | Kokkos::fence(); 61 | 62 | // do something with a and b 63 | ``` 64 | -------------------------------------------------------------------------------- /docs/source/API/core/policies/ExecutionPolicyConcept.md: -------------------------------------------------------------------------------- 1 | # `ExecutionPolicy` 2 | 3 | The concept of an `ExecutionPolicy` is the fundamental abstraction to represent "how" the execution of a Kokkos parallel pattern takes place. This page talks practically about how to *use* the common features of execution policies in Kokkos; for a more formal and theoretical treatment, see [this document](../KokkosConcepts). 4 | 5 | > *Disclaimer*: There is nothing new about the term "concept" in C++; anyone who has ever used templates in C++ has used concepts whether they knew it or not. Please do not be confused by the word "concept" itself, which is now more often associated with a shiny new C++20 language feature. Here, "concept" just means "what you're allowed to do with a type that is a template parameter in certain places". 6 | 7 | ## What is an `ExecutionPolicy`? 8 | 9 | The dominant parallel dispatch mechanism in Kokkos, described [elsewhere in the programming guide](../../../ProgrammingGuide/ParallelDispatch), involves a `parallel_pattern` (e.g., something like [`Kokkos::parallel_for`](../parallel-dispatch/parallel_for) or [`Kokkos::parallel_reduce`](../parallel-dispatch/parallel_reduce)), an `ExecutionPolicy`, and a `Functor`. In a hand-wavy sense: 10 | 11 | ```c++ 12 | parallel_pattern( 13 | ExecutionPolicy(), 14 | Functor() 15 | ); 16 | ``` 17 | 18 | The most basic ("beginner") case is actually a shortcut: 19 | 20 | ```c++ 21 | Kokkos::parallel_for( 22 | 42, 23 | KOKKOS_LAMBDA (int n) { /* ... */ } 24 | ); 25 | ``` 26 | 27 | is a "shortcut" for 28 | 29 | ```c++ 30 | Kokkos::parallel_for( 31 | Kokkos::RangePolicy( 32 | Kokkos::DefaultExecutionSpace(), 0, 42 33 | ), 34 | KOKKOS_LAMBDA(int n) { /* ... */ } 35 | ); 36 | ``` 37 | 38 | In this example, `Kokkos::RangePolicy` is the `ExecutionPolicy` type. 39 | 40 | ### Functionality 41 | 42 | All `ExecutionPolicy` types provide a nested type named `index_type`. 43 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::ScopeGuard.md: -------------------------------------------------------------------------------- 1 | # Kokkos::ScopeGuard 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | Kokkos::ScopeGuard(narg, arg); 8 | Kokkos::ScopeGuard(args); 9 | ``` 10 | 11 | `ScopeGuard` is a class which ensure that `Kokkos::initialize` and 12 | `Kokkos::finalize` are called correctly even in the presence of unhandled 13 | exceptions and multiple libraries trying to "own" Kokkos initialization. 14 | `ScopeGuard` calls `Kokkos::initialize` in its constructor only if 15 | `Kokkos::is_initialized()` is false, and calls `Kokkos::finalize` in its 16 | destructor only if it called `Kokkos::initialize` in its constructor. 17 | 18 | ## Interface 19 | 20 | ```cpp 21 | Kokkos::ScopeGuard(int& narg, char* arg[]); 22 | ``` 23 | 24 | ```cpp 25 | Kokkos::ScopeGuard(const InitArguments& args); 26 | ``` 27 | 28 | ```cpp 29 | ~ScopeGuard(); 30 | ``` 31 | 32 | 33 | ### Parameters: 34 | 35 | * narg: number of command line arguments 36 | * arg: array of command line arguments, valid arguments are listed below. 37 | * args: structure of valid Kokkos arguments 38 | 39 | Note that all of the parameters above are passed to the `Kokkos::initialize` called internally. See [Kokkos::initialize](Kokkos%3A%3Ainitialize) for more details. 40 | 41 | ### Requirements 42 | * `Kokkos::ScopeGuard` object should be constructed before user initiated Kokkos objects 43 | 44 | ### Semantics 45 | * Calls `Kokkos::initialize` only if `Kokkos::is_initialized()` is false. 46 | * Arguments are passed directly to `Kokkos::initialize` if it is called. 47 | * Kokkos::ScopeGuard::~ScopeGuard calls `Kokkos::finalize` only if the constructor of this object called `Kokkos::initialize`. 48 | 49 | ### Example 50 | 51 | 52 | ```c++ 53 | int main(int argc, char** argv) { 54 | Kokkos::ScopeGuard kokkos(argc, argv); 55 | Kokkos::View my_view("my_view", 10); 56 | // my_view destructor called before Kokkos::finalize 57 | // ScopeGuard destructor called, calls Kokkos::finalize 58 | } 59 | ``` 60 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Data-Parallelism.md: -------------------------------------------------------------------------------- 1 | ## Parallel patterns 2 | 3 | Parallel execution patterns for composing algorithms. 4 | 5 | |Function |Description | 6 | |:---------|:----------------------------| 7 | |[parallel_for](Kokkos%3A%3Aparallel_for) | Executes user code in parallel | 8 | |[parallel_reduce](Kokkos%3A%3Aparallel_reduce) | Executes user code to perform a reduction in parallel | 9 | |[parallel_scan](Kokkos%3A%3Aparallel_scan) | Executes user code to generate a prefix sum in parallel | 10 | |[fence](Kokkos%3A%3Afence) | Fences execution spaces | 11 | 12 | ## Built-in Reducers 13 | 14 | Reducer objects used in conjunction with [parallel_reduce](Kokkos%3A%3Aparallel_reduce). 15 | 16 | |Reducer |Description | 17 | |:---------|:----------------------------| 18 | |[BAnd](Kokkos%3A%3ABAnd) | Binary 'And' reduction | 19 | |[BOr](Kokkos%3A%3ABOr) | Binary 'Or' reduction | 20 | |[LAnd](Kokkos%3A%3ALAnd) | Logical 'And' reduction | 21 | |[LOr](Kokkos%3A%3ALOr) | Logical 'Or' reduction | 22 | |[Max](Kokkos%3A%3AMax) | Maximum reduction | 23 | |[MaxLoc](Kokkos%3A%3AMaxLoc) | Reduction providing maximum and an associated index | 24 | |[Min](Kokkos%3A%3AMin) | Minimum reduction | 25 | |[MinLoc](Kokkos%3A%3AMinLoc) | Reduction providing minimum and an associated index | 26 | |[MinMax](Kokkos%3A%3AMinMax) | Reduction providing both minimum and maximum | 27 | |[MinMaxLoc](Kokkos%3A%3AMinMaxLoc) | Reduction providing both minimum and maximum and associated indices | 28 | |[Prod](Kokkos%3A%3AProd) | Multiplicative reduction | 29 | |[Sum](Kokkos%3A%3ASum) | Sum reduction | 30 | 31 | ## Tags for Team Policy Calculations 32 | 33 | The following parallel pattern tags are used to call the correct overload for team size calculations (`team_size_max`,`team_size_recommended`): 34 | 35 | |Tag|pattern 36 | |:--------------|:----------------- 37 | [ParallelForTag](ParallelForTag)|parallel\_for 38 | [ParallelReduceTag](ParallelReduceTag)|parallel\_reduce 39 | [ParallelScanTag](ParallelScanTag)|parallel\_scan 40 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::fence.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::fence` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | 7 | ```c++ 8 | Kokkos::fence(); 9 | ``` 10 | 11 | Blocks on completion of all outstanding asynchronous Kokkos operations. 12 | That includes parallel dispatch (e.g. [parallel_for](Kokkos%3A%3Aparallel_for), [parallel_reduce](Kokkos%3A%3Aparallel_reduce) 13 | and [parallel_scan](Kokkos%3A%3Aparallel_scan)) as well as asynchronous data operations such as three-argument [deep_copy](Kokkos%3A%3Adeep_copy). 14 | 15 | Note: there is a execution space instance specific `fence` too: [ExecutionSpaceConcept](Kokkos%3A%3AExecutionSpaceConcept) 16 | 17 | ## Interface 18 | 19 | ```c++ 20 | void Kokkos::fence(); 21 | ``` 22 | 23 | ```c++ 24 | void Kokkos::fence(const std::string& label); 25 | ``` 26 | 27 | ### Parameters 28 | 29 | - `label`: A label to identify a specific fence in fence profiling operations. `label` does not have to be unique. 30 | 31 | ### Requirements 32 | 33 | - `Kokkos::fence()` cannot be called inside an existing parallel region (i.e. inside the `operator()` of a functor or lambda). 34 | 35 | ## Semantics 36 | 37 | - Blocks on completion of all outstanding asynchronous works. Side effects of outstanding work will be observable upon completion of the `fence` call - that means `Kokkos::fence()` implies a memory fence. 38 | 39 | ## Examples 40 | 41 | ### Timing kernels 42 | ```cpp 43 | Kokkos::Timer timer; 44 | // This operation is asynchronous, without a fence 45 | // one would time only the launch overhead 46 | Kokkos::parallel_for("Test", N, functor); 47 | Kokkos::fence(); 48 | double time = timer.seconds(); 49 | ``` 50 | 51 | ### Use with asynchronous deep copy 52 | 53 | ```cpp 54 | Kokkos::deep_copy(exec1, a,b); 55 | Kokkos::deep_copy(exec2, a,b); 56 | // do some stuff which doesn't touch a or b 57 | Kokkos::parallel_for("Test", N, functor); 58 | 59 | // wait for all three operations to finish 60 | Kokkos::fence(); 61 | 62 | // do something with a and b 63 | ``` 64 | 65 | 66 | 67 | ~ 68 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdReverse.md: -------------------------------------------------------------------------------- 1 | 2 | # `reverse` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | void reverse(const ExecutionSpace& exespace, (1) 12 | IteratorType first, IteratorType last); 13 | 14 | template 15 | void reverse(const std::string& label, const ExecutionSpace& exespace, (2) 16 | IteratorType first, IteratorType last); 17 | 18 | template 19 | void reverse(const ExecutionSpace& exespace, (3) 20 | const Kokkos::View& view); 21 | 22 | template 23 | void reverse(const std::string& label, const ExecutionSpace& exespace, (4) 24 | const Kokkos::View& view); 25 | 26 | } //end namespace Experimental 27 | } //end namespace Kokkos 28 | ``` 29 | 30 | ## Description 31 | 32 | Reverses ther order of the elements in the range `[first, last)` (overloads 1,2) 33 | or in `view` (overloads 3,4). 34 | 35 | 36 | ## Parameters and Requirements 37 | 38 | - `exespace`: 39 | - execution space instance 40 | - `label`: 41 | - used to name the implementation kernels for debugging purposes 42 | - for 1, the default string is: "Kokkos::reverse_iterator_api_default" 43 | - for 3, the default string is: "Kokkos::reverse_view_api_default" 44 | - `first, last`: 45 | - range of elements to reverse 46 | - must be *random access iterators* 47 | - must represent a valid range, i.e., `last >= first` (this condition is checked in debug mode) 48 | - must be accessible from `exespace` 49 | - `view`: 50 | - must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 51 | - must be accessible from `exespace` 52 | 53 | 54 | ## Return 55 | 56 | None -------------------------------------------------------------------------------- /docs/source/API/core/builtin_reducers.rst: -------------------------------------------------------------------------------- 1 | Built-in Reducers 2 | ================= 3 | 4 | `ReducerConcept `__ provides the concept for Reducers. 5 | 6 | Reducer objects used in conjunction with `parallel_reduce `__ 7 | 8 | .. list-table:: 9 | :widths: 25 75 10 | :header-rows: 1 11 | 12 | * - Reducer 13 | - Description 14 | * - `BAnd `__ 15 | - Binary 'And' reduction 16 | * - `BOr `__ 17 | - Binary 'Or' reduction 18 | * - `LAnd `__ 19 | - Logical 'And' reduction 20 | * - `LOr `__ 21 | - Logical 'Or' reduction 22 | * - `Max `__ 23 | - Maximum reduction 24 | * - `MaxLoc `__ 25 | - Reduction providing maximum and an associated index 26 | * - `Min `__ 27 | - Minimum reduction 28 | * - `MinLoc `__ 29 | - Reduction providing minimum and an associated index 30 | * - `MinMax `__ 31 | - Reduction providing both minimum and maximum 32 | * - `MinMaxLoc `__ 33 | - Reduction providing both minimum and maximum and associated indices 34 | * - `Prod `__ 35 | - Multiplicative reduction 36 | * - `Sum `__ 37 | - Sum reduction 38 | 39 | `Reduction Scalar Types `__ are template classes for storage for reducers. 40 | 41 | .. toctree:: 42 | :hidden: 43 | :maxdepth: 1 44 | 45 | ./builtinreducers/ReducerConcept 46 | ./builtinreducers/BAnd 47 | ./builtinreducers/BOr 48 | ./builtinreducers/LAnd 49 | ./builtinreducers/LOr 50 | ./builtinreducers/Max 51 | ./builtinreducers/MaxLoc 52 | ./builtinreducers/Min 53 | ./builtinreducers/MinLoc 54 | ./builtinreducers/MinMax 55 | ./builtinreducers/MinMaxLoc 56 | ./builtinreducers/Prod 57 | ./builtinreducers/Sum 58 | ./builtinreducers/ReductionScalarTypes 59 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdShiftRight.md: -------------------------------------------------------------------------------- 1 | 2 | # `shift_right` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | IteratorType shift_right(const ExecutionSpace& exespace, (1) 12 | IteratorType first, 13 | IteratorType last, 14 | typename IteratorType::difference_type n); 15 | 16 | template 17 | IteratorType shift_right(const std::string& label, (2) 18 | const ExecutionSpace& exespace, 19 | IteratorType first, IteratorType last, 20 | typename IteratorType::difference_type n); 21 | 22 | template 23 | auto shift_right(const ExecutionSpace& exespace, (3) 24 | const ::Kokkos::View& view, 25 | typename decltype(begin(view))::difference_type n); 26 | 27 | template 28 | auto shift_right(const std::string& label, (4) 29 | const ExecutionSpace& exespace, 30 | const ::Kokkos::View& view, 31 | typename decltype(begin(view))::difference_type n); 32 | 33 | } //end namespace Experimental 34 | } //end namespace Kokkos 35 | ``` 36 | ## Description 37 | 38 | Shifts the elements in the range `[first, last)` or in `view` 39 | by `n` positions towards the end of the range or the view. 40 | 41 | ## Parameters and Requirements 42 | 43 | - `exespace`, `first`, `last`, `view`: same as in [`shift_left`](./StdShiftLeft) 44 | - `label`: 45 | - for 1, the default string is: "Kokkos::shift_right_iterator_api_default" 46 | - for 3, the default string is: "Kokkos::shift_right_view_api_default" 47 | - `n`: 48 | - the number of positions to shift 49 | - must be non-negative 50 | 51 | ## Return 52 | 53 | The beginning of the resulting range. If `n` is less than `last - first`, 54 | returns `first + n`. Otherwise, returns `last`. 55 | -------------------------------------------------------------------------------- /docs/source/citation.rst: -------------------------------------------------------------------------------- 1 | Citing Kokkos 2 | ============= 3 | 4 | .. highlight:: none 5 | 6 | :: 7 | 8 | @article{9485033, 9 | author={Trott, Christian R. and Lebrun-Grandié, Damien and Arndt, Daniel and Ciesko, Jan and Dang, Vinh and Ellingwood, Nathan and Gayatri, Rahulkumar and Harvey, Evan and Hollman, Daisy S. and Ibanez, Dan and Liber, Nevin and Madsen, Jonathan and Miles, Jeff and Poliakoff, David and Powell, Amy and Rajamanickam, Sivasankaran and Simberg, Mikael and Sunderland, Dan and Turcksin, Bruno and Wilke, Jeremiah}, 10 | journal={IEEE Transactions on Parallel and Distributed Systems}, 11 | title={Kokkos 3: Programming Model Extensions for the Exascale Era}, 12 | year={2022}, 13 | volume={33}, 14 | number={4}, 15 | pages={805-817}, 16 | doi={10.1109/TPDS.2021.3097283}} 17 | 18 | 19 | If you use more than one Kokkos EcoSystem package, please also cite: 20 | 21 | :: 22 | 23 | @article{9502936, 24 | author={Trott, Christian and Berger-Vergiat, Luc and Poliakoff, David and Rajamanickam, Sivasankaran and Lebrun-Grandie, Damien and Madsen, Jonathan and Al Awar, Nader and Gligoric, Milos and Shipman, Galen and Womeldorff, Geoff}, 25 | journal={Computing in Science Engineering}, 26 | title={The Kokkos EcoSystem: Comprehensive Performance Portability for High Performance Computing}, 27 | year={2021}, 28 | volume={23}, 29 | number={5}, 30 | pages={10-18}, 31 | doi={10.1109/MCSE.2021.3098509}} 32 | 33 | 34 | And if you feel generous: feel free to cite the original Kokkos paper which describes most of the basic Kokkos concepts: 35 | 36 | :: 37 | 38 | @article{CarterEdwards20143202, 39 | title = "Kokkos: Enabling manycore performance portability through polymorphic memory access patterns ", 40 | journal = "Journal of Parallel and Distributed Computing ", 41 | volume = "74", 42 | number = "12", 43 | pages = "3202 - 3216", 44 | year = "2014", 45 | note = "Domain-Specific Languages and High-Level Frameworks for High-Performance Computing ", 46 | issn = "0743-7315", 47 | doi = "https://doi.org/10.1016/j.jpdc.2014.07.003", 48 | url = "http://www.sciencedirect.com/science/article/pii/S0743731514001257", 49 | author = "H. Carter Edwards and Christian R. Trott and Daniel Sunderland" 50 | } 51 | -------------------------------------------------------------------------------- /docs/source/hacks.css: -------------------------------------------------------------------------------- 1 | /* 2 | * CSS hacks and small modification for my Sphinx website 3 | * :copyright: Copyright 2013-2016 Lilian Besson 4 | * :license: GPLv3, see LICENSE for details. 5 | */ 6 | 7 | 8 | /* Colors and text decoration. 9 | For example, :black:`text in black` or :blink:`text blinking` in rST. */ 10 | 11 | .black { 12 | color: black; 13 | } 14 | 15 | .gray { 16 | color: gray; 17 | } 18 | 19 | .grey { 20 | color: gray; 21 | } 22 | 23 | .silver { 24 | color: silver; 25 | } 26 | 27 | .white { 28 | color: white; 29 | } 30 | 31 | .maroon { 32 | color: maroon; 33 | } 34 | 35 | .red { 36 | color: red; 37 | } 38 | 39 | .magenta { 40 | color: magenta; 41 | } 42 | 43 | .fuchsia { 44 | color: fuchsia; 45 | } 46 | 47 | .pink { 48 | color: pink; 49 | } 50 | 51 | .orange { 52 | color: orange; 53 | } 54 | 55 | .yellow { 56 | color: yellow; 57 | } 58 | 59 | .lime { 60 | color: lime; 61 | } 62 | 63 | .green { 64 | color: green; 65 | } 66 | 67 | .olive { 68 | color: olive; 69 | } 70 | 71 | .teal { 72 | color: teal; 73 | } 74 | 75 | .cyan { 76 | color: cyan; 77 | } 78 | 79 | .aqua { 80 | color: aqua; 81 | } 82 | 83 | .blue { 84 | color: blue; 85 | } 86 | 87 | .navy { 88 | color: navy; 89 | } 90 | 91 | .purple { 92 | color: purple; 93 | } 94 | 95 | .under { 96 | text-decoration: underline; 97 | } 98 | 99 | .over { 100 | text-decoration: overline; 101 | } 102 | 103 | .blink { 104 | text-decoration: blink; 105 | } 106 | 107 | .line { 108 | text-decoration: line-through; 109 | } 110 | 111 | .strike { 112 | text-decoration: line-through; 113 | } 114 | 115 | .it { 116 | font-style: italic; 117 | } 118 | 119 | .ob { 120 | font-style: oblique; 121 | } 122 | 123 | .small { 124 | font-size: small; 125 | } 126 | 127 | .medium { 128 | font-size: medium; 129 | } 130 | 131 | .large { 132 | font-size: large; 133 | } 134 | 135 | .smallpar { 136 | font-size: small; 137 | } 138 | 139 | .packnameindexpage { 140 | font-size: large; 141 | color: yellowgreen; 142 | } 143 | 144 | .summarylineindexpage { 145 | font-size: large; 146 | font-style: italic; 147 | color: olive; 148 | } 149 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Requirements-Issues-and-Feedback.md: -------------------------------------------------------------------------------- 1 | # Requirements, Issues and Feedback 2 | 3 | Kokkos manages its customer interactions primarily via [Kokkos Issues](https://github.com/kokkos/kokkos/issues) and the [KokkosTeam Slack](kokkosteam.slack.com) channel. The Slack channel is used for informal questions, requests and feedback. 4 | If the slack communication requires tracking, (especially if it requires code changes to Kokkos) 5 | a github.com issue will be opened. 6 | Issues must be opened for bug reports, enhancement requests and feature requests. 7 | Prioritization of issues is performed during the the weekly Kokkos developer meeting. 8 | 9 | ## Requirements 10 | 11 | Customer requirements for new capabilities and improvements for existing capabilities are tracked via github.com issues. 12 | Issues are assigned to a milestone roughly corresponding with a release cycle based on prioritization by the Kokkos team and after considering the customer needs. 13 | They are also assigned to a Kokkos developer, who will be responsible to communicate with the customer 14 | to determine the details of the requirement. 15 | To successfully satisfy a new requirement it must be implemented, appropriate unit and performance 16 | tests must be written and the customer must agree his needs are met. 17 | 18 | ## Reporting an Issue 19 | 20 | Problems with Kokkos both in correctness and performance are tracked via bug issues and sometimes via enhancement requests. 21 | The Kokkos team will assign a developer as response partner, and track progress on a resolution in the github issue. 22 | After assessing the severity and expected developer time the issue will be slotted into the priority list and assigned to a milestone. 23 | Bug reports require implementation of a unit test which can reproduce the issue prior to applying a fix. 24 | This shall be documented in the issue. 25 | 26 | ## Feedback 27 | 28 | Feedback can be provided on the slack channel or in issues. 29 | The Kokkos team will assess whether the feedback requires actions for improvement on the Kokkos side 30 | and if so create the corresponding github issues. 31 | Furthermore every two years a Kokkos usergroup meeting will be organized to provide customers with a platform to discuss Kokkos issues, provide feedback and contribute to the priority list of the Kokkos project. 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdGenerate_n.md: -------------------------------------------------------------------------------- 1 | 2 | # `generate_n` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | IteratorType generate_n(const ExecutionSpace& exespace, (1) 12 | IteratorType first, SizeType n, 13 | GeneratorType g); 14 | 15 | template 16 | IteratorType generate_n(const std::string& label, 17 | const ExecutionSpace& exespace, (2) 18 | IteratorType first, SizeType n, 19 | GeneratorType g); 20 | 21 | template < 22 | class ExecutionSpace, class DataType, class... Properties, class SizeType, class GeneratorType 23 | > 24 | auto generate_n(const ExecutionSpace& exespace, (3) 25 | const Kokkos::View& view, 26 | SizeType n, GeneratorType g); 27 | 28 | template < 29 | class ExecutionSpace, class DataType, class... Properties, class SizeType, class GeneratorType 30 | > 31 | auto generate_n(const std::string& label, (4) 32 | const ExecutionSpace& exespace, 33 | const Kokkos::View& view, 34 | SizeType n, GeneratorType g); 35 | 36 | } //end namespace Experimental 37 | } //end namespace Kokkos 38 | ``` 39 | 40 | ## Description 41 | 42 | Assigns the value generated by the functor `g` to the first `n` elements 43 | starting at `first` (overloads 1,2) or the first `n` elements in `view` (overloads 3,4). 44 | 45 | ## Parameters and Requirements 46 | 47 | - `exespace`, `first`, `view`, `g`: same as `generate` 48 | - `label`: 49 | - for 1, the default string is: "Kokkos::generate_n_iterator_api_default" 50 | - for 3, the default string is: "Kokkos::generate_n_view_api_default" 51 | - `n`: 52 | - number of elements to modify (must be non-negative) 53 | 54 | ## Return 55 | 56 | If `n>0`, returns an iterator to the element *after* the last element modified. 57 | 58 | Otherwise, returns `first` (for 1,2) or `Kokkos::begin(view)` (for 3,4). 59 | -------------------------------------------------------------------------------- /docs/source/testing-and-issue-tracking/Requirements-Issues-and-Feedback.md: -------------------------------------------------------------------------------- 1 | # Requirements, Issues and Feedback 2 | 3 | Kokkos manages its customer interactions primarily via [Kokkos Issues](https://github.com/kokkos/kokkos/issues) and the [KokkosTeam Slack](https://kokkosteam.slack.com) channel. The Slack channel is used for informal questions, requests and feedback. 4 | If the slack communication requires tracking, (especially if it requires code changes to Kokkos) 5 | a github.com issue will be opened. 6 | Issues must be opened for bug reports, enhancement requests and feature requests. 7 | Prioritization of issues is performed during the weekly Kokkos developer meeting. 8 | 9 | ## Requirements 10 | 11 | Customer requirements for new capabilities and improvements for existing capabilities are tracked via github.com issues. 12 | Issues are assigned to a milestone roughly corresponding with a release cycle based on prioritization by the Kokkos team and after considering the customer needs. 13 | They are also assigned to a Kokkos developer, who will be responsible to communicate with the customer 14 | to determine the details of the requirement. 15 | To successfully satisfy a new requirement it must be implemented, appropriate unit and performance 16 | tests must be written and the customer must agree his needs are met. 17 | 18 | ## Reporting an Issue 19 | 20 | Problems with Kokkos both in correctness and performance are tracked via bug issues and sometimes via enhancement requests. 21 | The Kokkos team will assign a developer as response partner, and track progress on a resolution in the github issue. 22 | After assessing the severity and expected developer time the issue will be slotted into the priority list and assigned to a milestone. 23 | Bug reports require implementation of a unit test which can reproduce the issue prior to applying a fix. 24 | This shall be documented in the issue. 25 | 26 | ## Feedback 27 | 28 | Feedback can be provided on the slack channel or in issues. 29 | The Kokkos team will assess whether the feedback requires actions for improvement on the Kokkos side 30 | and if so create the corresponding github issues. 31 | Furthermore every two years a Kokkos usergroup meeting will be organized to provide customers with a platform to discuss Kokkos issues, provide feedback and contribute to the priority list of the Kokkos project. 32 | -------------------------------------------------------------------------------- /docs/source/license.rst: -------------------------------------------------------------------------------- 1 | License 2 | ======= 3 | 4 | .. highlight:: none 5 | 6 | :: 7 | 8 | //@HEADER 9 | // ************************************************************************ 10 | // 11 | // Kokkos v. 3.0 12 | // Copyright (2020) National Technology & Engineering 13 | // Solutions of Sandia, LLC (NTESS). 14 | // 15 | // Under the terms of Contract DE-NA0003525 with NTESS, 16 | // the U.S. Government retains certain rights in this software. 17 | // 18 | // Kokkos is licensed under 3-clause BSD terms of use: 19 | // 20 | // Redistribution and use in source and binary forms, with or without 21 | // modification, are permitted provided that the following conditions are 22 | // met: 23 | // 24 | // 1. Redistributions of source code must retain the above copyright 25 | // notice, this list of conditions and the following disclaimer. 26 | // 27 | // 2. Redistributions in binary form must reproduce the above copyright 28 | // notice, this list of conditions and the following disclaimer in the 29 | // documentation and/or other materials provided with the distribution. 30 | // 31 | // 3. Neither the name of the Corporation nor the names of the 32 | // contributors may be used to endorse or promote products derived from 33 | // this software without specific prior written permission. 34 | // 35 | // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY 36 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE 39 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 40 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 41 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 42 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 43 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 44 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 45 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | // 47 | // Questions? Contact Christian R. Trott (crtrott@sandia.gov) 48 | // 49 | // ************************************************************************ 50 | //@HEADER 51 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdPartitionPoint.md: -------------------------------------------------------------------------------- 1 | 2 | # `partition_point` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | IteratorType partition_point(const ExecutionSpace& exespace, (1) 12 | IteratorType first, IteratorType last, 13 | PredicateType pred); 14 | 15 | template 16 | IteratorType partition_point(const std::string& label, (2) 17 | const ExecutionSpace& exespace, 18 | IteratorType first, IteratorType last, 19 | PredicateType pred); 20 | 21 | template 22 | auto partition_point(const ExecutionSpace& exespace, 23 | const ::Kokkos::View& view, (3) 24 | PredicateType pred); 25 | 26 | template 27 | auto partition_point(const std::string& label, (4) 28 | const ExecutionSpace& exespace, 29 | const ::Kokkos::View& view, 30 | PredicateType pred); 31 | 32 | } //end namespace Experimental 33 | } //end namespace Kokkos 34 | ``` 35 | 36 | ## Description 37 | 38 | Examines the range `[first, last)` or `view` and locates the 39 | first element that does not satisfy `pred`. 40 | 41 | Assumes the range (or the view) already to be partitioned. 42 | 43 | 44 | ## Parameters and Requirements 45 | 46 | - `exespace`, `first`, `last`, `view`, `pred`: same as in [`is_partioned`](./StdIsPartitioned) 47 | - execution space instance 48 | - `label`: 49 | - used to name the implementation kernels for debugging purposes 50 | - for 1, the default string is: "Kokkos::partition_point_iterator_api_default" 51 | - for 3, the default string is: "Kokkos::partition_point_view_api_default" 52 | 53 | ## Return 54 | 55 | Iterator to the elment *after* the last element in the first partition, 56 | or `last` if all elements satisfy `pred`. -------------------------------------------------------------------------------- /docs/source/API/core/Initialize-and-Finalize.rst: -------------------------------------------------------------------------------- 1 | Initialize and Finalize 2 | ======================= 3 | 4 | Kokkos::initialize 5 | ------------------ 6 | 7 | Initializes Kokkos internal objects and all enabled Kokkos backends. 8 | 9 | See `Kokkos::initialize `_ for details. 10 | 11 | 12 | Kokkos::finalize 13 | ---------------- 14 | 15 | Shutdown Kokkos initialized execution spaces and release internally managed resources. 16 | 17 | See `Kokkos::finalize `_ for details. 18 | 19 | 20 | Kokkos::ScopeGuard 21 | ------------------ 22 | 23 | ``Kokkos::ScopeGuard`` is a class which aggregates the resources managed by Kokkos. ScopeGuard will call ``Kokkos::initialize`` when constructed and ``Kokkos::finalize`` when destructed, thus the Kokkos context is automatically managed via the scope of the ScopeGuard object. 24 | 25 | See `Kokkos::ScopeGuard `_ for details. 26 | 27 | ScopeGuard aids in the following common mistake which is allowing Kokkos objects to live past ``Kokkos::finalize``: 28 | 29 | .. code-block:: cpp 30 | 31 | int main(int argc, char** argv) { 32 | Kokkos::initialize(argc, argv); 33 | Kokkos::View my_view("my_view", 10); 34 | Kokkos::finalize(); 35 | // my_view destructor called after Kokkos::finalize ! 36 | } 37 | 38 | Switching to ``Kokkos::ScopeGuard`` fixes it: 39 | 40 | .. code-block:: cpp 41 | 42 | int main(int argc, char** argv) { 43 | Kokkos::ScopeGuard kokkos(argc, argv); 44 | Kokkos::View my_view("my_view", 10); 45 | // my_view destructor called before Kokkos::finalize 46 | // ScopeGuard destructor called, calls Kokkos::finalize 47 | } 48 | 49 | In the above example, ``my_view`` will not go out of scope until the end of the main() function. Without ``ScopeGuard``, ``Kokkos::finalize`` will be called before ``my_view`` is out of scope. With ``ScopeGuard``, ``ScopeGuard`` will be dereferenced (subsequently calling ``Kokkos::finalize``) after ``my_view`` is dereferenced, which ensures the proper order during shutdown. 50 | 51 | .. toctree:: 52 | :hidden: 53 | :maxdepth: 1 54 | 55 | ./initialize_finalize/initialize 56 | ./initialize_finalize/finalize 57 | ./initialize_finalize/ScopeGuard 58 | ./initialize_finalize/InitializationSettings 59 | ./initialize_finalize/InitArguments 60 | -------------------------------------------------------------------------------- /docs/source/API/core-index.rst: -------------------------------------------------------------------------------- 1 | API: Core 2 | ######### 3 | 4 | .. list-table:: 5 | :widths: 20 80 6 | :header-rows: 1 7 | 8 | * - Reducer 9 | - Description 10 | * - `Initialization and Finalization `__ 11 | - Initialization and finalization of Kokkos. 12 | * - `View and related `__ 13 | - Kokkos MultiDimensional View class and related free functions. 14 | * - `Parallel Execution/Dispatch `__ 15 | - Parallel Execution Dispatch. 16 | * - `Built-in Reducers `__ 17 | - Built-in Reducers 18 | * - `Execution Policies `__ 19 | - Execution policies. 20 | * - `Spaces `__ 21 | - Description of Memory and Execution Spaces. 22 | * - `Task-Parallelism `__ 23 | - Creating and dispatching Task Graphs. 24 | * - `Atomics `__ 25 | - Atomics 26 | * - `Numerics `__ 27 | - Common mathematical functions, mathematical constants, numeric traits. 28 | * - `C-style memory management `__ 29 | - C-style memory management 30 | * - `Traits `__ 31 | - Traits 32 | * - `Kokkos Concepts `__ 33 | - Kokkos Concepts 34 | * - `STL Compatibility Issues `__ 35 | - Ports of standard C++ capabilities, which otherwise do not work on various hardware platforms. 36 | * - `Utilities `__ 37 | - Utility functionality part of Kokkos Core. 38 | * - `Detection Idiom `__ 39 | - Used to recognize, in an SFINAE-friendly way, the validity of any C++ expression. 40 | * - `Macros `__ 41 | - Global macros defined by Kokkos, used for architectures, general settings, etc. 42 | 43 | .. toctree:: 44 | :hidden: 45 | :maxdepth: 1 46 | 47 | ./core/Initialize-and-Finalize 48 | ./core/View 49 | ./core/ParallelDispatch 50 | ./core/builtin_reducers 51 | ./core/Execution-Policies 52 | ./core/Spaces 53 | ./core/Task-Parallelism 54 | ./core/atomics 55 | ./core/Numerics 56 | ./core/c_style_memory_management 57 | ./core/Traits 58 | ./core/KokkosConcepts 59 | ./core/STL-Compatibility 60 | ./core/Utilities 61 | ./core/Detection-Idiom 62 | ./core/Macros 63 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdMoveBackward.md: -------------------------------------------------------------------------------- 1 | 2 | # `move_backward` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | OutputIterator move_backward(const ExecutionSpace& exespace, (1) 12 | InputIterator first_from, 13 | InputIterator last_from, 14 | OutputIterator first_to); 15 | 16 | template 17 | OutputIterator move_backward(const std::string& label, (2) 18 | const ExecutionSpace& exespace, 19 | InputIterator first_from, 20 | InputIterator last_from, 21 | OutputIterator first_to); 22 | 23 | template < 24 | class ExecutionSpace, 25 | class DataType1, class... Properties1, 26 | class DataType2, class... Properties2 27 | > 28 | auto move_backward(const ExecutionSpace& exespace, (3) 29 | const Kokkos::View& source, 30 | Kokkos::View& dest); 31 | 32 | template < 33 | class ExecutionSpace, 34 | class DataType1, class... Properties1, 35 | class DataType2, class... Properties2 36 | > 37 | auto move_backward(const std::string& label, (4) 38 | const ExecutionSpace& exespace, 39 | const Kokkos::View& source, 40 | Kokkos::View& dest); 41 | 42 | } //end namespace Experimental 43 | } //end namespace Kokkos 44 | ``` 45 | 46 | ## Description 47 | 48 | - Overloads 1,2: moves the elements from the range `[first_from, last_from)` 49 | in reverse order to the range beginning at `first_to` 50 | 51 | - Overloads 3,4: moves the elements from `source` view in reverse order to `dest` view 52 | 53 | 54 | ## Parameters and Requirements 55 | 56 | - `exespace`, `first_from`, `last_from`, `source`, `dest`: same as `Kokkos::Experimental::move` 57 | - `label`: 58 | - for 1, the default string is: "Kokkos::move_backward_iterator_api_default" 59 | - for 3, the default string is: "Kokkos::move_backward_view_api_default" 60 | 61 | ## Return 62 | 63 | Iterator to the element *after* the last element moved. 64 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Random-Number.md: -------------------------------------------------------------------------------- 1 | #### headers: Kokkos_Core.hpp, Kokkos_Complex.hpp 2 | 3 | `template` 4 | `struct rand` 5 | 6 | * `KOKKOS_INLINE_FUNCTION 7 | static gen_func_type max(){return type_value}` 8 | 9 | * `KOKKOS_INLINE_FUNCTION 10 | static gen_func_type draw(Generator& gen) {return gen_data_type((gen.rand()&gen_return_value)}` 11 | 12 | * `KOKKOS_INLINE_FUNCTION 13 | static gen_func_type draw(Generator& gen, const gen_data_type& range) {return gen_data_type((gen.rand(range));}` 14 | 15 | * `KOKKOS_INLINE_FUNCTION 16 | static gen_func_type draw(Generator& gen, const gen_data_type& start, const gen_data_type& end) 17 | {return gen_data_type(gen.rand(start,end));}` 18 | 19 | 20 | Function specializations for _gen_data_type_, _gen_func_type_ and _type_value_ 21 | 22 | All functions and classes listed here are part of the `Kokkos::` namespace. 23 | 24 | |gen_data_type |gen_func_type | type_value | gen_return_value | 25 | |:-------------|:-------------|:-----------|:----------------------------| 26 | | char | short | 127 | (&0xff+256)%256 | 27 | | short | short | 32767 | (&0xffff+65536)%32768 | 28 | | int | int | MAX_RAND | ? | 29 | | uint | uint | MAX_URAND | ? | 30 | | long | long | MAX_RAND or MAX_RAND64 | ? | 31 | | ulong | ulong | MAX_RAND or MAX_RAND64 | ? | 32 | | long long | long long | MAX_RAND64 | ? | 33 | | ulong long | ulong long | MAX_URAND64 | ? | 34 | | float | float | 1.0f | ? | 35 | | double | double | 1.0 | ? | 36 | | complex | complex | 1.0,1.0 | ? | 37 | | complex | complex | 1.0,1.0 | ? | 38 | | | | | | 39 | 40 | where the maximum values of the XorShift function values are given by the following enums. 41 | * enum {MAX_URAND = 0xffffffffU}; 42 | * enum {MAX_URAND64 = 0xffffffffffffffffULL-1}; 43 | * enum {MAX_RAND = static_cast(0xffffffffU/2)}; 44 | * enum {MAX_RAND64 = static_cast(0xffffffffffffffffULL/2-1)}; 45 | 46 | # Kokkos::Generator 47 | 48 | 49 | Header Files: `Kokkos_core.hpp` 50 | `Kokkos_Complex.hpp` 51 | 52 | ## Synopsis 53 | Kokkos_Random provides the structure necessary for 54 | pseudorandom number generators. These generators are 55 | based on Vigna, Sebastiano (2014). ["_An_ 56 | _experimental exploration of Marsaglia's xorshift generators,_ 57 | _scrambled." See: http://arxiv.org/abs/1402.6246_] . 58 | 59 | **The text that had been posted here is incomplete and has been removed until it is completed.** 60 | -------------------------------------------------------------------------------- /docs/source/API/core/view/layoutLeft.md: -------------------------------------------------------------------------------- 1 | # `LayoutLeft` 2 | 3 | Header File: `Kokkos_Layout.hpp` 4 | 5 | This Kokkos Layout, when provided to a multidimensional View, lays out memory such that the first index is the contiguous one. This matches the Fortran conventions for allocations. 6 | 7 | Usage: 8 | 9 | ```c++ 10 | Kokkos::View my_view; 11 | ``` 12 | 13 | ## Synopsis 14 | ```c++ 15 | struct LayoutLeft { 16 | 17 | typedef LayoutLeft array_layout; 18 | 19 | size_t dimension[ARRAY_LAYOUT_MAX_RANK]; 20 | 21 | enum { is_extent_constructible = true }; 22 | 23 | LayoutLeft(LayoutLeft const&) = default; 24 | LayoutLeft(LayoutLeft&&) = default; 25 | LayoutLeft& operator=(LayoutLeft const&) = default; 26 | LayoutLeft& operator=(LayoutLeft&&) = default; 27 | 28 | KOKKOS_INLINE_FUNCTION 29 | explicit constexpr LayoutLeft(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 30 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 31 | size_t N6 = 0, size_t N7 = 0) 32 | : dimension{N0, N1, N2, N3, N4, N5, N6, N7} {} 33 | }; 34 | ``` 35 | 36 | ## Public Class Members 37 | 38 | * `dimension` 39 | 40 | An array containing the size of each dimension of the Layout 41 | 42 | ## Typedefs 43 | 44 | * `array_layout` 45 | 46 | A tag signifying that this models the Layout concept 47 | 48 | ## Enums 49 | 50 | * `is_extent_constructible` 51 | 52 | A boolean enum to allow detection that this class is extent constructible 53 | 54 | ### Constructors 55 | 56 | * `LayoutLeft(LayoutLeft const&) = default;` 57 | 58 | Default copy constructor, element-wise copies the other Layout 59 | 60 | * `LayoutLeft(LayoutLeft&&) = default;` 61 | 62 | Default move constructor, element-wise moves the other Layout 63 | 64 | * 65 | ```c++ 66 | KOKKOS_INLINE_FUNCTION 67 | explicit constexpr LayoutLeft(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 68 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 69 | size_t N6 = 0, size_t N7 = 0); 70 | ``` 71 | 72 | Constructor that takes in up to 8 sizes, to set the sizes of the corresponding dimensions of the Layout 73 | 74 | ### Assignment operators 75 | 76 | * `LayoutLeft& operator=(LayoutLeft const&) = default;` 77 | 78 | Default copy assignment, element-wise copies the other Layout 79 | 80 | * `LayoutLeft& operator=(LayoutLeft&&) = default;` 81 | 82 | Default move assignment, element-wise moves the other Layout 83 | 84 | ### Functions 85 | 86 | * None 87 | -------------------------------------------------------------------------------- /docs/source/API/core/view/layoutRight.md: -------------------------------------------------------------------------------- 1 | # `LayoutRight` 2 | 3 | Header File: `Kokkos_Layout.hpp` 4 | 5 | This Kokkos Layout, when provided to a multidimensional View, lays out memory such that the last index is the contiguous one. This matches the C conventions for allocations. 6 | 7 | Usage: 8 | 9 | ```c++ 10 | Kokkos::View my_view; 11 | ``` 12 | 13 | ## Synopsis 14 | ```c++ 15 | struct LayoutRight { 16 | 17 | typedef LayoutRight array_layout; 18 | 19 | size_t dimension[ARRAY_LAYOUT_MAX_RANK]; 20 | 21 | enum { is_extent_constructible = true }; 22 | 23 | LayoutRight(LayoutRight const&) = default; 24 | LayoutRight(LayoutRight&&) = default; 25 | LayoutRight& operator=(LayoutRight const&) = default; 26 | LayoutRight& operator=(LayoutRight&&) = default; 27 | 28 | KOKKOS_INLINE_FUNCTION 29 | explicit constexpr LayoutRight(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 30 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 31 | size_t N6 = 0, size_t N7 = 0) 32 | : dimension{N0, N1, N2, N3, N4, N5, N6, N7} {} 33 | }; 34 | ``` 35 | 36 | ## Public Class Members 37 | 38 | * `dimension` 39 | 40 | An array containing the size of each dimension of the Layout 41 | 42 | ## Typedefs 43 | 44 | * `array_layout` 45 | 46 | A tag signifying that this models the Layout concept 47 | 48 | ## Enums 49 | 50 | * `is_extent_constructible` 51 | 52 | A boolean enum to allow detection that this class is extent constructible 53 | 54 | ### Constructors 55 | 56 | * `LayoutRight(LayoutRight const&) = default;` 57 | 58 | Default copy constructor, element-wise copies the other Layout 59 | 60 | * `LayoutRight(LayoutRight&&) = default;` 61 | 62 | Default move constructor, element-wise moves the other Layout 63 | 64 | * 65 | ```c++ 66 | KOKKOS_INLINE_FUNCTION 67 | explicit constexpr LayoutRight(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 68 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 69 | size_t N6 = 0, size_t N7 = 0); 70 | ``` 71 | 72 | Constructor that takes in up to 8 sizes, to set the sizes of the corresponding dimensions of the Layout 73 | 74 | ### Assignment operators 75 | 76 | * LayoutRight& operator=(LayoutRight const&) = default; 77 | 78 | Default copy assignment, element-wise copies the other Layout 79 | 80 | * LayoutRight& operator=(LayoutRight&&) = default; 81 | 82 | Default move assignment, element-wise moves the other Layout 83 | 84 | ### Functions 85 | 86 | * None 87 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::LayoutLeft.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::LayoutLeft` 2 | 3 | Header File: `Kokkos_Layout.hpp` 4 | 5 | This Kokkos Layout, when provided to a multidimensional View, lays out memory such that the first index is the contiguous one. This matches the Fortran conventions for allocations. 6 | 7 | Usage: 8 | 9 | ```c++ 10 | Kokkos::View my_view; 11 | ``` 12 | 13 | ## Synopsis 14 | ```c++ 15 | struct LayoutLeft { 16 | 17 | typedef LayoutLeft array_layout; 18 | 19 | size_t dimension[ARRAY_LAYOUT_MAX_RANK]; 20 | 21 | enum { is_extent_constructible = true }; 22 | 23 | LayoutLeft(LayoutLeft const&) = default; 24 | LayoutLeft(LayoutLeft&&) = default; 25 | LayoutLeft& operator=(LayoutLeft const&) = default; 26 | LayoutLeft& operator=(LayoutLeft&&) = default; 27 | 28 | KOKKOS_INLINE_FUNCTION 29 | explicit constexpr LayoutLeft(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 30 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 31 | size_t N6 = 0, size_t N7 = 0) 32 | : dimension{N0, N1, N2, N3, N4, N5, N6, N7} {} 33 | }; 34 | ``` 35 | 36 | ## Public Class Members 37 | 38 | * `dimension` 39 | 40 | An array containing the size of each dimension of the Layout 41 | 42 | ## Typedefs 43 | 44 | * `array_layout` 45 | 46 | A tag signifying that this models the Layout concept 47 | 48 | ## Enums 49 | 50 | * `is_extent_constructible` 51 | 52 | A boolean enum to allow detection that this class is extent constructible 53 | 54 | ### Constructors 55 | 56 | * LayoutLeft(LayoutLeft const&) = default; 57 | 58 | Default copy constructor, element-wise copies the other Layout 59 | 60 | * LayoutLeft(LayoutLeft&&) = default; 61 | 62 | Default move constructor, element-wise moves the other Layout 63 | 64 | * 65 | ```c++ 66 | KOKKOS_INLINE_FUNCTION 67 | explicit constexpr LayoutLeft(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 68 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 69 | size_t N6 = 0, size_t N7 = 0); 70 | ``` 71 | 72 | Constructor that takes in up to 8 sizes, to set the sizes of the corresponding dimenesions of the Layout 73 | 74 | ### Assignment operators 75 | 76 | * LayoutLeft& operator=(LayoutLeft const&) = default; 77 | 78 | Default copy assignment, element-wise copies the other Layout 79 | 80 | * LayoutLeft& operator=(LayoutLeft&&) = default; 81 | 82 | Default move assignment, element-wise moves the other Layout 83 | 84 | ### Functions 85 | 86 | * None -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Initialization-API.md: -------------------------------------------------------------------------------- 1 | ## Kokkos::initialize 2 | 3 | ```c++ 4 | Kokkos::initialize(); 5 | Kokkos::initialize(const InitArguments&); 6 | Kokkos::initialize(int& argc, char* argv[]); 7 | ``` 8 | 9 | Initializes all enabled Kokkos backends. 10 | This function should be called before calling any other Kokkos API functions, 11 | including Kokkos object constructors. 12 | `Kokkos::finalize` must be called after `Kokkos::initialize`. 13 | 14 | ## Kokkos::finalize 15 | 16 | ```c++ 17 | Kokkos::finalize(); 18 | ``` 19 | 20 | Shuts down all enabled Kokkos backends and frees all associated resources. 21 | This function should be called after calling all other Kokkos API functions, 22 | *including Kokkos object destructors*. 23 | Programs are ill-formed if they do not call this function after calling `Kokkos::initialize`. 24 | 25 | ## Kokkos::ScopeGuard 26 | 27 | `ScopeGuard` is a class introduced to ensure that `Kokkos::initialize` and 28 | `Kokkos::finalize` are called correctly even in the presence of unhandled 29 | exceptions and multiple libraries trying to "own" Kokkos initialization. 30 | `ScopeGuard` calls `Kokkos::initialize` in its constructor only if 31 | `Kokkos::is_initialized()` is false, and calls `Kokkos::finalize` in its 32 | destructor only if it called `Kokkos::initialize` in its constructor. 33 | 34 | ### Kokkos::ScopeGuard::ScopeGuard 35 | ```c++ 36 | ScopeGuard(); 37 | ScopeGuard(const InitArguments&); 38 | ScopeGuard(int& argc, char* argv[]); 39 | ``` 40 | Calls `Kokkos::initialize` only if 41 | `Kokkos::is_initialized()` is false. 42 | Arguments are passed directly to `Kokkos::initialize` if it is called. 43 | 44 | ### Kokkos::ScopeGuard::~ScopeGuard 45 | ```c++ 46 | ~ScopeGuard(); 47 | ``` 48 | Calls `Kokkos::finalize` 49 | only if the constructor of this object called `Kokkos::initialize`. 50 | 51 | One common mistake is allowing Kokkos objects to live past `Kokkos::finalize`, 52 | which is easy to do since all objects in the scope of `main()` live past that point. 53 | Here is an example of this mistake: 54 | ```c++ 55 | int main(int argc, char** argv) { 56 | Kokkos::initialize(argc, argv); 57 | Kokkos::View my_view("my_view", 10); 58 | Kokkos::finalize(); 59 | // my_view destructor called after Kokkos::finalize ! 60 | } 61 | ``` 62 | Switching to `Kokkos::ScopeGuard` fixes it: 63 | ```c++ 64 | int main(int argc, char** argv) { 65 | Kokkos::ScopeGuard kokkos(argc, argv); 66 | Kokkos::View my_view("my_view", 10); 67 | // my_view destructor called before Kokkos::finalize 68 | // ScopeGuard destructor called, calls Kokkos::finalize 69 | } 70 | ``` 71 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::LayoutRight.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::LayoutRight` 2 | 3 | Header File: `Kokkos_Layout.hpp` 4 | 5 | This Kokkos Layout, when provided to a multidimensional View, lays out memory such that the last index is the contiguous one. This matches the C conventions for allocations. 6 | 7 | Usage: 8 | 9 | ```c++ 10 | Kokkos::View my_view; 11 | ``` 12 | 13 | ## Synopsis 14 | ```c++ 15 | struct LayoutRight { 16 | 17 | typedef LayoutRight array_layout; 18 | 19 | size_t dimension[ARRAY_LAYOUT_MAX_RANK]; 20 | 21 | enum { is_extent_constructible = true }; 22 | 23 | LayoutRight(LayoutRight const&) = default; 24 | LayoutRight(LayoutRight&&) = default; 25 | LayoutRight& operator=(LayoutRight const&) = default; 26 | LayoutRight& operator=(LayoutRight&&) = default; 27 | 28 | KOKKOS_INLINE_FUNCTION 29 | explicit constexpr LayoutRight(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 30 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 31 | size_t N6 = 0, size_t N7 = 0) 32 | : dimension{N0, N1, N2, N3, N4, N5, N6, N7} {} 33 | }; 34 | ``` 35 | 36 | ## Public Class Members 37 | 38 | * `dimension` 39 | 40 | An array containing the size of each dimension of the Layout 41 | 42 | ## Typedefs 43 | 44 | * `array_layout` 45 | 46 | A tag signifying that this models the Layout concept 47 | 48 | ## Enums 49 | 50 | * `is_extent_constructible` 51 | 52 | A boolean enum to allow detection that this class is extent constructible 53 | 54 | ### Constructors 55 | 56 | * LayoutRight(LayoutRight const&) = default; 57 | 58 | Default copy constructor, element-wise copies the other Layout 59 | 60 | * LayoutRight(LayoutRight&&) = default; 61 | 62 | Default move constructor, element-wise moves the other Layout 63 | 64 | * 65 | ```c++ 66 | KOKKOS_INLINE_FUNCTION 67 | explicit constexpr LayoutRight(size_t N0 = 0, size_t N1 = 0, size_t N2 = 0, 68 | size_t N3 = 0, size_t N4 = 0, size_t N5 = 0, 69 | size_t N6 = 0, size_t N7 = 0); 70 | ``` 71 | 72 | Constructor that takes in up to 8 sizes, to set the sizes of the corresponding dimenesions of the Layout 73 | 74 | ### Assignment operators 75 | 76 | * LayoutRight& operator=(LayoutRight const&) = default; 77 | 78 | Default copy assignment, element-wise copies the other Layout 79 | 80 | * LayoutRight& operator=(LayoutRight&&) = default; 81 | 82 | Default move assignment, element-wise moves the other Layout 83 | 84 | ### Functions 85 | 86 | * None -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdGenerate.md: -------------------------------------------------------------------------------- 1 | 2 | # `generate` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | void generate(const ExecutionSpace& exespace, (1) 12 | IteratorType first, IteratorType last, 13 | GeneratorType g); 14 | 15 | template 16 | void generate(const std::string& label, const ExecutionSpace& exespace, (2) 17 | IteratorType first, IteratorType last, 18 | GeneratorType g); 19 | 20 | template 21 | void generate(const ExecutionSpace& exespace, (3) 22 | const Kokkos::View& view, 23 | GeneratorType g); 24 | 25 | template 26 | void generate(const std::string& label, const ExecutionSpace& exespace, (4) 27 | const Kokkos::View& view, 28 | GeneratorType g); 29 | 30 | } //end namespace Experimental 31 | } //end namespace Kokkos 32 | ``` 33 | 34 | ## Description 35 | 36 | Assigns the value generated by the functor `g` to each elements in the 37 | range `[first, last)` (overloads 1,2) or in the `view` (overloads 3,4). 38 | 39 | 40 | ## Parameters and Requirements 41 | 42 | - `exespace`: 43 | - execution space instance 44 | - `label`: 45 | - used to name the implementation kernels for debugging purposes 46 | - for 1, the default string is: "Kokkos::generate_iterator_api_default" 47 | - for 3, the default string is: "Kokkos::generate_view_api_default" 48 | - `first, last`: 49 | - range of elements to modify 50 | - must be *random access iterators* 51 | - must represent a valid range, i.e., `last >= first` (checked in debug mode) 52 | - must be accessible from `exespace` 53 | - `view`: 54 | - view to modify 55 | - must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 56 | - must be accessible from `exespace` 57 | - `g`: 58 | - functor of the form: 59 | ```c++ 60 | struct Generate 61 | { 62 | KOKKOS_INLINE_FUNCTION 63 | return_type operator()() const{ return /* ... */; } 64 | }; 65 | ``` 66 | where `return_type` must be assignable to `value_type`, with `value_type` 67 | being the value type of `IteratorType` (for 1,2) or of `view` (for 3,4). 68 | 69 | 70 | ## Return 71 | 72 | None 73 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdShiftLeft.md: -------------------------------------------------------------------------------- 1 | 2 | # `shift_left` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | IteratorType shift_left(const ExecutionSpace& exespace, (1) 12 | IteratorType first, 13 | IteratorType last, 14 | typename IteratorType::difference_type n); 15 | 16 | template 17 | IteratorType shift_left(const std::string& label, (2) 18 | const ExecutionSpace& exespace, 19 | IteratorType first, IteratorType last, 20 | typename IteratorType::difference_type n); 21 | 22 | template 23 | auto shift_left(const ExecutionSpace& exespace, (3) 24 | const ::Kokkos::View& view, 25 | typename decltype(begin(view))::difference_type n); 26 | 27 | template 28 | auto shift_left(const std::string& label, (4) 29 | const ExecutionSpace& exespace, 30 | const ::Kokkos::View& view, 31 | typename decltype(begin(view))::difference_type n); 32 | 33 | } //end namespace Experimental 34 | } //end namespace Kokkos 35 | ``` 36 | ## Description 37 | 38 | Shifts the elements in the range `[first, last)` or in `view` 39 | by `n` positions towards the *beginning*. 40 | 41 | ## Parameters and Requirements 42 | 43 | - `exespace`: 44 | - execution space 45 | - `label`: 46 | - used to name the implementation kernels for debugging purposes 47 | - for 1, the default string is: "Kokkos::shift_left_iterator_api_default" 48 | - for 3, the default string is: "Kokkos::shift_left_view_api_default" 49 | - `first, last`: 50 | - range of elements to shift 51 | - must be *random access iterators* 52 | - must represent a valid range, i.e., `last >= first` (checked in debug mode) 53 | - must be accessible from `exespace` 54 | - `view_from`: 55 | - view to modify 56 | - must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 57 | - must be accessible from `exespace` 58 | - `n`: 59 | - the number of positions to shift 60 | - must be non-negative 61 | 62 | ## Return 63 | 64 | The end of the resulting range. 65 | If `n` is less than `last - first`, returns `first + (last - first - n)`. 66 | Otherwise, returns `first`. 67 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdFill.md: -------------------------------------------------------------------------------- 1 | 2 | # `fill` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | void fill(const ExecutionSpace& exespace, (1) 12 | IteratorType first, IteratorType last, 13 | const T& value); 14 | 15 | template 16 | void fill(const std::string& label, const ExecutionSpace& exespace, (2) 17 | IteratorType first, IteratorType last, 18 | const T& value); 19 | 20 | template 21 | void fill(const ExecutionSpace& exespace, (3) 22 | const Kokkos::View& view, 23 | const T& value); 24 | 25 | template 26 | void fill(const std::string& label, const ExecutionSpace& exespace, (4) 27 | const Kokkos::View& view, 28 | const T& value); 29 | 30 | } //end namespace Experimental 31 | } //end namespace Kokkos 32 | ``` 33 | 34 | ## Description 35 | 36 | Copy-assigns `value` to each element in the range `[first, last)` (overloads 1,2) 37 | or in `view` (overloads 3,4). 38 | 39 | 40 | ## Parameters and Requirements 41 | 42 | - `exespace`: 43 | - execution space instance 44 | - `label`: 45 | - used to name the implementation kernels for debugging purposes 46 | - for 1, the default string is: "Kokkos::fill_iterator_api_default" 47 | - for 3, the default string is: "Kokkos::fill_view_api_default" 48 | - `first, last`: 49 | - range of elements to assign to 50 | - must be *random access iterators*, e.g., `Kokkos::Experimental::begin/end` 51 | - must represent a valid range, i.e., `last >= first` (checked in debug mode) 52 | - must be accessible from `exespace` 53 | - `view`: 54 | - must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 55 | - must be accessible from `exespace` 56 | - `value`: 57 | - value to assign to each element 58 | 59 | 60 | ## Return 61 | 62 | None 63 | 64 | ## Example 65 | 66 | ```c++ 67 | namespace KE = Kokkos::Experimental; 68 | Kokkos::View a("a", 13); 69 | 70 | KE::fill(Kokkos::DefaultExecutionSpace(), KE::begin(a), KE::end(a), 4.); 71 | 72 | // passing the view directly 73 | KE::fill(Kokkos::DefaultExecutionSpace(), a, 22.); 74 | 75 | // explicitly set execution space (assuming active) 76 | KE::fill(Kokkos::OpenMP(), KE::begin(a), KE::end(a), 14.); 77 | ``` 78 | -------------------------------------------------------------------------------- /docs/source/ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.md: -------------------------------------------------------------------------------- 1 | # 9.2 Built-In Reducers with Custom Scalar Types 2 | 3 | In order to use a Custom Scalar Type with Built-in reductions, the following requirements must be fulfilled. 4 | 5 | * An initialization function must be provided via a specialization of the `Kokkos::reduction_identity` class. 6 | * Operators required for applied reduction class must be implemented. 7 | * The class / struct must either use the default copy constructor or have a specific copy constructor 8 | implemented. 9 | 10 | ## Example 11 | 12 | This example performs a custom reduction on an array using the built-in [`Sum`](../API/core/builtinreducers/Sum) reducer. 13 | 14 | ```c++ 15 | namespace sample { // namespace helps with name resolution in reduction identity 16 | template< class ScalarType, int N > 17 | struct array_type { 18 | ScalarType the_array[N]; 19 | 20 | KOKKOS_INLINE_FUNCTION // Default constructor - Initialize to 0's 21 | array_type() { 22 | for (int i = 0; i < N; i++ ) { the_array[i] = 0; } 23 | } 24 | KOKKOS_INLINE_FUNCTION // Copy Constructor 25 | array_type(const array_type & rhs) { 26 | for (int i = 0; i < N; i++ ){ 27 | the_array[i] = rhs.the_array[i]; 28 | } 29 | } 30 | KOKKOS_INLINE_FUNCTION // add operator 31 | array_type& operator += (const array_type& src) { 32 | for ( int i = 0; i < N; i++ ) { 33 | the_array[i]+=src.the_array[i]; 34 | } 35 | return *this; 36 | } 37 | }; 38 | typedef array_type ValueType; // used to simplify code below 39 | } 40 | namespace Kokkos { //reduction identity must be defined in Kokkos namespace 41 | template<> 42 | struct reduction_identity< sample::ValueType > { 43 | KOKKOS_FORCEINLINE_FUNCTION static sample::ValueType sum() { 44 | return sample::ValueType(); 45 | } 46 | }; 47 | } 48 | int main( int argc, char* argv[] ) 49 | { 50 | int E = 1024; 51 | Kokkos::initialize( argc, argv ); 52 | { 53 | sample::ValueType tr; 54 | Kokkos::parallel_reduce( E, KOKKOS_LAMBDA (const int& i, 55 | sample::ValueType & upd) { 56 | int ndx =i%4; // sum all of the i%4 entries (divide total by 4) 57 | upd.the_array[ndx] += 1; 58 | }, Kokkos::Sum(tr) ); 59 | printf( " Computed result for %d is %d, %d, %d, %d \n", 60 | E, tr.the_array[0], tr.the_array[1], 61 | tr.the_array[2], tr.the_array[3] ); 62 | } 63 | Kokkos::finalize(); 64 | 65 | return 0; 66 | } 67 | 68 | ``` -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdFill_n.md: -------------------------------------------------------------------------------- 1 | 2 | # `fill_n` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | IteratorType fill_n(const ExecutionSpace& exespace, (1) 12 | IteratorType first, 13 | SizeType n, const T& value); 14 | 15 | template 16 | IteratorType fill_n(const std::string& label, const ExecutionSpace& exespace, (2) 17 | IteratorType first, 18 | SizeType n, const T& value); 19 | 20 | template 21 | auto fill_n(const ExecutionSpace& exespace, (3) 22 | const Kokkos::View& view, 23 | SizeType n, const T& value); 24 | 25 | template 26 | auto fill_n(const std::string& label, const ExecutionSpace& exespace, (4) 27 | const Kokkos::View& view, 28 | SizeType n, const T& value); 29 | 30 | } //end namespace Experimental 31 | } //end namespace Kokkos 32 | ``` 33 | 34 | ## Description 35 | 36 | Copy-assigns `value` to the first `n` elements in the range starting at `first` (overloads 1,2) 37 | or the first `n` elements in `view` (overloads 3,4). 38 | 39 | ## Parameters and Requirements 40 | 41 | - `exespace`, `first`, `view`, `value`: same as in [`fill`](./StdFill) 42 | - `label`: 43 | - used to name the implementation kernels for debugging purposes 44 | - for 1, the default string is: "Kokkos::fill_n_iterator_api_default" 45 | - for 3, the default string is: "Kokkos::fill_n_view_api_default" 46 | - `n`: 47 | - number of elements to modify (must be non-negative) 48 | 49 | 50 | ## Return 51 | 52 | If `n > 0`, returns an iterator to the element *after* the last element assigned. 53 | 54 | Otherwise, it returns `first` (for 1,2) or `Kokkos::begin(view)` (for 3,4). 55 | 56 | 57 | ## Example 58 | 59 | ```c++ 60 | namespace KE = Kokkos::Experimental; 61 | Kokkos::View a("a", 13); 62 | // do something with a 63 | // ... 64 | 65 | const double newValue{4}; 66 | KE::fill_n(Kokkos::DefaultExecutionSpace(), KE::begin(a), 10, newValue); 67 | 68 | // passing the view directly 69 | KE::fill_n(Kokkos::DefaultExecutionSpace(), a, 10, newValue); 70 | 71 | // explicitly set execution space (assuming active) 72 | KE::fill_n(Kokkos::OpenMP(), KE::begin(a), 10, newValue); 73 | ``` 74 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdSwapRanges.md: -------------------------------------------------------------------------------- 1 | # `swap_ranges` 2 | 3 | Header File: `Kokkos_StdAlgorithms.hpp` 4 | 5 | ```c++ 6 | namespace Kokkos{ 7 | namespace Experimental{ 8 | 9 | template 10 | Iterator2 swap_ranges(const ExecutionSpace& exespace, (1) 11 | Iterator1 first1, Iterator1 last1, 12 | Iterator2 first2); 13 | 14 | template 15 | Iterator2 swap_ranges(const std::string& label, (2) 16 | const ExecutionSpace& exespace, 17 | Iterator1 first1, Iterator1 last1, 18 | Iterator2 first2); 19 | 20 | template < 21 | class ExecutionSpace, 22 | class DataType1, class... Properties1, 23 | class DataType2, class... Properties2 24 | > 25 | auto swap_ranges(const ExecutionSpace& exespace, (3) 26 | const Kokkos::View& source, 27 | Kokkos::View& dest); 28 | 29 | template < 30 | class ExecutionSpace, 31 | class DataType1, class... Properties1, 32 | class DataType2, class... Properties2 33 | > 34 | auto swap_ranges(const std::string& label, (4) 35 | const ExecutionSpace& exespace, 36 | const Kokkos::View& source, 37 | Kokkos::View& dest); 38 | 39 | } //end namespace Experimental 40 | } //end namespace Kokkos 41 | ``` 42 | 43 | ## Description 44 | 45 | - Overloads 1,2: swaps the elements between the range `[first1, last1)` 46 | and the range beginning at `first2` 47 | 48 | - Overloads 3,4: swaps the elements between `source` and `dest` view 49 | 50 | 51 | ## Parameters and Requirements 52 | 53 | - `exespace`: 54 | - execution space instance 55 | - `label`: 56 | - used to name the implementation kernels for debugging purposes 57 | - for 1, the default string is: "Kokkos::swap_ranges_iterator_api_default" 58 | - for 3, the default string is: "Kokkos::swap_ranges_view_api_default" 59 | - `first1, last1`, `first2`: 60 | - iterators to ranges to swap from and to 61 | - must be *random access iterators* 62 | - must represent a valid range, i.e., `last1 >= first1` (checked in debug mode) 63 | - must be accessible from `exespace` 64 | - `source, dest`: 65 | - views to move from and to, must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 66 | - must be accessible from `exespace` 67 | 68 | ## Return 69 | 70 | Iterator to the element *after* the last element swapped. 71 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdCopy_n.md: -------------------------------------------------------------------------------- 1 | 2 | # `copy_n` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | OutputIteratorType copy_n(const ExecutionSpace& exespace, (1) 12 | InputIteratorType first_from, 13 | SizeType n, 14 | OutputIteratorType first_to); 15 | 16 | template 17 | OutputIteratorType copy_n(const std::string & label, 18 | const ExecutionSpace& exespace, (2) 19 | InputIteratorType first_from, 20 | SizeType n, 21 | OutputIteratorType first_to); 22 | 23 | template < 24 | class ExecutionSpace, 25 | class DataType1, class... Properties1, 26 | class SizeType, 27 | class DataType2, class... Properties2 28 | > 29 | auto copy_n(const ExecutionSpace& exespace, (3) 30 | const Kokkos::View& view_from, 31 | SizeType n, 32 | const Kokkos::View& view_to); 33 | 34 | template < 35 | class ExecutionSpace, 36 | class DataType1, class... Properties1, 37 | class SizeType, 38 | class DataType2, class... Properties2 39 | > 40 | auto copy_n(const std::string& label, const ExecutionSpace& exespace, (4) 41 | const Kokkos::View& view_from, 42 | SizeType n, 43 | const Kokkos::View& view_to); 44 | 45 | } //end namespace Experimental 46 | } //end namespace Kokkos 47 | ``` 48 | 49 | Copies the first `n` elements starting at `first_from` to 50 | another range starting at `first_to` (overloads 1,2) or the first `n` elements 51 | from `view_from` to `view_to` (overloads 3,4). 52 | 53 | 54 | ## Parameters and Requirements 55 | 56 | - `exespace`, `first_from`, `first_to`, `view_from`, `view_to`: 57 | - same as in [`copy`](./StdCopy) 58 | - `label`: 59 | - used to name the implementation kernels for debugging purposes 60 | - for 1, the default string is: "Kokkos::copy_n_if_iterator_api_default" 61 | - for 3, the default string is: "Kokkos::copy_n_if_view_api_default" 62 | - `n`: 63 | - number of elements to copy (must be non-negative) 64 | 65 | 66 | ## Return 67 | 68 | If `n>0`, returns an iterator to the destination element *after* the last element copied. 69 | 70 | Otherwise, returns `first_to` (for 1,2) or `Kokkos::begin(view_to)` (for 3,4). 71 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdRemove.md: -------------------------------------------------------------------------------- 1 | 2 | # `remove` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | Iterator remove(const ExecutionSpace& exespace, (1) 12 | Iterator first, Iterator last, 13 | const ValueType& value); 14 | 15 | template 16 | Iterator remove(const std::string& label, (2) 17 | const ExecutionSpace& exespace, 18 | Iterator first, Iterator last, 19 | const ValueType& value); 20 | 21 | template < 22 | class ExecutionSpace, 23 | class DataType, class... Properties, 24 | class ValueType> 25 | auto remove(const ExecutionSpace& exespace, (3) 26 | const ::Kokkos::View& view, 27 | const ValueType& value); 28 | 29 | template < 30 | class ExecutionSpace, 31 | class DataType, class... Properties, 32 | class ValueType> 33 | auto remove(const std::string& label, (4) 34 | const ExecutionSpace& exespace, 35 | const ::Kokkos::View& view, 36 | const ValueType& value); 37 | 38 | } //end namespace Experimental 39 | } //end namespace Kokkos 40 | ``` 41 | 42 | ## Description 43 | 44 | Removes all elements equal to `value` by shifting via move assignment 45 | the elements in the range `[first, last)` (1,2) or in `view` (3,4) 46 | such that the elements not to be removed 47 | appear in the beginning of the range (1,2) or in the beginning of `view` (3,4). 48 | Relative order of the elements that remain is preserved 49 | and the physical size of the container is unchanged. 50 | 51 | ## Parameters and Requirements 52 | 53 | - `exespace`: 54 | - execution space instance 55 | - `label`: 56 | - used to name the implementation kernels for debugging purposes 57 | - for 1, the default string is: "Kokkos::remove_iterator_api_default" 58 | - for 3, the default string is: "Kokkos::remove_view_api_default" 59 | - `first, last`: 60 | - range of elements to modify 61 | - must be *random access iterators* 62 | - must represent a valid range, i.e., `last >= first` (checked in debug mode) 63 | - must be accessible from `exespace` 64 | - `view`: 65 | - view of elements to modify 66 | - must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 67 | - must be accessible from `exespace` 68 | - `value`: 69 | - target value to remove 70 | 71 | ## Return 72 | 73 | Iterator to the element *after* the new logical end. 74 | -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdMove.md: -------------------------------------------------------------------------------- 1 | # `move` 2 | 3 | Header File: `Kokkos_StdAlgorithms.hpp` 4 | 5 | ```c++ 6 | namespace Kokkos{ 7 | namespace Experimental{ 8 | 9 | template 10 | OutputIterator move(const ExecutionSpace& exespace, (1) 11 | InputIterator first_from, 12 | InputIterator last_from, 13 | OutputIterator first_to); 14 | 15 | template 16 | OutputIterator move(const std::string& label, (2) 17 | const ExecutionSpace& exespace, 18 | InputIterator first_from, 19 | InputIterator last_from, 20 | OutputIterator first_to); 21 | 22 | template < 23 | class ExecutionSpace, 24 | class DataType1, class... Properties1, 25 | class DataType2, class... Properties2 26 | > 27 | auto move(const ExecutionSpace& exespace, (3) 28 | const Kokkos::View& source, 29 | Kokkos::View& dest); 30 | 31 | template < 32 | class ExecutionSpace, 33 | class DataType1, class... Properties1, 34 | class DataType2, class... Properties2 35 | > 36 | auto move(const std::string& label, (4) 37 | const ExecutionSpace& exespace, 38 | const Kokkos::View& source, 39 | Kokkos::View& dest); 40 | 41 | } //end namespace Experimental 42 | } //end namespace Kokkos 43 | ``` 44 | 45 | ## Description 46 | 47 | - Overloads 1,2: moves the elements from the range `[first_from, last_from)` 48 | to the range beginning at `first_to` 49 | 50 | - Overloads 3,4: moves the elements from `source` view to `dest` view 51 | 52 | 53 | ## Parameters and Requirements 54 | 55 | - `exespace`: 56 | - execution space instance 57 | - `label`: 58 | - used to name the implementation kernels for debugging purposes 59 | - for 1, the default string is: "Kokkos::move_iterator_api_default" 60 | - for 3, the default string is: "Kokkos::move_view_api_default" 61 | - `first_from, last_from`: 62 | - range of elements to move 63 | - must be *random access iterators* 64 | - must represent a valid range, i.e., `last_from >= first_from` (checked in debug mode) 65 | - must be accessible from `exespace` 66 | - `source, dest`: 67 | - views to move from and to, must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 68 | - must be accessible from `exespace` 69 | 70 | 71 | ## Return 72 | 73 | Iterator to the element *after* the last element moved. 74 | -------------------------------------------------------------------------------- /docs/source/API/core/numerics/mathematical-constants.md: -------------------------------------------------------------------------------- 1 | # Mathematical constants 2 | 3 | Defined in header [``](https://github.com/kokkos/kokkos/blob/develop/core/src/Kokkos_MathematicalConstants.hpp) 4 | which is included from `` (since Kokkos 3.6) 5 | 6 | Provides all mathematical constants from [``](https://en.cppreference.com/w/cpp/numeric/constants) (since C++20). 7 | 8 | All constants are defined in the `Kokkos::Experimental` namespace. 9 | 10 | **Mathematical constants** 11 | `e` 12 | `log2e` 13 | `log10e` 14 | `pi` 15 | `inv_pi` 16 | `inv_sqrtpi` 17 | `ln2` 18 | `ln10` 19 | `sqrt2` 20 | `sqrt3` 21 | `inv_sqrt3` 22 | `egamma` 23 | `phi` 24 | 25 | 26 | | Standard library | Kokkos with C++20 | 27 | |-------------------------------------------------------|----------------------------------------------| 28 | | `std::numbers::e` | `Kokkos::Experimental::e` | 29 | | `std::numbers::log2e` | `Kokkos::Experimental::log2e` | 30 | | `std::numbers::log10e` | `Kokkos::Experimental::log10e` | 31 | | `std::numbers::pi` | `Kokkos::Experimental::pi` | 32 | | `std::numbers::inv_pi` | `Kokkos::Experimental::inv_pi` | 33 | | `std::numbers::inv_sqrtpi` | `Kokkos::Experimental::lnv_sqrtpi` | 34 | | `std::numbers::ln2` | `Kokkos::Experimental::ln2` | 35 | | `std::numbers::ln10` | `Kokkos::Experimental::ln10` | 36 | | `std::numbers::sqrt2` | `Kokkos::Experimental::sqrt2` | 37 | | `std::numbers::sqrt3` | `Kokkos::Experiemtnal::sqrt3` | 38 | | `std::numbers::inv_sqrt3` | `Kokkos::Experimental::inv_sqrt3` | 39 | | `std::numbers::egamma` | `Kokkos::Experimental::egamma` | 40 | | `std::numbers::phi` | `Kokkos::Experimental::phi` | 41 | 42 | Values of constants rely on ``. Refer to (https://eel.is/c++draft/numbers#math.constants) for details. 43 | 44 | --- 45 | 46 | ```C++ 47 | KOKKOS_FUNCTION void example() { 48 | constexpr auto pi = Kokkos::Experimental::pi_v; 49 | auto const x = Kokkos::Experimental::sin(pi/6); 50 | } 51 | ``` 52 | 53 | --- 54 | **See also** 55 | [Common mathematical functions](mathematical-functions) 56 | [Numeric traits](numeric-traits) 57 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Mathematical-Constants.md: -------------------------------------------------------------------------------- 1 | # Mathematical constants 2 | 3 | Defined in header [``](https://github.com/kokkos/kokkos/blob/develop/core/src/Kokkos_MathematicalConstants.hpp) 4 | which is included from `` (since Kokkos 3.6) 5 | 6 | Provides all mathematical constants from [``](https://en.cppreference.com/w/cpp/numeric/constants) (since C++20). 7 | 8 | All constants are defined in the `Kokkos::Experimental` namespace. 9 | 10 | **Mathematical constants** 11 | `e` 12 | `log2e` 13 | `log10e` 14 | `pi` 15 | `inv_pi` 16 | `inv_sqrtpi` 17 | `ln2` 18 | `ln10` 19 | `sqrt2` 20 | `sqrt3` 21 | `inv_sqrt3` 22 | `egamma` 23 | `phi` 24 | 25 | 26 | | Standard library | Kokkos with C++20 | 27 | |-------------------------------------------------------|----------------------------------------------| 28 | | `std::numbers::e` | `Kokkos::Experimental::e` | 29 | | `std::numbers::log2e` | `Kokkos::Experimental::log2e` | 30 | | `std::numbers::log10e` | `Kokkos::Experimental::log10e` | 31 | | `std::numbers::pi` | `Kokkos::Experimental::pi` | 32 | | `std::numbers::inv_pi` | `Kokkos::Experimental::inv_pi` | 33 | | `std::numbers::inv_sqrtpi` | `Kokkos::Experimental::lnv_sqrtpi` | 34 | | `std::numbers::ln2` | `Kokkos::Experimental::ln2` | 35 | | `std::numbers::ln10` | `Kokkos::Experimental::ln10` | 36 | | `std::numbers::sqrt2` | `Kokkos::Experimental::sqrt2` | 37 | | `std::numbers::sqrt3` | `Kokkos::Experiemtnal::sqrt3` | 38 | | `std::numbers::inv_sqrt3` | `Kokkos::Experimental::inv_sqrt3` | 39 | | `std::numbers::egamma` | `Kokkos::Experimental::egamma` | 40 | | `std::numbers::phi` | `Kokkos::Experimental::phi` | 41 | 42 | Values of constants rely on ``. Refer to (https://eel.is/c++draft/numbers#math.constants) for details. 43 | 44 | --- 45 | 46 | ```C++ 47 | KOKKOS_FUNCTION void example() { 48 | constexpr auto pi = Kokkos::Experimental::pi_v; 49 | auto const x = Kokkos::Experimental::sin(pi/6); 50 | } 51 | ``` 52 | 53 | --- 54 | **See also** 55 | [Common mathematical functions](Mathematical-Functions) 56 | [Numeric traits](Numeric-Traits) 57 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | sys.path.insert(0, os.path.abspath('.')) 16 | 17 | 18 | # -- Project information ----------------------------------------------------- 19 | # The master toctree document. 20 | master_doc = "index" 21 | 22 | project = 'Kokkos' 23 | copyright = '2014, National Technology & Engineering Solutions of Sandia, LLC (NTESS)' 24 | author = 'lots of people' 25 | 26 | # The full version, including alpha/beta/rc tags 27 | # release = '3.5.0' 28 | 29 | 30 | # -- General configuration --------------------------------------------------- 31 | 32 | # Add any Sphinx extension module names here, as strings. They can be 33 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 34 | # ones. 35 | extensions = ["myst_parser", 36 | "sphinx.ext.autodoc", 37 | "sphinx.ext.viewcode", 38 | "sphinx.ext.intersphinx", 39 | "sphinx_copybutton"] 40 | 41 | # Add any paths that contain templates here, relative to this directory. 42 | templates_path = ['_templates'] 43 | 44 | # List of patterns, relative to source directory, that match files and 45 | # directories to ignore when looking for source files. 46 | # This pattern also affects html_static_path and html_extra_path. 47 | exclude_patterns = [] 48 | 49 | 50 | # -- Options for HTML output ------------------------------------------------- 51 | # The name of the Pygments (syntax highlighting) style to use. 52 | pygments_style = "default" 53 | pygments_dark_style = "monokai" 54 | 55 | # The theme to use for HTML and HTML Help pages. See the documentation for 56 | # a list of builtin themes. 57 | # 58 | html_theme = 'furo' 59 | 60 | # Add any paths that contain custom static files (such as style sheets) here, 61 | # relative to this directory. They are copied after the builtin static files, 62 | # so a file named "default.css" will overwrite the builtin "default.css". 63 | html_static_path = ['.'] 64 | 65 | html_css_files = ['hacks.css'] 66 | 67 | source_suffix = { 68 | '.rst': 'restructuredtext', 69 | '.md': 'markdown', 70 | } 71 | 72 | myst_heading_anchors = 4 73 | # need to figure out why this does not work 74 | # rst_prolog = """ 75 | # .. include:: special.rst 76 | # """ 77 | -------------------------------------------------------------------------------- /docs/source/requirements.rst: -------------------------------------------------------------------------------- 1 | Requirements 2 | ############ 3 | 4 | Compiler Versions 5 | ================= 6 | 7 | Generally Kokkos should work with all compiler versions newer than the minimum. 8 | However,in complex code, we have to work around compiler bugs. So compiler versions we don't test may have issues 9 | we are unaware of. 10 | 11 | .. list-table:: 12 | :widths: 30 35 35 13 | :header-rows: 1 14 | :align: center 15 | 16 | * - Compiler 17 | - Minimum version 18 | - Primary tested versions 19 | 20 | * * GCC 21 | * 5.3.0 22 | * 5.3.0, 6.1.0, 7.3.0, 8.3, 9.2, 10.0 23 | 24 | * * Clang 25 | * 4.0.0 26 | * 8.0.0, 9.0.0, 10.0.0, 12.0.0 27 | 28 | * * Intel 29 | * 17.0.1 30 | * 17.4, 18.1, 19.5 31 | 32 | * * NVCC 33 | * 9.2.88 34 | * 9.2.88, 10.1, 11.0 35 | 36 | * * NVC++ 37 | * 21.5 38 | * NA 39 | 40 | * * ROCM 41 | * 4.5 42 | * 4.5.0 43 | 44 | * * MSVC 45 | * 19.29 46 | * 19.29 47 | 48 | * * IBM XL 49 | * 16.1.1 50 | * 16.1.1 51 | 52 | * * Fujitsu 53 | * 4.5.0 54 | * NA 55 | 56 | * * ARM/Clang 57 | * 20.1 58 | * 20.1 59 | 60 | Build system: 61 | ============= 62 | 63 | * CMake >= 3.16: required 64 | * CMake >= 3.18: Fortran linkage. This does not affect most mixed Fortran/Kokkos builds. See [build issues](BUILD.md#KnownIssues). 65 | * CMake >= 3.21.1 for NVC++ 66 | 67 | Primary tested compiler are passing in release mode 68 | with warnings as errors. They also are tested with a comprehensive set of 69 | backend combinations (i.e. OpenMP, Pthreads, Serial, OpenMP+Serial, ...). 70 | We are using the following set of flags: 71 | 72 | * GCC: 73 | 74 | .. code-block:: bash 75 | 76 | -Wall -Wunused-parameter -Wshadow -pedantic 77 | -Werror -Wsign-compare -Wtype-limits 78 | -Wignored-qualifiers -Wempty-body 79 | -Wclobbered -Wuninitialized 80 | 81 | * Intel: 82 | 83 | .. code-block:: bash 84 | 85 | -Wall -Wunused-parameter -Wshadow -pedantic 86 | -Werror -Wsign-compare -Wtype-limits 87 | -Wuninitialized 88 | 89 | * Clang: 90 | 91 | .. code-block:: bash 92 | 93 | -Wall -Wunused-parameter -Wshadow -pedantic 94 | -Werror -Wsign-compare -Wtype-limits 95 | -Wuninitialized 96 | 97 | * NVCC: 98 | 99 | .. code-block:: bash 100 | 101 | -Wall -Wunused-parameter -Wshadow -pedantic 102 | -Werror -Wsign-compare -Wtype-limits 103 | -Wuninitialized 104 | 105 | .. note:: 106 | 107 | Other compilers are tested occasionally, in particular when pushing from develop to master branch. These are tested less rigorously without ``-Werror`` and only for a select set of backends. 108 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/Custom-Reductions:-Built-In-Reducers-with-Custom-Scalar-Types.md: -------------------------------------------------------------------------------- 1 | In order to use a Custom Scalar Type with Built-in reductions, the following requirements must be fulfilled. 2 | 3 | * An initialization function must be provided via a specialization of the Kokkos::reduction_identity class. 4 | * Operators required for applied reduction class must be implemented. 5 | * The class / struct must either use the default copy constructor or have a specific copy constructor 6 | implemented. 7 | 8 | ## Example 9 | 10 | This example performs a custom reduction on an array using the built-in Sum reducer. 11 | 12 | ```c++ 13 | namespace sample { // namespace helps with name resolution in reduction identity 14 | template< class ScalarType, int N > 15 | struct array_type { 16 | ScalarType the_array[N]; 17 | 18 | KOKKOS_INLINE_FUNCTION // Default constructor - Initialize to 0's 19 | array_type() { 20 | for (int i = 0; i < N; i++ ) { the_array[i] = 0; } 21 | } 22 | KOKKOS_INLINE_FUNCTION // Copy Constructor 23 | array_type(const array_type & rhs) { 24 | for (int i = 0; i < N; i++ ){ 25 | the_array[i] = rhs.the_array[i]; 26 | } 27 | } 28 | KOKKOS_INLINE_FUNCTION // add operator 29 | array_type& operator += (const array_type& src) { 30 | for ( int i = 0; i < N; i++ ) { 31 | the_array[i]+=src.the_array[i]; 32 | } 33 | return *this; 34 | } 35 | KOKKOS_INLINE_FUNCTION // volatile add operator 36 | void operator += (const volatile array_type& src) volatile { 37 | for ( int i = 0; i < N; i++ ) { 38 | the_array[i]+=src.the_array[i]; 39 | } 40 | } 41 | }; 42 | typedef array_type ValueType; // used to simplify code below 43 | } 44 | namespace Kokkos { //reduction identity must be defined in Kokkos namespace 45 | template<> 46 | struct reduction_identity< sample::ValueType > { 47 | KOKKOS_FORCEINLINE_FUNCTION static sample::ValueType sum() { 48 | return sample::ValueType(); 49 | } 50 | }; 51 | } 52 | int main( int argc, char* argv[] ) 53 | { 54 | int E = 1024; 55 | Kokkos::initialize( argc, argv ); 56 | { 57 | sample::ValueType tr; 58 | Kokkos::parallel_reduce( E, KOKKOS_LAMBDA (const int& i, 59 | sample::ValueType & upd) { 60 | int ndx =i%4; // sum all of the i%4 entries (divide total by 4) 61 | upd.the_array[ndx] += 1; 62 | }, Kokkos::Sum(tr) ); 63 | printf( " Computed result for %d is %d, %d, %d, %d \n", 64 | E, tr.the_array[0], tr.the_array[1], 65 | tr.the_array[2], tr.the_array[3] ); 66 | } 67 | Kokkos::finalize(); 68 | 69 | return 0; 70 | } 71 | 72 | ``` -------------------------------------------------------------------------------- /docs/source/API/algorithms/std-algorithms/all/StdRotate.md: -------------------------------------------------------------------------------- 1 | 2 | # `rotate` 3 | 4 | Header File: `Kokkos_StdAlgorithms.hpp` 5 | 6 | ```c++ 7 | namespace Kokkos{ 8 | namespace Experimental{ 9 | 10 | template 11 | IteratorType rotate(const ExecutionSpace& exespace, (1) 12 | IteratorType first, 13 | IteratorType n_first, 14 | IteratorType last); 15 | 16 | template 17 | IteratorType rotate(const std::string& label, const ExecutionSpace& exespace, (2) 18 | IteratorType first, 19 | IteratorType n_first, 20 | IteratorType last); 21 | 22 | template 23 | auto rotate(const ExecutionSpace& exespace, (3) 24 | const ::Kokkos::View& view, 25 | std::size_t n_location); 26 | 27 | template 28 | auto rotate(const std::string& label, const ExecutionSpace& exespace, (4) 29 | const ::Kokkos::View& view, 30 | std::size_t n_location); 31 | 32 | } //end namespace Experimental 33 | } //end namespace Kokkos 34 | ``` 35 | 36 | ## Description 37 | 38 | Swaps the elements in the range `[first, last)` or in `view` in such a way that 39 | the element `n_first` or `view(n_location)` becomes the first element of the 40 | new range and `n_first - 1` becomes the last element. 41 | 42 | 43 | ## Parameters and Requirements 44 | 45 | - `exespace`: 46 | - execution space instance 47 | - `label`: 48 | - used to name the implementation kernels for debugging purposes 49 | - for 1, the default string is: "Kokkos::rotate_iterator_api_default" 50 | - for 3, the default string is: "Kokkos::rotate_view_api_default" 51 | - `first, last`: 52 | - range of elements to modify 53 | - must be *random access iterators* 54 | - must represent a valid range, i.e., `last >= first` (checked in debug mode) 55 | - must be accessible from `exespace` 56 | - `n_first`: 57 | - iterator to element that should be the first of the rotated range 58 | - must be a *random access iterator* 59 | - must be such that `[first, n_first)` and `[n_first, last)` are valid ranges. 60 | - must be accessible from `exespace` 61 | - `view`: 62 | - must be rank-1, and have `LayoutLeft`, `LayoutRight`, or `LayoutStride` 63 | - must be accessible from `exespace` 64 | - `n_location`: 65 | - integer value identifying the element to rotate about 66 | 67 | 68 | ## Return 69 | 70 | - For (1,2), returns the iterator computed as `first + (last - n_first)` 71 | 72 | - For (3,4), returns `Kokkos::begin(view) + (Kokkos::end(view) - n_location)` 73 | -------------------------------------------------------------------------------- /docs/source/API/core/view/subview.md: -------------------------------------------------------------------------------- 1 | # `subview` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | auto s = subview(view,std::pair(5,191),Kokkos::ALL,1); 8 | ``` 9 | 10 | Creates a `Kokkos::View` viewing a subset of another `Kokkos::View`. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | IMPL_DETAIL subview(const ViewType& v, Args ... args); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | IMPL_DETAIL subview(const ViewType& v, Args ... args); 24 | ``` 25 | Returns a new `Kokkos::View` `s` viewing a subset of `v` specified by `args...`. 26 | The return type of subview is an implementation detail and is determined by 27 | the types in `Args...`. 28 | 29 | Subset selection: 30 | * For every integer argument in `args...` the rank of the returned view is 31 | one smaller than the rank of `v` and the values referenced by `s` correspond to 32 | the values associated with using the integer argument in the corresponding 33 | position during indexing into `v`. 34 | * Passing [`Kokkos::ALL`](KokkosALL) as the `r`th argument is equivalent to passing 35 | `pair(0,v.extent(r))` as the `r`th argument. 36 | * If the `r`th argument `arg_r` is the `d`th range (`std::pair`, `Kokkos::pair` or 37 | [`Kokkos::ALL`](KokkosALL)) in the argument list than `s.extent(d) = arg_r.second-arg_r.first`, 38 | and dimension `d` of `s` references the range `[arg_r.first,arg_r.second)` of 39 | dimension `r` of `v`. 40 | 41 | Restrictions: 42 | * `sizeof...(args)` is equal to `ViewType::rank`. 43 | * Valid arguments are of type: 44 | * `std::pair` with `std::is_integral::value` being true. 45 | * `Kokkos::pair` with `std::is_integral::value` being true. 46 | * `iType` with `std::is_integral::value` being true. 47 | * `decltype(`[`Kokkos::ALL`](KokkosALL)`)` 48 | * If the `r`th argument `arg_r` is of type `std::pair` or `Kokkos::pair` it must meet: 49 | * `arg_r.first >= 0` 50 | * `arg_r.second <= v.extent(r)` 51 | * `arg_r.first <= arg_r.second` 52 | * If the `r`th argument `arg_r` is an integral it must meet: 53 | * `arg_r >= 0` 54 | * `arg_r < v.extent(r)` 55 | 56 | ## Examples 57 | 58 | ```c++ 59 | Kokkos::View a("A",N0,N1,N2); 60 | 61 | auto s = Kokkos::subview(a, 62 | std::pair(3,15), 63 | 5, 64 | Kokkos::ALL, 65 | Kokkos::ALL); 66 | for(int i0 = 0; i0 < s.extent(0); i0++) 67 | for(int i1 = 0; i1 < s.extent(1); i1++) 68 | for(int i2 = 0; i2 < s.extent(2); i2++) { 69 | assert(s(i0,i1,i2) == a(i0+3,5,i1,i2)); 70 | } 71 | 72 | auto s3415 = Kokkos::subview(a,3,4,1,5); 73 | assert(s3415() == a(3,4,1,5)); 74 | ``` 75 | -------------------------------------------------------------------------------- /docs/source/usecases/SoA-and-AoSoA-with-Cabana.md: -------------------------------------------------------------------------------- 1 | # Array of Structures and Structure of Arrays with Cabana 2 | 3 | [Cabana](https://github.com/ECP-copa/Cabana) is a MPI+Kokkos performance portable library for particle-based simulations. It provides particle data structures, algorithms, and utilities to enable simulations on a variety of platforms including many-core architectures and GPUs. 4 | 5 | This use case describes the SoA and AoSoA classes provided by Cabana. Their goal is to provide a vectorization-friendly collections of contiguous elements that exhibit good alignment. 6 | 7 | ## Structure of Arrays (SoA) 8 | 9 | ### `Cabana::SoA` 10 | Defined in header [``](https://github.com/ECP-copa/Cabana/blob/master/core/src/Cabana_SoA.hpp) 11 | ```C++ 12 | template 13 | struct SoA; 14 | ``` 15 | 16 | `Cabana::SoA` is a struct template that provides a way to store a fixed-size collection of heterogeneous arrays whose size is the specified vector length. 17 | 18 | Conceptually `Cabana::SoA, 8>` is equivalent to `std::tuple`. 19 | 20 | The data structure keeps a separate, homogeneous data array for each particle field, each having the same number of elements. The motivation is easier vectorization for the compiler. 21 | 22 | #### Template parameters 23 | `DataTypes` 24 | : The types of the elements that the SoA stores as fixed size arrays. 25 | It is required to be a specialization of `Cabana::MemberTypes` which is defined as 26 | ```C++ 27 | template 28 | MemberTypes; 29 | ``` 30 | 31 | `VectorLength` 32 | : The number of elements stored in contiguous memory locations for each data type. 33 | 34 | #### Non-member functions 35 | `Cabana::get` 36 | : accesses the specified element of the SoA. 37 | 38 | ## Array of Structures of Arrays (AoSoA) 39 | 40 | ### Cabana::AoSoA 41 | Defined in header [``](https://github.com/ECP-copa/Cabana/blob/master/core/src/Cabana_AoSoA.hpp) 42 | 43 | ```C++ 44 | template ::vector_length, 47 | class MemoryTraits = Kokkos::MemoryManaged> 48 | class AoSoA; 49 | ``` 50 | 51 | #### Template parameters 52 | `DataTypes` 53 | : The types of the elements stored in the underlying `Cabana::SoA`s. 54 | 55 | `DeviceType` 56 | : The Kokkos device type that carries the information about where to execute code and where to allocate storage. 57 | 58 | `VectorLength` 59 | : The vector length for the structure of arrays (optional). 60 | 61 | `MemoryTraits` 62 | : The Kokkos memory traits that tells who controls memory allocation and deallocation (optional). 63 | 64 | #### Non-member functions 65 | `slice` 66 | : accesses the particle data fields. 67 | -------------------------------------------------------------------------------- /wiki-md-files-to-port/SoA-and-AoSoA-with-Cabana.md: -------------------------------------------------------------------------------- 1 | # Array of Structures and Structure of Arrays with Cabana 2 | 3 | [Cabana](https://github.com/ECP-copa/Cabana) is a MPI+Kokkos performance portable library for particle-based simulations. It provides particle data structures, algorithms, and utilities to enable simulations on a variety of platforms including many-core architectures and GPUs. 4 | 5 | This use case describes the SoA and AoSoA classes provided by Cabana. Their goal is to provide a vectorization-friendly collections of contiguous elements that exhibit good alignment. 6 | 7 | ## Structure of Arrays (SoA) 8 | 9 | ### `Cabana::SoA` 10 | Defined in header [``](https://github.com/ECP-copa/Cabana/blob/master/core/src/Cabana_SoA.hpp) 11 | ```C++ 12 | template 13 | struct SoA; 14 | ``` 15 | 16 | `Cabana::SoA` is a struct template that provides a way to store a fixed-size collection of heterogeneous arrays whose size is the specified vector length. 17 | 18 | Conceptually `Cabana::SoA, 8>` is equivalent to `std::tuple`. 19 | 20 | The data structure keeps a separate, homogeneous data array for each particle field, each having the same number of elements. The motivation is easier vectorization for the compiler. 21 | 22 | 23 | #### Template parameters 24 | `DataTypes` 25 | : The types of the elements that the SoA stores as fixed size arrays. 26 | It is required to be a specialization of `Cabana::MemberTypes` which is defined as 27 | ```C++ 28 | template 29 | MemberTypes; 30 | ``` 31 | 32 | `VectorLength` 33 | : The number of elements stored in contiguous memory locations for each data type. 34 | 35 | #### Non-member functions 36 | `Cabana::get` 37 | : accesses the specified element of the SoA. 38 | 39 | ## Array of Structures of Arrays (AoSoA) 40 | 41 | ### Cabana::AoSoA 42 | Defined in header [``](https://github.com/ECP-copa/Cabana/blob/master/core/src/Cabana_AoSoA.hpp) 43 | 44 | ```C++ 45 | template ::vector_length, 48 | class MemoryTraits = Kokkos::MemoryManaged> 49 | class AoSoA; 50 | ``` 51 | 52 | #### Template parameters 53 | `DataTypes` 54 | : The types of the elements stored in the underlying `Cabana::SoA`s. 55 | 56 | `DeviceType` 57 | : The Kokkos device type that carries the information about where to execute code and where to allocate storage. 58 | 59 | `VectorLength` 60 | : The vector length for the structure of arrays (optional). 61 | 62 | `MemoryTraits` 63 | : The Kokkos memory traits that tells who controls memory allocation and deallocation (optional). 64 | 65 | #### Non-member functions 66 | `slice` 67 | : accesses the particle data fields. -------------------------------------------------------------------------------- /wiki-md-files-to-port/API-Reference/Kokkos::subview.md: -------------------------------------------------------------------------------- 1 | # `Kokkos::subview` 2 | 3 | Header File: `Kokkos_Core.hpp` 4 | 5 | Usage: 6 | ```c++ 7 | auto s = subview(view,std::pair(5,191),Kokkos::ALL,1); 8 | ``` 9 | 10 | Creates a `Kokkos::View` viewing a subset of another `Kokkos::View`. 11 | 12 | ## Synopsis 13 | 14 | ```c++ 15 | template 16 | IMPL_DETAIL subview(const ViewType& v, Args ... args); 17 | ``` 18 | 19 | ## Description 20 | 21 | * ```c++ 22 | template 23 | IMPL_DETAIL subview(const ViewType& v, Args ... args); 24 | ``` 25 | Returns a new `Kokkos::View` `s` viewing a subset of `v` specified by `args...`. 26 | The return type of subview is an implementation detail and is determined by 27 | the types in `Args...`. 28 | 29 | Subset selection: 30 | * For every integer argument in `args...` the rank of the returned view is 31 | one smaller than the rank of `v` and the values referenced by `s` correspond to 32 | the values associated with using the integer argument in the corresponding 33 | position during indexing into `v`. 34 | * Passing `Kokkos::ALL` as the `r`th argument is equivalent to passing 35 | `pair(0,v.extent(r))` as the `r`th argument. 36 | * If the `r`th argument `arg_r` is the `d`th range (`std::pair`, `Kokkos::pair` or 37 | `Kokkos::ALL`) in the argument list than `s.extent(d) = arg_r.second-arg_r.first`, 38 | and dimension `d` of `s` references the range `[arg_r.first,arg_r.second)` of 39 | dimension `r` of `v`. 40 | 41 | Restrictions: 42 | * `sizeof...(args)` is equal to `ViewType::rank`. 43 | * Valid arguments are of type: 44 | * `std::pair` with `std::is_integral::value` being true. 45 | * `Kokkos::pair` with `std::is_integral::value` being true. 46 | * `iType` with `std::is_integral::value` being true. 47 | * `decltype(Kokkos::ALL)` 48 | * If the `r`th argument `arg_r` is of type `std::pair` or `Kokkos::pair` it must meet: 49 | * `arg_r.first >= 0` 50 | * `arg_r.second <= v.extent(r)` 51 | * `arg_r.first <= arg_r.second` 52 | * If the `r`th argument `arg_r` is an integral it must meet: 53 | * `arg_r >= 0` 54 | * `arg_r < v.extent(r)` 55 | 56 | ## Examples 57 | 58 | ```c++ 59 | 60 | Kokkos::View a("A",N0,N1,N2); 61 | 62 | auto s = Kokkos::subview(a, 63 | std::pair(3,15), 64 | 5, 65 | Kokkos::ALL, 66 | Kokkos::ALL); 67 | for(int i0 = 0; i0 < s.extent(0); i0++) 68 | for(int i1 = 0; i1 < s.extent(1); i1++) 69 | for(int i2 = 0; i2 < s.extent(2); i2++) { 70 | assert(s(i0,i1,i2) == a(i0+3,5,i1,i2)); 71 | } 72 | 73 | auto s3415 = Kokkos::subview(a,3,4,1,5); 74 | assert(s3415() == a(3,4,1,5)); 75 | ``` 76 | 77 | 78 | 79 | --------------------------------------------------------------------------------