This class is a container for the memory interface like HeapMemory CudaMemory. More...
This class is a container for the memory interface like HeapMemory CudaMemory.
It store the object used to allocate memory and a representation of this memory as an array of objects T
It is mainly used by memory_conf to create the correct memory layout
Definition at line 45 of file memory_c.hpp.
#include <memory_c.hpp>
Public Types | |
typedef memory_c< T > | type |
define T | |
typedef T & | reference |
define a reference to T | |
typedef T | vtype |
define T | |
Public Member Functions | |
void | setMemory (memory &mem) |
This function set the object that allocate memory. | |
bool | bind_ref (const memory_c< T, MEMORY_C_STANDARD, D > &ref) |
This function bind the memory_c to this memory_c as reference. | |
memory & | getMemory () |
This function get the object that allocate memory. | |
void | switchToDevicePtr () |
Switch the pointer to device pointer (if the memory has been already set) | |
const memory & | getMemory () const |
This function get the object that allocate memory. | |
bool | allocate (const size_t sz, bool skip_initialization=false) |
This function allocate memory. | |
memory_c (bool manage_memory=true) | |
constructor | |
~memory_c () | |
destructor | |
void | disable_manage_memory () |
Disable the management of memory (it is used for toKernel views) | |
void | swap (memory_c &mem_obj) |
swap the memory | |
template<typename Mem_type > | |
__host__ void | swap_nomode (memory_c &mem_obj) |
swap the memory | |
Data Fields | |
memory * | mem |
object that allocate memory like HeapMemory or CudaMemory | |
memory_array< T > | mem_r |
object that represent the memory as an array of objects T | |
Private Attributes | |
bool | manage_memory = true |
define a reference to T
Definition at line 60 of file memory_c.hpp.
define T
Definition at line 57 of file memory_c.hpp.
define T
Definition at line 63 of file memory_c.hpp.
|
inline |
constructor
Definition at line 159 of file memory_c.hpp.
destructor
Definition at line 163 of file memory_c.hpp.
|
inline |
This function allocate memory.
We create a chunk of memory
we create the representation for this buffer
Definition at line 145 of file memory_c.hpp.
|
inline |
This function bind the memory_c to this memory_c as reference.
Bind ad reference it mean this this object does not create new memory but use the one from ref as a reference.
we create the representation for the memory buffer
Definition at line 98 of file memory_c.hpp.
|
inline |
Disable the management of memory (it is used for toKernel views)
Definition at line 182 of file memory_c.hpp.
|
inline |
This function get the object that allocate memory.
Definition at line 117 of file memory_c.hpp.
|
inline |
This function get the object that allocate memory.
Definition at line 137 of file memory_c.hpp.
|
inline |
This function set the object that allocate memory.
mem | the memory object |
Definition at line 76 of file memory_c.hpp.
|
inline |
Switch the pointer to device pointer (if the memory has been already set)
Definition at line 125 of file memory_c.hpp.
|
private |
indicate this object manage the memory. Call to functions like toKernels create views of the main data-structure. Views use memory_c create different ways to access the same sata. We have mainly have two options. Either views manage memory, either they do not. When a view manage the memory if the main-data structure get destroyed the view is still valid, the memory retained and the last view destroy the memory. When a view does not manage the memory, if the main-data structure get destroyed the view become invalid.
Definition at line 52 of file memory_c.hpp.
object that allocate memory like HeapMemory or CudaMemory
Definition at line 66 of file memory_c.hpp.
memory_array<T> memory_c< T, MEMORY_C_STANDARD, D >::mem_r |
object that represent the memory as an array of objects T
Definition at line 69 of file memory_c.hpp.