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-2022 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 <core/task.h>
21 #include <common/list.h>
22 
23 #pragma GCC visibility push(hidden)
24 
27 MULTILIST_CREATE_TYPE(_starpu_graph_node, all)
28 MULTILIST_CREATE_TYPE(_starpu_graph_node, top)
29 MULTILIST_CREATE_TYPE(_starpu_graph_node, bottom)
30 MULTILIST_CREATE_TYPE(_starpu_graph_node, dropped)
31 
33 {
35  starpu_pthread_mutex_t mutex;
37  struct _starpu_job *job;
38 
43  struct _starpu_graph_node_multilist_top top;
45  struct _starpu_graph_node_multilist_bottom bottom;
47  struct _starpu_graph_node_multilist_all all;
49  struct _starpu_graph_node_multilist_dropped dropped;
50 
55  unsigned *incoming_slot;
57  unsigned n_incoming;
59  unsigned alloc_incoming;
62 
64  unsigned total_incoming;
65 
67  unsigned *outgoing_slot;
69  unsigned n_outgoing;
71  unsigned alloc_outgoing;
72 
76  unsigned depth;
80  unsigned descendants;
81 
83  int graph_n;
84 };
85 
86 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, all)
87 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, top)
88 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, bottom)
89 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, dropped)
90 
91 extern int _starpu_graph_record;
92 void _starpu_graph_init(void);
93 void _starpu_graph_wrlock(void);
94 void _starpu_graph_rdlock(void);
95 void _starpu_graph_wrunlock(void);
96 void _starpu_graph_rdunlock(void);
97 
100 
102 void _starpu_graph_add_job_dep(struct _starpu_job *job, struct _starpu_job *prev_job);
103 
106 
109 
116 
119 
125 void _starpu_graph_foreach(void (*func)(void *data, struct _starpu_graph_node *node), void *data);
126 
127 struct _starpu_graph_node *_starpu_graph_task_node(struct starpu_task *task);
128 struct starpu_task *_starpu_graph_node_task(struct _starpu_graph_node *node);
129 void _starpu_graph_node_outgoing(struct _starpu_graph_node *node, unsigned *n_outgoing, struct _starpu_graph_node ***outgoing);
130 
131 #pragma GCC visibility pop
132 
133 #endif /* __GRAPH_H__ */
unsigned total_incoming
Definition: graph.h:64
void _starpu_graph_add_job(struct _starpu_job *job)
unsigned depth
Definition: graph.h:76
void _starpu_graph_compute_descendants(void)
unsigned * outgoing_slot
Definition: graph.h:67
unsigned alloc_incoming
Definition: graph.h:59
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:37
struct _starpu_graph_node ** incoming
Definition: graph.h:53
unsigned descendants
Definition: graph.h:80
void _starpu_graph_compute_depths(void)
starpu_pthread_mutex_t mutex
Definition: graph.h:35
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:45
struct _starpu_graph_node_multilist_top top
Definition: graph.h:43
struct _starpu_graph_node ** outgoing
Definition: graph.h:61
struct _starpu_graph_node_multilist_all all
Definition: graph.h:47
unsigned alloc_outgoing
Definition: graph.h:71
int graph_n
Definition: graph.h:83
unsigned * incoming_slot
Definition: graph.h:55
unsigned n_outgoing
Definition: graph.h:69
struct _starpu_graph_node_multilist_dropped dropped
Definition: graph.h:49
void _starpu_graph_drop_job(struct _starpu_job *job)
unsigned n_incoming
Definition: graph.h:57
Definition: graph.h:33
#define struct
Definition: list.h:175
Definition: jobs.h:74