Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:40

0001 #ifndef HeterogeneousCore_AlpakaInterface_interface_CopyToDevice_h
0002 #define HeterogeneousCore_AlpakaInterface_interface_CopyToDevice_h
0003 
0004 // TODO: this utility class is specific to CMSSW, but needs to be in a
0005 // package that is suitable as DataFormat dependence
0006 
0007 namespace cms::alpakatools {
0008   /**
0009    * This class template needs to be specialized for each host-side
0010    * EventSetup data product that should be implicitly copied to the
0011    * device memory. The specialization is expected to define static
0012    * copyAsync() function as in the following example
0013    *
0014    * \code
0015    * template <>
0016    * struct CopyToDevice<ExampleHostProduct> {
0017    *   template <typename TQueue>
0018    *   static auto copyAsync(TQueue& queue, ExampleHostProduct const& hostData) {
0019    *     // construct ExampleDeviceProduct corresponding the device of the TQueue
0020    *     // asynchronous copy hostData to the ExampleDeviceProduct object
0021    *     // return ExampleDeviceProduct object by value
0022    *   }
0023    * };
0024    * \endcode
0025    *
0026    * The copyAsync() function should not explicitly synchronize the
0027    * queue. The ExampleHostProduct and ExampleDevicxeProduct can be the
0028    * same type, if they internally are able to handle the memory
0029    * allocation difference between host and device.
0030    */
0031   template <typename THostData>
0032   struct CopyToDevice;
0033 }  // namespace cms::alpakatools
0034 
0035 #endif