StarPU Internal Handbook

sched_ctx_list.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2013-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 __SCHED_CONTEXT_LIST_H__
18#define __SCHED_CONTEXT_LIST_H__
19
23 struct _starpu_sched_ctx_elt;
24 struct _starpu_sched_ctx_list
25{
26 struct _starpu_sched_ctx_list *prev;
27 struct _starpu_sched_ctx_list *next;
28 struct _starpu_sched_ctx_elt *head;
29 unsigned priority;
30};
31
33 struct _starpu_sched_ctx_elt
34{
35 struct _starpu_sched_ctx_elt *prev;
36 struct _starpu_sched_ctx_elt *next;
37 struct _starpu_sched_ctx_list *parent;
38 unsigned sched_ctx;
39 long task_number;
40 unsigned last_poped;
41};
42
43 struct _starpu_sched_ctx_list_iterator
44{
45 struct _starpu_sched_ctx_list *list_head;
46 struct _starpu_sched_ctx_elt *cursor;
47};
48
50 struct _starpu_sched_ctx_elt* _starpu_sched_ctx_elt_find(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
51 void _starpu_sched_ctx_elt_ensure_consistency(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
52 void _starpu_sched_ctx_elt_init(struct _starpu_sched_ctx_elt *elt, unsigned sched_ctx);
53 struct _starpu_sched_ctx_elt* _starpu_sched_ctx_elt_add_after(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
54 struct _starpu_sched_ctx_elt* _starpu_sched_ctx_elt_add_before(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
55 struct _starpu_sched_ctx_elt* _starpu_sched_ctx_elt_add(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
56 void _starpu_sched_ctx_elt_remove(struct _starpu_sched_ctx_list *list, struct _starpu_sched_ctx_elt *elt);
57 int _starpu_sched_ctx_elt_exists(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
58 int _starpu_sched_ctx_elt_get_priority(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
59
60
62 struct _starpu_sched_ctx_list* _starpu_sched_ctx_list_find(struct _starpu_sched_ctx_list *list, unsigned prio);
63 struct _starpu_sched_ctx_elt* _starpu_sched_ctx_list_add_prio(struct _starpu_sched_ctx_list **list, unsigned prio, unsigned sched_ctx);
64 int _starpu_sched_ctx_list_add(struct _starpu_sched_ctx_list **list, unsigned sched_ctx);
65 void _starpu_sched_ctx_list_remove_elt(struct _starpu_sched_ctx_list **list, struct _starpu_sched_ctx_elt *rm);
66 int _starpu_sched_ctx_list_remove(struct _starpu_sched_ctx_list **list, unsigned sched_ctx);
67 int _starpu_sched_ctx_list_move(struct _starpu_sched_ctx_list **list, unsigned sched_ctx, unsigned prio_to);
68 int _starpu_sched_ctx_list_exists(struct _starpu_sched_ctx_list *list, unsigned prio);
69 void _starpu_sched_ctx_list_remove_all(struct _starpu_sched_ctx_list *list);
70 void _starpu_sched_ctx_list_delete(struct _starpu_sched_ctx_list **list);
71
73 int _starpu_sched_ctx_list_push_event(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
74 int _starpu_sched_ctx_list_pop_event(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
75 int _starpu_sched_ctx_list_pop_all_event(struct _starpu_sched_ctx_list *list, unsigned sched_ctx);
76
78 int _starpu_sched_ctx_list_iterator_init(struct _starpu_sched_ctx_list *list, struct _starpu_sched_ctx_list_iterator *it);
79 int _starpu_sched_ctx_list_iterator_has_next(struct _starpu_sched_ctx_list_iterator *it);
80 struct _starpu_sched_ctx_elt* _starpu_sched_ctx_list_iterator_get_next(struct _starpu_sched_ctx_list_iterator *it);
81
82#endif // __SCHED_CONTEXT_H__
_starpu_sched_ctx_list_iterator_init
int _starpu_sched_ctx_list_iterator_init(struct _starpu_sched_ctx_list *list, struct _starpu_sched_ctx_list_iterator *it)
_starpu_sched_ctx_list_find
struct _starpu_sched_ctx_list * _starpu_sched_ctx_list_find(struct _starpu_sched_ctx_list *list, unsigned prio)
_starpu_sched_ctx_list_push_event
int _starpu_sched_ctx_list_push_event(struct _starpu_sched_ctx_list *list, unsigned sched_ctx)
_starpu_sched_ctx_elt_find
struct _starpu_sched_ctx_elt * _starpu_sched_ctx_elt_find(struct _starpu_sched_ctx_list *list, unsigned sched_ctx)
_starpu_sched_ctx_elt
Definition: sched_ctx_list.h:34
_starpu_sched_ctx_list
Definition: sched_ctx_list.h:25
_starpu_sched_ctx_list_iterator
Definition: sched_ctx_list.h:44