StarPU Handbook
Insert_Task

Macros

#define STARPU_VALUE
 
#define STARPU_CL_ARGS
 
#define STARPU_CALLBACK
 
#define STARPU_CALLBACK_WITH_ARG
 
#define STARPU_CALLBACK_ARG
 
#define STARPU_PRIORITY
 
#define STARPU_DATA_ARRAY
 
#define STARPU_DATA_MODE_ARRAY
 
#define STARPU_EXECUTE_ON_WORKER
 
#define STARPU_WORKER_ORDER
 
#define STARPU_TAG
 
#define STARPU_TAG_ONLY
 
#define STARPU_NAME
 
#define STARPU_FLOPS
 
#define STARPU_SCHED_CTX
 
#define STARPU_TASK_COLOR
 

Functions

int starpu_insert_task (struct starpu_codelet *cl,...)
 
int starpu_task_insert (struct starpu_codelet *cl,...)
 
void starpu_task_insert_data_make_room (struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int current_buffer, int room)
 
void starpu_task_insert_data_process_arg (struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int *current_buffer, int arg_type, starpu_data_handle_t handle)
 
void starpu_task_insert_data_process_array_arg (struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int *current_buffer, int nb_handles, starpu_data_handle_t *handles)
 
void starpu_task_insert_data_process_mode_array_arg (struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int *current_buffer, int nb_descrs, struct starpu_data_descr *descrs)
 
void starpu_codelet_pack_args (void **arg_buffer, size_t *arg_buffer_size,...)
 
void starpu_codelet_pack_arg_init (struct starpu_codelet_pack_arg_data *state)
 
void starpu_codelet_pack_arg_fini (struct starpu_codelet_pack_arg_data *state, void **cl_arg, size_t *cl_arg_size)
 
void starpu_codelet_unpack_args (void *cl_arg,...)
 
void starpu_codelet_unpack_args_and_copyleft (void *cl_arg, void *buffer, size_t buffer_size,...)
 
struct starpu_taskstarpu_task_build (struct starpu_codelet *cl,...)
 

Detailed Description

Macro Definition Documentation

◆ STARPU_VALUE

#define STARPU_VALUE

this macro is used when calling starpu_task_insert(), and must be followed by a pointer to a constant value and the size of the constant

◆ STARPU_CL_ARGS

#define STARPU_CL_ARGS

this macro is used when calling starpu_task_insert(), and must be followed by a memory buffer containing the arguments to be given to the task, and by the size of the arguments. The memory buffer should be the result of a previous call to starpu_codelet_pack_args(), and will be freed (i.e. starpu_task::cl_arg_free will be set to 1)

◆ STARPU_CALLBACK

#define STARPU_CALLBACK

this macro is used when calling starpu_task_insert(), and must be followed by a pointer to a callback function

◆ STARPU_CALLBACK_WITH_ARG

#define STARPU_CALLBACK_WITH_ARG

this macro is used when calling starpu_task_insert(), and must be followed by two pointers: one to a callback function, and the other to be given as an argument to the callback function; this is equivalent to using both STARPU_CALLBACK and STARPU_CALLBACK_WITH_ARG.

◆ STARPU_CALLBACK_ARG

#define STARPU_CALLBACK_ARG

this macro is used when calling starpu_task_insert(), and must be followed by a pointer to be given as an argument to the callback function

◆ STARPU_PRIORITY

#define STARPU_PRIORITY

this macro is used when calling starpu_task_insert(), and must be followed by a integer defining a priority level

◆ STARPU_DATA_ARRAY

#define STARPU_DATA_ARRAY

TODO

◆ STARPU_DATA_MODE_ARRAY

#define STARPU_DATA_MODE_ARRAY

TODO

◆ STARPU_EXECUTE_ON_WORKER

#define STARPU_EXECUTE_ON_WORKER

this macro is used when calling starpu_task_insert(), and must be followed by an integer value specifying the worker on which to execute the task (as specified by starpu_task::execute_on_a_specific_worker)

◆ STARPU_WORKER_ORDER

#define STARPU_WORKER_ORDER

this macro is used when calling starpu_task_insert(), and must be followed by an integer value specifying the worker order in which to execute the tasks (as specified by starpu_task::workerorder)

◆ STARPU_TAG

#define STARPU_TAG

this macro is used when calling starpu_task_insert(), and must be followed by a tag.

◆ STARPU_TAG_ONLY

#define STARPU_TAG_ONLY

this macro is used when calling starpu_task_insert(), and must be followed by a tag. It sets starpu_task::tag_id, but leaves starpu_task::use_tag as 0.

◆ STARPU_NAME

#define STARPU_NAME

this macro is used when calling starpu_task_insert(), and must be followed by a char *. It sets starpu_task::name to it.

◆ STARPU_FLOPS

#define STARPU_FLOPS

this macro is used when calling starpu_task_insert(), and must be followed by an amount of floating point operations, as a double. Users MUST explicitly cast into double, otherwise parameter passing will not work.

◆ STARPU_SCHED_CTX

#define STARPU_SCHED_CTX

this macro is used when calling starpu_task_insert(), and must be followed by the id of the scheduling context to which we want to submit the task.

◆ STARPU_TASK_COLOR

#define STARPU_TASK_COLOR

Used when calling starpu_task_insert(), must be followed by an integer representing a color

Function Documentation

◆ starpu_insert_task()

int starpu_insert_task ( struct starpu_codelet cl,
  ... 
)

This function does the same as the function starpu_task_insert(). It has been kept to avoid breaking old codes.

◆ starpu_task_insert()

int starpu_task_insert ( struct starpu_codelet cl,
  ... 
)

Create and submit a task corresponding to cl with the following arguments. The argument list must be zero-terminated.

The arguments following the codelet can be of the following types:

When using STARPU_DATA_ARRAY, the access mode of the data handles is not defined, it will be taken from the codelet starpu_codelet::modes or starpu_codelet::dyn_modes field. One should use STARPU_DATA_MODE_ARRAY to define the data handles along with the access modes.

Parameters to be passed to the codelet implementation are defined through the type STARPU_VALUE. The function starpu_codelet_unpack_args() must be called within the codelet implementation to retrieve them.

◆ starpu_task_insert_data_make_room()

void starpu_task_insert_data_make_room ( struct starpu_codelet cl,
struct starpu_task task,
int *  allocated_buffers,
int  current_buffer,
int  room 
)

Assuming that there are already current_buffer data handles passed to the task, and if *allocated_buffers is not 0, the task->dyn_handles array has size *allocated_buffers, this function makes room for room other data handles, allocating or reallocating task->dyn_handles as necessary and updating *allocated_buffers accordingly. One can thus start with *allocated_buffers equal to 0 and current_buffer equal to 0, then make room by calling this function, then store handles with STARPU_TASK_SET_HANDLE(), make room again with this function, store yet more handles, etc.

◆ starpu_task_insert_data_process_arg()

void starpu_task_insert_data_process_arg ( struct starpu_codelet cl,
struct starpu_task task,
int *  allocated_buffers,
int *  current_buffer,
int  arg_type,
starpu_data_handle_t  handle 
)

Store data handle handle into task task with mode arg_type, updating *allocated_buffers and *current_buffer accordingly.

◆ starpu_task_insert_data_process_array_arg()

void starpu_task_insert_data_process_array_arg ( struct starpu_codelet cl,
struct starpu_task task,
int *  allocated_buffers,
int *  current_buffer,
int  nb_handles,
starpu_data_handle_t handles 
)

Store nb_handles data handles handles into task task, updating allocated_buffers and *current_buffer accordingly.

◆ starpu_task_insert_data_process_mode_array_arg()

void starpu_task_insert_data_process_mode_array_arg ( struct starpu_codelet cl,
struct starpu_task task,
int *  allocated_buffers,
int *  current_buffer,
int  nb_descrs,
struct starpu_data_descr descrs 
)

Store nb_descrs data handles described by descrs into task task, updating *allocated_buffers and *current_buffer accordingly.

◆ starpu_codelet_pack_args()

void starpu_codelet_pack_args ( void **  arg_buffer,
size_t *  arg_buffer_size,
  ... 
)

Pack arguments of type STARPU_VALUE into a buffer which can be given to a codelet and later unpacked with the function starpu_codelet_unpack_args().

Instead of calling starpu_codelet_pack_args(), one can also call starpu_codelet_pack_arg_init(), then starpu_codelet_pack_arg() for each data, then starpu_codelet_pack_arg_fini().

◆ starpu_codelet_pack_arg_init()

void starpu_codelet_pack_arg_init ( struct starpu_codelet_pack_arg_data state)

Initialize struct starpu_codelet_pack_arg before calling starpu_codelet_pack_arg() and starpu_codelet_pack_arg_fini(). This will simply initialize the content of the structure.

◆ starpu_codelet_pack_arg_fini()

void starpu_codelet_pack_arg_fini ( struct starpu_codelet_pack_arg_data state,
void **  cl_arg,
size_t *  cl_arg_size 
)

Finish packing data, after calling starpu_codelet_pack_arg_init() once and starpu_codelet_pack_arg() several times.

◆ starpu_codelet_unpack_args()

void starpu_codelet_unpack_args ( void *  cl_arg,
  ... 
)

Retrieve the arguments of type STARPU_VALUE associated to a task automatically created using the function starpu_task_insert(). If any parameter's value is 0, unpacking will stop there and ignore the remaining parameters.

◆ starpu_codelet_unpack_args_and_copyleft()

void starpu_codelet_unpack_args_and_copyleft ( void *  cl_arg,
void *  buffer,
size_t  buffer_size,
  ... 
)

Similar to starpu_codelet_unpack_args(), but if any parameter is 0, copy the part of cl_arg that has not been read in buffer which can then be used in a later call to one of the unpack functions.

◆ starpu_task_build()

struct starpu_task * starpu_task_build ( struct starpu_codelet cl,
  ... 
)

Create a task corresponding to cl with the following arguments. The argument list must be zero-terminated. The arguments following the codelet are the same as the ones for the function starpu_task_insert(). If some arguments of type STARPU_VALUE are given, the parameter starpu_task::cl_arg_free will be set to 1.