StarPU Internal Handbook
starpu_parallel_worker_create.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2015-2025 University of Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 *
5 * StarPU is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation; either version 2.1 of the License, or (at
8 * your option) any later version.
9 *
10 * StarPU is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
15 */
16
17#ifndef __STARPU_PARALLEL_WORKERS_CREATE_H__
18#define __STARPU_PARALLEL_WORKERS_CREATE_H__
19
22#include <starpu.h>
23#include <core/workers.h>
24#include <common/list.h>
25#include <string.h>
26#include <omp.h>
27#ifdef STARPU_MKL
28#include <mkl_service.h>
29#endif
30
31#ifdef STARPU_PARALLEL_WORKER
32
33#ifdef __cplusplus
34extern
35#endif
36
37#pragma GCC visibility push(hidden)
38
40{
41 unsigned id;
42 hwloc_topology_t topology;
43 unsigned nparallel_workers;
44 unsigned ngroups;
45 struct _starpu_parallel_worker_group_list *groups;
46 struct _starpu_parallel_worker_parameters *orig_params;
48};
49
51{
52 int min_nb;
53 int max_nb;
54 int nb;
55 char *sched_policy_name;
56 struct starpu_sched_policy *sched_policy_struct;
57 unsigned keep_homogeneous;
58 unsigned prefere_min;
59 void (*create_func)(void*);
60 void *create_func_arg;
61 int type;
62 unsigned awake_workers;
63};
64
65LIST_TYPE(_starpu_parallel_worker_group,
66 unsigned id;
67 hwloc_obj_t group_obj;
68 int nparallel_workers;
69 struct _starpu_parallel_worker_list *parallel_workers;
70 struct starpu_parallel_worker_config *father;
72)
73
74LIST_TYPE(_starpu_parallel_worker,
75 unsigned id;
76 hwloc_cpuset_t cpuset;
77 int ncores;
78 int *cores;
79 int *workerids;
80 struct _starpu_parallel_worker_group *father;
82)
83
85int _starpu_parallel_worker_config(hwloc_obj_type_t parallel_worker_level, struct starpu_parallel_worker_config *machine);
86int _starpu_parallel_worker_topology(hwloc_obj_type_t parallel_worker_level, struct starpu_parallel_worker_config *machine);
87void _starpu_parallel_worker_group(hwloc_obj_type_t parallel_worker_level, struct starpu_parallel_worker_config *machine);
88void _starpu_parallel_worker(struct _starpu_parallel_worker_group *group);
89
91void _starpu_parallel_worker_init_parameters(struct _starpu_parallel_worker_parameters *globals);
92void _starpu_parallel_worker_copy_parameters(struct _starpu_parallel_worker_parameters *src, struct _starpu_parallel_worker_parameters *dst);
93int _starpu_parallel_worker_analyze_parameters(struct _starpu_parallel_worker_parameters *params, int npus);
94
96void _starpu_parallel_worker_init(struct _starpu_parallel_worker *parallel_worker, struct _starpu_parallel_worker_group *father);
97int _starpu_parallel_worker_create(struct _starpu_parallel_worker *parallel_worker);
98
99int _starpu_parallel_worker_bind(struct _starpu_parallel_worker *parallel_worker);
100int _starpu_parallel_worker_remove(struct _starpu_parallel_worker_list *parallel_worker_list, struct _starpu_parallel_worker *parallel_worker);
101
103void _starpu_parallel_worker_group_init(struct _starpu_parallel_worker_group *group, struct starpu_parallel_worker_config *father);
104int _starpu_parallel_worker_group_create(struct _starpu_parallel_worker_group *group);
105int _starpu_parallel_worker_group_remove(struct _starpu_parallel_worker_group_list *group_list, struct _starpu_parallel_worker_group *group);
106
108void _starpu_parallel_worker_noop(void *buffers[], void *cl_arg)
109{
110 (void) buffers;
111 (void) cl_arg;
112}
113
114static struct starpu_codelet _starpu_parallel_worker_bind_cl=
115{
116 .cpu_funcs = {_starpu_parallel_worker_noop},
117 .nbuffers = 0,
118 .name = "parallel_worker_internal_runtime_init"
119};
120
121typedef void (*starpu_binding_function)(void*);
122starpu_binding_function _starpu_parallel_worker_type_get_func(enum starpu_parallel_worker_types type);
123
124#pragma GCC visibility pop
125
126#endif
127#endif /* __STARPU_PARALLEL_WORKERS_CREATE_H__ */
Definition: starpu_parallel_worker_create.h:40
Definition: starpu_parallel_worker_create.h:51