StarPU Internal Handbook

starpu_clusters_create.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2015-2021 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_CLUSTERS_CREATE_H__
18#define __STARPU_CLUSTERS_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_CLUSTER
32
33#ifdef __cplusplus
34 extern
35#endif
36
37 struct starpu_cluster_machine
38{
39 unsigned id;
40 hwloc_topology_t topology;
41 unsigned nclusters;
42 unsigned ngroups;
43 struct _starpu_cluster_group_list* groups;
44 struct _starpu_cluster_parameters* params;
45};
46
47 struct _starpu_cluster_parameters
48{
49 int min_nb;
50 int max_nb;
51 int nb;
52 char* sched_policy_name;
53 struct starpu_sched_policy* sched_policy_struct;
54 unsigned keep_homogeneous;
55 unsigned prefere_min;
56 void (*create_func)(void*);
57 void* create_func_arg;
58 int type;
59 unsigned awake_workers;
60};
61
62LIST_TYPE(_starpu_cluster_group,
63 unsigned id;
64 hwloc_obj_t group_obj;
65 int nclusters;
66 struct _starpu_cluster_list* clusters;
67 struct starpu_cluster_machine* father;
68 struct _starpu_cluster_parameters* params;
69)
70
71LIST_TYPE(_starpu_cluster,
72 unsigned id;
73 hwloc_cpuset_t cpuset;
74 int ncores;
75 int* cores;
76 int* workerids;
77 struct _starpu_cluster_group* father;
78 struct _starpu_cluster_parameters* params;
79)
80
81
83 int _starpu_cluster_machine(hwloc_obj_type_t cluster_level,
84 struct starpu_cluster_machine* machine);
85 int _starpu_cluster_topology(hwloc_obj_type_t cluster_level,
86 struct starpu_cluster_machine* machine);
87 void _starpu_cluster_group(hwloc_obj_type_t cluster_level,
88 struct starpu_cluster_machine* machine);
89 void _starpu_cluster(struct _starpu_cluster_group* group);
90
92 void _starpu_cluster_init_parameters(struct _starpu_cluster_parameters* globals);
93 void _starpu_cluster_copy_parameters(struct _starpu_cluster_parameters* src,
94 struct _starpu_cluster_parameters* dst);
95 int _starpu_cluster_analyze_parameters(struct _starpu_cluster_parameters* params, int npus);
96
98 void _starpu_cluster_init(struct _starpu_cluster* cluster, struct _starpu_cluster_group* father);
99 void _starpu_cluster_create(struct _starpu_cluster* cluster);
100
101 int _starpu_cluster_bind(struct _starpu_cluster* cluster);
102 int _starpu_cluster_remove(struct _starpu_cluster_list* cluster_list,
103 struct _starpu_cluster* cluster);
104
106 void _starpu_cluster_group_init(struct _starpu_cluster_group* group,
107 struct starpu_cluster_machine* father);
108 void _starpu_cluster_group_create(struct _starpu_cluster_group* group);
109 int _starpu_cluster_group_remove(struct _starpu_cluster_group_list* group_list,
110 struct _starpu_cluster_group* group);
111
113 void _starpu_cluster_noop(void* buffers[], void* cl_arg)
114{
115 (void) buffers;
116 (void) cl_arg;
117}
118
119 static struct starpu_codelet _starpu_cluster_bind_cl=
120{
121 .cpu_funcs = {_starpu_cluster_noop},
122 .nbuffers = 0,
123 .name = "cluster_internal_runtime_init"
124};
125
126 typedef void (*starpu_binding_function)(void*);
127starpu_binding_function _starpu_cluster_type_get_func(enum starpu_cluster_types type);
128
129#endif
130#endif /* __STARPU_CLUSTERS_CREATE_H__ */
list.h