Extended CUDA Library (ecuda)  2.0
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Public Types | Public Member Functions | Friends | List of all members
ecuda::striding_ptr< T, P > Class Template Reference

A specialized pointer to striding memory. More...

#include <striding_ptr.hpp>

Public Types

typedef T element_type
 
typedef P pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 

Public Member Functions

__HOST__ __DEVICE__ striding_ptr (pointer ptr=pointer(), size_type stride=0)
 
__HOST__ __DEVICE__ striding_ptr (const striding_ptr &src)
 
template<typename U , typename Q >
__HOST__ __DEVICE__ striding_ptr (const striding_ptr< U, Q > &src)
 
__HOST__ __DEVICE__ pointer get () const
 
__HOST__ __DEVICE__ size_type get_stride () const
 
__DEVICE__ reference operator* ()
 
__DEVICE__ const_reference operator* () const
 
__DEVICE__ pointer operator-> () const
 
__DEVICE__ reference operator[] (std::size_t i)
 
__DEVICE__ const_reference operator[] (std::size_t i) const
 
__HOST__ __DEVICE__ striding_ptroperator++ ()
 
__HOST__ __DEVICE__ striding_ptroperator-- ()
 
__HOST__ __DEVICE__ striding_ptr operator++ (int)
 
__HOST__ __DEVICE__ striding_ptr operator-- (int)
 
__HOST__ __DEVICE__ striding_ptroperator+= (int x)
 
__HOST__ __DEVICE__ striding_ptroperator-= (int x)
 
__HOST__ __DEVICE__ striding_ptr operator+ (int x) const
 
__HOST__ __DEVICE__ striding_ptr operator- (int x) const
 
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool operator== (const striding_ptr< T2, P2 > &other) const
 
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool operator!= (const striding_ptr< T2, P2 > &other) const
 
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool operator< (const striding_ptr< T2, P2 > &other) const
 
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool operator> (const striding_ptr< T2, P2 > &other) const
 
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool operator<= (const striding_ptr< T2, P2 > &other) const
 
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool operator>= (const striding_ptr< T2, P2 > &other) const
 

Friends

template<typename U , typename Q >
class striding_ptr
 
template<typename U , typename V >
std::basic_ostream< U, V > & operator<< (std::basic_ostream< U, V > &out, const striding_ptr &ptr)
 

Detailed Description

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
class ecuda::striding_ptr< T, P >

A specialized pointer to striding memory.

A specialized pointer to device memory where traversal of the data takes into a "stride", or a fixed number of elements that are skipped each time the pointer is incremented.

The specialization is used to create certain views of a matrix or cube (e.g. single matrix column).

Memory use can be conceptualized as:

|--- stride ----| // in multiples of sizeof(T)
+-+-------------+
| |xxxxxxxxxxxxx|
| |xxxxxxxxxxxxx| x = allocated but not used
| |xxxxxxxxxxxxx|
| |xxxxxxxxxxxxx|
| |xxxxxxxxxxxxx|
| |xxxxxxxxxxxxx| ... etc. (total size of the allocation is not known internally by striding_ptr)
+-+--------+----+

For example, a pointer that will traverse the first column of a 10x5 matrix containing elements of type T could be represented with striding_ptr<T>(ptr,5), where ptr points to the first element of the matrix.

Definition at line 78 of file striding_ptr.hpp.

Member Typedef Documentation

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
typedef const T& ecuda::striding_ptr< T, P >::const_reference

Definition at line 85 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
typedef std::ptrdiff_t ecuda::striding_ptr< T, P >::difference_type

Definition at line 87 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
typedef T ecuda::striding_ptr< T, P >::element_type

Definition at line 82 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
typedef P ecuda::striding_ptr< T, P >::pointer

Definition at line 83 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
typedef T& ecuda::striding_ptr< T, P >::reference

Definition at line 84 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
typedef std::size_t ecuda::striding_ptr< T, P >::size_type

Definition at line 86 of file striding_ptr.hpp.

Constructor & Destructor Documentation

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ ecuda::striding_ptr< T, P >::striding_ptr ( pointer  ptr = pointer(),
size_type  stride = 0 
)
inline

Definition at line 96 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ ecuda::striding_ptr< T, P >::striding_ptr ( const striding_ptr< T, P > &  src)
inline

Definition at line 98 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename U , typename Q >
__HOST__ __DEVICE__ ecuda::striding_ptr< T, P >::striding_ptr ( const striding_ptr< U, Q > &  src)
inline

Definition at line 101 of file striding_ptr.hpp.

Member Function Documentation

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ pointer ecuda::striding_ptr< T, P >::get ( ) const
inline

Definition at line 114 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ size_type ecuda::striding_ptr< T, P >::get_stride ( ) const
inline

Definition at line 116 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool ecuda::striding_ptr< T, P >::operator!= ( const striding_ptr< T2, P2 > &  other) const
inline

Definition at line 136 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__DEVICE__ reference ecuda::striding_ptr< T, P >::operator* ( )
inline

Definition at line 118 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__DEVICE__ const_reference ecuda::striding_ptr< T, P >::operator* ( ) const
inline

Definition at line 119 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr ecuda::striding_ptr< T, P >::operator+ ( int  x) const
inline

Definition at line 132 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr& ecuda::striding_ptr< T, P >::operator++ ( )
inline

Definition at line 124 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr ecuda::striding_ptr< T, P >::operator++ ( int  )
inline

Definition at line 126 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr& ecuda::striding_ptr< T, P >::operator+= ( int  x)
inline

Definition at line 129 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr ecuda::striding_ptr< T, P >::operator- ( int  x) const
inline

Definition at line 133 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr& ecuda::striding_ptr< T, P >::operator-- ( )
inline

Definition at line 125 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr ecuda::striding_ptr< T, P >::operator-- ( int  )
inline

Definition at line 127 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__HOST__ __DEVICE__ striding_ptr& ecuda::striding_ptr< T, P >::operator-= ( int  x)
inline

Definition at line 130 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__DEVICE__ pointer ecuda::striding_ptr< T, P >::operator-> ( ) const
inline

Definition at line 120 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool ecuda::striding_ptr< T, P >::operator< ( const striding_ptr< T2, P2 > &  other) const
inline

Definition at line 137 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool ecuda::striding_ptr< T, P >::operator<= ( const striding_ptr< T2, P2 > &  other) const
inline

Definition at line 139 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool ecuda::striding_ptr< T, P >::operator== ( const striding_ptr< T2, P2 > &  other) const
inline

Definition at line 135 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool ecuda::striding_ptr< T, P >::operator> ( const striding_ptr< T2, P2 > &  other) const
inline

Definition at line 138 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename T2 , typename P2 >
__HOST__ __DEVICE__ bool ecuda::striding_ptr< T, P >::operator>= ( const striding_ptr< T2, P2 > &  other) const
inline

Definition at line 140 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__DEVICE__ reference ecuda::striding_ptr< T, P >::operator[] ( std::size_t  i)
inline

Definition at line 121 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
__DEVICE__ const_reference ecuda::striding_ptr< T, P >::operator[] ( std::size_t  i) const
inline

Definition at line 122 of file striding_ptr.hpp.

Friends And Related Function Documentation

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename U , typename V >
std::basic_ostream<U,V>& operator<< ( std::basic_ostream< U, V > &  out,
const striding_ptr< T, P > &  ptr 
)
friend

Definition at line 143 of file striding_ptr.hpp.

template<typename T, typename P = typename ecuda::add_pointer<T>::type>
template<typename U , typename Q >
friend class striding_ptr
friend

Definition at line 93 of file striding_ptr.hpp.


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