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

#include <LifoStorageCuda.hpp>

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

Public Member Functions

 LifoStorageCuda (std::string name, size_t elemCnt, int numberOfBuffersToStoreOnDevice, 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::LifoStorageCuda< 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 43 of file LifoStorageCuda.hpp.

Constructor & Destructor Documentation

◆ LifoStorageCuda()

template<typename T , typename INDEX_TYPE >
geos::LifoStorageCuda< T, INDEX_TYPE >::LifoStorageCuda ( std::string  name,
size_t  elemCnt,
int  numberOfBuffersToStoreOnDevice,
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.
numberOfBuffersToStoreOnDeviceMaximum number of array to store on device memory ( -1 = use 80% of remaining memory ).
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 59 of file LifoStorageCuda.hpp.

Member Function Documentation

◆ computeNumberOfBufferOnDevice()

template<typename T , typename INDEX_TYPE >
static int geos::LifoStorageCuda< 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 148 of file LifoStorageCuda.hpp.

◆ popAsync()

template<typename T , typename INDEX_TYPE >
void geos::LifoStorageCuda< 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 110 of file LifoStorageCuda.hpp.

◆ popWait()

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

Waits for last pop to be terminated

Implements geos::LifoStorageCommon< T, INDEX_TYPE >.

Definition at line 132 of file LifoStorageCuda.hpp.

◆ pushAsync()

template<typename T , typename INDEX_TYPE >
void geos::LifoStorageCuda< 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 71 of file LifoStorageCuda.hpp.

◆ pushWait()

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

Waits for last push to be terminated

Implements geos::LifoStorageCommon< T, INDEX_TYPE >.

Definition at line 97 of file LifoStorageCuda.hpp.


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