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