tfel
Loading...
Searching...
No Matches
mfront::generic_parallel::StatusBlockPool< T, Device > Class Template Reference

pool of blocks of memory holding the statuses or the statistics of synchronous computations performed on a device. More...

#include </home/runner/work/tfel/tfel/mfront/include/MFront/GenericParallel/StatusBlockPool.hxx>

Classes

class  Block
 a block, given back to the pool at destruction More...

Public Member Functions

template<typename AllocationFunction>
Block acquire (const Device &d, const AllocationFunction &allocate) noexcept

Detailed Description

template<typename T, typename Device>
class mfront::generic_parallel::StatusBlockPool< T, Device >

pool of blocks of memory holding the statuses or the statistics of synchronous computations performed on a device.

The kernels only write in a block when an event occurs (failure at a point, bound violated, etc.). The primitives of the backends allocate the blocks in device memory, initialize them by a copy before the computations and copy them back once the computations are completed: the host never accesses a block, which the device may not share with the host while kernels run.

The blocks are allocated at their first use on a device and reused by the following calls: no memory is allocated per call. A block is used by one call at a time, so that concurrent calls (from several threads or on several queues) are supported. As the copies of the shared data, the blocks are never freed by the pool.

Template Parameters
Ttype of the values of a block (a block may hold several values, the allocation function giving the size of the blocks)
Devicetype identifying a device, comparable with ==

Member Function Documentation

◆ acquire()

template<typename T, typename Device>
template<typename AllocationFunction>
Block mfront::generic_parallel::StatusBlockPool< T, Device >::acquire ( const Device & d,
const AllocationFunction & allocate )
inlinenoexcept
Returns
a block of the given device, not used by another call. The block is null if the allocation failed.
Parameters
[in]ddevice
[in]allocatefunction allocating a block on the device, called if all the blocks of the device are used, and returning a null pointer on failure

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