Loading...
Searching...
No Matches
starpu_worker.h
Go to the documentation of this file.
/* StarPU --- Runtime system for heterogeneous multicore architectures.
*
* Copyright (C) 2009-2022 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
* Copyright (C) 2013 Thibaut Lambert
* Copyright (C) 2016 Uppsala University
*
* 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 __STARPU_WORKER_H__
#define __STARPU_WORKER_H__
#include <stdlib.h>
#include <starpu_config.h>
#include <starpu_thread.h>
#include <starpu_task.h>
#ifdef STARPU_HAVE_HWLOC
#include <hwloc.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
enum starpu_node_kind
{
STARPU_UNUSED=0,
STARPU_CPU_RAM=1,
STARPU_CUDA_RAM=2,
STARPU_OPENCL_RAM=3,
STARPU_DISK_RAM=4,
STARPU_MIC_RAM=5,
STARPU_MPI_MS_RAM=6
};
enum starpu_worker_archtype
{
STARPU_CPU_WORKER=0,
STARPU_CUDA_WORKER=1,
STARPU_OPENCL_WORKER=2,
STARPU_MIC_WORKER=3,
STARPU_MPI_MS_WORKER=5,
STARPU_ANY_WORKER=6
};
struct starpu_sched_ctx_iterator
{
int cursor;
void *value;
void *possible_value;
char visited[STARPU_NMAXWORKERS];
int possibly_parallel;
};
enum starpu_worker_collection_type
{
STARPU_WORKER_TREE,
STARPU_WORKER_LIST
};
struct starpu_worker_collection
{
int *workerids;
void *collection_private;
unsigned nworkers;
void *unblocked_workers;
unsigned nunblocked_workers;
void *masters;
unsigned nmasters;
char present[STARPU_NMAXWORKERS];
char is_unblocked[STARPU_NMAXWORKERS];
char is_master[STARPU_NMAXWORKERS];
enum starpu_worker_collection_type type;
unsigned (*has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
int (*get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
int (*add)(struct starpu_worker_collection *workers, int worker);
int (*remove)(struct starpu_worker_collection *workers, int worker);
void (*init)(struct starpu_worker_collection *workers);
void (*deinit)(struct starpu_worker_collection *workers);
void (*init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
void (*init_iterator_for_parallel_tasks)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it, struct starpu_task *task);
};
extern struct starpu_worker_collection starpu_worker_list;
extern struct starpu_worker_collection starpu_worker_tree;
unsigned starpu_worker_get_count(void);
unsigned starpu_cpu_worker_get_count(void);
unsigned starpu_cuda_worker_get_count(void);
unsigned starpu_opencl_worker_get_count(void);
unsigned starpu_mic_worker_get_count(void);
unsigned starpu_mpi_ms_worker_get_count(void);
unsigned starpu_mic_device_get_count(void);
int starpu_worker_get_id(void);
unsigned _starpu_worker_get_id_check(const char *f, int l);
unsigned starpu_worker_get_id_check(void);
#define starpu_worker_get_id_check() _starpu_worker_get_id_check(__FILE__, __LINE__)
int starpu_worker_get_bindid(int workerid);
void starpu_sched_find_all_worker_combinations(void);
enum starpu_worker_archtype starpu_worker_get_type(int id);
int starpu_worker_get_count_by_type(enum starpu_worker_archtype type);
unsigned starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, unsigned maxsize);
int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num);
int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid);
void starpu_worker_get_name(int id, char *dst, size_t maxlen);
void starpu_worker_display_names(FILE *output, enum starpu_worker_archtype type);
int starpu_worker_get_devid(int id);
int starpu_worker_get_mp_nodeid(int id);
struct starpu_tree* starpu_workers_get_tree(void);
unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx);
void starpu_worker_get_current_task_exp_end(unsigned workerid, struct timespec *date);
unsigned starpu_worker_is_blocked_in_parallel(int workerid);
unsigned starpu_worker_is_slave_somewhere(int workerid);
char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type);
int starpu_bindid_get_workerids(int bindid, int **workerids);
int starpu_worker_get_devids(enum starpu_worker_archtype type, int *devids, int num);
int starpu_worker_get_stream_workerids(unsigned devid, int *workerids, enum starpu_worker_archtype type);
unsigned starpu_worker_get_sched_ctx_id_stream(unsigned stream_workerid);
#ifdef STARPU_HAVE_HWLOC
hwloc_cpuset_t starpu_worker_get_hwloc_cpuset(int workerid);
hwloc_obj_t starpu_worker_get_hwloc_obj(int workerid);
#endif
int starpu_memory_node_get_devid(unsigned node);
unsigned starpu_worker_get_local_memory_node(void);
unsigned starpu_worker_get_memory_node(unsigned workerid);
unsigned starpu_memory_nodes_get_count(void);
int starpu_memory_node_get_name(unsigned node, char *name, size_t size);
int starpu_memory_nodes_get_numa_count(void);
int starpu_memory_nodes_numa_id_to_devid(int osid);
int starpu_memory_nodes_numa_devid_to_id(unsigned id);
enum starpu_node_kind starpu_node_get_kind(unsigned node);
int starpu_worker_sched_op_pending(void);
void starpu_worker_relax_on(void);
void starpu_worker_relax_off(void);
int starpu_worker_get_relax_state(void);
void starpu_worker_lock(int workerid);
int starpu_worker_trylock(int workerid);
void starpu_worker_unlock(int workerid);
void starpu_worker_lock_self(void);
void starpu_worker_unlock_self(void);
#ifdef STARPU_WORKER_CALLBACKS
void starpu_worker_set_going_to_sleep_callback(void (*callback)(unsigned workerid));
void starpu_worker_set_waking_up_callback(void (*callback)(unsigned workerid));
#endif
unsigned starpu_combined_worker_get_count(void);
unsigned starpu_worker_is_combined_worker(int id);
int starpu_combined_worker_get_id(void);
int starpu_combined_worker_get_size(void);
int starpu_combined_worker_get_rank(void);
int starpu_combined_worker_assign_workerid(int nworkers, int workerid_array[]);
int starpu_combined_worker_get_description(int workerid, int *worker_size, int **combined_workerid);
int starpu_combined_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
void starpu_parallel_task_barrier_init(struct starpu_task *task, int workerid);
void starpu_parallel_task_barrier_init_n(struct starpu_task *task, int worker_size);
#ifdef __cplusplus
}
#endif
#endif /* __STARPU_WORKER_H__ */
starpu_task
Definition starpu_task.h:567
starpu_combined_worker_assign_workerid
int starpu_combined_worker_assign_workerid(int nworkers, int workerid_array[])
starpu_parallel_task_barrier_init
void starpu_parallel_task_barrier_init(struct starpu_task *task, int workerid)
starpu_combined_worker_get_count
unsigned starpu_combined_worker_get_count(void)
starpu_combined_worker_get_rank
int starpu_combined_worker_get_rank(void)
starpu_combined_worker_get_size
int starpu_combined_worker_get_size(void)
starpu_combined_worker_get_description
int starpu_combined_worker_get_description(int workerid, int *worker_size, int **combined_workerid)
starpu_combined_worker_can_execute_task
int starpu_combined_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl)
starpu_combined_worker_get_id
int starpu_combined_worker_get_id(void)
starpu_parallel_task_barrier_init_n
void starpu_parallel_task_barrier_init_n(struct starpu_task *task, int worker_size)
starpu_tree
Definition starpu_tree.h:32
starpu_worker_collection::workerids
int * workerids
Definition starpu_worker.h:109
starpu_worker_collection::nworkers
unsigned nworkers
Definition starpu_worker.h:114
starpu_worker_collection::remove
int(* remove)(struct starpu_worker_collection *workers, int worker)
Definition starpu_worker.h:141
starpu_worker_collection::deinit
void(* deinit)(struct starpu_worker_collection *workers)
Definition starpu_worker.h:149
starpu_sched_ctx_iterator::cursor
int cursor
Definition starpu_worker.h:81
starpu_worker_collection::has_next
unsigned(* has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition starpu_worker.h:129
starpu_worker_collection::get_next
int(* get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition starpu_worker.h:133
starpu_worker_collection::type
enum starpu_worker_collection_type type
Definition starpu_worker.h:125
starpu_worker_collection::init
void(* init)(struct starpu_worker_collection *workers)
Definition starpu_worker.h:145
starpu_worker_collection::add
int(* add)(struct starpu_worker_collection *workers, int worker)
Definition starpu_worker.h:137
starpu_worker_collection::init_iterator
void(* init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition starpu_worker.h:153
starpu_worker_get_devid
int starpu_worker_get_devid(int id)
starpu_opencl_worker_get_count
unsigned starpu_opencl_worker_get_count(void)
starpu_worker_lock
void starpu_worker_lock(int workerid)
starpu_worker_archtype
starpu_worker_archtype
Definition starpu_worker.h:63
starpu_worker_get_id_check
#define starpu_worker_get_id_check()
Definition starpu_worker.h:219
starpu_memory_nodes_numa_id_to_devid
int starpu_memory_nodes_numa_id_to_devid(int osid)
starpu_memory_nodes_get_numa_count
int starpu_memory_nodes_get_numa_count(void)
starpu_worker_get_relax_state
int starpu_worker_get_relax_state(void)
starpu_worker_trylock
int starpu_worker_trylock(int workerid)
starpu_worker_get_hwloc_obj
hwloc_obj_t starpu_worker_get_hwloc_obj(int workerid)
starpu_worker_unlock
void starpu_worker_unlock(int workerid)
starpu_worker_display_names
void starpu_worker_display_names(FILE *output, enum starpu_worker_archtype type)
starpu_worker_get_current_task_exp_end
void starpu_worker_get_current_task_exp_end(unsigned workerid, struct timespec *date)
starpu_worker_sched_op_pending
int starpu_worker_sched_op_pending(void)
starpu_worker_get_local_memory_node
unsigned starpu_worker_get_local_memory_node(void)
starpu_worker_get_type
enum starpu_worker_archtype starpu_worker_get_type(int id)
starpu_memory_nodes_get_count
unsigned starpu_memory_nodes_get_count(void)
starpu_memory_nodes_numa_devid_to_id
int starpu_memory_nodes_numa_devid_to_id(unsigned id)
starpu_worker_get_count_by_type
int starpu_worker_get_count_by_type(enum starpu_worker_archtype type)
starpu_worker_get_count
unsigned starpu_worker_get_count(void)
starpu_node_kind
starpu_node_kind
Definition starpu_worker.h:45
starpu_worker_unlock_self
void starpu_worker_unlock_self(void)
starpu_worker_get_memory_node
unsigned starpu_worker_get_memory_node(unsigned workerid)
starpu_worker_collection_type
starpu_worker_collection_type
Definition starpu_worker.h:92
starpu_mic_device_get_count
unsigned starpu_mic_device_get_count(void)
starpu_cpu_worker_get_count
unsigned starpu_cpu_worker_get_count(void)
starpu_worker_lock_self
void starpu_worker_lock_self(void)
starpu_node_get_kind
enum starpu_node_kind starpu_node_get_kind(unsigned node)
starpu_mic_worker_get_count
unsigned starpu_mic_worker_get_count(void)
starpu_mpi_ms_worker_get_count
unsigned starpu_mpi_ms_worker_get_count(void)
starpu_worker_get_by_type
int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num)
starpu_worker_relax_off
void starpu_worker_relax_off(void)
starpu_worker_get_type_as_string
char * starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
starpu_worker_get_id
int starpu_worker_get_id(void)
starpu_cuda_worker_get_count
unsigned starpu_cuda_worker_get_count(void)
starpu_worker_set_waking_up_callback
void starpu_worker_set_waking_up_callback(void(*callback)(unsigned workerid))
starpu_worker_relax_on
void starpu_worker_relax_on(void)
STARPU_NMAXWORKERS
#define STARPU_NMAXWORKERS
Definition starpu_config.h:236
starpu_worker_get_ids_by_type
unsigned starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, unsigned maxsize)
starpu_worker_set_going_to_sleep_callback
void starpu_worker_set_going_to_sleep_callback(void(*callback)(unsigned workerid))
starpu_worker_get_name
void starpu_worker_get_name(int id, char *dst, size_t maxlen)
starpu_worker_get_by_devid
int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
starpu_memory_node_get_name
int starpu_memory_node_get_name(unsigned node, char *name, size_t size)
starpu_worker_get_hwloc_cpuset
hwloc_cpuset_t starpu_worker_get_hwloc_cpuset(int workerid)
STARPU_CUDA_WORKER
@ STARPU_CUDA_WORKER
Definition starpu_worker.h:65
STARPU_MIC_WORKER
@ STARPU_MIC_WORKER
Definition starpu_worker.h:67
STARPU_MPI_MS_WORKER
@ STARPU_MPI_MS_WORKER
Definition starpu_worker.h:68
STARPU_CPU_WORKER
@ STARPU_CPU_WORKER
Definition starpu_worker.h:64
STARPU_OPENCL_WORKER
@ STARPU_OPENCL_WORKER
Definition starpu_worker.h:66
STARPU_ANY_WORKER
@ STARPU_ANY_WORKER
Definition starpu_worker.h:69
STARPU_WORKER_TREE
@ STARPU_WORKER_TREE
Definition starpu_worker.h:93
STARPU_WORKER_LIST
@ STARPU_WORKER_LIST
Definition starpu_worker.h:94
starpu_sched_ctx_iterator
Definition starpu_worker.h:76
starpu_worker_collection
Definition starpu_worker.h:105
starpu_config.h
starpu_task.h
starpu_thread.h