From f67e4ca35516821267cdc81f1cb45f3d46ac7207 Mon Sep 17 00:00:00 2001 From: pierrepebay Date: Wed, 14 Dec 2022 15:02:31 +0100 Subject: [PATCH 1/4] kokkos#120: resize md to rst --- docs/source/API/core/view/resize.md | 168 ---------------------- docs/source/API/core/view/resize.rst | 201 +++++++++++++++++++++++++++ 2 files changed, 201 insertions(+), 168 deletions(-) delete mode 100644 docs/source/API/core/view/resize.md create mode 100644 docs/source/API/core/view/resize.rst diff --git a/docs/source/API/core/view/resize.md b/docs/source/API/core/view/resize.md deleted file mode 100644 index e667e8f5f..000000000 --- a/docs/source/API/core/view/resize.md +++ /dev/null @@ -1,168 +0,0 @@ -# `resize` - -Header File: `Kokkos_Core.hpp` - -Usage: -```c++ -resize(view,n0,n1,n2,n3); -resize(view,layout); -``` - -Reallocates a view to have the new dimensions. Can grow or shrink, and will preserve content of the common subextents. - -## Synopsis - -```c++ -template -void resize(View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - -template -void resize(const I& arg_prop, Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - -template -void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - -template -void resize(Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - -template -void resize(const I& arg_prop, Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - -template -void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); -``` - -## Description - -* ```c++ - template - void resize(View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - ``` - Resizes `v` to have the new dimensions while preserving the contents for the common subview of the old and new view. - * `v`: existing view, can be a default constructed one. - * `n[X]`: new length for extent X. - - Restrictions: - * `View::array_layout` is either `LayoutLeft` or `LayoutRight`. - -* ```c++ - template - void resize(const I& arg_prop, Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - ``` - Resizes `v` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new `Kokkos::View` is constructed using the View constructor property `arg_prop`, e.g., Kokkos::WithoutInitializing. - * `v`: existing view, can be a default constructed one. - * `n[X]`: new length for extent X. - * `arg_prop`: View constructor property, e.g., `Kokkos::WithoutInitializing`. - - Restrictions: - * `View::array_layout` is either `LayoutLeft` or `LayoutRight`. - -* ```c++ - template - void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - ``` - Resizes `v` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new `Kokkos::View` is constructed using the View constructor properties `arg_prop`, e.g., `Kokkos::view_alloc(Kokkos::WithoutInitializing)`. If `arg_prop` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. - * `v`: existing view, can be a default constructed one. - * `n[X]`: new length for extent X. - * `arg_prop`: View constructor properties, e.g., `Kokkos::view_alloc(Kokkos::WithoutInitializing)`. - - Restrictions: - * `View::array_layout` is either `LayoutLeft` or `LayoutRight`. - * `arg_prop` must not include a pointer to memory, a label, or a memory space. - -* ```c++ - template - void resize(Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - ``` - Resizes `v` to have the new dimensions while preserving the contents for the common subview of the old and new view. - * `v`: existing view, can be a default constructed one. - * `layout`: a layout instance containing the new dimensions. - -* ```c++ - template - void resize(const I& arg_prop, Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - ``` - Resizes `v` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new `Kokkos::View` is constructed using the View constructor property `arg_prop`, e.g., Kokkos::WithoutInitializing. - * `v`: existing view, can be a default constructed one. - * `layout`: a layout instance containing the new dimensions. - * `arg_prop`: View constructor property, e.g., `Kokkos::WithoutInitializing`. - -* ```c++ - template - void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - ``` - Resizes `v` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new `Kokkos::View` is constructed using the View constructor properties `arg_prop`, e.g., `Kokkos::view_alloc(Kokkos::WithoutInitializing)`. If `arg_prop` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. - * `v`: existing view, can be a default constructed one. - * `layout`: a layout instance containing the new dimensions. - * `arg_prop`: View constructor properties, e.g., `Kokkos::view_alloc(Kokkos::WithoutInitializing)`. - - Restrictions: - * `arg_prop` must not include a pointer to memory, a label, or a memory space. - -## Example: - * ```c++ - Kokkos::resize(v, 2, 3); - ``` - Resize a `Kokkos::View` with dynamic rank 2 to have dynamic extent 2 and 3 respectively preserving previous content. - * ```c++ - Kokkos::resize(Kokkos::WithoutInitializing, v, 2, 3); - ``` - Resize a `Kokkos::View` with dynamic rank 2 to have dynamic extent 2 and 3 respectively preserving previous content. After this call, the new content is uninitialized. diff --git a/docs/source/API/core/view/resize.rst b/docs/source/API/core/view/resize.rst new file mode 100644 index 000000000..b72106fe0 --- /dev/null +++ b/docs/source/API/core/view/resize.rst @@ -0,0 +1,201 @@ +``resize`` +========== + +.. role:: cppkokkos(code) + :language: cppkokkos + +.. role:: cpp(code) + :language: cpp + +Header File: ``Kokkos_Core.hpp`` + +Usage: + +.. code-block:: cpp + + resize(view,n0,n1,n2,n3); + resize(view,layout); + +Reallocates a view to have the new dimensions. Can grow or shrink, and will preserve content of the common subextents. + +Synopsis +-------- + +.. code-block:: cpp + + template + void resize(View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + template + void resize(const I& arg_prop, Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + template + void resize(const Impl::ViewCtorProp& arg_prop, + Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + template + void resize(Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); + + template + void resize(const I& arg_prop, Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); + + template + void resize(const Impl::ViewCtorProp& arg_prop, + Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); + +Description +----------- + +* .. code-block:: cpp + + template + void resize(View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. + + * ``v``: existing view, can be a default constructed one. + * ``n[X]``: new length for extent X. + + Restrictions: + + * ``View::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. + +* .. code-block:: cpp + + template + void resize(const I& arg_prop, Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. + + * ``v``: existing view, can be a default constructed one. + + * ``n[X]``: new length for extent X. + + * ``arg_prop``: View constructor property, e.g., ``Kokkos::WithoutInitializing``. + + Restrictions: + + * ``View::array_layout`` is either ``LayoutLeft` or `LayoutRight``. + +* .. code-block:: cpp + + template + void resize(const Impl::ViewCtorProp& arg_prop, + Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor properties ``arg_prop``, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. If ``arg_prop`` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. + + * ``v``: existing view, can be a default constructed one. + * ``n[X]``: new length for extent X. + * ``arg_prop``: View constructor properties, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. + + Restrictions: + + * ``View::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. + * ``arg_prop`` must not include a pointer to memory, a label, or a memory space. + +* .. code-block:: cpp + + template + void resize(Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. + + * ``v``: existing view, can be a default constructed one. + * ``layout``: a layout instance containing the new dimensions. + +* .. code-block:: cpp + + template + void resize(const I& arg_prop, Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. + + * ``v``: existing view, can be a default constructed one. + * ``layout``: a layout instance containing the new dimensions. + * ``arg_prop``: View constructor property, e.g., ``Kokkos::WithoutInitializing``. + +* .. code-block:: cpp + + template + void resize(const Impl::ViewCtorProp& arg_prop, + Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor properties ``arg_prop``, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. If ``arg_prop`` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. + + * ``v``: existing view, can be a default constructed one. + * ``layout``: a layout instance containing the new dimensions. + * ``arg_prop``: View constructor properties, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. + + Restrictions: + + * ``arg_prop`` must not include a pointer to memory, a label, or a memory space. + +Example: +-------- + +* .. code-block:: cpp + + Kokkos::resize(v, 2, 3); + +Resize a ``Kokkos::View`` with dynamic rank 2 to have dynamic extent 2 and 3 respectively preserving previous content. + +* .. code-block:: cpp + + Kokkos::resize(Kokkos::WithoutInitializing, v, 2, 3); + +Resize a ``Kokkos::View`` with dynamic rank 2 to have dynamic extent 2 and 3 respectively preserving previous content. After this call, the new content is uninitialized. From f02cf16b7f8b7872dca58d0fca7c1c6e8d41a36d Mon Sep 17 00:00:00 2001 From: pierrepebay Date: Mon, 19 Dec 2022 15:47:33 +0100 Subject: [PATCH 2/4] kokkos#120: fixed alignement --- docs/source/API/core/view/resize.rst | 60 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/docs/source/API/core/view/resize.rst b/docs/source/API/core/view/resize.rst index b72106fe0..062c927e0 100644 --- a/docs/source/API/core/view/resize.rst +++ b/docs/source/API/core/view/resize.rst @@ -36,39 +36,39 @@ Synopsis template void resize(const I& arg_prop, Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); template void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); template void resize(Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); + const typename Kokkos::View::array_layout& layout); template void resize(const I& arg_prop, Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); + const typename Kokkos::View::array_layout& layout); template void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); + Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); Description ----------- @@ -77,14 +77,14 @@ Description template void resize(View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. @@ -123,7 +123,7 @@ Description * .. code-block:: cpp template - void resize(const Impl::ViewCtorProp& arg_prop, + void resize(const Impl::ViewCtorProp& arg_prop, Kokkos::View& v, const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, From aea477b7789218aebfd8ce99a7f39f99a0952c9f Mon Sep 17 00:00:00 2001 From: Francesco Rizzi Date: Fri, 10 Mar 2023 10:00:26 +0100 Subject: [PATCH 3/4] wip --- docs/source/API/core/view/resize.rst | 122 ++++++++------------------- 1 file changed, 34 insertions(+), 88 deletions(-) diff --git a/docs/source/API/core/view/resize.rst b/docs/source/API/core/view/resize.rst index 062c927e0..ccccfae19 100644 --- a/docs/source/API/core/view/resize.rst +++ b/docs/source/API/core/view/resize.rst @@ -4,12 +4,10 @@ .. role:: cppkokkos(code) :language: cppkokkos -.. role:: cpp(code) - :language: cpp +Header File: -Header File: ``Kokkos_Core.hpp`` - -Usage: +Usage +----- .. code-block:: cpp @@ -18,107 +16,55 @@ Usage: Reallocates a view to have the new dimensions. Can grow or shrink, and will preserve content of the common subextents. -Synopsis --------- - -.. code-block:: cpp - - template - void resize(View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - - template - void resize(const I& arg_prop, Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - - template - void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - - template - void resize(Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - - template - void resize(const I& arg_prop, Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); - - template - void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); Description ----------- -* .. code-block:: cpp - - template - void resize(View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, +.. cppkokkos::function: template \ + void resize(View& v,\ + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. - * ``v``: existing view, can be a default constructed one. - * ``n[X]``: new length for extent X. + :param v: existing view, can be a default constructed one. - Restrictions: + :param n[X]: new length for extent X. - * ``View::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. + Restrictions: ``View::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. -* .. code-block:: cpp +| - template - void resize(const I& arg_prop, Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, +.. cppkokkos::function: template \ + void resize(const I& arg_prop, Kokkos::View& v, \ + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. + Resizes ``v`` to have the new dimensions while preserving the contents for the + common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. - * ``v``: existing view, can be a default constructed one. + :param v: existing view, can be a default constructed one. - * ``n[X]``: new length for extent X. + :param n[X]: new length for extent X. - * ``arg_prop``: View constructor property, e.g., ``Kokkos::WithoutInitializing``. + :param arg_prop: View constructor property, e.g., ``Kokkos::WithoutInitializing``. - Restrictions: + Restrictions: ``View::array_layout`` is either ``LayoutLeft` or `LayoutRight``. + +| - * ``View::array_layout`` is either ``LayoutLeft` or `LayoutRight``. * .. code-block:: cpp From 6c839ec87a348c540816eba0bf2161b6a1e0f5fa Mon Sep 17 00:00:00 2001 From: Francesco Rizzi Date: Fri, 10 Mar 2023 10:10:50 +0100 Subject: [PATCH 4/4] finalize, fix indentation of arguments in code blocks --- docs/source/API/core/view/resize.rst | 127 +++++++++++++++------------ 1 file changed, 69 insertions(+), 58 deletions(-) diff --git a/docs/source/API/core/view/resize.rst b/docs/source/API/core/view/resize.rst index ccccfae19..e65253af7 100644 --- a/docs/source/API/core/view/resize.rst +++ b/docs/source/API/core/view/resize.rst @@ -20,67 +20,73 @@ Reallocates a view to have the new dimensions. Can grow or shrink, and will pres Description ----------- -.. cppkokkos::function: template \ - void resize(View& v,\ - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - - Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. +* .. code-block:: cpp - :param v: existing view, can be a default constructed one. + template + void resize(View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - :param n[X]: new length for extent X. + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. - Restrictions: ``View::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. + * ``v``: existing view, can be a default constructed one. + * ``n[X]``: new length for extent X. -| + Restrictions: -.. cppkokkos::function: template \ - void resize(const I& arg_prop, Kokkos::View& v, \ - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG,\ - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + * ``View::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. - Resizes ``v`` to have the new dimensions while preserving the contents for the - common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. +* .. code-block:: cpp - :param v: existing view, can be a default constructed one. + template + void resize(const I& arg_prop, Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common + subview of the old and new view. The new ``Kokkos::View`` is constructed using the + View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. - :param n[X]: new length for extent X. + * ``v``: existing view, can be a default constructed one. - :param arg_prop: View constructor property, e.g., ``Kokkos::WithoutInitializing``. + * ``n[X]``: new length for extent X. - Restrictions: ``View::array_layout`` is either ``LayoutLeft` or `LayoutRight``. + * ``arg_prop``: View constructor property, e.g., ``Kokkos::WithoutInitializing``. -| + Restrictions: + * ``View::array_layout`` is either ``LayoutLeft` or `LayoutRight``. * .. code-block:: cpp - template - void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, - const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); - - Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor properties ``arg_prop``, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. If ``arg_prop`` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. + template + void resize(const Impl::ViewCtorProp& arg_prop, + Kokkos::View& v, + const size_t n0 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n1 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n2 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n3 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n4 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n5 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n6 = KOKKOS_IMPL_CTOR_DEFAULT_ARG, + const size_t n7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG); + + Resizes ``v`` to have the new dimensions while preserving the contents for the common + subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor + properties ``arg_prop``, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. + If ``arg_prop`` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. * ``v``: existing view, can be a default constructed one. * ``n[X]``: new length for extent X. @@ -93,9 +99,9 @@ Description * .. code-block:: cpp - template - void resize(Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); + template + void resize(Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. @@ -104,11 +110,13 @@ Description * .. code-block:: cpp - template - void resize(const I& arg_prop, Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); + template + void resize(const I& arg_prop, Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); - Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor property ``arg_prop``, e.g., Kokkos::WithoutInitializing. + Resizes ``v`` to have the new dimensions while preserving the contents for the common subview + of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor + property ``arg_prop``, e.g., Kokkos::WithoutInitializing. * ``v``: existing view, can be a default constructed one. * ``layout``: a layout instance containing the new dimensions. @@ -116,12 +124,15 @@ Description * .. code-block:: cpp - template - void resize(const Impl::ViewCtorProp& arg_prop, - Kokkos::View& v, - const typename Kokkos::View::array_layout& layout); + template + void resize(const Impl::ViewCtorProp& arg_prop, + Kokkos::View& v, + const typename Kokkos::View::array_layout& layout); - Resizes ``v`` to have the new dimensions while preserving the contents for the common subview of the old and new view. The new ``Kokkos::View`` is constructed using the View constructor properties ``arg_prop``, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. If ``arg_prop`` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. + Resizes ``v`` to have the new dimensions while preserving the contents for the + common subview of the old and new view. The new ``Kokkos::View`` is constructed using + the View constructor properties ``arg_prop``, e.g., ``Kokkos::view_alloc(Kokkos::WithoutInitializing)``. + If ``arg_prop`` includes an execution space, it is used for allocating memory and for copying elements without using a final fence. * ``v``: existing view, can be a default constructed one. * ``layout``: a layout instance containing the new dimensions.