StarPU Internal Handbook
tags.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2008-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 __TAGS_H__
18 #define __TAGS_H__
19 
22 #include <starpu.h>
23 #include <common/config.h>
24 #include <common/starpu_spinlock.h>
25 #include <core/dependencies/cg.h>
26 
27 #define _STARPU_TAG_SIZE (sizeof(starpu_tag_t)*8)
28 
29 enum _starpu_tag_state
30 {
31  /* this tag is not declared by any task */
32  STARPU_INVALID_STATE,
33  /* _starpu_tag_declare was called to associate the tag to a task */
34  STARPU_ASSOCIATED,
35  /* some task dependencies are not fulfilled yet */
36  STARPU_BLOCKED,
37  /* the task can be (or has been) submitted to the scheduler (all deps
38  * fulfilled) */
39  STARPU_READY,
40 // useless ...
41 // /* the task has been submitted to the scheduler */
42 // STARPU_SCHEDULED,
43  /* the task has been performed */
44  STARPU_DONE
45 };
46 
47 struct _starpu_job;
48 
50 {
51  /* Lock for this structure. Locking order is in dependency order: a tag
52  * must not be locked before locking a tag it depends on */
53  struct _starpu_spinlock lock;
54  starpu_tag_t id; /* an identifier for the task */
55  enum _starpu_tag_state state;
56 
57  struct _starpu_cg_list tag_successors;
58 
59  struct _starpu_job *job; /* which job is associated to the tag if any ? */
60 
61  unsigned is_assigned;
62  unsigned is_submitted;
63 };
64 
65 void _starpu_init_tags(void);
66 
67 void _starpu_notify_tag_dependencies(struct _starpu_tag *tag);
68 void _starpu_notify_job_start_tag_dependencies(struct _starpu_tag *tag, _starpu_notify_job_start_data *data);
69 
70 void _starpu_tag_declare(starpu_tag_t id, struct _starpu_job *job);
71 void _starpu_tag_set_ready(struct _starpu_tag *tag);
72 
73 unsigned _starpu_submit_job_enforce_task_deps(struct _starpu_job *j);
74 
75 void _starpu_tag_clear(void);
76 
77 #endif // __TAGS_H__
_starpu_cg_list
Definition: cg.h:40
starpu_spinlock.h
_starpu_tag
Definition: tags.h:49
_starpu_job::tag
struct _starpu_tag * tag
Definition: jobs.h:107
_starpu_spinlock
Definition: starpu_spinlock.h:81
_starpu_job
Definition: jobs.h:78
cg.h