Celeritas 0.7.0-33+develop.9c828abdd
Loading...
Searching...
No Matches
Classes | Functions
Copier.hh File Reference
#include <cstddef>
#include <type_traits>
#include "corecel/Assert.hh"
#include "corecel/Types.hh"
#include "corecel/cont/Span.hh"
#include "corecel/sys/Device.hh"
#include "corecel/sys/ThreadId.hh"
#include "ObserverPtr.hh"
#include "detail/CopierImpl.hh"

Classes

class  celeritas::Copier< T, M >
 Copy spans of data. More...
 

Functions

template<class T , MemSpace M>
 celeritas::Copier (ObserverPtr< T, M >, std::size_t, StreamId) -> Copier< T, M >
 Deduce the element type and memory space from the destination pointer.
 
template<class T , MemSpace M>
std::remove_const_t< T > celeritas::load_sync (ObserverPtr< T, M > src, StreamId stream={})
 Copy a single value from the given memory space to the host.
 
void celeritas::copy_bytes (MemSpace dstmem, void *dst, MemSpace srcmem, void const *src, std::size_t count)
 Copy bytes between two memory spaces.
 
void celeritas::copy_bytes (MemSpace dstmem, void *dst, MemSpace srcmem, void const *src, std::size_t count, StreamId stream)
 Asynchronously copy bytes between two memory spaces.
 
template<MemSpace D, MemSpace S>
void celeritas::copy_bytes (ObserverPtr< void, D > dst, ObserverPtr< void const, S > src, std::size_t count, Stream const &stream)
 Asynchronously copy bytes between two memory spaces on a stream.
 

Function Documentation

◆ copy_bytes()

template<MemSpace D, MemSpace S>
void celeritas::copy_bytes ( ObserverPtr< void, D >  dst,
ObserverPtr< void const, S >  src,
std::size_t  count,
Stream const &  stream 
)
inline

Asynchronously copy bytes between two memory spaces on a stream.

The memory spaces are part of the pointer types, so they can't be mixed up. Copying to or from pageable host memory may be synchronous.

◆ load_sync()

template<class T , MemSpace M>
std::remove_const_t< T > celeritas::load_sync ( ObserverPtr< T, M >  src,
StreamId  stream = {} 
)
inline

Copy a single value from the given memory space to the host.

If the source is on the device, the copy is enqueued on the given stream and the stream is synchronized before returning.