Loading...
Searching...
No Matches
task.h
Go to the documentation of this file.
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2009-2025 University of Bordeaux, CNRS (LaBRI UMR 5800), Inria
*
* 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 __CORE_TASK_H__
#define __CORE_TASK_H__
#include <starpu.h>
#include <common/config.h>
#include <core/jobs.h>
#include <common/starpu_spinlock.h>
#pragma GCC visibility push(hidden)
void _starpu_task_destroy(struct starpu_task *task);
#ifdef STARPU_OPENMP
int _starpu_task_test_termination(struct starpu_task *task);
#endif
void _starpu_task_init(void);
void _starpu_task_deinit(void);
void _starpu_set_current_task(struct starpu_task *task);
int _starpu_submit_job(struct _starpu_job *j, int nodeps);
void _starpu_task_declare_deps_array(struct starpu_task *task, unsigned ndeps, struct starpu_task *task_array[], int check);
#define _STARPU_JOB_UNSET ((struct _starpu_job *) NULL)
#define _STARPU_JOB_SETTING ((struct _starpu_job *) 1)
struct _starpu_job *_starpu_get_job_associated_to_task_slow(struct starpu_task *task, struct _starpu_job *job);
static inline struct _starpu_job *_starpu_get_job_associated_to_task(struct starpu_task *task)
{
STARPU_ASSERT(task);
struct _starpu_job *job = *(struct _starpu_job * volatile *) &task->starpu_private;
if (STARPU_LIKELY(job != _STARPU_JOB_UNSET && job != _STARPU_JOB_SETTING))
{
/* Already available */
STARPU_RMB();
return job;
}
return _starpu_get_job_associated_to_task_slow(task, job);
}
int _starpu_task_submit_internally(struct starpu_task *task);
int _starpu_handle_needs_conversion_task(starpu_data_handle_t handle,
unsigned int node);
int
_starpu_handle_needs_conversion_task_for_arch(starpu_data_handle_t handle,
enum starpu_node_kind node_kind);
#ifdef STARPU_OPENMP
void _starpu_task_prepare_for_continuation_ext(unsigned continuation_resubmit,
void (*continuation_callback_on_sleep)(void *arg), void *continuation_callback_on_sleep_arg);
void _starpu_task_prepare_for_continuation(void);
void _starpu_task_set_omp_cleanup_callback(struct starpu_task *task, void (*omp_cleanup_callback)(void *arg),
void *omp_cleanup_callback_arg);
#endif
int _starpu_task_uses_multiformat_handles(struct starpu_task *task);
int _starpu_task_submit_conversion_task(struct starpu_task *task,
unsigned int workerid);
void _starpu_task_check_deprecated_fields(struct starpu_task *task);
void _starpu_codelet_check_deprecated_fields(struct starpu_codelet *cl);
static inline starpu_cpu_func_t _starpu_task_get_cpu_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)
{
return cl->cpu_funcs[nimpl];
}
static inline starpu_cuda_func_t _starpu_task_get_cuda_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)
{
return cl->cuda_funcs[nimpl];
}
static inline starpu_hip_func_t _starpu_task_get_hip_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)
{
return cl->hip_funcs[nimpl];
}
static inline starpu_opencl_func_t _starpu_task_get_opencl_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)
{
return cl->opencl_funcs[nimpl];
}
static inline starpu_max_fpga_func_t _starpu_task_get_fpga_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)
{
return cl->max_fpga_funcs[nimpl];
}
static inline const char *_starpu_task_get_cpu_name_nth_implementation(struct starpu_codelet *cl, unsigned nimpl)
{
return cl->cpu_funcs_name[nimpl];
}
#define _STARPU_TASK_SET_INTERFACE(task, interface, i) do { if (task->dyn_handles) task->dyn_interfaces[i] = interface; else task->interfaces[i] = interface;} while(0)
#define _STARPU_TASK_GET_INTERFACES(task) ((task->dyn_handles) ? task->dyn_interfaces : task->interfaces)
void _starpu_watchdog_init(void);
void _starpu_watchdog_shutdown(void);
int _starpu_task_wait_for_all_and_return_nb_waited_tasks(void);
int _starpu_task_wait_for_all_in_ctx_and_return_nb_waited_tasks(unsigned sched_ctx);
#pragma GCC visibility pop
#ifdef BUILDING_STARPU
LIST_CREATE_TYPE_NOSTRUCT(starpu_task, prev, next);
PRIO_LIST_CREATE_TYPE(starpu_task, priority);
#endif
enum _starpu_trs_state
{
_starpu_trs_uninitialized = 0,
_starpu_trs_initialized = 1,
};
enum _starpu_trs_epoch_state
{
_starpu_trs_epoch_uninitialized = 0,
_starpu_trs_epoch_inactive = 1,
_starpu_trs_epoch_confirmed = 2,
_starpu_trs_epoch_cancelled = 3,
_starpu_trs_epoch_terminated = 4,
};
LIST_TYPE(_starpu_trs_epoch,
enum _starpu_trs_epoch_state state;
int do_sync;
int is_begin;
int is_end;
void *do_start_arg;
);
struct starpu_transaction
{
struct _starpu_spinlock lock;
struct _starpu_trs_epoch_list epoch_list;
starpu_data_handle_t handle;
int dummy_data;
int (*do_start_func)(void *buffer, void* arg);
enum _starpu_trs_state state;
int flags;
};
#endif // __CORE_TASK_H__
starpu_node_kind
starpu_node_kind
Definition starpu_worker.h:44
jobs.h
_starpu_job::workerid
int workerid
Definition jobs.h:191
_starpu_job::continuation_callback_on_sleep
void(* continuation_callback_on_sleep)(void *arg)
Definition jobs.h:147
_starpu_job::nimpl
unsigned nimpl
Definition jobs.h:184
_starpu_job::continuation_resubmit
unsigned continuation_resubmit
Definition jobs.h:140
_starpu_job::task
struct starpu_task * task
Definition jobs.h:80
_starpu_job
Definition jobs.h:75
LIST_CREATE_TYPE_NOSTRUCT
#define LIST_CREATE_TYPE_NOSTRUCT(ENAME, _prev, _next)
Definition list.h:190
starpu_spinlock.h
_starpu_spinlock
Definition starpu_spinlock.h:82
starpu_transaction::dummy_data
int dummy_data
Definition task.h:197
_starpu_task_prepare_for_continuation_ext
void _starpu_task_prepare_for_continuation_ext(unsigned continuation_resubmit, void(*continuation_callback_on_sleep)(void *arg), void *continuation_callback_on_sleep_arg)
_starpu_task_init
void _starpu_task_init(void)
_starpu_trs_epoch_state
_starpu_trs_epoch_state
Definition task.h:153
_starpu_trs_epoch_terminated
@ _starpu_trs_epoch_terminated
Definition task.h:166
_starpu_trs_epoch_confirmed
@ _starpu_trs_epoch_confirmed
Definition task.h:160
_starpu_trs_epoch_cancelled
@ _starpu_trs_epoch_cancelled
Definition task.h:163
_starpu_trs_epoch_inactive
@ _starpu_trs_epoch_inactive
Definition task.h:157
_starpu_trs_epoch::is_begin
int is_begin
Definition task.h:177
starpu_transaction::do_start_func
int(* do_start_func)(void *buffer, void *arg)
Definition task.h:201
_starpu_task_test_termination
int _starpu_task_test_termination(struct starpu_task *task)
starpu_transaction::lock
struct _starpu_spinlock lock
Definition task.h:190
_starpu_task_destroy
void _starpu_task_destroy(struct starpu_task *task)
_starpu_trs_epoch::do_start_arg
void * do_start_arg
Definition task.h:184
_starpu_trs_epoch::is_end
int is_end
Definition task.h:180
_starpu_trs_epoch::do_sync
int do_sync
Definition task.h:174
starpu_transaction::flags
int flags
Definition task.h:205
_starpu_trs_state
_starpu_trs_state
Definition task.h:146
_starpu_get_job_associated_to_task_slow
struct _starpu_job * _starpu_get_job_associated_to_task_slow(struct starpu_task *task, struct _starpu_job *job)
starpu_transaction::handle
starpu_data_handle_t handle
Definition task.h:194
_starpu_task_submit_internally
int _starpu_task_submit_internally(struct starpu_task *task)
_starpu_trs_epoch
Definition task.h:169
starpu_transaction
Definition task.h:188