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-2023 Université de 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
34 extern
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;
47 };
48 
50 {
51  int min_nb;
52  int max_nb;
53  int nb;
54  char *sched_policy_name;
55  struct starpu_sched_policy *sched_policy_struct;
56  unsigned keep_homogeneous;
57  unsigned prefere_min;
58  void (*create_func)(void*);
59  void *create_func_arg;
60  int type;
61  unsigned awake_workers;
62 };
63 
64 LIST_TYPE(_starpu_parallel_worker_group,
65  unsigned id;
66  hwloc_obj_t group_obj;
67  int nparallel_workers;
68  struct _starpu_parallel_worker_list *parallel_workers;
69  struct starpu_parallel_worker_config *father;
71 )
72 
73 LIST_TYPE(_starpu_parallel_worker,
74  unsigned id;
75  hwloc_cpuset_t cpuset;
76  int ncores;
77  int *cores;
78  int *workerids;
79  struct _starpu_parallel_worker_group *father;
81 )
82 
84 int _starpu_parallel_worker_config(hwloc_obj_type_t parallel_worker_level, struct starpu_parallel_worker_config *machine);
85 int _starpu_parallel_worker_topology(hwloc_obj_type_t parallel_worker_level, struct starpu_parallel_worker_config *machine);
86 void _starpu_parallel_worker_group(hwloc_obj_type_t parallel_worker_level, struct starpu_parallel_worker_config *machine);
87 void _starpu_parallel_worker(struct _starpu_parallel_worker_group *group);
88 
90 void _starpu_parallel_worker_init_parameters(struct _starpu_parallel_worker_parameters *globals);
91 void _starpu_parallel_worker_copy_parameters(struct _starpu_parallel_worker_parameters *src, struct _starpu_parallel_worker_parameters *dst);
92 int _starpu_parallel_worker_analyze_parameters(struct _starpu_parallel_worker_parameters *params, int npus);
93 
95 void _starpu_parallel_worker_init(struct _starpu_parallel_worker *parallel_worker, struct _starpu_parallel_worker_group *father);
96 void _starpu_parallel_worker_create(struct _starpu_parallel_worker *parallel_worker);
97 
98 int _starpu_parallel_worker_bind(struct _starpu_parallel_worker *parallel_worker);
99 int _starpu_parallel_worker_remove(struct _starpu_parallel_worker_list *parallel_worker_list, struct _starpu_parallel_worker *parallel_worker);
100 
102 void _starpu_parallel_worker_group_init(struct _starpu_parallel_worker_group *group, struct starpu_parallel_worker_config *father);
103 void _starpu_parallel_worker_group_create(struct _starpu_parallel_worker_group *group);
104 int _starpu_parallel_worker_group_remove(struct _starpu_parallel_worker_group_list *group_list, struct _starpu_parallel_worker_group *group);
105 
107 void _starpu_parallel_worker_noop(void *buffers[], void *cl_arg)
108 {
109  (void) buffers;
110  (void) cl_arg;
111 }
112 
113 static struct starpu_codelet _starpu_parallel_worker_bind_cl=
114 {
115  .cpu_funcs = {_starpu_parallel_worker_noop},
116  .nbuffers = 0,
117  .name = "parallel_worker_internal_runtime_init"
118 };
119 
120 typedef void (*starpu_binding_function)(void*);
121 starpu_binding_function _starpu_parallel_worker_type_get_func(enum starpu_parallel_worker_types type);
122 
123 #pragma GCC visibility pop
124 
125 #endif
126 #endif /* __STARPU_PARALLEL_WORKERS_CREATE_H__ */
Definition: starpu_parallel_worker_create.h:40
Definition: starpu_parallel_worker_create.h:50