9.1
general documentation
cs_host_task< FunctionType, Args > Class Template Reference

cs_host_task extends cs_device_task to add support for host function tasks. More...

#include <cs_dispatch_queue.h>

+ Inheritance diagram for cs_host_task< FunctionType, Args >:
+ Collaboration diagram for cs_host_task< FunctionType, Args >:

Public Types

using args_tuple_t = std::tuple< Args... >
 Tuple type for argument storage. More...
 
using data_tuple_t = std::tuple< FunctionType >
 

Public Member Functions

 cs_host_task (cs_host_task const &)=delete
 
cs_host_taskoperator= (cs_host_task const &)=delete
 
 cs_host_task (cs_host_task &&)=default
 
cs_host_taskoperator= (cs_host_task &&)=default
 
 cs_host_task (FunctionType &&function, cs_dispatch_context context)
 
void launch (Args... args)
 
 ~cs_host_task ()
 Wait for task termination. More...
 
- Public Member Functions inherited from cs_task
 cs_task (cs_task const &)=delete
 
cs_taskoperator= (cs_task const &)=delete
 
 cs_task (cs_task &&)=default
 
cs_taskoperator= (cs_task &&)=default
 
 cs_task (cs_dispatch_context context={})
 Create a new task with a given context and initialize a new stream. More...
 
void add_dependency (cs_event_ref event)
 Add an event to wait for. More...
 
void add_dependency (std::initializer_list< cs_event_ref > const &sync_events)
 
void wait ()
 Wait for task completion. More...
 
cs_event_ref record_end_event ()
 Record an event from the task and return a cs_event_ref to it. More...
 
 operator cs_event_ref ()
 Call record_event() to implicitely convert a task to an event. More...
 
cs_dispatch_contextget_context ()
 Return a reference to the context. More...
 
cs_event_ref get_start_event ()
 Return a reference to the start event. More...
 
cs_event_ref get_end_event ()
 Return a reference to the end event. More...
 
 ~cs_task ()
 Waits for task termination and destroys the associated CUDA stream. More...
 

Detailed Description

template<class FunctionType, class... Args>
class cs_host_task< FunctionType, Args >

cs_host_task extends cs_device_task to add support for host function tasks.

Member Typedef Documentation

◆ args_tuple_t

using args_tuple_t = std::tuple<Args...>

Tuple type for argument storage.

◆ data_tuple_t

using data_tuple_t = std::tuple<FunctionType>

Tuple type for function (possibly a lambda with captures) and argument storage.

Constructor & Destructor Documentation

◆ cs_host_task() [1/3]

cs_host_task ( cs_host_task< FunctionType, Args > const &  )
delete

◆ cs_host_task() [2/3]

cs_host_task ( cs_host_task< FunctionType, Args > &&  )
default

◆ cs_host_task() [3/3]

cs_host_task ( FunctionType &&  function,
cs_dispatch_context  context 
)
inline

Initialize a host task with given function and context. The function must be launched using the launch method.

◆ ~cs_host_task()

~cs_host_task ( )
inline

Wait for task termination.

Member Function Documentation

◆ launch()

void launch ( Args...  args)
inline

Launch the host function asynchronously using the given parameters with cudaLaunchHostFunc.

◆ operator=() [1/2]

cs_host_task & operator= ( cs_host_task< FunctionType, Args > &&  )
default

◆ operator=() [2/2]

cs_host_task & operator= ( cs_host_task< FunctionType, Args > const &  )
delete

The documentation for this class was generated from the following file: