-
Notifications
You must be signed in to change notification settings - Fork 49
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
API-core-view-resize from md to rst #226
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
``resize`` | ||
========== | ||
|
||
.. role:: cppkokkos(code) | ||
:language: cppkokkos | ||
|
||
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. | ||
|
||
|
||
Description | ||
----------- | ||
|
||
* .. code-block:: cpp | ||
|
||
template <class T, class... P> | ||
void resize(View<T, P...>& 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<T, P...>::array_layout`` is either ``LayoutLeft`` or ``LayoutRight``. | ||
|
||
* .. code-block:: cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
template <class I, class T, class... P> | ||
void resize(const I& arg_prop, Kokkos::View<T, P...>& 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<T, P...>::array_layout`` is either ``LayoutLeft` or `LayoutRight``. | ||
|
||
* .. code-block:: cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
template <class T, class... P, class... ViewCtorArgs> | ||
void resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop, | ||
Kokkos::View<T, P...>& 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<T, P...>::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 <class T, class... P> | ||
void resize(Kokkos::View<T, P...>& v, | ||
const typename Kokkos::View<T, P...>::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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
template <class T, class... P> | ||
void resize(const I& arg_prop, Kokkos::View<T, P...>& v, | ||
const typename Kokkos::View<T, P...>::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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
template <class T, class... P, class... ViewCtorArgs> | ||
void resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop, | ||
Kokkos::View<T, P...>& v, | ||
const typename Kokkos::View<T, P...>::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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the "Example" section have real, live working code that one could copy and paste? This is not an .md to .rst issue, but one relating to standardization. This issue does not have to be dealt with in the conversion exercise. I mention it because we probably want to move towards "live", working code, vs. pseudo code. |
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.
Please use :cpp:function:: (or rather our variant
:cppkokkos:function::
)