StarPU Internal Handbook
Loading...
Searching...
No Matches
topology.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2009-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 __TOPOLOGY_H__
18#define __TOPOLOGY_H__
19
22#include <starpu.h>
23#include <common/config.h>
24#include <common/list.h>
25#include <common/fxt.h>
26#include <common/uthash.h>
27
28#pragma GCC visibility push(hidden)
29
31
32#ifndef STARPU_SIMGRID
33#ifdef STARPU_HAVE_HWLOC
35struct _starpu_hwloc_userdata
36{
38 struct _starpu_worker_list *worker_list;
40 unsigned ngpus;
42 struct _starpu_worker *pu_worker;
43};
44#endif
45#endif
46
49
51int _starpu_build_topology(struct _starpu_machine_config *config, int no_mp_config);
52
65void _starpu_initialize_workers_deviceid(int *explicit_workers_gpuid,
66 int *current, int *workers_gpuid,
67 const char *varname, unsigned nhwgpus,
68 enum starpu_worker_archtype type);
69
72
75void _starpu_topology_check_ndevices(int *ndevices, unsigned nhwdevices, int overflow, unsigned max, int reserved, const char *nname, const char *dname, const char *configurename);
76
84#define ALLOC_WORKER_SET ((struct _starpu_worker_set*) -1)
85
87#define DEVID_PER_WORKER -2
88
89void _starpu_topology_configure_workers(struct _starpu_machine_topology *topology,
90 struct _starpu_machine_config *config,
91 enum starpu_worker_archtype type,
92 int devnum, int devid,
93 int homogeneous, int worker_devid,
94 unsigned nworker_per_device,
95 unsigned ncores,
96 struct _starpu_worker_set *worker_set,
97 struct _starpu_worker_set *driver_worker_set);
98
99extern unsigned _starpu_may_bind_automatically[STARPU_NARCH];
100
105unsigned _starpu_get_next_bindid(struct _starpu_machine_config *config, unsigned flags,
106 unsigned *preferred_binding, unsigned npreferred);
107
109void _starpu_destroy_machine_config(struct _starpu_machine_config *config, int no_mp_config);
110
113
114#ifdef STARPU_HAVE_HWLOC
116hwloc_obj_t _starpu_numa_get_obj(hwloc_obj_t obj);
117#endif
118
121
124
127
130
133
135unsigned _starpu_topology_get_numa_core_binding(struct _starpu_machine_config *config, const unsigned *numa_binding, unsigned nnuma, unsigned *binding, unsigned nbinding);
136
137int starpu_memory_nodes_numa_hwloclogid_to_id(int logid);
138
139/* This returns the exact NUMA node next to a worker */
140int _starpu_get_logical_numa_node_worker(unsigned workerid);
141
143unsigned _starpu_get_nhyperthreads() STARPU_ATTRIBUTE_VISIBILITY_DEFAULT;
144
145#ifdef STARPU_HAVE_HWLOC
147void _starpu_topology_filter(hwloc_topology_t topology);
148#endif
149
150#define STARPU_NOWORKERID -1
151#define STARPU_ACTIVETHREAD -2
152#define STARPU_NONACTIVETHREAD -2
156int _starpu_bind_thread_on_cpu(int cpuid, int workerid, const char *name);
157
161
162struct _starpu_worker *_starpu_get_worker_from_driver(struct starpu_driver *d);
163
164unsigned starpu_memory_nodes_get_numa_count(void) STARPU_ATTRIBUTE_VISIBILITY_DEFAULT;
165int starpu_memory_nodes_numa_id_to_hwloclogid(unsigned id);
166
168int _starpu_task_data_get_node_on_node(struct starpu_task *task, unsigned index, unsigned target_node);
170int _starpu_task_data_get_node_on_worker(struct starpu_task *task, unsigned index, unsigned worker);
171
172#pragma GCC visibility pop
173
174#endif // __TOPOLOGY_H__
Definition starpu_driver.h:49
starpu_worker_archtype
Definition starpu_worker.h:66
unsigned starpu_memory_nodes_get_numa_count(void)
@ STARPU_NARCH
Definition starpu_worker.h:74
Definition workers.h:311
Definition workers.h:441
Definition workers.h:352
unsigned nhwdevices[STARPU_NARCH]
Definition workers.h:388
int devid[STARPU_NARCH][STARPU_NMAXDEVS]
Definition workers.h:404
unsigned ndevices[STARPU_NARCH]
Definition workers.h:396
Definition workers.h:339
Definition workers.h:155
int _starpu_build_topology(struct _starpu_machine_config *config, int no_mp_config)
int _starpu_get_next_devid(struct _starpu_machine_topology *topology, struct _starpu_machine_config *config, enum starpu_worker_archtype arch)
void _starpu_destroy_topology(struct _starpu_machine_config *config)
int _starpu_task_data_get_node_on_worker(struct starpu_task *task, unsigned index, unsigned worker)
void _starpu_destroy_machine_config(struct _starpu_machine_config *config, int no_mp_config)
unsigned _starpu_get_nhyperthreads() STARPU_ATTRIBUTE_VISIBILITY_DEFAULT
unsigned _starpu_topology_get_nhwnumanodes(struct _starpu_machine_config *config)
void _starpu_topology_check_ndevices(int *ndevices, unsigned nhwdevices, int overflow, unsigned max, int reserved, const char *nname, const char *dname, const char *configurename)
unsigned _starpu_get_next_bindid(struct _starpu_machine_config *config, unsigned flags, unsigned *preferred_binding, unsigned npreferred)
int _starpu_task_data_get_node_on_node(struct starpu_task *task, unsigned index, unsigned target_node)
unsigned _starpu_topology_get_numa_core_binding(struct _starpu_machine_config *config, const unsigned *numa_binding, unsigned nnuma, unsigned *binding, unsigned nbinding)
int _starpu_bind_thread_on_cpu(int cpuid, int workerid, const char *name)
unsigned _starpu_topology_get_nnumanodes(struct _starpu_machine_config *config)
void _starpu_topology_filter(hwloc_topology_t topology)
unsigned _starpu_topology_get_nhwpu(struct _starpu_machine_config *config)
hwloc_obj_t _starpu_numa_get_obj(hwloc_obj_t obj)
void _starpu_initialize_workers_deviceid(int *explicit_workers_gpuid, int *current, int *workers_gpuid, const char *varname, unsigned nhwgpus, enum starpu_worker_archtype type)
void _starpu_bind_thread_on_cpus(struct _starpu_combined_worker *combined_worker)
unsigned _starpu_topology_get_nhwcpu(struct _starpu_machine_config *config)