GEOS
|
#include <LifoStorageCommon.hpp>
Public Member Functions | |
LifoStorageCommon (std::string name, size_t elemCnt, int numberOfBuffersToStoreOnHost, int maxNumberOfBuffers) | |
virtual void | pushAsync (arrayView1d< T > array)=0 |
virtual void | pushWait ()=0 |
virtual void | popAsync (arrayView1d< T > array)=0 |
void | popAsyncPrelude () |
virtual void | popWait ()=0 |
bool | empty () |
Static Public Member Functions | |
static int | computeNumberOfBufferOnHost (int percent, size_t bufferSize, int maxNumberOfBuffers, int numberOfBuffersToStoreOnDevice) |
Protected Member Functions | |
void | hostToDisk (int id) |
void | diskToHost (int id) |
bool | dirExists (const std::string &dirName) |
void | writeOnDisk (const T *d, int id) |
void | readOnDisk (T *d, int id) |
Protected Attributes | |
int | m_maxNumberOfBuffers |
number of buffers to be inserted into the LIFO | |
size_t | m_bufferSize |
size of one buffer in bytes | |
std::string | m_name |
name used to store data on disk | |
FixedSizeDequeWithMutexes< T, INDEX_TYPE > | m_hostDeque |
Queue of data stored on host memory. | |
int | m_bufferCount |
counter of buffer stored in LIFO | |
int | m_bufferToHostCount |
counter of buffer pushed to host | |
int | m_bufferToDiskCount |
counter of buffer pushed to disk | |
std::condition_variable | m_task_queue_not_empty_cond [2] |
condition used to tell m_worker queue has been filled or processed is stopped. | |
std::mutex | m_task_queue_mutex [2] |
mutex to protect access to m_task_queue. | |
std::deque< std::packaged_task< void() > > | m_task_queue [2] |
queue of task to be executed by m_worker. | |
std::thread | m_worker [2] |
thread to execute tasks. | |
bool | m_continue |
boolean to keep m_worker alive. | |
bool | m_hasPoppedBefore |
marker to detect first pop | |
This class is used to store in a LIFO way buffers, first on device, then on host, then on disk.
Definition at line 51 of file LifoStorageCommon.hpp.
|
inline |
A LIFO storage will store numberOfBuffersToStoreDevice buffer on deevice, numberOfBuffersToStoreHost on host and the rest on disk.
name | Prefix of the files used to save the occurenncy of the saved buffer on disk. |
elemCnt | Number of elments in the LvArray we want to store in the LIFO storage. |
numberOfBuffersToStoreOnHost | Maximum number of array to store on host memory ( -1 = use 80% of remaining memory ). |
maxNumberOfBuffers | Number of arrays expected to be stores in the LIFO. |
Definition at line 65 of file LifoStorageCommon.hpp.
|
inlinestatic |
Compute the number of arrays that can be stored on host
percent | Percentage of the remaining device memory that can be dedicated to the LIFO storage. |
bufferSize | Size of one buffer |
maxNumberOfBuffers | Maximum number of buffers to store in the LIFO storage |
numberOfBuffersToStoreOnDevice | The number of buffer that will be stored on device by the LIFO. |
Definition at line 157 of file LifoStorageCommon.hpp.
|
inlineprotected |
Checks if a directory exists.
dirName | Directory name to check existence of. |
Definition at line 242 of file LifoStorageCommon.hpp.
|
inlineprotected |
Copy data from disk to host memory
id | ID of the buffer to read on disk. |
Definition at line 225 of file LifoStorageCommon.hpp.
|
inline |
Check if the LIFO is empty
Definition at line 144 of file LifoStorageCommon.hpp.
|
inlineprotected |
Copy data from host memory to disk
id | ID of the buffer to store on disk. |
Definition at line 209 of file LifoStorageCommon.hpp.
|
pure virtual |
Asynchroneously copy last data from the LIFO into the LvArray.
array | LvArray to store data from the LIFO into it. |
Implemented in geos::LifoStorageHost< T, INDEX_TYPE >, and geos::LifoStorageCuda< T, INDEX_TYPE >.
|
inline |
Prelude for pop async
Definition at line 109 of file LifoStorageCommon.hpp.
|
pure virtual |
Waits for last pop to be terminated
Implemented in geos::LifoStorageHost< T, INDEX_TYPE >, and geos::LifoStorageCuda< T, INDEX_TYPE >.
|
pure virtual |
Asynchroneously push a copy of the given LvArray into the LIFO
array | The LvArray to store in the LIFO, should match the size of the data used in constructor. |
Implemented in geos::LifoStorageHost< T, INDEX_TYPE >, and geos::LifoStorageCuda< T, INDEX_TYPE >.
|
pure virtual |
Waits for last push to be terminated
Implemented in geos::LifoStorageHost< T, INDEX_TYPE >, and geos::LifoStorageCuda< T, INDEX_TYPE >.
|
inlineprotected |
Read data from disk
d | Buffer to store data read from disk. |
id | ID of the buffer on disk. |
Definition at line 278 of file LifoStorageCommon.hpp.
|
inlineprotected |
Write data on disk
d | Data to store on disk. |
id | ID of the buffer to read on disk |
Definition at line 254 of file LifoStorageCommon.hpp.