Kokkos Core Kernels Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | 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

using array_type = View< typename traits::scalar_array_type, typename traits::array_layout, typename traits::device_type, typename traits::hooks_policy, typename traits::memory_traits >
 Compatible view of array of scalar types. More...
 
using const_type = View< typename traits::const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::hooks_policy, typename traits::memory_traits >
 Compatible view of const data type. More...
 
using non_const_type = View< typename traits::non_const_data_type, typename traits::array_layout, typename traits::device_type, typename traits::hooks_policy, typename traits::memory_traits >
 Compatible view of non-const data type. More...
 
using HostMirror = View< typename traits::non_const_data_type, typename traits::array_layout, Device< DefaultHostExecutionSpace, typename traits::host_mirror_space::memory_space >, typename traits::hooks_policy >
 Compatible HostMirror view. More...
 
using host_mirror_type = View< typename traits::non_const_data_type, typename traits::array_layout, typename traits::host_mirror_space, typename traits::hooks_policy >
 Compatible HostMirror view. More...
 
using uniform_type = typename Impl::ViewUniformType< View, 0 >::type
 Unified types. 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 292 of file Kokkos_Core_fwd.hpp.

Member Typedef Documentation

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

Compatible view of array of scalar types.

Definition at line 602 of file Kokkos_View.hpp.

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

Compatible view of const data type.

Definition at line 608 of file Kokkos_View.hpp.

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

Compatible view of non-const data type.

Definition at line 614 of file Kokkos_View.hpp.

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

Compatible HostMirror view.

Definition at line 621 of file Kokkos_View.hpp.

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

Compatible HostMirror view.

Definition at line 626 of file Kokkos_View.hpp.

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

Unified types.

Definition at line 629 of file Kokkos_View.hpp.


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