27 MUDA_HOST
HostCall(cudaStream_t stream =
nullptr)
32 template <
typename F,
typename UserTag = DefaultTag>
33 MUDA_HOST
HostCall& apply(F&& f, UserTag tag = {})
35 MUDA_ASSERT(ComputeGraphBuilder::is_phase_none(),
36 "HostCall must be can't appear in a compute graph");
37 using CallableType = raw_type_t<F>;
38 static_assert(std::is_invocable_v<CallableType>,
"f:void (void)");
39 auto userdata =
new CallableType(std::forward<F>(f));
40 checkCudaErrors(cudaLaunchHostFunc(
41 this->stream(), details::generic_host_call<CallableType, UserTag>, userdata));
42 checkCudaErrors(cudaLaunchHostFunc(
43 this->stream(), details::delete_function_object<CallableType, UserTag>, userdata));
55 template <
typename F,
typename UserTag = DefaultTag>
58 using CallableType = raw_type_t<F>;
59 auto parms = std::make_shared<HostNodeParms<CallableType>>(std::forward<F>(f));
60 parms->fn((cudaHostFn_t)details::generic_host_call<CallableType, UserTag>);