From 4b5804b3c759cf13219b89ab2f4e0afd1d32deac Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Thu, 26 Jan 2023 14:59:54 +0100 Subject: [PATCH 1/2] kokkos#120: API/core/builtinreducers/LOr init transition --- docs/source/API/core/builtinreducers/LOr.md | 88 ----------------- docs/source/API/core/builtinreducers/LOr.rst | 99 ++++++++++++++++++++ 2 files changed, 99 insertions(+), 88 deletions(-) delete mode 100644 docs/source/API/core/builtinreducers/LOr.md create mode 100644 docs/source/API/core/builtinreducers/LOr.rst diff --git a/docs/source/API/core/builtinreducers/LOr.md b/docs/source/API/core/builtinreducers/LOr.md deleted file mode 100644 index b691c43d1..000000000 --- a/docs/source/API/core/builtinreducers/LOr.md +++ /dev/null @@ -1,88 +0,0 @@ -# `LOr` - -Specific implementation of [ReducerConcept](ReducerConcept) performing logical `OR` operation - -Header File: `Kokkos_Core.hpp` - -Usage: -```c++ -T result; -parallel_reduce(N,Functor,LOr(result)); -``` - -## Synopsis -```c++ -template -class LOr{ - public: - typedef LOr 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 - LOr(value_type& value_); - - KOKKOS_INLINE_FUNCTION - LOr(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++ - LOr(value_type& result) - ``` - Constructs a reducer which references a local variable as its result location. - - * ```c++ - LOr(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 `or` 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=0`. - - * ```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 - * `LOr::value_type` is non-const `T` - * `LOr::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::lor()` is a valid expression. - * In order to use LOr 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/LOr.rst b/docs/source/API/core/builtinreducers/LOr.rst new file mode 100644 index 000000000..ccd5b7dec --- /dev/null +++ b/docs/source/API/core/builtinreducers/LOr.rst @@ -0,0 +1,99 @@ +``LOr`` +======= + +.. role::cpp(code) + :language: cpp + +.. role:: cppkokkos(code) + :language: cppkokkos + +Specific implementation of `ReducerConcept `_ performing logical ``OR`` operation + +Header File: ```` + +Usage +----- + +.. code-block:: cpp + + T result; + parallel_reduce(N,Functor,LOr(result)); + +Synopsis +-------- + +.. code-block:: cpp + + template + class LOr{ + public: + typedef LOr 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 + LOr(value_type& value_); + + KOKKOS_INLINE_FUNCTION + LOr(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:: LOr(value_type& value_); + + * Constructs a reducer which references a local variable as its result location. + +.. cppkokkos:kokkosinlinefunction:: LOr(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 ``or`` 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=0``. + +.. 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 +~~~~~~~~~~~~~~~~~~~~~~ + +* ``LOr::value_type`` is non-const ``T`` +* ``LOr::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::lor()`` is a valid expression. +* In order to use LOr 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 20945fbf3b25d6972e8a6e2a143534598737fe1e Mon Sep 17 00:00:00 2001 From: antoinemeyer5 Date: Wed, 1 Feb 2023 13:14:12 +0100 Subject: [PATCH 2/2] kokkos#120: API/core/builtinreducers/LOr remove cpp --- docs/source/API/core/builtinreducers/LOr.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/source/API/core/builtinreducers/LOr.rst b/docs/source/API/core/builtinreducers/LOr.rst index ccd5b7dec..5b323345e 100644 --- a/docs/source/API/core/builtinreducers/LOr.rst +++ b/docs/source/API/core/builtinreducers/LOr.rst @@ -1,9 +1,6 @@ ``LOr`` ======= -.. role::cpp(code) - :language: cpp - .. role:: cppkokkos(code) :language: cppkokkos