|
StarPU Internal Handbook
|
#include <starpu.h>#include <starpu_sched_ctx.h>#include <starpu_sched_ctx_hypervisor.h>#include <starpu_scheduler.h>#include <common/config.h>#include <common/barrier_counter.h>#include <common/utils.h>#include <profiling/profiling.h>#include <semaphore.h>#include <core/task.h>#include "sched_ctx_list.h"#include <hwloc.h>Go to the source code of this file.
Data Structures | |
| struct | _starpu_sched_ctx |
| struct | _starpu_ctx_change |
Functions | |
| void | _starpu_init_all_sched_ctxs (struct _starpu_machine_config *config) |
| struct _starpu_sched_ctx * | _starpu_create_sched_ctx (struct starpu_sched_policy *policy, int *workerid, int nworkerids, unsigned is_init_sched, const char *sched_name, int min_prio_set, int min_prio, int max_prio_set, int max_prio, unsigned awake_workers, void(*sched_policy_callback)(unsigned), void *user_data, int nsub_ctxs, int *sub_ctxs, int nsms) |
| void | _starpu_delete_all_sched_ctxs () |
| int | _starpu_wait_for_all_tasks_of_sched_ctx (unsigned sched_ctx_id) |
| int | _starpu_wait_for_n_submitted_tasks_of_sched_ctx (unsigned sched_ctx_id, unsigned n) |
| void | _starpu_decrement_nsubmitted_tasks_of_sched_ctx (unsigned sched_ctx_id) |
| void | _starpu_increment_nsubmitted_tasks_of_sched_ctx (unsigned sched_ctx_id) |
| int | _starpu_get_nsubmitted_tasks_of_sched_ctx (unsigned sched_ctx_id) |
| int | _starpu_check_nsubmitted_tasks_of_sched_ctx (unsigned sched_ctx_id) |
| void | _starpu_decrement_nready_tasks_of_sched_ctx (unsigned sched_ctx_id, double ready_flops) |
| unsigned | _starpu_increment_nready_tasks_of_sched_ctx (unsigned sched_ctx_id, double ready_flops, struct starpu_task *task) |
| int | _starpu_wait_for_no_ready_of_sched_ctx (unsigned sched_ctx_id) |
| int | _starpu_get_workers_of_sched_ctx (unsigned sched_ctx_id, int *pus, enum starpu_worker_archtype arch) |
| void | _starpu_worker_gets_out_of_ctx (unsigned sched_ctx_id, struct _starpu_worker *worker) |
| unsigned | _starpu_worker_belongs_to_a_sched_ctx (int workerid, unsigned sched_ctx_id) |
| unsigned | _starpu_sched_ctx_last_worker_awake (struct _starpu_worker *worker) |
| unsigned | _starpu_sched_ctx_get_current_context () STARPU_ATTRIBUTE_VISIBILITY_DEFAULT |
| int | _starpu_workers_able_to_execute_task (struct starpu_task *task, struct _starpu_sched_ctx *sched_ctx) |
| unsigned | _starpu_sched_ctx_allow_hypervisor (unsigned sched_ctx_id) |
| struct starpu_perfmodel_arch * | _starpu_sched_ctx_get_perf_archtype (unsigned sched_ctx) |
| void | _starpu_sched_ctx_post_exec_task_cb (int workerid, struct starpu_task *task, size_t data_size, uint32_t footprint) |
| void | starpu_sched_ctx_add_combined_workers (int *combined_workers_to_add, unsigned n_combined_workers_to_add, unsigned sched_ctx_id) |
| struct _starpu_sched_ctx * | __starpu_sched_ctx_get_sched_ctx_for_worker_and_job (struct _starpu_worker *worker, struct _starpu_job *j) |
| static struct _starpu_sched_ctx * | _starpu_get_sched_ctx_struct (unsigned id) |
| static int | _starpu_sched_ctx_check_write_locked (unsigned sched_ctx_id) |
| static void | _starpu_sched_ctx_lock_write (unsigned sched_ctx_id) |
| static void | _starpu_sched_ctx_unlock_write (unsigned sched_ctx_id) |
| static void | _starpu_sched_ctx_lock_read (unsigned sched_ctx_id) |
| static void | _starpu_sched_ctx_unlock_read (unsigned sched_ctx_id) |
| static unsigned | _starpu_sched_ctx_worker_is_master_for_child_ctx (unsigned sched_ctx_id, unsigned workerid, struct starpu_task *task) |
| void | _starpu_worker_apply_deferred_ctx_changes (void) |
| struct _starpu_sched_ctx |
| Data Fields | ||
|---|---|---|
| unsigned | id |
id of the context used in user mode |
| unsigned | do_schedule |
boolean indicating whether the scheduling_ctx will be considered for scheduling (1) or not (0) |
| const char * | name |
name of context |
| struct starpu_sched_policy * | sched_policy |
policy of the context |
| void * | policy_data |
data necessary for the policy |
| void * | user_data |
pointer for application use |
| struct starpu_worker_collection * | workers | |
| unsigned | is_initial_sched |
we keep an initial sched which we never delete |
| struct _starpu_barrier_counter | tasks_barrier |
wait for the tasks submitted to the context to be executed |
| struct _starpu_barrier_counter | ready_tasks_barrier |
wait for the tasks ready of the context to be executed |
| double | ready_flops |
amount of ready flops in a context |
| long | iterations[2] |
Iteration number, as advertised by application |
| int | iteration_level | |
| struct starpu_task_list | empty_ctx_tasks | |
| struct starpu_task_list | waiting_tasks | |
| int | min_ncpus |
min CPUs to execute |
| int | max_ncpus |
max CPUs to execute |
| int | min_ngpus |
min GPUs to execute |
| int | max_ngpus |
max GPUs to execute |
| unsigned | inheritor |
in case we delete the context leave resources to the inheritor |
| unsigned | finished_submit |
indicates whether the application finished submitting tasks to this context |
| int | min_priority |
By default we have a binary type of priority: either a task is a priority task (level 1) or it is not (level 0). |
| int | max_priority | |
| int | min_priority_is_set | |
| int | max_priority_is_set | |
| hwloc_bitmap_t | hwloc_workers_set |
hwloc tree structure of workers |
| struct starpu_sched_ctx_performance_counters * | perf_counters |
a structure containing a series of performance counters determining the resize procedure |
| void(*)(unsigned sched_ctx_id, void *args) | close_callback |
callback called when the context finished executed its submitted tasks |
| void * | close_args | |
| unsigned | hierarchy_level |
value placing the contexts in their hierarchy |
| int | main_master |
if we execute non-StarPU code inside the context we have a single master worker that stays awake, if not master is -1 |
| unsigned | nesting_sched_ctx |
ctx nesting the current ctx |
| struct starpu_perfmodel_arch | perf_arch |
perf model for the device comb of the ctx |
| unsigned | parallel_view |
For parallel workers, say whether it is viewed as sequential or not. This is a helper for the prologue code. |
| unsigned | awake_workers |
for ctxs without policy: flag to indicate that we want to get the threads to sleep in order to replace them with other threads or leave them awake & use them in the parallel code |
| void(*)(unsigned) | callback_sched |
callback function called when initializing the scheduler |
| int | sub_ctxs[STARPU_NMAXWORKERS] | |
| int | nsub_ctxs | |
| int | nsms |
nr of SMs assigned to this ctx if we partition gpus |
| int | sms_start_idx | |
| int | sms_end_idx | |
| int | stream_worker | |
| starpu_pthread_rwlock_t | rwlock | |
| starpu_pthread_t | lock_write_owner | |
| struct _starpu_ctx_change |
| void _starpu_init_all_sched_ctxs | ( | struct _starpu_machine_config * | config | ) |
init sched_ctx_id of all contextes
| struct _starpu_sched_ctx * _starpu_create_sched_ctx | ( | struct starpu_sched_policy * | policy, |
| int * | workerid, | ||
| int | nworkerids, | ||
| unsigned | is_init_sched, | ||
| const char * | sched_name, | ||
| int | min_prio_set, | ||
| int | min_prio, | ||
| int | max_prio_set, | ||
| int | max_prio, | ||
| unsigned | awake_workers, | ||
| void(* | sched_policy_callback )(unsigned), | ||
| void * | user_data, | ||
| int | nsub_ctxs, | ||
| int * | sub_ctxs, | ||
| int | nsms ) |
allocate all structures belonging to a context
| void _starpu_delete_all_sched_ctxs | ( | ) |
delete all sched_ctx
| int _starpu_wait_for_all_tasks_of_sched_ctx | ( | unsigned | sched_ctx_id | ) |
This function waits until all the tasks that were already submitted to a specific context have been executed.
| int _starpu_wait_for_n_submitted_tasks_of_sched_ctx | ( | unsigned | sched_ctx_id, |
| unsigned | n ) |
This function waits until at most n tasks are still submitted.
| void _starpu_decrement_nsubmitted_tasks_of_sched_ctx | ( | unsigned | sched_ctx_id | ) |
In order to implement starpu_wait_for_all_tasks_of_ctx, we keep track of the number of task currently submitted to the context
| int _starpu_get_workers_of_sched_ctx | ( | unsigned | sched_ctx_id, |
| int * | pus, | ||
| enum starpu_worker_archtype | arch ) |
Get workers belonging to a certain context, it returns the number of workers take care: no mutex taken, the list of workers might not be updated
| void _starpu_worker_gets_out_of_ctx | ( | unsigned | sched_ctx_id, |
| struct _starpu_worker * | worker ) |
Let the worker know it does not belong to the context and that it should stop poping from it
| unsigned _starpu_worker_belongs_to_a_sched_ctx | ( | int | workerid, |
| unsigned | sched_ctx_id ) |
Check if the worker belongs to another sched_ctx
| unsigned _starpu_sched_ctx_last_worker_awake | ( | struct _starpu_worker * | worker | ) |
indicates whether this worker should go to sleep or not (if it is the last one awake in a context he should better keep awake)
| unsigned _starpu_sched_ctx_get_current_context | ( | ) |
If starpu_sched_ctx_set_context() has been called, returns the context id set by its last call, or the id of the initial context
| int _starpu_workers_able_to_execute_task | ( | struct starpu_task * | task, |
| struct _starpu_sched_ctx * | sched_ctx ) |
verify that some worker can execute a certain task
| void _starpu_sched_ctx_post_exec_task_cb | ( | int | workerid, |
| struct starpu_task * | task, | ||
| size_t | data_size, | ||
| uint32_t | footprint ) |
Notifies the hypervisor that a tasks was poped from the workers' list
| struct _starpu_sched_ctx * __starpu_sched_ctx_get_sched_ctx_for_worker_and_job | ( | struct _starpu_worker * | worker, |
| struct _starpu_job * | j ) |
if the worker is the master of a parallel context, and the job is meant to be executed on this parallel context, return a pointer to the context
| void _starpu_worker_apply_deferred_ctx_changes | ( | void | ) |
Go through the list of deferred ctx changes of the current worker and apply any ctx change operation found until the list is empty