Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HeterogeneousCore_AlpakaInterface_interface_CopyToHost_h
0002 #define HeterogeneousCore_AlpakaInterface_interface_CopyToHost_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 device-side
0010    * Event data product so that the framework can implicitly copy the
0011    * device-side data product to the host memory. The specialization
0012    * is expected to define static copyAsync() function as in the
0013    * following example
0014    *
0015    * \code
0016    * template <>
0017    * struct CopyToHost<ExampleDeviceProduct> {
0018    *   template <typename TQueue>
0019    *   static ExampleHostProduct copyAsync(TQueue& queue, ExampleDeviceProduct const& deviceData) {
0020    *     // construct ExampleHostProduct
0021    *     // asynchronous copy deviceData to the ExampleHostProduct object
0022    *     // return ExampleHostProduct object by value
0023    *   }
0024    * };
0025    * \endcode
0026    *
0027    * The copyAsync() function should not explicitly synchronize the
0028    * queue. The ExampleDeviceProduct and ExampleHostProduct can be the
0029    * same type, if they internally are able to handle the memory
0030    * allocation difference between host and device.
0031    */
0032   template <typename TDeviceData>
0033   struct CopyToHost;
0034 }  // namespace cms::alpakatools
0035 
0036 #endif