Loading...
Searching...
No Matches
Scheduling Context Hypervisor - Regular usage

## Functions

void * | sc_hypervisor_init (struct sc_hypervisor_policy *policy)
void | sc_hypervisor_shutdown (void)
void | sc_hypervisor_register_ctx (unsigned sched_ctx, double total_flops)
void | sc_hypervisor_unregister_ctx (unsigned sched_ctx)
void | sc_hypervisor_post_resize_request (unsigned sched_ctx, int task_tag)
void | sc_hypervisor_resize_ctxs (unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
void | sc_hypervisor_stop_resize (unsigned sched_ctx)
void | sc_hypervisor_start_resize (unsigned sched_ctx)
const char * | sc_hypervisor_get_policy ()
void | sc_hypervisor_add_workers_to_sched_ctx (int *workers_to_add, unsigned nworkers_to_add, unsigned sched_ctx)
void | sc_hypervisor_remove_workers_from_sched_ctx (int *workers_to_remove, unsigned nworkers_to_remove, unsigned sched_ctx, unsigned now)
void | sc_hypervisor_move_workers (unsigned sender_sched_ctx, unsigned receiver_sched_ctx, int *workers_to_move, unsigned nworkers_to_move, unsigned now)
void | sc_hypervisor_size_ctxs (unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
unsigned | sc_hypervisor_get_size_req (unsigned **sched_ctxs, int *nsched_ctxs, int **workers, int *nworkers)
void | sc_hypervisor_save_size_req (unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
void | sc_hypervisor_free_size_req (void)
unsigned | sc_hypervisor_can_resize (unsigned sched_ctx)
void | sc_hypervisor_set_type_of_task (struct starpu_codelet *cl, unsigned sched_ctx, uint32_t footprint, size_t data_size)
void | sc_hypervisor_update_diff_total_flops (unsigned sched_ctx, double diff_total_flops)
void | sc_hypervisor_update_diff_elapsed_flops (unsigned sched_ctx, double diff_task_flops)
void | sc_hypervisor_update_resize_interval (unsigned *sched_ctxs, int nsched_ctxs, int max_nworkers)
void | sc_hypervisor_get_ctxs_on_level (unsigned **sched_ctxs, int *nsched_ctxs, unsigned hierarchy_level, unsigned father_sched_ctx_id)
unsigned | sc_hypervisor_get_nhierarchy_levels (void)
void | sc_hypervisor_get_leaves (unsigned *sched_ctxs, int nsched_ctxs, unsigned *leaves, int *nleaves)
double | sc_hypervisor_get_nready_flops_of_all_sons_of_sched_ctx (unsigned sched_ctx)
void | sc_hypervisor_print_overhead ()
void | sc_hypervisor_init_worker (int workerid, unsigned sched_ctx)

## Variables

starpu_pthread_mutex_t | act_hypervisor_mutex

## Detailed Description

There is a single hypervisor that is in charge of resizing contexts and the resizing strategy is chosen at the initialization of the hypervisor. A single resize can be done at a time.

The Scheduling Context Hypervisor Plugin provides a series of performance counters to StarPU. By incrementing them, StarPU can help the hypervisor in the resizing decision making process.

The function sc_hypervisor_init() initializes the hypervisor to use the strategy provided as parameter and creates the performance counters (see starpu_sched_ctx_performance_counters). These performance counters represent actually some callbacks that will be used by the contexts to notify the information needed by the hypervisor.

Scheduling Contexts that have to be resized by the hypervisor must be first registered to the hypervisor using the function sc_hypervisor_register_ctx()

Note: The Hypervisor is actually a worker that takes this role once certain conditions trigger the resizing process (there is no additional thread assigned to the hypervisor).

## Function Documentation

## sc_hypervisor_init()

void * sc_hypervisor_init | ( | struct sc_hypervisor_policy * | policy | ) |

Start the hypervisor with the given policy

## sc_hypervisor_shutdown()

void sc_hypervisor_shutdown | ( | void |  | ) |

Shutdown the hypervisor. The hypervisor and all information concerning it is cleaned. There is no synchronization between this function and starpu_shutdown(). Thus, this should be called after starpu_shutdown(), because the performance counters will still need allocated callback functions.

## sc_hypervisor_register_ctx()

void sc_hypervisor_register_ctx | ( | unsigned | sched_ctx,
|  | double | total_flops
| ) |  |

Register the context to the hypervisor, and indicate the number of flops the context will execute (used for Gflops rate based strategy)

## sc_hypervisor_unregister_ctx()

void sc_hypervisor_unregister_ctx | ( | unsigned | sched_ctx | ) |

Unregister a context from the hypervisor, and so exclude the context from the resizing process

## sc_hypervisor_post_resize_request()

void sc_hypervisor_post_resize_request | ( | unsigned | sched_ctx,
|  | int | task_tag
| ) |  |

Require resizing the context `sched_ctx` whenever a task tagged with the id `task_tag` finished executing

## sc_hypervisor_resize_ctxs()

void sc_hypervisor_resize_ctxs | ( | unsigned * | sched_ctxs,
|  | int | nsched_ctxs,
|  | int * | workers,
|  | int | nworkers
| ) |  |

Require reconsidering the distribution of ressources over the indicated scheduling contexts, i.e reevaluate the distribution of the resources and eventually resize if needed

## sc_hypervisor_stop_resize()

void sc_hypervisor_stop_resize | ( | unsigned | sched_ctx | ) |

Do not allow the hypervisor to resize a context.

## sc_hypervisor_start_resize()

void sc_hypervisor_start_resize | ( | unsigned | sched_ctx | ) |

Allow the hypervisor to resize a context if necessary.

## sc_hypervisor_get_policy()

const char * sc_hypervisor_get_policy | ( |  | ) |

Return the name of the resizing policy used by the hypervisor

## sc_hypervisor_add_workers_to_sched_ctx()

void sc_hypervisor_add_workers_to_sched_ctx | ( | int * | workers_to_add,
|  | unsigned | nworkers_to_add,
|  | unsigned | sched_ctx
| ) |  |

Ask the hypervisor to add workers to a sched_ctx

## sc_hypervisor_remove_workers_from_sched_ctx()

void sc_hypervisor_remove_workers_from_sched_ctx | ( | int * | workers_to_remove,
|  | unsigned | nworkers_to_remove,
|  | unsigned | sched_ctx,
|  | unsigned | now
| ) |  |

Ask the hypervisor to remove workers from a sched_ctx

## sc_hypervisor_move_workers()

void sc_hypervisor_move_workers | ( | unsigned | sender_sched_ctx,
|  | unsigned | receiver_sched_ctx,
|  | int * | workers_to_move,
|  | unsigned | nworkers_to_move,
|  | unsigned | now
| ) |  |

Ask the hypervisor to move workers from one context to another

## sc_hypervisor_size_ctxs()

void sc_hypervisor_size_ctxs | ( | unsigned * | sched_ctxs,
|  | int | nsched_ctxs,
|  | int * | workers,
|  | int | nworkers
| ) |  |

Ask the hypervisor to choose a distribution of workers in the required contexts

## sc_hypervisor_get_size_req()

unsigned sc_hypervisor_get_size_req | ( | unsigned ** | sched_ctxs,
|  | int * | nsched_ctxs,
|  | int ** | workers,
|  | int * | nworkers
| ) |  |

Check if there are pending demands of resizing

## sc_hypervisor_save_size_req()

void sc_hypervisor_save_size_req | ( | unsigned * | sched_ctxs,
|  | int | nsched_ctxs,
|  | int * | workers,
|  | int | nworkers
| ) |  |

Save a demand of resizing

## sc_hypervisor_free_size_req()

void sc_hypervisor_free_size_req | ( | void |  | ) |

Clear the list of pending demands of resizing

## sc_hypervisor_can_resize()

unsigned sc_hypervisor_can_resize | ( | unsigned | sched_ctx | ) |

Check out if a context can be resized

## sc_hypervisor_set_type_of_task()

void sc_hypervisor_set_type_of_task | ( | struct starpu_codelet * | cl,
|  | unsigned | sched_ctx,
|  | uint32_t | footprint,
|  | size_t | data_size
| ) |  |

Indicate the types of tasks a context will execute in order to better decide the sizing of ctxs

## sc_hypervisor_update_diff_total_flops()

void sc_hypervisor_update_diff_total_flops | ( | unsigned | sched_ctx,
|  | double | diff_total_flops
| ) |  |

Change dynamically the total number of flops of a context, move the deadline of the finishing time of the context

## sc_hypervisor_update_diff_elapsed_flops()

void sc_hypervisor_update_diff_elapsed_flops | ( | unsigned | sched_ctx,
|  | double | diff_task_flops
| ) |  |

Change dynamically the number of the elapsed flops in a context, modify the past in order to better compute the speed

## sc_hypervisor_update_resize_interval()

void sc_hypervisor_update_resize_interval | ( | unsigned * | sched_ctxs,
|  | int | nsched_ctxs,
|  | int | max_nworkers
| ) |  |

Update the min and max workers needed by each context

## sc_hypervisor_get_ctxs_on_level()

void sc_hypervisor_get_ctxs_on_level | ( | unsigned ** | sched_ctxs,
|  | int * | nsched_ctxs,
|  | unsigned | hierarchy_level,
|  | unsigned | father_sched_ctx_id
| ) |  |

Return a list of contexts that are on the same level in the hierarchy of contexts

## sc_hypervisor_get_nhierarchy_levels()

unsigned sc_hypervisor_get_nhierarchy_levels | ( | void |  | ) |

Returns the number of levels of ctxs registered to the hyp

## sc_hypervisor_get_leaves()

void sc_hypervisor_get_leaves | ( | unsigned * | sched_ctxs,
|  | int | nsched_ctxs,
|  | unsigned * | leaves,
|  | int * | nleaves
| ) |  |

Return the leaves ctxs from the list of ctxs

## sc_hypervisor_get_nready_flops_of_all_sons_of_sched_ctx()

double sc_hypervisor_get_nready_flops_of_all_sons_of_sched_ctx | ( | unsigned | sched_ctx | ) |

Return the nready flops of all ctxs below in hierachy of sched_ctx

## Variable Documentation

## act_hypervisor_mutex

starpu_pthread_mutex_t act_hypervisor_mutex

extern

synchronise the hypervisor when several workers try to update its information