StarPU Internal Handbook
Loading...
Searching...
No Matches
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
35struct _starpu_job;
36
41{
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
65 struct _starpu_cg **succ;
66#else
67 struct _starpu_cg *succ[STARPU_NMAXDEPS];
68#endif
69};
70
71enum _starpu_cg_type
72{
73 STARPU_CG_APPS=(1<<0),
74 STARPU_CG_TAG=(1<<1),
75 STARPU_CG_TASK=(1<<2)
76};
77
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
117typedef struct _starpu_notify_job_start_data _starpu_notify_job_start_data;
118
119void _starpu_notify_dependencies(struct _starpu_job *j);
120void _starpu_job_notify_start(struct _starpu_job *j, struct starpu_perfmodel_arch* perf_arch);
121void _starpu_job_notify_ready_soon(struct _starpu_job *j, _starpu_notify_job_start_data *data);
122
123void _starpu_cg_list_init(struct _starpu_cg_list *list);
124void _starpu_cg_list_deinit(struct _starpu_cg_list *list);
125int _starpu_add_successor_to_cg_list(struct _starpu_cg_list *successors, struct _starpu_cg *cg);
126int _starpu_list_task_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, struct starpu_task *task_array[]);
127int _starpu_list_task_scheduled_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, struct starpu_task *task_array[]);
128int _starpu_list_tag_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, starpu_tag_t tag_array[]);
129void _starpu_notify_cg(void *pred, struct _starpu_cg *cg);
130void _starpu_notify_cg_list(void *pred, struct _starpu_cg_list *successors);
131void _starpu_notify_job_start_cg_list(void *pred, struct _starpu_cg_list *successors, _starpu_notify_job_start_data *data);
132void _starpu_notify_task_dependencies(struct _starpu_job *j);
133void _starpu_notify_job_start_tasks(struct _starpu_job *j, _starpu_notify_job_start_data *data);
134
135#endif // __CG_H__
unsigned ntags
Definition cg.h:82
unsigned nsuccs
Definition cg.h:61
struct _starpu_spinlock lock
Definition cg.h:43
unsigned remaining
Definition cg.h:84
unsigned succ_list_size
Definition cg.h:64
unsigned terminated
Definition cg.h:58
unsigned ndeps
Definition cg.h:46
Definition cg.h:80
Definition cg.h:41
Definition starpu_spinlock.h:82
Definition jobs.h:79
Definition tags.h:49