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-2020 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 {
31  starpu_pthread_mutex_t mutex; /* protects access to the job */
32  struct _starpu_job *job; /* pointer to the job, if it is still alive, NULL otherwise */
33 
38  struct _starpu_graph_node_multilist_top top;
40  struct _starpu_graph_node_multilist_bottom bottom;
42  struct _starpu_graph_node_multilist_all all;
44  struct _starpu_graph_node_multilist_dropped dropped;
45 
47  struct _starpu_graph_node **incoming; /* May contain NULLs for terminated jobs */
48  unsigned *incoming_slot; /* Index within corresponding outgoing array */
49  unsigned n_incoming; /* Number of slots used */
50  unsigned alloc_incoming; /* Size of incoming */
53  unsigned *outgoing_slot; /* Index within corresponding incoming array */
54  unsigned n_outgoing; /* Number of slots used */
55  unsigned alloc_outgoing; /* Size of outgoing */
56 
57  unsigned depth; /* Rank from bottom, in number of jobs */
58  /* Only available if _starpu_graph_compute_depths was called */
59  unsigned descendants; /* Number of children, grand-children, etc. */
60  /* Only available if _starpu_graph_compute_descendants was called */
61 
62  int graph_n; /* Variable available for graph flow */
63 };
64 
65 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, all)
66 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, top)
67 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, bottom)
68 MULTILIST_CREATE_INLINES(struct _starpu_graph_node, _starpu_graph_node, dropped)
69 
70 extern int _starpu_graph_record;
71 void _starpu_graph_init(void);
72 void _starpu_graph_wrlock(void);
73 void _starpu_graph_rdlock(void);
74 void _starpu_graph_wrunlock(void);
75 void _starpu_graph_rdunlock(void);
76 
79 
81 void _starpu_graph_add_job_dep(struct _starpu_job *job, struct _starpu_job *prev_job);
82 
85 
88 
95 
98 
104 void _starpu_graph_foreach(void (*func)(void *data, struct _starpu_graph_node *node), void *data);
105 
106 #endif /* __GRAPH_H__ */
_starpu_graph_drop_job
void _starpu_graph_drop_job(struct _starpu_job *job)
_starpu_graph_node::incoming
struct _starpu_graph_node ** incoming
Definition: graph.h:47
_starpu_graph_node::bottom
struct _starpu_graph_node_multilist_bottom bottom
Definition: graph.h:40
_starpu_graph_foreach
void _starpu_graph_foreach(void(*func)(void *data, struct _starpu_graph_node *node), void *data)
_starpu_graph_node::all
struct _starpu_graph_node_multilist_all all
Definition: graph.h:42
_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::outgoing
struct _starpu_graph_node ** outgoing
Definition: graph.h:52
_starpu_graph_compute_depths
void _starpu_graph_compute_depths(void)
_starpu_job
Definition: jobs.h:79
_starpu_graph_compute_descendants
void _starpu_graph_compute_descendants(void)
_starpu_graph_add_job
void _starpu_graph_add_job(struct _starpu_job *job)
_starpu_graph_node::dropped
struct _starpu_graph_node_multilist_dropped dropped
Definition: graph.h:44
_starpu_graph_node
Definition: graph.h:30
_starpu_graph_node::top
struct _starpu_graph_node_multilist_top top
Definition: graph.h:38