From 49520256ba201c6d13cd380ae0128ab824a61cf4 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Thu, 26 Jan 2023 14:40:43 +0100 Subject: [PATCH 1/3] kokkos#120: API/core/builtinreducers/LAnd init transition --- docs/source/API/core/builtinreducers/LAnd.md | 88 --------------- docs/source/API/core/builtinreducers/LAnd.rst | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 88 deletions(-) delete mode 100644 docs/source/API/core/builtinreducers/LAnd.md create mode 100644 docs/source/API/core/builtinreducers/LAnd.rst diff --git a/docs/source/API/core/builtinreducers/LAnd.md b/docs/source/API/core/builtinreducers/LAnd.md deleted file mode 100644 index bac236932..000000000 --- a/docs/source/API/core/builtinreducers/LAnd.md +++ /dev/null @@ -1,88 +0,0 @@ -# `LAnd` - -Specific implementation of [ReducerConcept](ReducerConcept) performing logical `AND` operation - -Header File: `Kokkos_Core.hpp` - -Usage: -```c++ -T result; -parallel_reduce(N,Functor,LAnd(result)); -``` - -## Synopsis -```c++ -template -class LAnd{ - public: - typedef LAnd reducer; - typedef typename std::remove_cv::type value_type; - typedef Kokkos::View result_view_type; - - KOKKOS_INLINE_FUNCTION - void join(value_type& dest, const value_type& src) const - - KOKKOS_INLINE_FUNCTION - void init( value_type& val) const; - - KOKKOS_INLINE_FUNCTION - value_type& reference() const; - - KOKKOS_INLINE_FUNCTION - result_view_type view() const; - - KOKKOS_INLINE_FUNCTION - LAnd(value_type& value_); - - KOKKOS_INLINE_FUNCTION - LAnd(const result_view_type& value_); -}; -``` - -## Public Class Members - -### Typedefs - - * `reducer`: The self type. - * `value_type`: The reduction scalar type. - * `result_view_type`: A `Kokkos::View` referencing the reduction result - -### Constructors - - * ```c++ - LAnd(value_type& result) - ``` - Constructs a reducer which references a local variable as its result location. - - * ```c++ - LAnd(const result_view_type result) - ``` - Constructs a reducer which references a specific view as its result location. - -### Functions - - * ```c++ - void join(value_type& dest, const value_type& src) const; - ``` - Store logical `and` of `src` and `dest` into `dest`: `dest = src && dest;`. - - * ```c++ - void init( value_type& val) const; - ``` - Initialize `val` using the Kokkos::reduction_identity::land() method. The default implementation sets `val=1`. - - * ```c++ - value_type& reference() const; - ``` - Returns a reference to the result provided in class constructor. - - * ```c++ - result_view_type view() const; - ``` - Returns a view of the result place provided in class constructor. - -### Additional Information - * `LAnd::value_type` is non-const `T` - * `LAnd::result_view_type` is `Kokkos::View>`. Note that the S (memory space) must be the same as the space where the result resides. - * Requires: `Scalar` has `operator =` and `operator &&` defined. `Kokkos::reduction_identity::land()` is a valid expression. - * In order to use LAnd with a custom type, a template specialization of `Kokkos::reduction_identity` must be defined. See [Built-In Reducers with Custom Scalar Types](../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types) for details diff --git a/docs/source/API/core/builtinreducers/LAnd.rst b/docs/source/API/core/builtinreducers/LAnd.rst new file mode 100644 index 000000000..c661af996 --- /dev/null +++ b/docs/source/API/core/builtinreducers/LAnd.rst @@ -0,0 +1,100 @@ +``LAnd`` +======== + +.. role::cpp(code) + :language: cpp + +.. role:: cppkokkos(code) + :language: cppkokkos + +Specific implementation of `ReducerConcept `_ performing logical ``AND`` operation + +Header File: ```` + +Usage +----- + +.. code-block:: cpp + + T result; + parallel_reduce(N,Functor,LAnd(result)); + +Synopsis +-------- + +.. code-block:: cpp + + template + class LAnd{ + public: + typedef LAnd reducer; + typedef typename std::remove_cv::type value_type; + typedef Kokkos::View result_view_type; + + KOKKOS_INLINE_FUNCTION + void join(value_type& dest, const value_type& src) const; + + KOKKOS_INLINE_FUNCTION + void init(value_type& val) const; + + KOKKOS_INLINE_FUNCTION + value_type& reference() const; + + KOKKOS_INLINE_FUNCTION + result_view_type view() const; + + KOKKOS_INLINE_FUNCTION + LAnd(value_type& value_); + + KOKKOS_INLINE_FUNCTION + LAnd(const result_view_type& value_); + }; + + +Public Class Members +-------------------- + +Typedefs +~~~~~~~~ + +* ``reducer``: The self type. +* ``value_type``: The reduction scalar type. +* ``result_view_type``: A ``Kokkos::View`` referencing the reduction result + +Constructors +~~~~~~~~~~~~ + +.. cppkokkos:kokkosinlinefunction:: LAnd(value_type& value_); + + * Constructs a reducer which references a local variable as its result location. + +.. cppkokkos:kokkosinlinefunction:: LAnd(const result_view_type& value_); + + * Constructs a reducer which references a specific view as its result location. + +Functions +~~~~~~~~~ + +.. cppkokkos:kokkosinlinefunction:: void join(value_type& dest, const value_type& src) const; + + * Store logical ``and`` of ``src`` and ``dest`` into ``dest``: ``dest = src && dest;``. + +.. cppkokkos:kokkosinlinefunction:: void init(value_type& val) const; + + * Initialize ``val`` using the ``Kokkos::reduction_identity::land()`` method. The default implementation sets ``val=1``. + +.. cppkokkos:kokkosinlinefunction:: value_type& reference() const; + + * Returns a reference to the result provided in class constructor. + +.. cppkokkos:kokkosinlinefunction:: result_view_type view() const; + + * Returns a view of the result place provided in class constructor. + +Additional Information +~~~~~~~~~~~~~~~~~~~~~~ + +* ``LAnd::value_type`` is non-const ``T`` +* ``LAnd::result_view_type`` is ``Kokkos::View>``. Note that the S (memory space) must be the same as the space where the result resides. +* Requires: ``Scalar`` has ``operator =`` and ``operator &&`` defined. ``Kokkos::reduction_identity::land()`` is a valid expression. +* In order to use LAnd with a custom type, a template specialization of ``Kokkos::reduction_identity`` must be defined. See `Built-In Reducers with Custom Scalar Types <../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.html`_ for details From f4bfb0700a6342f911c8c579b8c5f21ec7763c61 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Thu, 26 Jan 2023 14:48:10 +0100 Subject: [PATCH 2/3] kokkos#120: API/core/builtinreducers/LAnd fix link --- docs/source/API/core/builtinreducers/LAnd.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/API/core/builtinreducers/LAnd.rst b/docs/source/API/core/builtinreducers/LAnd.rst index c661af996..6dcc594ea 100644 --- a/docs/source/API/core/builtinreducers/LAnd.rst +++ b/docs/source/API/core/builtinreducers/LAnd.rst @@ -97,4 +97,4 @@ Additional Information * ``LAnd::value_type`` is non-const ``T`` * ``LAnd::result_view_type`` is ``Kokkos::View>``. Note that the S (memory space) must be the same as the space where the result resides. * Requires: ``Scalar`` has ``operator =`` and ``operator &&`` defined. ``Kokkos::reduction_identity::land()`` is a valid expression. -* In order to use LAnd with a custom type, a template specialization of ``Kokkos::reduction_identity`` must be defined. See `Built-In Reducers with Custom Scalar Types <../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.html`_ for details +* In order to use LAnd with a custom type, a template specialization of ``Kokkos::reduction_identity`` must be defined. See `Built-In Reducers with Custom Scalar Types <../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.html>`_ for details From f570822ac30ec2f6bbee6d053f183bc008e99646 Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Wed, 1 Feb 2023 11:32:26 +0100 Subject: [PATCH 3/3] kokkos#120: API/core/builtinreducers/LAnd remove cpp and keep cppkokkos --- docs/source/API/core/builtinreducers/LAnd.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/source/API/core/builtinreducers/LAnd.rst b/docs/source/API/core/builtinreducers/LAnd.rst index 6dcc594ea..5ac5b9336 100644 --- a/docs/source/API/core/builtinreducers/LAnd.rst +++ b/docs/source/API/core/builtinreducers/LAnd.rst @@ -1,9 +1,6 @@ ``LAnd`` ======== -.. role::cpp(code) - :language: cpp - .. role:: cppkokkos(code) :language: cppkokkos