StarPU Internal Handbook

graph.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2016-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 __GRAPH_H__
18#define __GRAPH_H__
19
20#include <common/list.h>
21
24MULTILIST_CREATE_TYPE(_starpu_graph_node, all)
25MULTILIST_CREATE_TYPE(_starpu_graph_node, top)
26MULTILIST_CREATE_TYPE(_starpu_graph_node, bottom)
27MULTILIST_CREATE_TYPE(_starpu_graph_node, dropped)
28
29 struct _starpu_graph_node
30{
32 starpu_pthread_mutex_t mutex;
34 struct _starpu_job *job;
35
40 struct _starpu_graph_node_multilist_top top;
42 struct _starpu_graph_node_multilist_bottom bottom;
44 struct _starpu_graph_node_multilist_all all;
46 struct _starpu_graph_node_multilist_dropped dropped;
47
50 struct _starpu_graph_node **incoming;
52 unsigned *incoming_slot;
54 unsigned n_incoming;
56 unsigned alloc_incoming;
58 struct _starpu_graph_node **outgoing;
59
61 unsigned *outgoing_slot;
63 unsigned n_outgoing;
65 unsigned alloc_outgoing;
66
70 unsigned depth;
74 unsigned descendants;
75
77 int graph_n;
78};
79
80MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, all)
81MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, top)
82MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, bottom)
83MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, dropped)
84
85 extern int _starpu_graph_record;
86 void _starpu_graph_init(void);
87 void _starpu_graph_wrlock(void);
88 void _starpu_graph_rdlock(void);
89 void _starpu_graph_wrunlock(void);
90 void _starpu_graph_rdunlock(void);
91
93 void _starpu_graph_add_job(struct _starpu_job *job);
94
96 void _starpu_graph_add_job_dep(struct _starpu_job *job, struct _starpu_job *prev_job);
97
99 void _starpu_graph_drop_job(struct _starpu_job *job);
100
102 void _starpu_graph_drop_dropped_nodes(void);
103
109 void _starpu_graph_compute_depths(void);
110
112 void _starpu_graph_compute_descendants(void);
113
119 void _starpu_graph_foreach(void (*func)(void *data, struct _starpu_graph_node *node), void *data);
120
121#endif /* __GRAPH_H__ */
_starpu_graph_add_job
void _starpu_graph_add_job(struct _starpu_job *job)
_starpu_graph_node::depth
unsigned depth
Definition: graph.h:70
_starpu_graph_compute_descendants
void _starpu_graph_compute_descendants(void)
_starpu_graph_node::outgoing_slot
unsigned * outgoing_slot
Definition: graph.h:61
_starpu_graph_node::alloc_incoming
unsigned alloc_incoming
Definition: graph.h:56
_starpu_graph_drop_dropped_nodes
void _starpu_graph_drop_dropped_nodes(void)
_starpu_graph_add_job_dep
void _starpu_graph_add_job_dep(struct _starpu_job *job, struct _starpu_job *prev_job)
_starpu_graph_node::job
struct _starpu_job * job
Definition: graph.h:34
_starpu_graph_node::incoming
struct _starpu_graph_node ** incoming
Definition: graph.h:50
_starpu_graph_node::descendants
unsigned descendants
Definition: graph.h:74
_starpu_graph_compute_depths
void _starpu_graph_compute_depths(void)
_starpu_graph_node::mutex
starpu_pthread_mutex_t mutex
Definition: graph.h:32
_starpu_graph_foreach
void _starpu_graph_foreach(void(*func)(void *data, struct _starpu_graph_node *node), void *data)
_starpu_graph_node::bottom
struct _starpu_graph_node_multilist_bottom bottom
Definition: graph.h:42
_starpu_graph_node::top
struct _starpu_graph_node_multilist_top top
Definition: graph.h:40
_starpu_graph_node::outgoing
struct _starpu_graph_node ** outgoing
Definition: graph.h:58
_starpu_graph_node::all
struct _starpu_graph_node_multilist_all all
Definition: graph.h:44
_starpu_graph_node::alloc_outgoing
unsigned alloc_outgoing
Definition: graph.h:65
_starpu_graph_node::graph_n
int graph_n
Definition: graph.h:77
_starpu_graph_node::incoming_slot
unsigned * incoming_slot
Definition: graph.h:52
_starpu_graph_node::n_outgoing
unsigned n_outgoing
Definition: graph.h:63
_starpu_graph_node::dropped
struct _starpu_graph_node_multilist_dropped dropped
Definition: graph.h:46
_starpu_graph_drop_job
void _starpu_graph_drop_job(struct _starpu_job *job)
_starpu_graph_node::n_incoming
unsigned n_incoming
Definition: graph.h:54
_starpu_graph_node
Definition: graph.h:30
list.h
struct
#define struct
Definition: list.h:172
_starpu_job
Definition: jobs.h:79