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 
24 MULTILIST_CREATE_TYPE(_starpu_graph_node, all)
25 MULTILIST_CREATE_TYPE(_starpu_graph_node, top)
26 MULTILIST_CREATE_TYPE(_starpu_graph_node, bottom)
27 MULTILIST_CREATE_TYPE(_starpu_graph_node, dropped)
28 
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 
52  unsigned *incoming_slot;
54  unsigned n_incoming;
56  unsigned alloc_incoming;
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 
80 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, all)
81 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, top)
82 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, bottom)
83 MULTILIST_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 
94 
96 void _starpu_graph_add_job_dep(struct _starpu_job *job, struct _starpu_job *prev_job);
97 
100 
103 
110 
113 
119 void _starpu_graph_foreach(void (*func)(void *data, struct _starpu_graph_node *node), void *data);
120 
121 #endif /* __GRAPH_H__ */
void _starpu_graph_add_job(struct _starpu_job *job)
unsigned depth
Definition: graph.h:70
void _starpu_graph_compute_descendants(void)
unsigned * outgoing_slot
Definition: graph.h:61
unsigned alloc_incoming
Definition: graph.h:56
void _starpu_graph_drop_dropped_nodes(void)
void _starpu_graph_add_job_dep(struct _starpu_job *job, struct _starpu_job *prev_job)
struct _starpu_job * job
Definition: graph.h:34
struct _starpu_graph_node ** incoming
Definition: graph.h:50
unsigned descendants
Definition: graph.h:74
void _starpu_graph_compute_depths(void)
starpu_pthread_mutex_t mutex
Definition: graph.h:32
void _starpu_graph_foreach(void(*func)(void *data, struct _starpu_graph_node *node), void *data)
struct _starpu_graph_node_multilist_bottom bottom
Definition: graph.h:42
struct _starpu_graph_node_multilist_top top
Definition: graph.h:40
struct _starpu_graph_node ** outgoing
Definition: graph.h:58
struct _starpu_graph_node_multilist_all all
Definition: graph.h:44
unsigned alloc_outgoing
Definition: graph.h:65
int graph_n
Definition: graph.h:77
unsigned * incoming_slot
Definition: graph.h:52
unsigned n_outgoing
Definition: graph.h:63
struct _starpu_graph_node_multilist_dropped dropped
Definition: graph.h:46
void _starpu_graph_drop_job(struct _starpu_job *job)
unsigned n_incoming
Definition: graph.h:54
Definition: graph.h:30
#define struct
Definition: list.h:172
Definition: jobs.h:79