GEOS
Public Member Functions | Static Public Member Functions | List of all members
geos::LifoStorageHost< T, INDEX_TYPE > Class Template Reference

#include <LifoStorageHost.hpp>

Inheritance diagram for geos::LifoStorageHost< T, INDEX_TYPE >:
Inheritance graph
[legend]

Public Member Functions

 LifoStorageHost (std::string name, size_t elemCnt, int numberOfBuffersToStoreOnHost, int maxNumberOfBuffers)
 
void pushAsync (arrayView1d< T > array) override final
 
void pushWait () override final
 
void popAsync (arrayView1d< T > array) override final
 
void popWait () override final
 
- Public Member Functions inherited from geos::LifoStorageCommon< T, INDEX_TYPE >
 LifoStorageCommon (std::string name, size_t elemCnt, int numberOfBuffersToStoreOnHost, int maxNumberOfBuffers)
 
void popAsyncPrelude ()
 
bool empty ()
 

Static Public Member Functions

static int computeNumberOfBufferOnDevice (int percent, size_t bufferSize, int maxNumberOfBuffers)
 
- Static Public Member Functions inherited from geos::LifoStorageCommon< T, INDEX_TYPE >
static int computeNumberOfBufferOnHost (int percent, size_t bufferSize, int maxNumberOfBuffers, int numberOfBuffersToStoreOnDevice)
 

Additional Inherited Members

- Protected Member Functions inherited from geos::LifoStorageCommon< T, INDEX_TYPE >
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 inherited from geos::LifoStorageCommon< T, INDEX_TYPE >
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
 

Detailed Description

template<typename T, typename INDEX_TYPE>
class geos::LifoStorageHost< T, INDEX_TYPE >

This class is used to store in a LIFO way buffers, first on device, then on host, then on disk.

Definition at line 39 of file LifoStorageHost.hpp.

Constructor & Destructor Documentation

◆ LifoStorageHost()

template<typename T , typename INDEX_TYPE >
geos::LifoStorageHost< T, INDEX_TYPE >::LifoStorageHost ( std::string  name,
size_t  elemCnt,
int  numberOfBuffersToStoreOnHost,
int  maxNumberOfBuffers 
)
inline

A LIFO storage will store numberOfBuffersToStoreDevice buffer on deevice, numberOfBuffersToStoreHost on host and the rest on disk.

Parameters
namePrefix of the files used to save the occurenncy of the saved buffer on disk.
elemCntNumber of elments in the LvArray we want to store in the LIFO storage.
numberOfBuffersToStoreOnHostMaximum number of array to store on host memory ( -1 = use 80% of remaining memory ).
maxNumberOfBuffersNumber of arrays expected to be stores in the LIFO.

Definition at line 55 of file LifoStorageHost.hpp.

Member Function Documentation

◆ computeNumberOfBufferOnDevice()

template<typename T , typename INDEX_TYPE >
static int geos::LifoStorageHost< T, INDEX_TYPE >::computeNumberOfBufferOnDevice ( int  percent,
size_t  bufferSize,
int  maxNumberOfBuffers 
)
inlinestatic

Compute the number of arrays that can be stored on device

Parameters
percentPercentage of the remaining device memory that can be dedicated to the LIFO storage.
bufferSizeSize of one buffer
maxNumberOfBuffersMaximum number of buffers to store in the LIFO storage
Returns
The maximum number of buffer to allocate to fit in the percentage of the available memory.

Definition at line 158 of file LifoStorageHost.hpp.

◆ popAsync()

template<typename T , typename INDEX_TYPE >
void geos::LifoStorageHost< T, INDEX_TYPE >::popAsync ( arrayView1d< T >  array)
inlinefinaloverridevirtual

Asynchroneously copy last data from the LIFO into the LvArray.

Parameters
arrayLvArray to store data from the LIFO into it.

Implements geos::LifoStorageCommon< T, INDEX_TYPE >.

Definition at line 113 of file LifoStorageHost.hpp.

◆ popWait()

template<typename T , typename INDEX_TYPE >
void geos::LifoStorageHost< T, INDEX_TYPE >::popWait ( )
inlinefinaloverridevirtual

Waits for last pop to be terminated

Implements geos::LifoStorageCommon< T, INDEX_TYPE >.

Definition at line 143 of file LifoStorageHost.hpp.

◆ pushAsync()

template<typename T , typename INDEX_TYPE >
void geos::LifoStorageHost< T, INDEX_TYPE >::pushAsync ( arrayView1d< T >  array)
inlinefinaloverridevirtual

Asynchroneously push a copy of the given LvArray into the LIFO

Parameters
arrayThe LvArray to store in the LIFO, should match the size of the data used in constructor.

Implements geos::LifoStorageCommon< T, INDEX_TYPE >.

Definition at line 66 of file LifoStorageHost.hpp.

◆ pushWait()

template<typename T , typename INDEX_TYPE >
void geos::LifoStorageHost< T, INDEX_TYPE >::pushWait ( )
inlinefinaloverridevirtual

Waits for last push to be terminated

Implements geos::LifoStorageCommon< T, INDEX_TYPE >.

Definition at line 100 of file LifoStorageHost.hpp.


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