forked from kokkos/kokkos
-
Notifications
You must be signed in to change notification settings - Fork 0
Kokkos::realloc
Damien L-G edited this page Mar 1, 2022
·
4 revisions
Header File: Kokkos_Core.hpp
Usage:
realloc(view,n0,n1,n2,n3);
realloc(view,layout);
Reallocates a view to have the new dimensions. Can grow or shrink, and will not preserve content.
template <class T, class... P>
void realloc(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);
template <class I, class T, class... P>
void realloc(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);
template <class T, class... P>
void realloc(Kokkos::View<T, P...>& v,
const typename Kokkos::View<T, P...>::array_layout& layout);
template <class I, class T, class... P>
void realloc(const I& arg_prop, Kokkos::View<T, P...>& v,
const typename Kokkos::View<T, P...>::array_layout& layout);
-
template <class T, class... P> void realloc(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 without preserving its contents.-
v
: existing view, can be a default constructed one. -
n[X]
: new length for extent X.
Restrictions:
-
View<T, P...>::array_layout
is eitherLayoutLeft
orLayoutRight
.
-
-
template <class I, class T, class... P> void realloc(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 without preserving its contents. The newKokkos::View
is constructed using the View constructor propertyarg_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 eitherLayoutLeft
orLayoutRight
.
-
-
template <class T, class... P> void realloc(Kokkos::View<T, P...>& v, const typename Kokkos::View<T, P...>::array_layout& layout);
Resizes
v
to have the new dimensions without preserving its contents.-
v
: existing view, can be a default constructed one. -
layout
: a layout instance containing the new dimensions.
-
-
template <class I, class T, class... P> void realloc(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 without preserving its contents. The newKokkos::View
is constructed using the View constructor propertyarg_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
.
-
-
Reallocate a
Kokkos::realloc(v, 2, 3);
Kokkos::View
with dynamic rank 2 to have dynamic extent 2 and 3 respectively. -
Reallocate a
Kokkos::realloc(Kokkos::WithoutInitializing, v, 2, 3);
Kokkos::View
with dynamic rank 2 to have dynamic extent 2 and 3 respectively. After this call, the View is uninitialized.
Home:
- Introduction
- Machine Model
- Programming Model
- Compiling
- Initialization
- View
- Parallel Dispatch
- Hierarchical Parallelism
- Custom Reductions
- Atomic Operations
- Subviews
- Interoperability
- Kokkos and Virtual Functions
- Initialization and Finalization
- View
- Data Parallelism
- Execution Policies
- Spaces
- Task Parallelism
- Utilities
- STL Compatibility
- Numerics
- Detection Idiom