1 #ifndef HeterogeneousCore_AlpakaInterface_interface_HostOnlyTask_h 2 #define HeterogeneousCore_AlpakaInterface_interface_HostOnlyTask_h 7 #include <alpaka/alpaka.hpp> 27 #ifdef ALPAKA_ACC_GPU_CUDA_ENABLED 31 using TApi = ApiCudaRt;
33 static void CUDART_CB
callback(cudaStream_t , cudaError_t ,
void*
arg) {
35 std::unique_ptr<HostOnlyTask> pTask(static_cast<HostOnlyTask*>(
arg));
41 ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK(
42 cudaStreamAddCallback(alpaka::getNativeHandle(
queue),
callback, static_cast<void*>(pTask.release()), 0u));
45 #endif // ALPAKA_ACC_GPU_CUDA_ENABLED 47 #ifdef ALPAKA_ACC_GPU_HIP_ENABLED 51 using TApi = ApiHipRt;
53 static void callback(hipStream_t , hipError_t ,
void*
arg) {
55 std::unique_ptr<HostOnlyTask> pTask(static_cast<HostOnlyTask*>(
arg));
61 ALPAKA_UNIFORM_CUDA_HIP_RT_CHECK(
62 hipStreamAddCallback(alpaka::getNativeHandle(
queue),
callback, static_cast<void*>(pTask.release()), 0u));
65 #endif // ALPAKA_ACC_GPU_HIP_ENABLED 71 #endif // HeterogeneousCore_AlpakaInterface_interface_HostOnlyTask_h HostOnlyTask(std::function< void()> task)
std::function< void()> task_