StarPU Handbook

starpu_task_util.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 *
5 * StarPU is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation; either version 2.1 of the License, or (at
8 * your option) any later version.
9 *
10 * StarPU is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15 */
16
17#ifndef __STARPU_TASK_UTIL_H__
18#define __STARPU_TASK_UTIL_H__
19
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <assert.h>
24#include <starpu.h>
25
26#ifdef __cplusplus
27 extern "C"
28{
29#endif
30
36/* NOTE: when adding a value here, please make sure to update both
37 * src/util/starpu_task_insert_utils.c (in two places) and
38 * mpi/src/starpu_mpi_task_insert.c and mpi/src/starpu_mpi_task_insert_fortran.c */
39
40#define STARPU_MODE_SHIFT 17
41
46#define STARPU_VALUE (1<<STARPU_MODE_SHIFT)
47
52#define STARPU_CALLBACK (2<<STARPU_MODE_SHIFT)
53
60#define STARPU_CALLBACK_WITH_ARG (3<<STARPU_MODE_SHIFT)
61
66#define STARPU_CALLBACK_ARG (4<<STARPU_MODE_SHIFT)
67
72#define STARPU_PRIORITY (5<<STARPU_MODE_SHIFT)
73
80#define STARPU_EXECUTE_ON_NODE (6<<STARPU_MODE_SHIFT)
81
88#define STARPU_EXECUTE_ON_DATA (7<<STARPU_MODE_SHIFT)
89
95#define STARPU_DATA_ARRAY (8<<STARPU_MODE_SHIFT)
96
102#define STARPU_DATA_MODE_ARRAY (9<<STARPU_MODE_SHIFT)
103
107#define STARPU_TAG (10<<STARPU_MODE_SHIFT)
108
112#define STARPU_HYPERVISOR_TAG (11<<STARPU_MODE_SHIFT)
113
120#define STARPU_FLOPS (12<<STARPU_MODE_SHIFT)
121
126#define STARPU_SCHED_CTX (13<<STARPU_MODE_SHIFT)
127
132#define STARPU_PROLOGUE_CALLBACK (14<<STARPU_MODE_SHIFT)
133
139#define STARPU_PROLOGUE_CALLBACK_ARG (15<<STARPU_MODE_SHIFT)
140
145#define STARPU_PROLOGUE_CALLBACK_POP (16<<STARPU_MODE_SHIFT)
146
152#define STARPU_PROLOGUE_CALLBACK_POP_ARG (17<<STARPU_MODE_SHIFT)
153
159#define STARPU_EXECUTE_ON_WORKER (18<<STARPU_MODE_SHIFT)
160
166#define STARPU_EXECUTE_WHERE (19<<STARPU_MODE_SHIFT)
167
172#define STARPU_TAG_ONLY (20<<STARPU_MODE_SHIFT)
173
178#define STARPU_POSSIBLY_PARALLEL (21<<STARPU_MODE_SHIFT)
179
185#define STARPU_WORKER_ORDER (22<<STARPU_MODE_SHIFT)
186
193#define STARPU_NODE_SELECTION_POLICY (23<<STARPU_MODE_SHIFT)
194
199#define STARPU_NAME (24<<STARPU_MODE_SHIFT)
200
208#define STARPU_CL_ARGS (25<<STARPU_MODE_SHIFT)
209
218#define STARPU_CL_ARGS_NFREE (26<<STARPU_MODE_SHIFT)
219
226#define STARPU_TASK_DEPS_ARRAY (27<<STARPU_MODE_SHIFT)
227
232#define STARPU_TASK_COLOR (28<<STARPU_MODE_SHIFT)
233
239#define STARPU_HANDLES_SEQUENTIAL_CONSISTENCY (29<<STARPU_MODE_SHIFT)
240
245#define STARPU_TASK_SYNCHRONOUS (30<<STARPU_MODE_SHIFT)
246
253#define STARPU_TASK_END_DEPS_ARRAY (31<<STARPU_MODE_SHIFT)
254
259#define STARPU_TASK_END_DEP (32<<STARPU_MODE_SHIFT)
260
267#define STARPU_TASK_WORKERIDS (33<<STARPU_MODE_SHIFT)
268
274#define STARPU_SEQUENTIAL_CONSISTENCY (34<<STARPU_MODE_SHIFT)
275
280#define STARPU_TASK_PROFILING_INFO (35<<STARPU_MODE_SHIFT)
281
286#define STARPU_TASK_NO_SUBMITORDER (36<<STARPU_MODE_SHIFT)
287
294#define STARPU_CALLBACK_ARG_NFREE (37<<STARPU_MODE_SHIFT)
295
303#define STARPU_CALLBACK_WITH_ARG_NFREE (38<<STARPU_MODE_SHIFT)
304
312#define STARPU_PROLOGUE_CALLBACK_ARG_NFREE (39<<STARPU_MODE_SHIFT)
313
321#define STARPU_PROLOGUE_CALLBACK_POP_ARG_NFREE (40<<STARPU_MODE_SHIFT)
322
328#define STARPU_TASK_SCHED_DATA (41<<STARPU_MODE_SHIFT)
329
330#define STARPU_SHIFTED_MODE_MAX (42<<STARPU_MODE_SHIFT)
331
340 int starpu_task_set(struct starpu_task *task, struct starpu_codelet *cl, ...);
341
350 struct starpu_task *starpu_task_build(struct starpu_codelet *cl, ...);
351
388 int starpu_task_insert(struct starpu_codelet *cl, ...);
389
393 int starpu_insert_task(struct starpu_codelet *cl, ...);
394
407 void starpu_task_insert_data_make_room(struct starpu_codelet *cl, struct starpu_task *task, int *allocated_buffers, int current_buffer, int room);
408
414 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);
415
420 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);
421
427 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);
428
438 void starpu_codelet_pack_args(void **arg_buffer, size_t *arg_buffer_size, ...);
439
440 struct starpu_codelet_pack_arg_data
441{
442 char *arg_buffer;
443 size_t arg_buffer_size;
444 size_t current_offset;
445 int nargs;
446};
447
453 void starpu_codelet_pack_arg_init(struct starpu_codelet_pack_arg_data *state);
454
463 void starpu_codelet_pack_arg(struct starpu_codelet_pack_arg_data *state, const void *ptr, size_t ptr_size);
464
469 void starpu_codelet_pack_arg_fini(struct starpu_codelet_pack_arg_data *state, void **cl_arg, size_t *cl_arg_size);
470
477 void starpu_codelet_unpack_args(void *cl_arg, ...);
478
485 void starpu_codelet_unpack_args_and_copyleft(void *cl_arg, void *buffer, size_t buffer_size, ...);
486
489#ifdef __cplusplus
490}
491#endif
492
493#endif /* __STARPU_TASK_UTIL_H__ */
starpu_task::cl
struct starpu_codelet * cl
Definition: starpu_task.h:584
starpu_task::handles
starpu_data_handle_t handles[STARPU_NMAXBUFS]
Definition: starpu_task.h:661
starpu_codelet
Definition: starpu_task.h:250
starpu_data_descr
Definition: starpu_task.h:552
starpu_task
Definition: starpu_task.h:567
starpu_data_handle_t
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:44
starpu_codelet_pack_args
void starpu_codelet_pack_args(void **arg_buffer, size_t *arg_buffer_size,...)
starpu_task_set
int starpu_task_set(struct starpu_task *task, struct starpu_codelet *cl,...)
starpu_insert_task
int starpu_insert_task(struct starpu_codelet *cl,...)
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)
starpu_codelet_pack_arg
void starpu_codelet_pack_arg(struct starpu_codelet_pack_arg_data *state, const void *ptr, size_t ptr_size)
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)
starpu_codelet_pack_arg_init
void starpu_codelet_pack_arg_init(struct starpu_codelet_pack_arg_data *state)
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)
starpu_task_build
struct starpu_task * starpu_task_build(struct starpu_codelet *cl,...)
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)
starpu_codelet_unpack_args
void starpu_codelet_unpack_args(void *cl_arg,...)
starpu_codelet_unpack_args_and_copyleft
void starpu_codelet_unpack_args_and_copyleft(void *cl_arg, void *buffer, size_t buffer_size,...)
starpu_task_insert
int starpu_task_insert(struct starpu_codelet *cl,...)
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)
starpu_codelet_pack_arg_data
Definition: starpu_task_util.h:441
starpu.h