-
Notifications
You must be signed in to change notification settings - Fork 50
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 (9/10): team-level API, and rst update for release 4.2 #403
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f19f66e
Convert StdIsSorted from md to rst
antoinemeyer5 af68d53
Convert StdIsSorted from md to rst: fix
antoinemeyer5 7da5a8b
Fix description of StdIsSorted
antoinemeyer5 e25f58f
Fix indentation
antoinemeyer5 7b577bd
Fix
antoinemeyer5 2b0414a
Convert StdMinElement from md to rst
antoinemeyer5 798d9fc
Convert StdMinElement from md to rst: fix
antoinemeyer5 09b1e1f
Convert StdMaxElement from md to rst
antoinemeyer5 27c829c
Convert StdMinMaxElement from md to rst
antoinemeyer5 ebd76ef
Convert StdMinElement from md to rst: fix
antoinemeyer5 44e552a
Convert StdMinElement from md to rst: fix
antoinemeyer5 4283f11
Convert StdMinElement from md to rst: fix
antoinemeyer5 ea86eb6
Convert StdMaxElement from md to rst: fix
antoinemeyer5 156b37d
Convert StdMaxElement from md to rst: fix
antoinemeyer5 4b2a578
Convert StdMinMaxElement from md to rst: fix
antoinemeyer5 8102b84
Convert StdMinElement from md to rst: fix
antoinemeyer5 6f5588a
Convert StdIsPartitioned from md to rst
antoinemeyer5 8a5f5ed
Convert StdPartitionCopy from md to rst
antoinemeyer5 1c0a880
Convert StdPartitionCopy from md to rst: fix indent
antoinemeyer5 c258fd8
Convert StdMinMaxElement from md to rst: fix indent
antoinemeyer5 675400a
Convert StdPartitionCopy from md to rst: fix pred
antoinemeyer5 49773a3
update
fnrizzi 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
101 changes: 0 additions & 101 deletions
101
docs/source/API/algorithms/std-algorithms/all/StdIsPartitioned.md
This file was deleted.
Oops, something went wrong.
143 changes: 143 additions & 0 deletions
143
docs/source/API/algorithms/std-algorithms/all/StdIsPartitioned.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,143 @@ | ||
``is_partitioned`` | ||
================== | ||
|
||
Header: ``<Kokkos_StdAlgorithms.hpp>`` | ||
|
||
Description | ||
----------- | ||
|
||
Returns ``true`` if all elements in a range or in a rank-1 ``View`` satisfying | ||
the predicate ``pred`` appear *before* all elements that don't. | ||
If the range or the ``view`` is empty, returns ``true``. | ||
|
||
Interface | ||
--------- | ||
|
||
.. warning:: This is currently inside the ``Kokkos::Experimental`` namespace. | ||
|
||
Overload set accepting execution space | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code-block:: cpp | ||
|
||
template <class ExecutionSpace, class InputIterator, class PredicateType> | ||
bool is_partitioned(const ExecutionSpace& exespace, (1) | ||
InputIterator first, InputIterator last, | ||
PredicateType pred); | ||
|
||
template <class ExecutionSpace, class InputIterator, class PredicateType> | ||
bool is_partitioned(const std::string& label, const ExecutionSpace& exespace, (2) | ||
InputIterator first, InputIterator last, | ||
PredicateType pred); | ||
|
||
template <class ExecutionSpace, class DataType, class... Properties, class PredicateType> | ||
auto is_partitioned(const ExecutionSpace& exespace, | ||
const ::Kokkos::View<DataType, Properties...>& view, (3) | ||
PredicateType pred); | ||
|
||
template <class ExecutionSpace, class DataType, class... Properties, class PredicateType> | ||
auto is_partitioned(const std::string& label, const ExecutionSpace& exespace, | ||
const ::Kokkos::View<DataType, Properties...>& view, (4) | ||
PredicateType pred); | ||
|
||
|
||
Overload set accepting a team handle | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 4.2 | ||
|
||
.. code-block:: cpp | ||
|
||
template <class TeamHandleType, class IteratorType, class PredicateType> | ||
KOKKOS_FUNCTION | ||
bool is_partitioned(const TeamHandleType& teamHandle, IteratorType first, (5) | ||
IteratorType last, PredicateType pred); | ||
|
||
template <class TeamHandleType, class PredicateType, class DataType, | ||
class... Properties> | ||
KOKKOS_FUNCTION | ||
bool is_partitioned(const TeamHandleType& teamHandle, (6) | ||
const ::Kokkos::View<DataType, Properties...>& view, | ||
PredicateType pred); | ||
|
||
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 | ||
|
||
- 1: The default string is "Kokkos::is_partitioned_iterator_api_default". | ||
|
||
- 3: The default string is "Kokkos::is_partitioned_view_api_default". | ||
|
||
- NOTE: overloads accepting a team handle do not use a label internally | ||
|
||
- ``first, last``: range of elements to search in | ||
|
||
- must be *random access iterators*, e.g., returned from ``Kokkos::Experimental::(c)begin/(c)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`` or from the execution space associated with the team handle | ||
|
||
- ``pred``: | ||
|
||
- *unary* predicate returning ``true`` for the required element to replace; ``pred(v)`` | ||
must be valid to be called from the execution space passed, and convertible to bool for every | ||
argument ``v`` of type (possible const) ``value_type``, where ``value_type`` | ||
is the value type of ``IteratorType`` (for 1,2) or the value type of ``view`` (for 3,4), | ||
and must not modify ``v``. | ||
|
||
- must conform to: | ||
|
||
.. code-block:: cpp | ||
|
||
struct Predicate | ||
{ | ||
KOKKOS_INLINE_FUNCTION | ||
bool operator()(const value_type & v) const { return /* ... */; } | ||
|
||
// or, also valid | ||
|
||
KOKKOS_INLINE_FUNCTION | ||
bool operator()(value_type v) const { return /* ... */; } | ||
}; | ||
|
||
Return Value | ||
~~~~~~~~~~~~ | ||
|
||
- ``true``: if range is partitioned according to ``pred`` or if range is empty | ||
- ``false``: otherwise | ||
|
||
Example | ||
~~~~~~~ | ||
|
||
.. code-block:: cpp | ||
|
||
namespace KE = Kokkos::Experimental; | ||
|
||
template<class ValueType> | ||
struct IsNegative | ||
{ | ||
KOKKOS_INLINE_FUNCTION | ||
bool operator()(const ValueType & operand) const { | ||
constexpr auto zero = static_cast<ValueType>(0); | ||
return (operand < zero); | ||
} | ||
}; | ||
|
||
using view_type = Kokkos::View<int*>; | ||
view_type a("a", 15); | ||
// fill a somehow | ||
|
||
auto exespace = Kokkos::DefaultExecutionSpace; | ||
const auto res = KE::is_partitioned(exespace, KE::cbegin(a), KE::cend(a), IsNegative<int>()); |
105 changes: 0 additions & 105 deletions
105
docs/source/API/algorithms/std-algorithms/all/StdIsSorted.md
This file was deleted.
Oops, something went wrong.
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.