17 #ifndef __MEMORY_NODES_H__
18 #define __MEMORY_NODES_H__
23 #include <common/config.h>
28 #include <core/workers.h>
34 extern char _starpu_worker_drives_memory[STARPU_NMAXWORKERS][STARPU_MAXNODES];
38 starpu_pthread_cond_t *cond;
45 enum starpu_node_kind nodes[STARPU_MAXNODES];
51 unsigned nworkers[STARPU_MAXNODES];
54 starpu_sg_host_t host[STARPU_MAXNODES];
68 unsigned condition_count[STARPU_MAXNODES];
73 void _starpu_memory_nodes_init(
void);
74 void _starpu_memory_nodes_deinit(
void);
76 static inline void _starpu_memory_node_add_nworkers(
unsigned node)
78 _starpu_descr.nworkers[node]++;
84 static inline struct _starpu_node_ops *_starpu_memory_node_get_node_ops(
unsigned node)
86 return _starpu_descr.node_ops[node];
89 static inline unsigned _starpu_memory_node_get_nworkers(
unsigned node)
91 return _starpu_descr.nworkers[node];
95 static inline void _starpu_simgrid_memory_node_set_host(
unsigned node, starpu_sg_host_t host)
97 _starpu_descr.host[node] = host;
100 static inline starpu_sg_host_t _starpu_simgrid_memory_node_get_host(
unsigned node)
102 return _starpu_descr.host[node];
105 unsigned _starpu_memory_node_register(
enum starpu_node_kind kind,
int devid,
struct _starpu_node_ops *node_ops);
107 void _starpu_memory_node_register_condition(
struct _starpu_worker *worker, starpu_pthread_cond_t *cond,
unsigned nodeid);
111 return &_starpu_descr;
114 static inline enum starpu_node_kind _starpu_node_get_kind(
unsigned node)
116 return _starpu_descr.nodes[node];
118 #define starpu_node_get_kind _starpu_node_get_kind
120 static inline unsigned _starpu_memory_nodes_get_count(
void)
122 return _starpu_descr.nnodes;
124 #define starpu_memory_nodes_get_count _starpu_memory_nodes_get_count
131 unsigned nworkers = config->topology.
nworkers;
133 if (workerid < config->topology.nworkers)
137 unsigned ncombinedworkers STARPU_ATTRIBUTE_UNUSED = config->topology.
ncombinedworkers;
138 STARPU_ASSERT_MSG(workerid < ncombinedworkers + nworkers,
"Bad workerid %u, maximum %u", workerid, ncombinedworkers + nworkers);
142 #define starpu_worker_get_memory_node _starpu_worker_get_memory_node
144 #endif // __MEMORY_NODES_H__