C++ Run-time Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
fletcher::Context Class Reference

A Context for a platform where a RecordBatches can be prepared for processing by the Kernel. More...

#include <context.h>

Public Member Functions

 Context (std::shared_ptr< Platform > platform)
 Context constructor.
 
 ~Context ()
 Deconstruct the context object, freeing all allocated device buffers.
 
Status QueueRecordBatch (const std::shared_ptr< arrow::RecordBatch > &record_batch, MemType mem_type=MemType::ANY)
 Enqueue an arrow::RecordBatch for usage on the device.
 
size_t GetQueueSize () const
 Obtain the size (in bytes) of all buffers currently enqueued.
 
Status Enable ()
 Enable the usage of the enqueued buffers by the device.
 
std::shared_ptr< Platformplatform () const
 Return the platform this context is active on.
 
uint64_t num_buffers () const
 Return the number of device buffers in this context.
 
DeviceBuffer device_buffer (size_t i) const
 Return the i-th DeviceBuffer of this context.
 
uint64_t num_recordbatches () const
 Return the number of RecordBatches in this context.
 
std::shared_ptr< arrow::RecordBatch > recordbatch (size_t i) const
 Return the i-th arrow::RecordBatch of this context.
 

Static Public Member Functions

static Status Make (std::shared_ptr< Context > *context, const std::shared_ptr< Platform > &platform)
 Create a new context on a specific platform.
 

Protected Attributes

std::shared_ptr< Platformplatform_
 The platform this context is running on.
 
std::vector< std::shared_ptr< arrow::RecordBatch > > host_batches_
 The RecordBatches on the host side.
 
std::vector< RecordBatchDescription > host_batch_desc_
 The descriptions of the RecordBatches on the host side.
 
std::vector< MemTypehost_batch_memtype_
 Whether the RecordBatch must be prepared or cached for the device.
 
std::vector< DeviceBufferdevice_buffers_
 Prepared/cached buffers on the device.
 

Detailed Description

A Context for a platform where a RecordBatches can be prepared for processing by the Kernel.

Definition at line 83 of file context.h.

Constructor & Destructor Documentation

◆ Context()

fletcher::Context::Context ( std::shared_ptr< Platform platform)
inlineexplicit

Context constructor.

Parameters
[in]platformA platform to construct the context on.

Definition at line 89 of file context.h.

◆ ~Context()

fletcher::Context::~Context ( )

Deconstruct the context object, freeing all allocated device buffers.

Member Function Documentation

◆ device_buffer()

DeviceBuffer fletcher::Context::device_buffer ( size_t  i) const
inline

Return the i-th DeviceBuffer of this context.

Parameters
[in]iThe index of the DeviceBuffer to return.
Returns
The i-th DeviceBuffer.

Definition at line 132 of file context.h.

◆ Enable()

Status fletcher::Context::Enable ( )

Enable the usage of the enqueued buffers by the device.

◆ GetQueueSize()

size_t fletcher::Context::GetQueueSize ( ) const

Obtain the size (in bytes) of all buffers currently enqueued.

◆ Make()

static Status fletcher::Context::Make ( std::shared_ptr< Context > *  context,
const std::shared_ptr< Platform > &  platform 
)
static

Create a new context on a specific platform.

Parameters
[out]contextA pointer to a shared pointer that will own the new Context.
[in]platformThe platform to create the Context on.
Returns
Status::OK() if successful, otherwise a descriptive error status.

◆ num_buffers()

uint64_t fletcher::Context::num_buffers ( ) const

Return the number of device buffers in this context.

◆ num_recordbatches()

uint64_t fletcher::Context::num_recordbatches ( ) const
inline

Return the number of RecordBatches in this context.

Definition at line 135 of file context.h.

◆ platform()

std::shared_ptr< Platform > fletcher::Context::platform ( ) const
inline

Return the platform this context is active on.

Definition at line 122 of file context.h.

◆ QueueRecordBatch()

Status fletcher::Context::QueueRecordBatch ( const std::shared_ptr< arrow::RecordBatch > &  record_batch,
MemType  mem_type = MemType::ANY 
)

Enqueue an arrow::RecordBatch for usage on the device.

This function utilizes Arrow metadata in the schema of the RecordBatch to determine whether or not some field (i.e. some Array in the internal structure) will be used on the device.

Parameters
[in]record_batchThe arrow::RecordBatch to queue
[in]mem_typeForce caching; i.e. the RecordBatch is guaranteed to be copied to on-board memory.
Returns
Status::OK() if successful, otherwise a descriptive error status.

◆ recordbatch()

std::shared_ptr< arrow::RecordBatch > fletcher::Context::recordbatch ( size_t  i) const
inline

Return the i-th arrow::RecordBatch of this context.

Parameters
[in]iThe index of the arrow::RecordBatch to return.
Returns
A shared pointer to the arrow::RecordBatch.

Definition at line 142 of file context.h.

Member Data Documentation

◆ device_buffers_

std::vector<DeviceBuffer> fletcher::Context::device_buffers_
protected

Prepared/cached buffers on the device.

Definition at line 154 of file context.h.

◆ host_batch_desc_

std::vector<RecordBatchDescription> fletcher::Context::host_batch_desc_
protected

The descriptions of the RecordBatches on the host side.

Definition at line 150 of file context.h.

◆ host_batch_memtype_

std::vector<MemType> fletcher::Context::host_batch_memtype_
protected

Whether the RecordBatch must be prepared or cached for the device.

Definition at line 152 of file context.h.

◆ host_batches_

std::vector<std::shared_ptr<arrow::RecordBatch> > fletcher::Context::host_batches_
protected

The RecordBatches on the host side.

Definition at line 148 of file context.h.

◆ platform_

std::shared_ptr<Platform> fletcher::Context::platform_
protected

The platform this context is running on.

Definition at line 146 of file context.h.


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