13#ifndef CudaInterface_h
14#define CudaInterface_h
29namespace CudaInterface {
49 inline operator cudaEvent_t() {
return *
reinterpret_cast<cudaEvent_t *
>(
_ptr.get()); }
52 std::unique_ptr<void, Deleter<CudaEvent>>
_ptr;
67 inline cudaStream_t *get() {
return reinterpret_cast<cudaStream_t *&
>(
_ptr); }
68 inline operator cudaStream_t() {
return *
reinterpret_cast<cudaStream_t *
>(
_ptr.get()); }
71 std::unique_ptr<void, Deleter<CudaStream>>
_ptr;
78void copyHostToDeviceImpl(
const void *
src,
void *
dest, std::size_t
n,
CudaStream * =
nullptr);
79void copyDeviceToHostImpl(
const void *
src,
void *
dest, std::size_t
n,
CudaStream * =
nullptr);
80void copyDeviceToDeviceImpl(
const void *
src,
void *
dest, std::size_t
n,
CudaStream * =
nullptr);
94 copyHostToDeviceImpl(
src,
dest,
sizeof(T) *
n);
108 copyDeviceToHostImpl(
src,
dest,
sizeof(T) *
n);
122 copyDeviceToDeviceImpl(
src,
dest,
sizeof(T) *
n);
132 DeviceMemory(std::size_t
n, std::size_t typeSize);
134 std::size_t
size()
const {
return _size; }
135 void *
data() {
return _data.get(); }
136 void const *
data()
const {
return _data.get(); }
139 std::unique_ptr<void, Deleter<DeviceMemory>> _data;
140 std::size_t _size = 0;
143class PinnedHostMemory {
145 PinnedHostMemory(std::size_t
n, std::size_t typeSize);
147 std::size_t
size()
const {
return _size; }
148 void *
data() {
return _data.get(); }
149 void const *
data()
const {
return _data.get(); }
152 std::unique_ptr<void, Deleter<PinnedHostMemory>> _data;
153 std::size_t _size = 0;
168template <
class Data_t,
class Memory_t>
184 inline std::size_t
size()
const {
return Memory_t::size(); }
193 inline Data_t *
data() {
return static_cast<Data_t *
>(Memory_t::data()); }
202 inline Data_t
const *
data()
const {
return static_cast<Data_t
const *
>(Memory_t::data()); }
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
TRObject operator()(const T1 &t1) const
A templated class for managing an array of data using a specified memory type.
Array(std::size_t n)
Constructor to create an Array object with a specified size.
Data_t * data()
Get a pointer to the start of the array.
Data_t const * data() const
Get a const pointer to the start of the array.
std::size_t size() const
Get the size of the array.
std::unique_ptr< void, Deleter< CudaEvent > > _ptr
CudaStream()
Creates a new CUDA stream.
bool isActive()
Checks if a CUDA stream is currently active.
std::unique_ptr< void, Deleter< CudaStream > > _ptr
void waitForEvent(CudaEvent &)
Makes a CUDA stream wait for a CUDA event.
void copyDeviceToDevice(const T *src, T *dest, std::size_t n, CudaStream *=nullptr)
Copies data from the CUDA device to the CUDA device.
void cudaEventRecord(CudaEvent &event, CudaStream &stream)
Records a CUDA event.
void copyHostToDevice(const T *src, T *dest, std::size_t n, CudaStream *=nullptr)
Copies data from the host to the CUDA device.
void copyDeviceToHost(const T *src, T *dest, std::size_t n, CudaStream *=nullptr)
Copies data from the CUDA device to the host.
float cudaEventElapsedTime(CudaEvent &begin, CudaEvent &end)
Calculates the elapsed time between two CUDA events.
Namespace for dispatching RooFit computations to various backends.