cuda::experimental::stf::stream_task

Defined in include/cuda/experimental/__stf/stream/stream_task.cuh

template<typename ...Data>
class stream_task

Task running on stream with fixed, typed dependencies.

This type models tasks that have known dependencies in arity and type. Dependencies are set statically at construction and must be statically-typed (i.e., must have type task_dep<T> as opposed to task_dep_untyped). Therefore, the choice between stream_task and stream_task<> is made depending on the nature of the task’s dependencies.

Most of the time a stream_task object is created for the sake of using its ->* method that effects execution. The execution place can be set in the constructor and also dynamically. An invocation of ->* takes place on the last set execution place.

It is possible to copy or move this task into a stream_task<> by implicit conversion. Subsequently, the obtained object can be used with dynamic dependencies.

Template Parameters

Data – A list of data that this task depends on

Public Functions

inline stream_task(backend_ctx_untyped ctx, exec_place e_place, task_dep<Data>... deps)

Construct with an execution place and dependencies.

Parameters
  • ctx – The backend context

  • e_place – Place where execution will be carried

  • deps – A list of task_dep objects that this task depends on

inline stream_task(stream_ctx *ctx, task_dep<Data>... deps)

Construct with given dependencies, will execute on the current device.

Parameters
  • ctx – The stream context

  • deps – A list of task_dep objects that this task depends on

inline stream_task &set_symbol(::std::string s) &

Set the symbol object.

Parameters

s

Returns

stream_task&

inline stream_task &&set_symbol(::std::string s) &&
template<typename Fun>
inline auto operator->*(Fun &&fun)

Run lambda function on the specified device, automatically passing it the dependencies.

If fun’s first parameter has is declared as one of stream_task<Data...>, stream_task<Data...>&, auto, auto&, or auto&&, then *this is passed as fun’s first argument. Otherwise, this->get_stream() is passed as fun’s first argument. In either case, the first argument is followed by slice objects that the task depends on. The framework automatically binds dependencies to slices and fun may invoke a kernel passing it the slices.

Template Parameters

Fun – Type of lambda

Parameters

fun – Lambda function