StarPU Handbook

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
sc_hypervisor_policy.h
Go to the documentation of this file.
1 /* StarPUf --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2012 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 SC_HYPERVISOR_POLICY_H
18 #define SC_HYPERVISOR_POLICY_H
19
20 #include <sc_hypervisor.h>
21
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26
27
28 #define HYPERVISOR_REDIM_SAMPLE 0.02
29 #define HYPERVISOR_START_REDIM_SAMPLE 0.1
30 #define SC_NOTHING 0
31 #define SC_IDLE 1
32 #define SC_SPEED 2
33
34 struct types_of_workers
35 {
36 unsigned ncpus;
37 unsigned ncuda;
38 unsigned nw;
39 };
40
41 struct sc_hypervisor_policy_task_pool
42 {
43 struct starpu_codelet *cl;
44 uint32_t footprint;
45 unsigned sched_ctx_id;
46 unsigned long n;
47 size_t data_size;
48 struct sc_hypervisor_policy_task_pool *next;
49 };
50
51 /* add task information to a task wrapper linked list */
52 void sc_hypervisor_policy_add_task_to_pool(struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, struct sc_hypervisor_policy_task_pool **task_pools, size_t data_size);
53
54 /* remove task information from a task wrapper linked list */
55 void sc_hypervisor_policy_remove_task_from_pool(struct starpu_task *task, uint32_t footprint, struct sc_hypervisor_policy_task_pool **task_pools);
56
57 /* clone a task wrapper linked list */
58 struct sc_hypervisor_policy_task_pool* sc_hypervisor_policy_clone_task_pool(struct sc_hypervisor_policy_task_pool *tp);
59
60 /* get the execution time of the submitted tasks out of starpu's calibration files */
61 void sc_hypervisor_get_tasks_times(int nw, int nt, double times[nw][nt], int *workers, unsigned size_ctxs, struct sc_hypervisor_policy_task_pool *task_pools);
62
63 /* find the context with the lowest priority in order to move some workers */
64 unsigned sc_hypervisor_find_lowest_prio_sched_ctx(unsigned req_sched_ctx, int nworkers_to_move);
65
66 /* find the first most idle workers of a context*/
67 int* sc_hypervisor_get_idlest_workers(unsigned sched_ctx, int *nworkers, enum starpu_worker_archtype arch);
68
69 /* find the first most idle workers in a list */
70 int* sc_hypervisor_get_idlest_workers_in_list(int *start, int *workers, int nall_workers, int *nworkers, enum starpu_worker_archtype arch);
71
72 /* find workers that can be moved from a context (if the constraints of min, max, etc allow this) */
73 int sc_hypervisor_get_movable_nworkers(struct sc_hypervisor_policy_config *config, unsigned sched_ctx, enum starpu_worker_archtype arch);
74
75 /* compute how many workers should be moved from this context */
76 int sc_hypervisor_compute_nworkers_to_move(unsigned req_sched_ctx);
77
78 /* check the policy's constraints in order to resize */
79 unsigned sc_hypervisor_policy_resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigned force_resize, unsigned now);
80
81 /* check the policy's constraints in order to resize and find a context willing the resources */
82 unsigned sc_hypervisor_policy_resize_to_unknown_receiver(unsigned sender_sched_ctx, unsigned now);
83
84 /* compute the speed of a context */
85 double sc_hypervisor_get_ctx_speed(struct sc_hypervisor_wrapper* sc_w);
86
87 /* get the time of execution of the slowest context */
88 double sc_hypervisor_get_slowest_ctx_exec_time(void);
89
90 /* get the time of execution of the fastest context */
91 double sc_hypervisor_get_fastest_ctx_exec_time(void);
92
93 /* compute the speed of a workers in a context */
94 double sc_hypervisor_get_speed_per_worker(struct sc_hypervisor_wrapper *sc_w, unsigned worker);
95
96 /* compute the speed of a type of worker in a context */
97 double sc_hypervisor_get_speed_per_worker_type(struct sc_hypervisor_wrapper* sc_w, enum starpu_worker_archtype arch);
98
99 /* compute the speed of a type of worker in a context depending on its history */
100 double sc_hypervisor_get_ref_speed_per_worker_type(struct sc_hypervisor_wrapper* sc_w, enum starpu_worker_archtype arch);
101
102 /* get the list of workers grouped by type */
103 void sc_hypervisor_group_workers_by_type(struct types_of_workers *tw, int *total_nw);
104
105 /* get what type of worker corresponds to a certain index of types of workers */
106 enum starpu_worker_archtype sc_hypervisor_get_arch_for_index(unsigned w, struct types_of_workers *tw);
107
108 /* get the index of types of workers corresponding to the type of workers indicated */
109 unsigned sc_hypervisor_get_index_for_arch(enum starpu_worker_archtype arch, struct types_of_workers *tw);
110
111 /* check if we trigger resizing or not */
112 unsigned sc_hypervisor_criteria_fulfilled(unsigned sched_ctx, int worker);
113
114 /* check if worker was idle long enough */
115 unsigned sc_hypervisor_check_idle(unsigned sched_ctx, int worker);
116
117 /* check if there is a speed gap btw ctxs */
118 unsigned sc_hypervisor_check_speed_gap_btw_ctxs(void);
119
120 /* check what triggers resizing (idle, speed, etc.)*/
121 unsigned sc_hypervisor_get_resize_criteria();
122
123 /* load information concerning the type of workers into a types_of_workers struct */
124 struct types_of_workers* sc_hypervisor_get_types_of_workers(int *workers, unsigned nworkers);
125
126 #ifdef __cplusplus
127 }
128 #endif
129
130 #endif
sc_hypervisor_policy_task_pool::next
struct sc_hypervisor_policy_task_pool * next
Definition: sc_hypervisor_policy.h:48
starpu_codelet
Definition: starpu_task.h:73
sc_hypervisor_wrapper
Definition: sc_hypervisor_monitoring.h:42
sc_hypervisor_policy_task_pool::data_size
size_t data_size
Definition: sc_hypervisor_policy.h:47
sc_hypervisor_policy_task_pool
Definition: sc_hypervisor_policy.h:41
starpu_worker_archtype
starpu_worker_archtype
Definition: starpu_worker.h:29
sc_hypervisor_policy_task_pool::sched_ctx_id
unsigned sched_ctx_id
Definition: sc_hypervisor_policy.h:45
sc_hypervisor_policy_task_pool::n
unsigned long n
Definition: sc_hypervisor_policy.h:46
starpu_task
Definition: starpu_task.h:104
sc_hypervisor_policy_task_pool::cl
struct starpu_codelet * cl
Definition: sc_hypervisor_policy.h:43
types_of_workers
Definition: sc_hypervisor_policy.h:34
sc_hypervisor_policy_task_pool::footprint
uint32_t footprint
Definition: sc_hypervisor_policy.h:44
sc_hypervisor.h
sc_hypervisor_policy_config
Definition: sc_hypervisor_config.h:47