cg.h
Go to the documentation of this file.
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2010-2020 Université de 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 __CG_H__
#define __CG_H__
#include <starpu.h>
#include <common/config.h>
#define STARPU_DYNAMIC_DEPS_SIZE 1
/* randomly choosen ! */
#ifndef STARPU_DYNAMIC_DEPS_SIZE
#define STARPU_NMAXDEPS 256
#endif
struct _starpu_job;
struct _starpu_cg_list
{
struct _starpu_spinlock lock;
unsigned ndeps; /* how many deps ? */
unsigned ndeps_completed; /* how many deps are done ? */
#ifdef STARPU_DEBUG
struct _starpu_cg **deps;
char *done;
#endif
unsigned terminated;
unsigned nsuccs; /* how many successors ? */
#ifdef STARPU_DYNAMIC_DEPS_SIZE
unsigned succ_list_size;
struct _starpu_cg **succ;
#else
struct _starpu_cg *succ[STARPU_NMAXDEPS];
#endif
};
enum _starpu_cg_type
{
STARPU_CG_APPS=(1<<0),
STARPU_CG_TAG=(1<<1),
STARPU_CG_TASK=(1<<2)
};
struct _starpu_cg
{
unsigned ntags;
unsigned remaining;
#ifdef STARPU_DEBUG
unsigned ndeps;
void **deps;
char *done;
#endif
enum _starpu_cg_type cg_type;
union
{
struct _starpu_tag *tag;
struct _starpu_job *job;
struct
{
unsigned completed;
starpu_pthread_mutex_t cg_mutex;
starpu_pthread_cond_t cg_cond;
} succ_apps;
} succ;
};
typedef struct _starpu_notify_job_start_data _starpu_notify_job_start_data;
void _starpu_notify_dependencies(struct _starpu_job *j);
void _starpu_job_notify_start(struct _starpu_job *j, struct starpu_perfmodel_arch* perf_arch);
void _starpu_job_notify_ready_soon(struct _starpu_job *j, _starpu_notify_job_start_data *data);
void _starpu_cg_list_init(struct _starpu_cg_list *list);
void _starpu_cg_list_deinit(struct _starpu_cg_list *list);
int _starpu_add_successor_to_cg_list(struct _starpu_cg_list *successors, struct _starpu_cg *cg);
int _starpu_list_task_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, struct starpu_task *task_array[]);
int _starpu_list_task_scheduled_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, struct starpu_task *task_array[]);
int _starpu_list_tag_successors_in_cg_list(struct _starpu_cg_list *successors, unsigned ndeps, starpu_tag_t tag_array[]);
void _starpu_notify_cg(void *pred, struct _starpu_cg *cg);
void _starpu_notify_cg_list(void *pred, struct _starpu_cg_list *successors);
void _starpu_notify_job_start_cg_list(void *pred, struct _starpu_cg_list *successors, _starpu_notify_job_start_data *data);
void _starpu_notify_task_dependencies(struct _starpu_job *j);
void _starpu_notify_job_start_tasks(struct _starpu_job *j, _starpu_notify_job_start_data *data);
#endif // __CG_H__
_starpu_cg::ntags
unsigned ntags
Definition: cg.h:82
_starpu_cg_list::nsuccs
unsigned nsuccs
Definition: cg.h:61
_starpu_cg_list::lock
struct _starpu_spinlock lock
Definition: cg.h:43
_starpu_cg::remaining
unsigned remaining
Definition: cg.h:84
_starpu_cg_list::succ_list_size
unsigned succ_list_size
Definition: cg.h:64
_starpu_cg_list::terminated
unsigned terminated
Definition: cg.h:58
_starpu_cg_list::ndeps
unsigned ndeps
Definition: cg.h:46
_starpu_cg
Definition: cg.h:80
_starpu_cg_list
Definition: cg.h:41
_starpu_spinlock
Definition: starpu_spinlock.h:82
_starpu_job
Definition: jobs.h:79
_starpu_tag
Definition: tags.h:49