StarPU Internal Handbook
Loading...
Searching...
No Matches
jobs.h File Reference
#include <starpu.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <common/config.h>
#include <common/timing.h>
#include <common/list.h>
#include <common/fxt.h>
#include <core/dependencies/tags.h>
#include <datawizard/datawizard.h>
#include <core/perfmodel/perfmodel.h>
#include <core/errorcheck.h>
#include <common/barrier.h>
#include <common/utils.h>

Go to the source code of this file.

Data Structures

struct  _starpu_data_descr
 
struct  _starpu_job
 

Macros

#define _STARPU_MAY_PERFORM(j, arch)
 
#define _STARPU_JOB_GET_ORDERED_BUFFER_INDEX(job, i)
 
#define _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(job, i)
 
#define _STARPU_JOB_GET_ORDERED_BUFFER_MODE(job, i)
 
#define _STARPU_JOB_GET_ORDERED_BUFFER_NODE(job, i)
 
#define _STARPU_JOB_SET_ORDERED_BUFFER_INDEX(job, __index, i)
 
#define _STARPU_JOB_SET_ORDERED_BUFFER_HANDLE(job, __handle, i)
 
#define _STARPU_JOB_SET_ORDERED_BUFFER_MODE(job, __mode, i)
 
#define _STARPU_JOB_SET_ORDERED_BUFFER_NODE(job, __node, i)
 
#define _STARPU_JOB_SET_ORDERED_BUFFER(job, buffer, i)
 
#define _STARPU_JOB_GET_ORDERED_BUFFERS(job)
 
#define _STARPU_JOB_GET_DEP_SLOTS(job)
 

Typedefs

typedef void(* _starpu_cl_func_t) (void **, void *)
 

Functions

void _starpu_job_init (void)
 
void _starpu_job_fini (void)
 
struct _starpu_job_starpu_job_create (struct starpu_task *task) STARPU_ATTRIBUTE_MALLOC
 
void _starpu_job_destroy (struct _starpu_job *j)
 
int _starpu_job_finished (struct _starpu_job *j)
 
void _starpu_wait_job (struct _starpu_job *j)
 
int _starpu_test_job_termination (struct _starpu_job *j)
 
void _starpu_job_prepare_for_continuation_ext (struct _starpu_job *j, unsigned continuation_resubmit, void(*continuation_callback_on_sleep)(void *arg), void *continuation_callback_on_sleep_arg)
 
void _starpu_job_prepare_for_continuation (struct _starpu_job *j)
 
void _starpu_job_set_omp_cleanup_callback (struct _starpu_job *j, void(*omp_cleanup_callback)(void *arg), void *omp_cleanup_callback_arg)
 
void _starpu_exclude_task_from_dag (struct starpu_task *task)
 
unsigned _starpu_enforce_deps_and_schedule (struct _starpu_job *j)
 
unsigned _starpu_enforce_deps_starting_from_task (struct _starpu_job *j)
 
unsigned _starpu_reenforce_task_deps_and_schedule (struct _starpu_job *j)
 
unsigned _starpu_take_deps_and_schedule (struct _starpu_job *j)
 
void _starpu_enforce_deps_notify_job_ready_soon (struct _starpu_job *j, _starpu_notify_job_start_data *data, int tag)
 
void _starpu_handle_job_submission (struct _starpu_job *j)
 
void _starpu_handle_job_termination (struct _starpu_job *j)
 
size_t _starpu_job_get_data_size (struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned nimpl, struct _starpu_job *j)
 
struct starpu_task * _starpu_pop_local_task (struct _starpu_worker *worker)
 
int _starpu_push_local_task (struct _starpu_worker *worker, struct starpu_task *task)
 

Data Structure Documentation

◆ _starpu_data_descr

struct _starpu_data_descr
Data Fields
starpu_data_handle_t handle
enum starpu_data_access_mode mode
int node
int index

This is the value actually chosen, only set by _starpu_fetch_task_input for coherency with __starpu_push_task_output

int orderedindex

◆ _starpu_job

struct _starpu_job

A job is the internal representation of a task.

Data Fields
unsigned long job_id

Each job is attributed a unique id. This however only defined when recording traces or using jobid-based task breakpoints

struct starpu_task * task

The task associated to that job

struct _starpu_job * quick_next

A task that this will unlock quickly, e.g. we are the pre_sync part of a data acquisition, and the caller promised that data release will happen immediately, so that the post_sync task will be started immediately after.

starpu_pthread_mutex_t sync_mutex

These synchronization structures are used to wait for the job to be available or terminated for instance.

starpu_pthread_cond_t sync_cond
struct _starpu_data_descr ordered_buffers[STARPU_NMAXBUFS]

To avoid deadlocks, we reorder the different buffers accessed to by the task so that we always grab the rw-lock associated to the handles in the same order.

struct _starpu_task_wrapper_dlist dep_slots[STARPU_NMAXBUFS]
struct _starpu_data_descr * dyn_ordered_buffers
struct _starpu_task_wrapper_dlist * dyn_dep_slots
struct _starpu_tag * tag

If a tag is associated to the job, this points to the internal data structure that describes the tag status.

struct _starpu_cg_list job_successors

Maintain a list of all the completion groups that depend on the job.

struct starpu_task * end_rdep

Task whose termination depends on this task

starpu_data_handle_t implicit_dep_handle

For tasks with cl==NULL but submitted with explicit data dependency, the handle for this dependency, so as to remove the task from the last_writer/readers

struct _starpu_task_wrapper_dlist implicit_dep_slot
unsigned submitted:2

Indicates whether the task associated to that job has already been submitted to StarPU (1) or not (0) (using starpu_task_submit). Becomes and stays 2 when the task is submitted several times.

Protected by j->sync_mutex.

unsigned terminated:2

Indicates whether the task associated to this job is terminated or not.

Protected by j->sync_mutex.

unsigned continuation

Job is a continuation or a regular task.

unsigned continuation_resubmit

If 0, the prepared continuation is not resubmitted automatically when going to sleep, if 1, the prepared continuation is immediately resubmitted when going to sleep.

void(*)(void *arg) continuation_callback_on_sleep

Callback function called when:

  • The continuation starpu task is ready to be submitted again if continuation_resubmit = 0;
  • The continuation starpu task has just been re-submitted if continuation_resubmit = 1.
void * continuation_callback_on_sleep_arg
void(*)(void *arg) omp_cleanup_callback
void * omp_cleanup_callback_arg
unsigned discontinuous

Job has been stopped at least once.

struct timespec cumulated_ts

Cumulated execution time for discontinuous jobs

double cumulated_energy_consumed

Cumulated energy consumption for discontinuous jobs

uint32_t footprint

The value of the footprint that identifies the job may be stored in this structure.

unsigned footprint_is_computed:1
unsigned exclude_from_dag:1

Should that task appear in the debug tools ? (eg. the DAG generated with dot)

unsigned internal:1

Is that task internal to StarPU?

unsigned sequential_consistency:1

Did that task use sequential consistency for its data?

unsigned reduction_task:1

During the reduction of a handle, StarPU may have to submit tasks to perform the reduction itself: those task should not be stalled while other tasks are blocked until the handle has been properly reduced, so we need a flag to differentiate them from "normal" tasks.

unsigned nimpl

The implementation associated to the job

int task_size

Number of workers executing that task (>1 if the task is parallel)

int workerid

The worker the task is running on (or -1 when not running yet)

int combined_workerid

In case we have assigned this job to a combined workerid

int active_task_alias_count

How many workers are currently running an alias of that job (for parallel tasks only).

struct bound_task * bound_task
starpu_pthread_barrier_t before_work_barrier

Parallel workers may have to synchronize before/after the execution of a parallel task.

starpu_pthread_barrier_t after_work_barrier
unsigned after_work_busy_barrier
struct _starpu_graph_node * graph_node
int already_turned_into_bubble
unsigned is_bubble:1

Typedef Documentation

◆ _starpu_cl_func_t

typedef void(* _starpu_cl_func_t) (void **, void *)

codelet function

Function Documentation

◆ _starpu_job_create()

struct _starpu_job * _starpu_job_create ( struct starpu_task * task)

Create an internal struct _starpu_job *structure to encapsulate the task.

◆ _starpu_job_destroy()

void _starpu_job_destroy ( struct _starpu_job * j)

Destroy the data structure associated to the job structure

◆ _starpu_job_finished()

int _starpu_job_finished ( struct _starpu_job * j)

Test for the termination of the job

◆ _starpu_wait_job()

void _starpu_wait_job ( struct _starpu_job * j)

Wait for the termination of the job

◆ _starpu_test_job_termination()

int _starpu_test_job_termination ( struct _starpu_job * j)

Test for the termination of the job

◆ _starpu_job_prepare_for_continuation_ext()

void _starpu_job_prepare_for_continuation_ext ( struct _starpu_job * j,
unsigned continuation_resubmit,
void(* continuation_callback_on_sleep )(void *arg),
void * continuation_callback_on_sleep_arg )

Prepare the job for accepting new dependencies before becoming a continuation.

◆ _starpu_exclude_task_from_dag()

void _starpu_exclude_task_from_dag ( struct starpu_task * task)

Specify that the task should not appear in the DAG generated by debug tools.

◆ _starpu_enforce_deps_and_schedule()

unsigned _starpu_enforce_deps_and_schedule ( struct _starpu_job * j)

try to submit job j, enqueue it if it's not schedulable yet. The job's sync mutex is supposed to be held already

◆ _starpu_reenforce_task_deps_and_schedule()

unsigned _starpu_reenforce_task_deps_and_schedule ( struct _starpu_job * j)

When waking up a continuation, we only enforce new task dependencies

◆ _starpu_handle_job_submission()

void _starpu_handle_job_submission ( struct _starpu_job * j)

Called at the submission of the job

◆ _starpu_handle_job_termination()

void _starpu_handle_job_termination ( struct _starpu_job * j)

This function must be called after the execution of a job, this triggers all job's dependencies and perform the callback function if any.

◆ _starpu_job_get_data_size()

size_t _starpu_job_get_data_size ( struct starpu_perfmodel * model,
struct starpu_perfmodel_arch * arch,
unsigned nimpl,
struct _starpu_job * j )

Get the sum of the size of the data accessed by the job.

◆ _starpu_pop_local_task()

struct starpu_task * _starpu_pop_local_task ( struct _starpu_worker * worker)

Get a task from the local pool of tasks that were explicitly attributed to that worker.

◆ _starpu_push_local_task()

int _starpu_push_local_task ( struct _starpu_worker * worker,
struct starpu_task * task )

Put a task into the pool of tasks that are explicitly attributed to the specified worker.