Loading...
Searching...
No Matches
jobs.h
Go to the documentation of this file.
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
* Copyright (C) 2011 Télécom-SudParis
* Copyright (C) 2013 Thibaut Lambert
*
* StarPU is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at
* your option) any later version.
*
* StarPU is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU Lesser General Public License in COPYING.LGPL for more details.
*/
#ifndef __JOBS_H__
#define __JOBS_H__
#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>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#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>
#include <common/list.h>
#ifdef STARPU_USE_CUDA
#include <cuda.h>
#endif
struct _starpu_worker;
typedef void (*_starpu_cl_func_t)(void **, void *);
#define _STARPU_CPU_MAY_PERFORM(j) ((j)->task->where & STARPU_CPU)
#define _STARPU_CUDA_MAY_PERFORM(j) ((j)->task->where & STARPU_CUDA)
#define _STARPU_OPENCL_MAY_PERFORM(j) ((j)->task->where & STARPU_OPENCL)
#define _STARPU_MIC_MAY_PERFORM(j) ((j)->task->where & STARPU_MIC)
struct _starpu_data_descr
{
starpu_data_handle_t handle;
enum starpu_data_access_mode mode;
int node;
int index;
int orderedindex;
};
#ifdef STARPU_DEBUG
MULTILIST_CREATE_TYPE(_starpu_job, all_submitted)
#endif
struct _starpu_job
{
unsigned long job_id;
struct starpu_task *task;
struct _starpu_job *quick_next;
starpu_pthread_mutex_t sync_mutex;
starpu_pthread_cond_t sync_cond;
struct _starpu_data_descr ordered_buffers[STARPU_NMAXBUFS];
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;
struct _starpu_cg_list job_successors;
struct starpu_task *end_rdep;
starpu_data_handle_t implicit_dep_handle;
struct _starpu_task_wrapper_dlist implicit_dep_slot;
unsigned submitted:2;
unsigned terminated:2;
#ifdef STARPU_OPENMP
unsigned continuation;
unsigned continuation_resubmit;
void (*continuation_callback_on_sleep)(void *arg);
void *continuation_callback_on_sleep_arg;
void (*omp_cleanup_callback)(void *arg);
void *omp_cleanup_callback_arg;
unsigned discontinuous;
struct timespec cumulated_ts;
double cumulated_energy_consumed;
#endif
uint32_t footprint;
unsigned footprint_is_computed:1;
unsigned exclude_from_dag:1;
unsigned internal:1;
unsigned sequential_consistency:1;
unsigned reduction_task:1;
unsigned nimpl;
int task_size;
int combined_workerid;
int active_task_alias_count;
struct bound_task *bound_task;
starpu_pthread_barrier_t before_work_barrier;
starpu_pthread_barrier_t after_work_barrier;
unsigned after_work_busy_barrier;
struct _starpu_graph_node *graph_node;
#ifdef STARPU_DEBUG
struct _starpu_job_multilist_all_submitted all_submitted;
#endif
};
#ifdef STARPU_DEBUG
MULTILIST_CREATE_INLINES(struct _starpu_job, _starpu_job, all_submitted)
#endif
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);
#ifdef STARPU_OPENMP
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);
#endif
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);
#ifdef STARPU_OPENMP
unsigned _starpu_reenforce_task_deps_and_schedule(struct _starpu_job *j);
#endif
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, int prio);
#define _STARPU_JOB_GET_ORDERED_BUFFER_INDEX(job, i) ((job->dyn_ordered_buffers) ? job->dyn_ordered_buffers[i].index : job->ordered_buffers[i].index)
#define _STARPU_JOB_GET_ORDERED_BUFFER_HANDLE(job, i) ((job->dyn_ordered_buffers) ? job->dyn_ordered_buffers[i].handle : job->ordered_buffers[i].handle)
#define _STARPU_JOB_GET_ORDERED_BUFFER_MODE(job, i) ((job->dyn_ordered_buffers) ? job->dyn_ordered_buffers[i].mode : job->ordered_buffers[i].mode)
#define _STARPU_JOB_GET_ORDERED_BUFFER_NODE(job, i) ((job->dyn_ordered_buffers) ? job->dyn_ordered_buffers[i].node : job->ordered_buffers[i].node)
#define _STARPU_JOB_SET_ORDERED_BUFFER_INDEX(job, __index, i) do { if (job->dyn_ordered_buffers) job->dyn_ordered_buffers[i].index = (__index); else job->ordered_buffers[i].index = (__index);} while(0)
#define _STARPU_JOB_SET_ORDERED_BUFFER_HANDLE(job, __handle, i) do { if (job->dyn_ordered_buffers) job->dyn_ordered_buffers[i].handle = (__handle); else job->ordered_buffers[i].handle = (__handle);} while(0)
#define _STARPU_JOB_SET_ORDERED_BUFFER_MODE(job, __mode, i) do { if (job->dyn_ordered_buffers) job->dyn_ordered_buffers[i].mode = __mode; else job->ordered_buffers[i].mode = __mode;} while(0)
#define _STARPU_JOB_SET_ORDERED_BUFFER_NODE(job, __node, i) do { if (job->dyn_ordered_buffers) job->dyn_ordered_buffers[i].node = __node; else job->ordered_buffers[i].node = __node;} while(0)
#define _STARPU_JOB_SET_ORDERED_BUFFER(job, buffer, i) do { if (job->dyn_ordered_buffers) job->dyn_ordered_buffers[i] = buffer; else job->ordered_buffers[i] = buffer;} while(0)
#define _STARPU_JOB_GET_ORDERED_BUFFERS(job) ((job->dyn_ordered_buffers) ? job->dyn_ordered_buffers : &job->ordered_buffers[0])
#define _STARPU_JOB_GET_DEP_SLOTS(job) (((job)->dyn_dep_slots) ? (job)->dyn_dep_slots : (job)->dep_slots)
#endif // __JOBS_H__
barrier.h
_starpu_cg_list
Definition cg.h:41
_starpu_task_wrapper_dlist
Definition coherency.h:105
datawizard.h
errorcheck.h
fxt.h
_starpu_graph_node
Definition graph.h:30
_starpu_handle_job_submission
void _starpu_handle_job_submission(struct _starpu_job *j)
_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)
_starpu_test_job_termination
int _starpu_test_job_termination(struct _starpu_job *j)
_starpu_reenforce_task_deps_and_schedule
unsigned _starpu_reenforce_task_deps_and_schedule(struct _starpu_job *j)
_starpu_job_destroy
void _starpu_job_destroy(struct _starpu_job *j)
_starpu_pop_local_task
struct starpu_task * _starpu_pop_local_task(struct _starpu_worker *worker)
_starpu_job_finished
int _starpu_job_finished(struct _starpu_job *j)
_starpu_job_create
struct _starpu_job * _starpu_job_create(struct starpu_task *task) STARPU_ATTRIBUTE_MALLOC
_starpu_exclude_task_from_dag
void _starpu_exclude_task_from_dag(struct starpu_task *task)
_starpu_enforce_deps_and_schedule
unsigned _starpu_enforce_deps_and_schedule(struct _starpu_job *j)
_starpu_push_local_task
int _starpu_push_local_task(struct _starpu_worker *worker, struct starpu_task *task, int prio)
_starpu_wait_job
void _starpu_wait_job(struct _starpu_job *j)
_starpu_data_descr::index
int index
Definition jobs.h:67
_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)
_starpu_cl_func_t
void(* _starpu_cl_func_t)(void **, void *)
Definition jobs.h:53
_starpu_handle_job_termination
void _starpu_handle_job_termination(struct _starpu_job *j)
_starpu_data_descr
Definition jobs.h:61
list.h
perfmodel.h
_starpu_job
Definition jobs.h:79
_starpu_job::end_rdep
struct starpu_task * end_rdep
Definition jobs.h:114
_starpu_job::job_successors
struct _starpu_cg_list job_successors
Definition jobs.h:111
_starpu_job::cumulated_energy_consumed
double cumulated_energy_consumed
Definition jobs.h:164
_starpu_job::continuation_callback_on_sleep
void(* continuation_callback_on_sleep)(void *arg)
Definition jobs.h:151
_starpu_job::footprint
uint32_t footprint
Definition jobs.h:169
_starpu_job::before_work_barrier
starpu_pthread_barrier_t before_work_barrier
Definition jobs.h:204
_starpu_job::cumulated_ts
struct timespec cumulated_ts
Definition jobs.h:161
_starpu_job::combined_workerid
int combined_workerid
Definition jobs.h:195
_starpu_job::submitted
unsigned submitted
Definition jobs.h:128
_starpu_job::nimpl
unsigned nimpl
Definition jobs.h:188
_starpu_job::continuation_resubmit
unsigned continuation_resubmit
Definition jobs.h:144
_starpu_job::ordered_buffers
struct _starpu_data_descr ordered_buffers[STARPU_NMAXBUFS]
Definition jobs.h:100
_starpu_job::terminated
unsigned terminated
Definition jobs.h:135
_starpu_job::reduction_task
unsigned reduction_task
Definition jobs.h:185
_starpu_job::quick_next
struct _starpu_job * quick_next
Definition jobs.h:90
_starpu_job::job_id
unsigned long job_id
Definition jobs.h:81
_starpu_job::tag
struct _starpu_tag * tag
Definition jobs.h:107
_starpu_job::sync_mutex
starpu_pthread_mutex_t sync_mutex
Definition jobs.h:94
_starpu_job::exclude_from_dag
unsigned exclude_from_dag
Definition jobs.h:174
_starpu_job::implicit_dep_handle
starpu_data_handle_t implicit_dep_handle
Definition jobs.h:119
_starpu_job::active_task_alias_count
int active_task_alias_count
Definition jobs.h:199
_starpu_job::sequential_consistency
unsigned sequential_consistency
Definition jobs.h:179
_starpu_job::internal
unsigned internal
Definition jobs.h:177
_starpu_job::task
struct starpu_task * task
Definition jobs.h:84
_starpu_job::task_size
int task_size
Definition jobs.h:192
_starpu_job::discontinuous
unsigned discontinuous
Definition jobs.h:158
_starpu_job::continuation
unsigned continuation
Definition jobs.h:139
_starpu_worker
Definition workers.h:70
tags.h
_starpu_tag
Definition tags.h:49
timing.h
utils.h