DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::DeviceHostSingleAllocationBase Class Referenceabstract

Abstract single-allocation owning byte buffer. More...

#include <Vector.hpp>

Inheritance diagram for DNDS::DeviceHostSingleAllocationBase:
[legend]

Public Member Functions

 DeviceHostSingleAllocationBase ()=default
 
virtual ~DeviceHostSingleAllocationBase ()
 
virtual void allocate (size_t bytes, DeviceBackend B=DeviceBackend::Unknown)=0
 Allocate bytes on backend B (or on the host when Unknown).
 
virtual void free ()=0
 Release the allocation.
 
virtual uint8_t * get ()=0
 Typed byte pointer to the current allocation.
 
virtual size_t bytes () const =0
 Allocation size in bytes.
 
virtual DeviceBackend device ()=0
 Which backend currently owns the allocation.
 
virtual void copy_from_host (uint8_t *host_src, size_t n)=0
 Copy n bytes from host_src into this allocation.
 
virtual void copy_to_host (uint8_t *host_dst, size_t n)=0
 Copy n bytes from this allocation into host_dst.
 
virtual std::unique_ptr< DeviceHostSingleAllocationBaseclone ()=0
 Deep copy; returns a new allocation containing the same bytes.
 

Detailed Description

Abstract single-allocation owning byte buffer.

A cross-backend "uniquely owned chunk of memory" interface: either a plain std::vector<uint8_t> on the host, or a backend-specific DeviceStorage on a device. Used as the storage primitive for #host_device_vector_r1.

Definition at line 24 of file Vector.hpp.

Constructor & Destructor Documentation

◆ DeviceHostSingleAllocationBase()

DNDS::DeviceHostSingleAllocationBase::DeviceHostSingleAllocationBase ( )
default

◆ ~DeviceHostSingleAllocationBase()

DNDS::DeviceHostSingleAllocationBase::~DeviceHostSingleAllocationBase ( )
virtual

Definition at line 5 of file Vector.cpp.

Member Function Documentation

◆ allocate()

virtual void DNDS::DeviceHostSingleAllocationBase::allocate ( size_t  bytes,
DeviceBackend  B = DeviceBackend::Unknown 
)
pure virtual

Allocate bytes on backend B (or on the host when Unknown).

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ bytes()

virtual size_t DNDS::DeviceHostSingleAllocationBase::bytes ( ) const
pure virtual

Allocation size in bytes.

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ clone()

virtual std::unique_ptr< DeviceHostSingleAllocationBase > DNDS::DeviceHostSingleAllocationBase::clone ( )
pure virtual

Deep copy; returns a new allocation containing the same bytes.

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ copy_from_host()

virtual void DNDS::DeviceHostSingleAllocationBase::copy_from_host ( uint8_t *  host_src,
size_t  n 
)
pure virtual

Copy n bytes from host_src into this allocation.

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ copy_to_host()

virtual void DNDS::DeviceHostSingleAllocationBase::copy_to_host ( uint8_t *  host_dst,
size_t  n 
)
pure virtual

Copy n bytes from this allocation into host_dst.

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ device()

virtual DeviceBackend DNDS::DeviceHostSingleAllocationBase::device ( )
pure virtual

Which backend currently owns the allocation.

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ free()

virtual void DNDS::DeviceHostSingleAllocationBase::free ( )
pure virtual

Release the allocation.

Implemented in DNDS::DeviceHostSingleAllocationDirect.

◆ get()

virtual uint8_t * DNDS::DeviceHostSingleAllocationBase::get ( )
pure virtual

Typed byte pointer to the current allocation.

Implemented in DNDS::DeviceHostSingleAllocationDirect.


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