StarPU Internal Handbook

cg.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 __CG_H__
18#define __CG_H__
19
22#include <starpu.h>
23#include <common/config.h>
24
28#define STARPU_DYNAMIC_DEPS_SIZE 1
29
30/* randomly choosen ! */
31#ifndef STARPU_DYNAMIC_DEPS_SIZE
32#define STARPU_NMAXDEPS 256
33#endif
34
35 struct _starpu_job;
36
40 struct _starpu_cg_list
41{
43 struct _starpu_spinlock lock;
44
46 unsigned ndeps; /* how many deps ? */
47 unsigned ndeps_completed; /* how many deps are done ? */
48#ifdef STARPU_DEBUG
50 struct _starpu_cg **deps;
52 char *done;
53#endif
54
58 unsigned terminated;
59
61 unsigned nsuccs; /* how many successors ? */
62#ifdef STARPU_DYNAMIC_DEPS_SIZE
64 unsigned succ_list_size;
65 struct _starpu_cg **succ;
66#else
67 struct _starpu_cg *succ[STARPU_NMAXDEPS];
68#endif
69};
70
71 enum _starpu_cg_type
72{
73 STARPU_CG_APPS=(1<<0),
74 STARPU_CG_TAG=(1<<1),
75 STARPU_CG_TASK=(1<<2)
76};
77
79 struct _starpu_cg
80{
82 unsigned ntags;
84 unsigned remaining;
85
86#ifdef STARPU_DEBUG
87 unsigned ndeps;
89 void **deps;
91 char *done;
92#endif
93
94 enum _starpu_cg_type cg_type;
95
96 union
97 {
99 struct _starpu_tag *tag;
100
102 struct _starpu_job *job;
103
108 struct
109 {
110 unsigned completed;
111 starpu_pthread_mutex_t cg_mutex;
112 starpu_pthread_cond_t cg_cond;
113 } succ_apps;
114 } succ;
115};
116
117 typedef struct _starpu_notify_job_start_data _starpu_notify_job_start_data;
118
119 void _starpu_notify_dependencies(struct _starpu_job *j);
120 void _starpu_job_notify_start(struct _starpu_job *j, struct starpu_perfmodel_arch* perf_arch);
121 void _starpu_job_notify_ready_soon(struct _starpu_job *j, _starpu_notify_job_start_data *data);
122
123 void _starpu_cg_list_init(struct _starpu_cg_list *list);
124 void _starpu_cg_list_deinit(struct _starpu_cg_list *list);
125 int _starpu_add_successor_to_cg_list(struct _starpu_cg_list *successors, struct _starpu_cg *cg);
126 int _starpu_list_task_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, struct starpu_task *task_array[]);
127 int _starpu_list_task_scheduled_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, struct starpu_task *task_array[]);
128 int _starpu_list_tag_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, starpu_tag_t tag_array[]);
129 void _starpu_notify_cg(void *pred, struct _starpu_cg *cg);
130 void _starpu_notify_cg_list(void *pred, struct _starpu_cg_list *successors);
131 void _starpu_notify_job_start_cg_list(void *pred, struct _starpu_cg_list *successors, _starpu_notify_job_start_data *data);
132 void _starpu_notify_task_dependencies(struct _starpu_job *j);
133 void _starpu_notify_job_start_tasks(struct _starpu_job *j, _starpu_notify_job_start_data *data);
134
135#endif // __CG_H__
_starpu_cg::ntags
unsigned ntags
Definition: cg.h:82
_starpu_cg_list::nsuccs
unsigned nsuccs
Definition: cg.h:61
_starpu_cg_list::lock
struct _starpu_spinlock lock
Definition: cg.h:43
_starpu_cg::remaining
unsigned remaining
Definition: cg.h:84
_starpu_cg_list::succ_list_size
unsigned succ_list_size
Definition: cg.h:64
_starpu_cg_list::terminated
unsigned terminated
Definition: cg.h:58
_starpu_cg_list::ndeps
unsigned ndeps
Definition: cg.h:46
_starpu_cg
Definition: cg.h:80
_starpu_cg_list
Definition: cg.h:41
_starpu_spinlock
Definition: starpu_spinlock.h:82
_starpu_job
Definition: jobs.h:79
_starpu_tag
Definition: tags.h:49