Celeritas 0.7+cf8d83d
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
celeritas::DeviceAllocation Class Reference

Allocate raw uninitialized memory. More...

#include <DeviceAllocation.hh>

Public Types

Type aliases
using size_type = std::size_t
 
using SpanBytes = Span< std::byte >
 
using SpanConstBytes = Span< std::byte const >
 

Public Member Functions

 DeviceAllocation (StreamId stream)
 Construct in unallocated state.
 
 DeviceAllocation (size_type num_bytes)
 Allocate a buffer with the given number of bytes.
 
 DeviceAllocation (size_type num_bytes, StreamId stream)
 Allocate a buffer asynchronously with the given number of bytes.
 
void swap (DeviceAllocation &other) noexcept
 Swap with another allocation.
 
size_type size () const
 Get the number of bytes allocated.
 
bool empty () const
 Whether memory is allocated.
 
StreamId stream_id () const
 Access the stream, set for asynchronous allocation/copy.
 
SpanBytes device_ref ()
 Get a view to the owned device memory.
 
SpanConstBytes device_ref () const
 Get a view to the owned device memory.
 
void copy_to_device (SpanConstBytes bytes)
 Copy data to device.
 
void copy_to_host (SpanBytes bytes) const
 Copy data to host.
 
voiddata ()
 
void constdata () const
 

Detailed Description

Allocate raw uninitialized memory.

This class is intended to be used by host-compiler .hh code as a bridge to device memory. It allows Storage classes to allocate and manage device memory without using thrust, which requires NVCC and propagates that requirement into all downstream code.


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