curfil  ..
 All Classes Functions Variables Typedefs Friends Groups Pages
Public Types | Public Member Functions | Friends | List of all members
cuv::linear_memory< V, M > Class Template Reference

represents contiguous memory More...

#include <memory.hpp>

Inheritance diagram for cuv::linear_memory< V, M >:
cuv::memory< V, M >

Public Types

typedef super::value_type value_type
 type of contained values
typedef super::const_value_type const_value_type
 const version of value_type
typedef super::memory_space_type memory_space_type
 host or dev memory_space
typedef super::index_type index_type
 how to index values
typedef super::size_type size_type
 type of shapes
typedef super::reference_type reference_type
 type of reference you get using operator[]
typedef super::const_reference_type const_reference_type
 type of reference you get using operator[]
- Public Types inherited from cuv::memory< V, M >
typedef unconst< V >::type value_type
 type of contained values
typedef const V const_value_type
 const version of value_type
typedef M memory_space_type
 host or dev memory_space
typedef unsigned int size_type
 type of shapes
typedef int index_type
 how to index values
typedef reference< V, M > reference_type
 type of reference you get using operator[]
typedef const reference< V, M > const_reference_type
 type of reference you get using operator[]

Public Member Functions

 linear_memory (const boost::shared_ptr< allocator > _allocator=boost::make_shared< default_allocator >())
 default constructor: does nothing
 linear_memory (size_type i, const boost::shared_ptr< allocator > _allocator=boost::make_shared< default_allocator >())
 constructor: reserves space for i elements
value_typerelease ()
 releases ownership of pointer (for storage in memory class)
void set_size (size_type s)
 sets the size (reallocates if necessary)
void alloc ()
 allocate space according to size()
my_typeoperator= (const my_type &o)
 Copy linear_memory.
template<class OM >
my_typeoperator= (const linear_memory< value_type, OM > &o)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 linear_memory (const my_type &o)
 construct from other linear memory
template<class OM >
 linear_memory (const linear_memory< V, OM > &o)
 construct from other linear memory
reference_type operator[] (const index_type &idx)
const_reference_type operator[] (const index_type &idx) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 ~linear_memory ()
 deallocates memory
void set_strides (linear_memory< index_type, cuv::host_memory_space > &strides, const linear_memory< size_type, cuv::host_memory_space > &shape, row_major)
 set strides for this memory
void set_strides (linear_memory< index_type, cuv::host_memory_space > &strides, const linear_memory< size_type, cuv::host_memory_space > &shape, column_major)
 set strides for this memory
void reverse ()
 reverse the array (for transposing etc)
template<class value_type2 , class memory_space >
void copy_from (const value_type2 *src, size_t size, memory_space m, cudaStream_t stream)
template<class V2 , class OM >
void copy_from (const linear_memory< V2, OM > &src, cudaStream_t stream) const
- Public Member Functions inherited from cuv::memory< V, M >
V * ptr ()
const V * ptr () const
size_type size () const
size_type memsize () const
void reset (V *p, size_type s)
 reset information (use with care, for deserialization)
 memory (const boost::shared_ptr< allocator > &_allocator)
 default constructor (just sets ptr to NULL)
 memory (value_type *ptr, size_type size, const boost::shared_ptr< allocator > &_allocator, bool owned=true)
 construct with pointer (takes /ownership/ of this pointer and deletes it when destroyed!)
 ~memory ()
 destructor (deallocates the memory)
void dealloc ()
 dellocate space
template<class value_type2 , class memory_space >
void copy_from (V *dst, const value_type2 *src, size_t size, memory_space m, cudaStream_t stream)
template<class value_type2 , class memory_space >
void copy2d_from (V *dst, const value_type2 *src, size_t dpitch, size_t spitch, size_t h, size_t w, memory_space m, cudaStream_t stream)
template<class value_type2 , class memory_space >
void copy2d_from (const value_type2 *src, size_t dpitch, size_t spitch, size_t h, size_t w, memory_space m, cudaStream_t stream)

Friends

class boost::serialization::access

Additional Inherited Members

- Protected Member Functions inherited from cuv::memory< V, M >
void check_size_limit (size_t size) const
- Protected Attributes inherited from cuv::memory< V, M >
V * m_ptr
 points to allocated memory
size_type m_size
 size (for serialization)
boost::shared_ptr< allocatorm_allocator
 how stored memory was allocated
bool m_owned
 flag is this instance owns the memory (m_ptr) and is responsibly for destroying

Detailed Description

template<class V, class M>
class cuv::linear_memory< V, M >

represents contiguous memory

Definition at line 217 of file memory.hpp.

Constructor & Destructor Documentation

template<class V, class M>
cuv::linear_memory< V, M >::linear_memory ( size_type  i,
const boost::shared_ptr< allocator _allocator = boost::make_shared<default_allocator>() 
)
inlineexplicit

constructor: reserves space for i elements

Parameters
inumber of elements

Definition at line 247 of file memory.hpp.

Member Function Documentation

template<class V, class M>
my_type& cuv::linear_memory< V, M >::operator= ( const my_type o)
inline

Copy linear_memory.

Parameters
oSource linear_memory
Returns
*this

Definition at line 285 of file memory.hpp.

template<class V, class M>
template<class OM >
my_type& cuv::linear_memory< V, M >::operator= ( const linear_memory< value_type, OM > &  o)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Copy linear_memory from other memory type.

Parameters
oSource linear_memory
Returns
*this

Definition at line 313 of file memory.hpp.

template<class V, class M>
reference_type cuv::linear_memory< V, M >::operator[] ( const index_type idx)
inline
Returns
a reference to memory at a position
Parameters
idxposition

Definition at line 347 of file memory.hpp.

template<class V, class M>
const_reference_type cuv::linear_memory< V, M >::operator[] ( const index_type idx) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns
a reference to memory at a position
Parameters
idxposition

Definition at line 359 of file memory.hpp.

template<class V, class M>
void cuv::linear_memory< V, M >::reverse ( )
inline

reverse the array (for transposing etc)

currently only enabled for host memory space arrays

Definition at line 396 of file memory.hpp.


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