represents 2D non-contiguous ("pitched") memory More...
#include <memory.hpp>
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 | |
size_type | rows () const |
size_type | cols () const |
size_type | pitch () const |
size_type | size () const |
size_type | memsize () const |
pitched_memory (const boost::shared_ptr< allocator > _allocator=boost::make_shared< default_allocator >()) | |
default constructor: does nothing | |
pitched_memory (index_type i, index_type j, const boost::shared_ptr< allocator > _allocator=boost::make_shared< default_allocator >()) | |
constructor: reserves space for at least i*j elements | |
void | alloc () |
allocate space according to size() | |
value_type * | release () |
releases ownership of pointer (for storage in memory class) | |
void | set_size (size_type rows, size_type cols) |
set the size (reallocating, if necessary) | |
my_type & | operator= (const my_type &o) |
Copy pitched_memory. | |
template<class OM > | |
my_type & | operator= (const pitched_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. | |
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. | |
reference_type | operator() (const index_type &i, const index_type &j) |
get a reference to a datum in memory | |
const_reference_type | operator() (const index_type &i, const index_type &j) const |
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) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. column major version. | |
template<class V2 , class OM > | |
void | copy2d_from (const memory< V2, OM > src, cudaStream_t stream) const |
template<class V2 , class OM > | |
void | copy_from (const pitched_memory< V2, OM > &src, cudaStream_t stream) const |
Public Member Functions inherited from cuv::memory< V, M > | |
V * | ptr () |
const V * | ptr () 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 | copy_from (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< allocator > | m_allocator |
how stored memory was allocated | |
bool | m_owned |
flag is this instance owns the memory (m_ptr) and is responsibly for destroying |
represents 2D non-contiguous ("pitched") memory
Definition at line 425 of file memory.hpp.
|
inlineexplicit |
constructor: reserves space for at least i*j elements
i | number of rows |
j | minimum number of elements per row |
Definition at line 485 of file memory.hpp.
|
inline |
Definition at line 457 of file memory.hpp.
|
inline |
Reimplemented from cuv::memory< V, M >.
Definition at line 472 of file memory.hpp.
|
inline |
get a reference to a datum in memory
i | first (slow-changing) dimension index |
j | second (fast-changing) dimension index |
Definition at line 609 of file memory.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 617 of file memory.hpp.
|
inline |
Copy pitched_memory.
o | Source pitched_memory |
Definition at line 538 of file memory.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Copy pitched_memory from other memory type.
o | Source pitched_memory |
Definition at line 566 of file memory.hpp.
|
inline |
idx | position |
Definition at line 583 of file memory.hpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
idx | position |
Definition at line 598 of file memory.hpp.
|
inline |
Definition at line 462 of file memory.hpp.
|
inline |
Definition at line 452 of file memory.hpp.
|
inline |
set the size (reallocating, if necessary)
rows | number of desired rows |
cols | number of desired columns |
Definition at line 518 of file memory.hpp.
|
inline |
set strides for this memory
determines the strides for a given shape, with special consideration to pitched dimension
strides | output vector |
shape | shape of the vector |
row major version
Definition at line 631 of file memory.hpp.
|
inline |
Reimplemented from cuv::memory< V, M >.
Definition at line 467 of file memory.hpp.