StarPU Handbook
starpu_worker.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2013-2014 Inria
4  * Copyright (C) 2010-2015 CNRS
5  * Copyright (C) 2009-2014,2016 Université de Bordeaux
6  *
7  * StarPU is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * StarPU is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
17  */
18 
19 #ifndef __STARPU_WORKER_H__
20 #define __STARPU_WORKER_H__
21 
22 #include <stdlib.h>
23 #include <starpu_config.h>
24 #include <starpu_thread.h>
25 
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30 
32 {
39 };
40 
42 {
43  int cursor;
44  void *value;
45  void *possible_value;
46  char visited[STARPU_NMAXWORKERS];
47 };
48 
50 {
51  STARPU_WORKER_TREE,
53 };
54 
56 {
57  int *workerids;
58  void *collection_private;
59  unsigned nworkers;
60  void *masters;
61  unsigned nmasters;
62  char present[STARPU_NMAXWORKERS];
63  char is_master[STARPU_NMAXWORKERS];
65  unsigned (*has_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
66  int (*get_next)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
67  unsigned (*has_next_master)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
68  int (*get_next_master)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it);
69  int (*add)(struct starpu_worker_collection *workers, int worker);
70  int (*remove)(struct starpu_worker_collection *workers, int worker);
71  void (*init)(struct starpu_worker_collection *workers);
72  void (*deinit)(struct starpu_worker_collection *workers);
74 };
75 
76 extern struct starpu_worker_collection worker_list;
77 extern struct starpu_worker_collection worker_tree;
78 
79 unsigned starpu_worker_get_count(void);
81 unsigned starpu_worker_is_combined_worker(int id);
82 
83 unsigned starpu_cpu_worker_get_count(void);
84 unsigned starpu_cuda_worker_get_count(void);
85 unsigned starpu_opencl_worker_get_count(void);
86 unsigned starpu_mic_worker_get_count(void);
87 unsigned starpu_scc_worker_get_count(void);
88 
89 unsigned starpu_mic_device_get_count(void);
90 
91 int starpu_worker_get_id(void);
92 unsigned _starpu_worker_get_id_check(const char *f, int l);
93 unsigned starpu_worker_get_id_check(void);
94 #define starpu_worker_get_id_check() _starpu_worker_get_id_check(__FILE__, __LINE__)
95 int starpu_worker_get_bindid(int workerid);
96 
100 
102 
104 
106 
108 
110 
111 void starpu_worker_get_name(int id, char *dst, size_t maxlen);
112 
113 int starpu_worker_get_devid(int id);
114 
115 int starpu_worker_get_mp_nodeid(int id);
116 
117 struct starpu_tree* starpu_workers_get_tree(void);
118 
119 unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx);
120 
121 unsigned starpu_worker_is_slave(int workerid);
122 
124 
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif /* __STARPU_WORKER_H__ */
130 
int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize)
unsigned starpu_mic_worker_get_count(void)
unsigned starpu_mic_device_get_count(void)
Definition: starpu_worker.h:55
unsigned starpu_scc_worker_get_count(void)
int starpu_combined_worker_get_size(void)
Definition: starpu_worker.h:35
int starpu_combined_worker_get_id(void)
int starpu_combined_worker_get_rank(void)
starpu_worker_archtype
Definition: starpu_worker.h:31
Definition: starpu_worker.h:34
int cursor
Definition: starpu_worker.h:43
int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num)
void(* deinit)(struct starpu_worker_collection *workers)
Definition: starpu_worker.h:72
Definition: starpu_worker.h:41
Definition: starpu_worker.h:33
unsigned starpu_combined_worker_get_count(void)
Definition: starpu_worker.h:37
char * starpu_worker_get_type_as_string(enum starpu_worker_archtype type)
Definition: starpu_worker.h:52
Definition: starpu_tree.h:27
void(* init_iterator)(struct starpu_worker_collection *workers, struct starpu_sched_ctx_iterator *it)
Definition: starpu_worker.h:73
int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid)
unsigned starpu_cpu_worker_get_count(void)
Definition: starpu_worker.h:36
enum starpu_worker_archtype starpu_worker_get_type(int id)
#define STARPU_NMAXWORKERS
Definition: starpu_config.h:102
Definition: starpu_worker.h:38
unsigned nworkers
Definition: starpu_worker.h:59
void starpu_worker_get_name(int id, char *dst, size_t maxlen)
int * workerids
Definition: starpu_worker.h:57
unsigned starpu_opencl_worker_get_count(void)
enum starpu_worker_collection_type type
Definition: starpu_worker.h:64
int starpu_worker_get_id(void)
unsigned starpu_worker_get_count(void)
#define starpu_worker_get_id_check()
Definition: starpu_worker.h:94
starpu_worker_collection_type
Definition: starpu_worker.h:49
unsigned starpu_cuda_worker_get_count(void)
void(* init)(struct starpu_worker_collection *workers)
Definition: starpu_worker.h:71
int starpu_worker_get_devid(int id)
int starpu_worker_get_count_by_type(enum starpu_worker_archtype type)