-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdalgos (4/10): team-level API, and rst update for release 4.2 #390
Open
mperrinel
wants to merge
7
commits into
kokkos:main
Choose a base branch
from
mperrinel:std_teamlevel_p4of10
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fb1e77b
Converted MD files to rst files
mperrinel a66e55b
Added Team Level documentation
mperrinel 732fca4
finalize
fnrizzi 73e9895
Update docs/source/API/algorithms/std-algorithms/all/StdReplaceCopy.rst
JBludau fdd2748
Update docs/source/API/algorithms/std-algorithms/all/StdReplace.rst
JBludau 960e0ee
Update docs/source/API/algorithms/std-algorithms/all/StdReplaceCopyIf…
JBludau e4b9b8a
Update docs/source/API/algorithms/std-algorithms/all/StdReplaceIf.rst
JBludau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
115 changes: 115 additions & 0 deletions
115
docs/source/API/algorithms/std-algorithms/all/StdFill.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
|
||
``fill`` | ||
========= | ||
|
||
Header: ``<Kokkos_StdAlgorithms.hpp>`` | ||
|
||
Description | ||
----------- | ||
|
||
Assigns a given ``value`` to each element in a given range or rank-1 ``View``. | ||
|
||
|
||
Interface | ||
--------- | ||
|
||
.. warning:: This is currently inside the ``Kokkos::Experimental`` namespace. | ||
|
||
|
||
Overload set accepting execution space | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code-block:: cpp | ||
|
||
template <class ExecutionSpace, class IteratorType, class T> | ||
void fill(const ExecutionSpace& exespace, (1) | ||
IteratorType first, IteratorType last, | ||
const T& value); | ||
|
||
template <class ExecutionSpace, class IteratorType, class T> | ||
void fill(const std::string& label, const ExecutionSpace& exespace, (2) | ||
IteratorType first, IteratorType last, | ||
const T& value); | ||
|
||
template <class ExecutionSpace, class DataType, class... Properties, class T> | ||
void fill(const ExecutionSpace& exespace, (3) | ||
const Kokkos::View<DataType, Properties...>& view, | ||
const T& value); | ||
|
||
template <class ExecutionSpace, class DataType, class... Properties, class T> | ||
void fill(const std::string& label, const ExecutionSpace& exespace, (4) | ||
const Kokkos::View<DataType, Properties...>& view, | ||
const T& value); | ||
|
||
Overload set accepting a team handle | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 4.2 | ||
|
||
.. code-block:: cpp | ||
|
||
template <class TeamHandleType, class IteratorType, class T> | ||
KOKKOS_FUNCTION | ||
void fill(const TeamHandleType& teamHandle, (5) | ||
IteratorType first, IteratorType last, | ||
const T& value); | ||
|
||
template <class TeamHandleType, class DataType, class... Properties, class T> | ||
KOKKOS_FUNCTION | ||
void fill(const TeamHandleType& teamHandle, (6) | ||
const Kokkos::View<DataType, Properties...>& view, | ||
const T& value); | ||
|
||
|
||
Parameters and Requirements | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- ``exespace``: execution space instance | ||
|
||
- ``teamHandle``: team handle instance given inside a parallel region when using a TeamPolicy | ||
|
||
- ``label``: string forwarded to internal parallel kernels for debugging purposes | ||
|
||
- for 1, the default string is: "Kokkos::fill_iterator_api_default" | ||
|
||
- for 3, the default string is: "Kokkos::fill_view_api_default" | ||
|
||
- NOTE: overloads accepting a team handle do not use a label internally | ||
|
||
- ``first, last``: range of elements to modify | ||
|
||
- must be *random access iterators*, e.g., ``Kokkos::Experimental::begin/end`` | ||
|
||
- must represent a valid range, i.e., ``last >= first`` | ||
|
||
- must be accessible from ``exespace`` or from the execution space associated with the team handle | ||
|
||
- ``view``: | ||
|
||
- must be rank-1, and have ``LayoutLeft``, ``LayoutRight``, or ``LayoutStride`` | ||
|
||
- must be accessible from ``exespace`` | ||
|
||
- ``value``: value to assign to each element | ||
|
||
|
||
Return Value | ||
~~~~~~~~~~~~ | ||
|
||
None | ||
|
||
Example | ||
~~~~~~~~~~~~ | ||
|
||
.. code-block:: cpp | ||
|
||
namespace KE = Kokkos::Experimental; | ||
Kokkos::View<double*> a("a", 13); | ||
|
||
KE::fill(Kokkos::DefaultExecutionSpace(), KE::begin(a), KE::end(a), 4.); | ||
|
||
// passing the view directly | ||
KE::fill(Kokkos::DefaultExecutionSpace(), a, 22.); | ||
|
||
// explicitly set execution space (assuming active) | ||
KE::fill(Kokkos::OpenMP(), KE::begin(a), KE::end(a), 14.); | ||
73 changes: 0 additions & 73 deletions
73
docs/source/API/algorithms/std-algorithms/all/StdFill_n.md
This file was deleted.
Oops, something went wrong.
112 changes: 112 additions & 0 deletions
112
docs/source/API/algorithms/std-algorithms/all/StdFill_n.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
|
||
``fill_n`` | ||
=========== | ||
|
||
Header: ``<Kokkos_StdAlgorithms.hpp>`` | ||
|
||
Description | ||
----------- | ||
|
||
Assigns a given ``value`` to the first ``n`` elements in a given range or rank-1 ``View``. | ||
|
||
|
||
Interface | ||
--------- | ||
|
||
.. warning:: This is currently inside the ``Kokkos::Experimental`` namespace. | ||
|
||
|
||
Overload set accepting execution space | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code-block:: cpp | ||
|
||
template <class ExecutionSpace, class IteratorType, class SizeType, class T> | ||
IteratorType fill_n(const ExecutionSpace& exespace, (1) | ||
IteratorType first, | ||
SizeType n, const T& value); | ||
|
||
template <class ExecutionSpace, class IteratorType, class SizeType, class T> | ||
IteratorType fill_n(const std::string& label, const ExecutionSpace& exespace, (2) | ||
IteratorType first, | ||
SizeType n, const T& value); | ||
|
||
template < | ||
class ExecutionSpace, class DataType, class... Properties, | ||
class SizeType, class T> | ||
auto fill_n(const ExecutionSpace& exespace, (3) | ||
const Kokkos::View<DataType, Properties...>& view, | ||
SizeType n, const T& value); | ||
|
||
template < | ||
class ExecutionSpace, class DataType, class... Properties, | ||
class SizeType, class T> | ||
auto fill_n(const std::string& label, const ExecutionSpace& exespace, (4) | ||
const Kokkos::View<DataType, Properties...>& view, | ||
SizeType n, const T& value); | ||
|
||
Overload set accepting a team handle | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 4.2 | ||
|
||
|
||
.. code-block:: cpp | ||
|
||
template <class TeamHandleType, class IteratorType, class SizeType, class T> | ||
KOKKOS_FUNCTION | ||
IteratorType fill_n(const TeamHandleType& teamHandle, (5) | ||
IteratorType first, SizeType n, const T& value); | ||
|
||
template < | ||
class TeamHandleType, class DataType, class... Properties, class SizeType, | ||
class T> | ||
KOKKOS_FUNCTION | ||
auto fill_n(const TeamHandleType& teamHandle, (6) | ||
const Kokkos::View<DataType, Properties...>& view, | ||
SizeType n, const T& value); | ||
|
||
|
||
Parameters and Requirements | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
- ``exespace``, ``teamHandle``, ``first``, ``view``, ``value``: same as in [``fill``](./StdFill): execution space instance | ||
|
||
- ``label``: used to name the implementation kernels for debugging purposes | ||
|
||
- for 1, the default string is: "Kokkos::fill_n_iterator_api_default" | ||
|
||
- for 3, the default string is: "Kokkos::fill_n_view_api_default" | ||
|
||
- NOTE: overloads accepting a team handle do not use a label internally | ||
|
||
- ``n``: number of elements to modify (must be non-negative) | ||
|
||
- ``value``: value to assign to each element | ||
|
||
Return Value | ||
~~~~~~~~~~~~ | ||
|
||
If ``n > 0``, returns an iterator to the element *after* the last element assigned. | ||
|
||
Otherwise, it returns ``first`` (for 1,2,5) or ``Kokkos::begin(view)`` (for 3,4,6). | ||
|
||
|
||
Example | ||
~~~~~~~~~~~~ | ||
|
||
.. code-block:: cpp | ||
|
||
namespace KE = Kokkos::Experimental; | ||
Kokkos::View<double*> a("a", 13); | ||
// do something with a | ||
// ... | ||
|
||
const double newValue{4}; | ||
KE::fill_n(Kokkos::DefaultExecutionSpace(), KE::begin(a), 10, newValue); | ||
|
||
// passing the view directly | ||
KE::fill_n(Kokkos::DefaultExecutionSpace(), a, 10, newValue); | ||
|
||
// explicitly set execution space (assuming active) | ||
KE::fill_n(Kokkos::OpenMP(), KE::begin(a), 10, newValue); | ||
JBludau marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the explicit space here was done to show, that it is possible to pass any enabled execution space.