CMS 3D CMS Logo

cms::alpakatools::CopyToDevice< THostData > Struct Template Reference

#include <CopyToDevice.h>

Detailed Description

template<typename THostData>
struct cms::alpakatools::CopyToDevice< THostData >

This class template needs to be specialized for each host-side EventSetup data product that should be implicitly copied to the device memory. The specialization is expected to define static copyAsync() function as in the following example

template <>
struct CopyToDevice<ExampleHostProduct> {
template <typename TQueue>
static auto copyAsync(TQueue& queue, ExampleHostProduct const& hostData) {
// construct ExampleDeviceProduct corresponding the device of the TQueue
// asynchronous copy hostData to the ExampleDeviceProduct object
// return ExampleDeviceProduct object by value
}
};

The copyAsync() function should not explicitly synchronize the queue. The ExampleHostProduct and ExampleDevicxeProduct can be the same type, if they internally are able to handle the memory allocation difference between host and device.

Definition at line 32 of file CopyToDevice.h.