Loading...
Searching...
No Matches
starpu_worker.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
* Copyright (C) 2016-2016 Uppsala University
* Copyright (C) 2013-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 __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_MAX_FPGA_RAM = 4,
STARPU_DISK_RAM = 5,
STARPU_MPI_MS_RAM = 6,
STARPU_TCPIP_MS_RAM = 7,
STARPU_HIP_RAM = 8,
STARPU_MAX_RAM = 8,
STARPU_NRAM = 9,
};
enum starpu_worker_archtype
{
STARPU_CPU_WORKER = 0,
STARPU_CUDA_WORKER = 1,
STARPU_OPENCL_WORKER = 2,
STARPU_MAX_FPGA_WORKER = 4,
STARPU_MPI_MS_WORKER = 5,
STARPU_TCPIP_MS_WORKER = 6,
STARPU_HIP_WORKER = 7,
STARPU_NARCH = 8,
STARPU_ANY_WORKER = 255
};
#define STARPU_UNKNOWN_WORKER ((enum starpu_worker_archtype)-1)
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;
void starpu_worker_wait_for_initialisation(void);
unsigned starpu_worker_archtype_is_valid(enum starpu_worker_archtype type);
enum starpu_worker_archtype starpu_arch_mask_to_worker_archtype(unsigned mask);
unsigned starpu_worker_get_count(void);
unsigned starpu_cpu_worker_get_count(void);
unsigned starpu_cuda_worker_get_count(void);
unsigned starpu_hip_worker_get_count(void);
unsigned starpu_opencl_worker_get_count(void);
unsigned starpu_mpi_ms_worker_get_count(void);
unsigned starpu_tcpip_ms_worker_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);
unsigned starpu_worker_type_can_execute_task(enum starpu_worker_archtype worker_type, const struct starpu_task *task);
void starpu_worker_get_name(int id, char *dst, size_t maxlen);
void starpu_worker_display_all(FILE *output);
void starpu_worker_display_names(FILE *output, enum starpu_worker_archtype type);
void starpu_worker_display_count(FILE *output, enum starpu_worker_archtype type);
int starpu_worker_get_devid(int id);
int starpu_worker_get_devnum(int id);
int starpu_worker_get_subworkerid(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);
const char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type);
enum starpu_worker_archtype starpu_worker_get_type_from_string(const char *type);
const char *starpu_worker_get_type_as_env_var(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);
#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);
unsigned starpu_memory_nodes_get_count_by_kind(enum starpu_node_kind kind);
unsigned starpu_memory_node_get_ids_by_type(enum starpu_node_kind kind, unsigned *memory_nodes_ids, unsigned maxsize);
int starpu_memory_node_get_name(unsigned node, char *name, size_t size);
unsigned 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);
enum starpu_worker_archtype starpu_memory_node_get_worker_archtype(enum starpu_node_kind node_kind);
enum starpu_node_kind starpu_worker_get_memory_node_kind(enum starpu_worker_archtype type);
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:689
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_worker_is_combined_worker
unsigned starpu_worker_is_combined_worker(int id)
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:34
starpu_worker_collection::workerids
int * workerids
Definition starpu_worker.h:117
starpu_worker_collection::nworkers
unsigned nworkers
Definition starpu_worker.h:122
starpu_worker_collection::remove
int(* remove)(struct starpu_worker_collection *workers, int worker)
Definition starpu_worker.h:149
starpu_worker_collection::deinit
void(* deinit)(struct starpu_worker_collection *workers)
Definition starpu_worker.h:157
starpu_sched_ctx_iterator::cursor
int cursor
Definition starpu_worker.h:89
starpu_worker_collection::has_next
unsigned(* has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition starpu_worker.h:137
starpu_worker_collection::get_next
int(* get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition starpu_worker.h:141
starpu_worker_collection::type
enum starpu_worker_collection_type type
Definition starpu_worker.h:133
starpu_worker_collection::init
void(* init)(struct starpu_worker_collection *workers)
Definition starpu_worker.h:153
starpu_worker_collection::add
int(* add)(struct starpu_worker_collection *workers, int worker)
Definition starpu_worker.h:145
starpu_worker_collection::init_iterator
void(* init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition starpu_worker.h:161
starpu_worker_get_devids
int starpu_worker_get_devids(enum starpu_worker_archtype type, int *devids, int num)
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_memory_node_get_devid
int starpu_memory_node_get_devid(unsigned node)
starpu_worker_get_type_from_string
enum starpu_worker_archtype starpu_worker_get_type_from_string(const char *type)
starpu_worker_archtype
starpu_worker_archtype
Definition starpu_worker.h:66
starpu_worker_get_id_check
#define starpu_worker_get_id_check()
Definition starpu_worker.h:257
starpu_hip_worker_get_count
unsigned starpu_hip_worker_get_count(void)
starpu_sched_find_all_worker_combinations
void starpu_sched_find_all_worker_combinations(void)
starpu_memory_nodes_get_count_by_kind
unsigned starpu_memory_nodes_get_count_by_kind(enum starpu_node_kind kind)
starpu_memory_nodes_numa_id_to_devid
int starpu_memory_nodes_numa_id_to_devid(int osid)
starpu_worker_display_all
void starpu_worker_display_all(FILE *output)
starpu_arch_mask_to_worker_archtype
enum starpu_worker_archtype starpu_arch_mask_to_worker_archtype(unsigned mask)
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_bindid_get_workerids
int starpu_bindid_get_workerids(int bindid, int **workerids)
starpu_worker_display_names
void starpu_worker_display_names(FILE *output, enum starpu_worker_archtype type)
starpu_worker_get_bindid
int starpu_worker_get_bindid(int workerid)
starpu_worker_get_current_task_exp_end
void starpu_worker_get_current_task_exp_end(unsigned workerid, struct timespec *date)
starpu_worker_get_sched_ctx_list
unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx)
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_worker_get_stream_workerids
int starpu_worker_get_stream_workerids(unsigned devid, int *workerids, enum starpu_worker_archtype type)
starpu_memory_nodes_numa_devid_to_id
int starpu_memory_nodes_numa_devid_to_id(unsigned id)
starpu_workers_get_tree
struct starpu_tree * starpu_workers_get_tree(void)
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_worker_wait_for_initialisation
void starpu_worker_wait_for_initialisation(void)
starpu_node_kind
starpu_node_kind
Definition starpu_worker.h:44
starpu_worker_unlock_self
void starpu_worker_unlock_self(void)
starpu_worker_display_count
void starpu_worker_display_count(FILE *output, enum starpu_worker_archtype type)
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:100
starpu_memory_node_get_ids_by_type
unsigned starpu_memory_node_get_ids_by_type(enum starpu_node_kind kind, unsigned *memory_nodes_ids, unsigned maxsize)
starpu_worker_is_slave_somewhere
unsigned starpu_worker_is_slave_somewhere(int workerid)
starpu_cpu_worker_get_count
unsigned starpu_cpu_worker_get_count(void)
starpu_worker_lock_self
void starpu_worker_lock_self(void)
starpu_worker_type_can_execute_task
unsigned starpu_worker_type_can_execute_task(enum starpu_worker_archtype worker_type, const struct starpu_task *task)
starpu_worker_get_devnum
int starpu_worker_get_devnum(int id)
starpu_node_get_kind
enum starpu_node_kind starpu_node_get_kind(unsigned node)
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_archtype_is_valid
unsigned starpu_worker_archtype_is_valid(enum starpu_worker_archtype type)
starpu_worker_relax_off
void starpu_worker_relax_off(void)
starpu_memory_node_get_worker_archtype
enum starpu_worker_archtype starpu_memory_node_get_worker_archtype(enum starpu_node_kind node_kind)
starpu_memory_nodes_get_numa_count
unsigned starpu_memory_nodes_get_numa_count(void)
starpu_worker_is_blocked_in_parallel
unsigned starpu_worker_is_blocked_in_parallel(int workerid)
starpu_worker_get_id
int starpu_worker_get_id(void)
starpu_cuda_worker_get_count
unsigned starpu_cuda_worker_get_count(void)
starpu_worker_get_memory_node_kind
enum starpu_node_kind starpu_worker_get_memory_node_kind(enum starpu_worker_archtype type)
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_worker_get_subworkerid
int starpu_worker_get_subworkerid(int id)
STARPU_NMAXWORKERS
#define STARPU_NMAXWORKERS
Definition starpu_config.h:305
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_type_as_env_var
const char * starpu_worker_get_type_as_env_var(enum starpu_worker_archtype type)
starpu_worker_get_by_devid
int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
starpu_tcpip_ms_worker_get_count
unsigned starpu_tcpip_ms_worker_get_count(void)
starpu_memory_node_get_name
int starpu_memory_node_get_name(unsigned node, char *name, size_t size)
starpu_worker_get_type_as_string
const char * starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
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:68
STARPU_MPI_MS_WORKER
@ STARPU_MPI_MS_WORKER
Definition starpu_worker.h:71
STARPU_HIP_WORKER
@ STARPU_HIP_WORKER
Definition starpu_worker.h:73
STARPU_CPU_WORKER
@ STARPU_CPU_WORKER
Definition starpu_worker.h:67
STARPU_MAX_FPGA_WORKER
@ STARPU_MAX_FPGA_WORKER
Definition starpu_worker.h:70
STARPU_OPENCL_WORKER
@ STARPU_OPENCL_WORKER
Definition starpu_worker.h:69
STARPU_ANY_WORKER
@ STARPU_ANY_WORKER
Definition starpu_worker.h:75
STARPU_NARCH
@ STARPU_NARCH
Definition starpu_worker.h:74
STARPU_TCPIP_MS_WORKER
@ STARPU_TCPIP_MS_WORKER
Definition starpu_worker.h:72
STARPU_MAX_RAM
@ STARPU_MAX_RAM
Definition starpu_worker.h:54
STARPU_HIP_RAM
@ STARPU_HIP_RAM
Definition starpu_worker.h:53
STARPU_TCPIP_MS_RAM
@ STARPU_TCPIP_MS_RAM
Definition starpu_worker.h:52
STARPU_MAX_FPGA_RAM
@ STARPU_MAX_FPGA_RAM
Definition starpu_worker.h:49
STARPU_CUDA_RAM
@ STARPU_CUDA_RAM
Definition starpu_worker.h:47
STARPU_DISK_RAM
@ STARPU_DISK_RAM
Definition starpu_worker.h:50
STARPU_MPI_MS_RAM
@ STARPU_MPI_MS_RAM
Definition starpu_worker.h:51
STARPU_NRAM
@ STARPU_NRAM
Definition starpu_worker.h:55
STARPU_CPU_RAM
@ STARPU_CPU_RAM
Definition starpu_worker.h:46
STARPU_OPENCL_RAM
@ STARPU_OPENCL_RAM
Definition starpu_worker.h:48
STARPU_WORKER_TREE
@ STARPU_WORKER_TREE
Definition starpu_worker.h:101
STARPU_WORKER_LIST
@ STARPU_WORKER_LIST
Definition starpu_worker.h:102
starpu_sched_ctx_iterator
Definition starpu_worker.h:84
starpu_worker_collection
Definition starpu_worker.h:113
starpu_config.h
starpu_task.h
starpu_thread.h