OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
memory.hpp
1/*
2 * memory.hpp
3 *
4 * Created on: Aug 8, 2014
5 * Author: Pietro Incardona
6 */
7
14#ifndef MEMORY_HPP_
15#define MEMORY_HPP_
16
17typedef long int mem_id;
18
19#include "config.h"
20#include <stddef.h>
21
22class memory
23{
24 public:
25
30 virtual bool flush() = 0;
31
40 virtual bool allocate(size_t sz) = 0;
41
49 virtual bool resize(size_t sz) = 0;
50
56 virtual void destroy() = 0;
57
58
64 virtual bool copy(const memory & m) = 0;
65
70 virtual size_t size() const = 0;
71
78 virtual void * getPointer() = 0;
79
86 virtual const void * getPointer() const = 0;
87
93 virtual ~memory() {};
94
99 virtual void incRef() = 0;
100
105 virtual void decRef() = 0;
106
112 virtual long int ref() = 0;
113
119 virtual bool isInitialized() = 0;
120
126 virtual void * getDevicePointer() = 0;
127
132 virtual void deviceToHost() = 0;
133
138 virtual void hostToDevice() = 0;
139
146 virtual void hostToDevice(size_t start, size_t top) = 0;
147
154 virtual void deviceToHost(size_t start, size_t stop) = 0;
155
156
161 virtual void fill(unsigned char c) = 0;
162
163
164};
165
166#endif
virtual void hostToDevice(size_t start, size_t top)=0
Copy the memory from host to device.
virtual bool allocate(size_t sz)=0
allocate on device a buffer of
virtual long int ref()=0
Return the actual reference counter.
virtual bool resize(size_t sz)=0
resize on device a buffer
virtual void fill(unsigned char c)=0
Fill the buffer with a particular byte.
virtual void * getDevicePointer()=0
Return the device pointer of the memory.
virtual void destroy()=0
Destroy the buffer on the device.
virtual bool isInitialized()=0
Return if the actual memory that is going to be allocated is already initialized.
virtual bool copy(const memory &m)=0
Copy the memory from one device to another device.
virtual bool flush()=0
Flush the memory into the device.
virtual void incRef()=0
Increment the internal reference counter.
virtual const void * getPointer() const =0
return a data pointer
virtual ~memory()
destructor
Definition memory.hpp:93
virtual void deviceToHost(size_t start, size_t stop)=0
Copy the memory from device to host.
virtual void hostToDevice()=0
Copy the memory from host to device.
virtual void decRef()=0
Decrement the internal reference counter.
virtual void * getPointer()=0
return a data pointer
virtual void deviceToHost()=0
Copy the memory from device to host.
virtual size_t size() const =0
get the size of the buffer