Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | List of all members
Kokkos::View< DataType, Properties > Class Template Reference

View to an array of data. More...

#include <Kokkos_View.hpp>

Inheritance diagram for Kokkos::View< DataType, Properties >:
Inheritance graph
[legend]

Public Types

typedef View< typename
traits::scalar_array_type,
typename traits::array_layout,
typename traits::device_type,
typename traits::memory_traits > 
array_type
 Compatible view of array of scalar types. More...
 
typedef View< typename
traits::const_data_type,
typename traits::array_layout,
typename traits::device_type,
typename traits::memory_traits > 
const_type
 Compatible view of const data type. More...
 
typedef View< typename
traits::non_const_data_type,
typename traits::array_layout,
typename traits::device_type,
typename traits::memory_traits > 
non_const_type
 Compatible view of non-const data type. More...
 
typedef View< typename
traits::non_const_data_type,
typename traits::array_layout,
Device
< DefaultHostExecutionSpace,
typename
traits::host_mirror_space::memory_space > > 
HostMirror
 Compatible HostMirror view. More...
 
typedef View< typename
traits::non_const_data_type,
typename traits::array_layout,
typename
traits::host_mirror_space > 
host_mirror_type
 Compatible HostMirror view. More...
 
typedef Impl::ViewUniformType
< View, 0 >::type 
uniform_type
 Unified types. More...
 

Public Member Functions

template<typename iType >
KOKKOS_INLINE_FUNCTION
constexpr std::enable_if
< std::is_integral< iType >
::value, size_t >::type 
extent (const iType &r) const noexcept
 rank() to be implemented More...
 

Detailed Description

template<class DataType, class... Properties>
class Kokkos::View< DataType, Properties >

View to an array of data.

A View represents an array of one or more dimensions. For details, please refer to Kokkos' tutorial materials.

Template parameters

This class has both required and optional template parameters. The DataType parameter must always be provided, and must always be first. The parameters Arg1Type, Arg2Type, and Arg3Type are placeholders for different template parameters. The default value of the fifth template parameter Specialize suffices for most use cases. When explaining the template parameters, we won't refer to Arg1Type, Arg2Type, and Arg3Type; instead, we will refer to the valid categories of template parameters, in whatever order they may occur.

Valid ways in which template arguments may be specified:

Template Parameters
DataType(required) This indicates both the type of each entry of the array, and the combination of compile-time and run-time array dimension(s). For example, double* indicates a one-dimensional array of double with run-time dimension, and int*[3] a two-dimensional array of int with run-time first dimension and compile-time second dimension (of 3). In general, the run-time dimensions (if any) must go first, followed by zero or more compile-time dimensions. For more examples, please refer to the tutorial materials.
Space(required) The memory space.
Layout(optional) The array's layout in memory. For example, LayoutLeft indicates a column-major (Fortran style) layout, and LayoutRight a row-major (C style) layout. If not specified, this defaults to the preferred layout for the Space.
MemoryTraits(optional) Assertion of the user's intended access behavior. For example, RandomAccess indicates read-only access with limited spatial locality, and Unmanaged lets users wrap externally allocated memory in a View without automatic deallocation.

MemoryTraits discussion

MemoryTraits interpretation depends on

Space

Some MemoryTraits options may have different interpretations for different Space types. For example, with the Cuda device, RandomAccess tells Kokkos to fetch the data through the texture cache, whereas the non-GPU devices have no such hardware construct.

Preferred use of MemoryTraits

Users should defer applying the optional MemoryTraits parameter until the point at which they actually plan to rely on it in a computational kernel. This minimizes the number of template parameters exposed in their code, which reduces the cost of compilation. Users may always assign a View without specified MemoryTraits to a compatible View with that specification. For example:

// Pass in the simplest types of View possible.
void
doSomething (View<double*, Cuda> out,
View<const double*, Cuda> in)
{
// Assign the "generic" View in to a RandomAccess View in_rr.
// Note that RandomAccess View objects must have const data.
View<const double*, Cuda, RandomAccess> in_rr = in;
// ... do something with in_rr and out ...
}

Definition at line 451 of file Kokkos_View.hpp.

Member Typedef Documentation

template<class DataType, class... Properties>
typedef View<typename traits::scalar_array_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits> Kokkos::View< DataType, Properties >::array_type

Compatible view of array of scalar types.

Definition at line 623 of file Kokkos_View.hpp.

template<class DataType, class... Properties>
typedef View<typename traits::const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits> Kokkos::View< DataType, Properties >::const_type

Compatible view of const data type.

Definition at line 628 of file Kokkos_View.hpp.

template<class DataType, class... Properties>
typedef View<typename traits::non_const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::memory_traits> Kokkos::View< DataType, Properties >::non_const_type

Compatible view of non-const data type.

Definition at line 634 of file Kokkos_View.hpp.

template<class DataType, class... Properties>
typedef View<typename traits::non_const_data_type, typename traits::array_layout, Device<DefaultHostExecutionSpace, typename traits::host_mirror_space::memory_space> > Kokkos::View< DataType, Properties >::HostMirror

Compatible HostMirror view.

Definition at line 641 of file Kokkos_View.hpp.

template<class DataType, class... Properties>
typedef View<typename traits::non_const_data_type, typename traits::array_layout, typename traits::host_mirror_space> Kokkos::View< DataType, Properties >::host_mirror_type

Compatible HostMirror view.

Definition at line 647 of file Kokkos_View.hpp.

template<class DataType, class... Properties>
typedef Impl::ViewUniformType<View, 0>::type Kokkos::View< DataType, Properties >::uniform_type

Unified types.

Definition at line 650 of file Kokkos_View.hpp.

Member Function Documentation

template<class DataType, class... Properties>
template<typename iType >
KOKKOS_INLINE_FUNCTION constexpr std::enable_if<std::is_integral<iType>::value, size_t>::type Kokkos::View< DataType, Properties >::extent ( const iType &  r) const
inlinenoexcept

rank() to be implemented

Definition at line 680 of file Kokkos_View.hpp.


The documentation for this class was generated from the following file: