Loading...
Searching...
No Matches
sched_ctx.h File Reference
`#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

## Macros

#define | NO_RESIZE
#define | REQ_RESIZE
#define | DO_RESIZE
#define | STARPU_GLOBAL_SCHED_CTX
#define | STARPU_NMAXSMS
#define | _starpu_sched_ctx_get_sched_ctx_for_worker_and_job(w, j)
#define | STARPU_SCHED_CTX_CHECK_LOCK(sched_ctx_id)

## 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_init)(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_index_in_ctx_of_workerid (unsigned sched_ctx, unsigned workerid)
starpu_pthread_mutex_t * | _starpu_get_sched_mutex (struct _starpu_sched_ctx *sched_ctx, int worker)
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 ()
int | _starpu_workers_able_to_execute_task (struct starpu_task *task, struct _starpu_sched_ctx *sched_ctx)
void | _starpu_fetch_tasks_from_empty_ctx_list (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)

## Data Structure Documentation

## _starpu_ctx_change

struct _starpu_ctx_change

per-worker list of deferred ctx_change ops

Data Fields
int | sched_ctx_id |
int | op |
int | nworkers_to_notify |
int * | workerids_to_notify |
int | nworkers_to_change |
int * | workerids_to_change |

## Function Documentation

## _starpu_init_all_sched_ctxs()

void _starpu_init_all_sched_ctxs | ( | struct _starpu_machine_config * | config | ) |

init sched_ctx_id of all contextes

## _starpu_create_sched_ctx()

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(*)(unsigned) | sched_policy_init,
|  | void * | user_data,
|  | int | nsub_ctxs,
|  | int * | sub_ctxs,
|  | int | nsms
| ) |  |

allocate all structures belonging to a context

## _starpu_delete_all_sched_ctxs()

void _starpu_delete_all_sched_ctxs | ( |  | ) |

delete all sched_ctx

## _starpu_wait_for_all_tasks_of_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.

## _starpu_wait_for_n_submitted_tasks_of_sched_ctx()

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.

## _starpu_decrement_nsubmitted_tasks_of_sched_ctx()

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

## _starpu_get_index_in_ctx_of_workerid()

int _starpu_get_index_in_ctx_of_workerid | ( | unsigned | sched_ctx,
|  | unsigned | workerid
| ) |  |

Return the corresponding index of the workerid in the ctx table

## _starpu_get_sched_mutex()

starpu_pthread_mutex_t * _starpu_get_sched_mutex | ( | struct _starpu_sched_ctx * | sched_ctx,
|  | int | worker
| ) |  |

Get the mutex corresponding to the global workerid

## _starpu_get_workers_of_sched_ctx()

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

## _starpu_worker_gets_out_of_ctx()

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

## _starpu_worker_belongs_to_a_sched_ctx()

unsigned _starpu_worker_belongs_to_a_sched_ctx | ( | int | workerid,
|  | unsigned | sched_ctx_id
| ) |  |

Check if the worker belongs to another sched_ctx

## _starpu_sched_ctx_last_worker_awake()

unsigned _starpu_sched_ctx_last_worker_awake | ( | struct _starpu_worker * | worker | ) |

indicates wheather this worker should go to sleep or not (if it is the last one awake in a context he should better keep awake)

## _starpu_sched_ctx_get_current_context()

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

## _starpu_workers_able_to_execute_task()

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

## _starpu_sched_ctx_post_exec_task_cb()

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

## __starpu_sched_ctx_get_sched_ctx_for_worker_and_job()

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

## _starpu_worker_apply_deferred_ctx_changes()

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