42 #ifndef STOKHOS_STATIC_ARRAY_TRAITS_HPP
43 #define STOKHOS_STATIC_ARRAY_TRAITS_HPP
47 #include "Sacado_Traits.hpp"
49 #include "Kokkos_Macros.hpp"
58 template <
typename T,
typename device,
59 bool isScalar = Sacado::IsScalarType<T>::value>
65 template <
typename T,
typename D>
73 KOKKOS_INLINE_FUNCTION
74 void copy(
const volatile T* src,
volatile T* dest, std::size_t sz) {
75 for (std::size_t i=0; i<sz; ++i)
81 KOKKOS_INLINE_FUNCTION
82 void copy(
const volatile T* src, T* dest, std::size_t sz) {
83 for (std::size_t i=0; i<sz; ++i)
89 KOKKOS_INLINE_FUNCTION
90 void copy(
const T* src,
volatile T* dest, std::size_t sz) {
91 for (std::size_t i=0; i<sz; ++i)
97 KOKKOS_INLINE_FUNCTION
98 void copy(
const T* src, T* dest, std::size_t sz) {
99 for (std::size_t i=0; i<sz; ++i)
100 *(dest++) = *(src++);
105 KOKKOS_INLINE_FUNCTION
106 void zero(T* dest, std::size_t sz) {
107 for (std::size_t i=0; i<sz; ++i)
113 KOKKOS_INLINE_FUNCTION
114 void zero(
volatile T* dest, std::size_t sz) {
115 for (std::size_t i=0; i<sz; ++i)
121 KOKKOS_INLINE_FUNCTION
122 void fill(T* dest, std::size_t sz,
const T& v) {
123 for (std::size_t i=0; i<sz; ++i)
129 KOKKOS_INLINE_FUNCTION
130 void fill(
volatile T* dest, std::size_t sz,
const T& v) {
131 for (std::size_t i=0; i<sz; ++i)
141 template <
typename T,
typename D>
149 KOKKOS_INLINE_FUNCTION
150 void copy(
const volatile T* src,
volatile T* dest, std::size_t sz) {
153 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
156 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
157 #pragma vector aligned
159 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
162 for (std::size_t i=0; i<sz; ++i)
163 *(dest++) = *(src++);
168 KOKKOS_INLINE_FUNCTION
169 void copy(
const volatile T* src, T* dest, std::size_t sz) {
172 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
175 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
176 #pragma vector aligned
178 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
181 for (std::size_t i=0; i<sz; ++i)
182 *(dest++) = *(src++);
187 KOKKOS_INLINE_FUNCTION
188 void copy(
const T* src,
volatile T* dest, std::size_t sz) {
191 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
194 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
195 #pragma vector aligned
197 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
200 for (std::size_t i=0; i<sz; ++i)
201 *(dest++) = *(src++);
206 KOKKOS_INLINE_FUNCTION
207 void copy(
const T* src, T* dest, std::size_t sz) {
209 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
212 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
213 #pragma vector aligned
215 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
218 for (std::size_t i=0; i<sz; ++i)
219 *(dest++) = *(src++);
224 KOKKOS_INLINE_FUNCTION
225 void zero(T* dest, std::size_t sz) {
227 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
230 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
231 #pragma vector aligned
233 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
236 for (std::size_t i=0; i<sz; ++i)
242 KOKKOS_INLINE_FUNCTION
243 void zero(
volatile T* dest, std::size_t sz) {
245 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
248 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
249 #pragma vector aligned
251 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
254 for (std::size_t i=0; i<sz; ++i)
260 KOKKOS_INLINE_FUNCTION
261 void fill(T* dest, std::size_t sz, T v) {
263 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
266 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
267 #pragma vector aligned
269 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
272 for (std::size_t i=0; i<sz; ++i)
278 KOKKOS_INLINE_FUNCTION
279 void fill(
volatile T* dest, std::size_t sz, T v) {
281 #ifdef STOKHOS_HAVE_PRAGMA_IVDEP
284 #ifdef STOKHOS_HAVE_PRAGMA_VECTOR_ALIGNED
285 #pragma vector aligned
287 #ifdef STOKHOS_HAVE_PRAGMA_UNROLL
290 for (std::size_t i=0; i<sz; ++i)
298 #endif // STOKHOS_STATIC_ARRAY_TRAITS_HPP
static KOKKOS_INLINE_FUNCTION void copy(const T *src, T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void zero(volatile T *dest, std::size_t sz)
Zero out array dest of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const volatile T *src, T *dest, std::size_t sz)
Copy array from src to dest of length sz.
Static array allocation class.
static KOKKOS_INLINE_FUNCTION void fill(T *dest, std::size_t sz, const T &v)
Fill array dest of length sz with value v.
static KOKKOS_INLINE_FUNCTION void copy(const T *src, volatile T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const T *src, volatile T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const volatile T *src, volatile T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const volatile T *src, T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const T *src, T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void copy(const volatile T *src, volatile T *dest, std::size_t sz)
Copy array from src to dest of length sz.
static KOKKOS_INLINE_FUNCTION void zero(volatile T *dest, std::size_t sz)
Zero out array dest of length sz.
static KOKKOS_INLINE_FUNCTION void fill(volatile T *dest, std::size_t sz, const T &v)
Fill array dest of length sz with value v.
static KOKKOS_INLINE_FUNCTION void fill(T *dest, std::size_t sz, T v)
Fill array dest of length sz with value v.
static KOKKOS_INLINE_FUNCTION void zero(T *dest, std::size_t sz)
Zero out array dest of length sz.
static KOKKOS_INLINE_FUNCTION void zero(T *dest, std::size_t sz)
Zero out array dest of length sz.
static KOKKOS_INLINE_FUNCTION void fill(volatile T *dest, std::size_t sz, T v)
Fill array dest of length sz with value v.