StarPU Handbook

starpurm.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2017-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 __STARPURM_H
18#define __STARPURM_H
19#include <hwloc.h>
20#include <starpurm_config.h>
21
22#ifdef __cplusplus
23 extern "C"
24{
25#endif
26
37 enum e_starpurm_drs_ret
38{
42 starpurm_DRS_SUCCESS = 0,
43
47 starpurm_DRS_DISABLD = -1,
52 starpurm_DRS_PERM = -2,
57 starpurm_DRS_EINVAL = -3
58#if 0
59 /* Unused for now */
60 starpurm_DRS_NOTED,
61 starpurm_DRS_REQST
62#endif
63};
64 typedef int starpurm_drs_ret_t;
65 typedef void *starpurm_drs_desc_t;
66 typedef void *starpurm_drs_cbs_t;
67 typedef void (*starpurm_drs_cb_t)(void *);
68 typedef void *starpurm_block_cond_t;
69 typedef int (*starpurm_polling_t)(void *);
70
79 void starpurm_initialize_with_cpuset(hwloc_cpuset_t initially_owned_cpuset);
80
87 void starpurm_initialize(void);
88
94 void starpurm_shutdown(void);
95
110 void starpurm_spawn_kernel_on_cpus(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset);
111
122 void starpurm_spawn_kernel_on_cpus_callback(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset, void(*cb_f)(void *), void *cb_args);
123
124 void starpurm_spawn_kernel_callback(void *data, void(*f)(void *), void *args, void(*cb_f)(void *), void *cb_args);
125
136starpurm_drs_ret_t starpurm_set_drs_enable(starpurm_drs_desc_t *spd);
137
141starpurm_drs_ret_t starpurm_set_drs_disable(starpurm_drs_desc_t *spd);
142
147 int starpurm_drs_enabled_p(void);
148
154starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int max);
155
156#if 0
157/* Unused for now */
158starpurm_drs_ret_t starpurm_callback_set(starpurm_drs_desc_t *spd, starpurm_drs_cbs_t which, starpurm_drs_cb_t callback);
159starpurm_drs_ret_t starpurm_callback_get(starpurm_drs_desc_t *spd, starpurm_drs_cbs_t which, starpurm_drs_cb_t *callback);
160#endif
161
168starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int cpuid);
169
175starpurm_drs_ret_t starpurm_assign_cpus_to_starpu(starpurm_drs_desc_t *spd, int ncpus);
176
182starpurm_drs_ret_t starpurm_assign_cpu_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
183
189starpurm_drs_ret_t starpurm_assign_all_cpus_to_starpu(starpurm_drs_desc_t *spd);
190
197starpurm_drs_ret_t starpurm_withdraw_cpu_from_starpu(starpurm_drs_desc_t *spd, int cpuid);
198
203starpurm_drs_ret_t starpurm_withdraw_cpus_from_starpu(starpurm_drs_desc_t *spd, int ncpus);
204
210starpurm_drs_ret_t starpurm_withdraw_cpu_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
211
216starpurm_drs_ret_t starpurm_withdraw_all_cpus_from_starpu(starpurm_drs_desc_t *spd);
217
218/* --- */
219
223starpurm_drs_ret_t starpurm_lend(starpurm_drs_desc_t *spd);
224
228starpurm_drs_ret_t starpurm_lend_cpu(starpurm_drs_desc_t *spd, int cpuid);
229
233starpurm_drs_ret_t starpurm_lend_cpus(starpurm_drs_desc_t *spd, int ncpus);
234
238starpurm_drs_ret_t starpurm_lend_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
239
243starpurm_drs_ret_t starpurm_reclaim(starpurm_drs_desc_t *spd);
244
248starpurm_drs_ret_t starpurm_reclaim_cpu(starpurm_drs_desc_t *spd, int cpuid);
249
253starpurm_drs_ret_t starpurm_reclaim_cpus(starpurm_drs_desc_t *spd, int ncpus);
254
258starpurm_drs_ret_t starpurm_reclaim_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
259
263starpurm_drs_ret_t starpurm_acquire(starpurm_drs_desc_t *spd);
264
268starpurm_drs_ret_t starpurm_acquire_cpu(starpurm_drs_desc_t *spd, int cpuid);
269
273starpurm_drs_ret_t starpurm_acquire_cpus(starpurm_drs_desc_t *spd, int ncpus);
274
278starpurm_drs_ret_t starpurm_acquire_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
279
283starpurm_drs_ret_t starpurm_return_all(starpurm_drs_desc_t *spd);
284
288starpurm_drs_ret_t starpurm_return_cpu(starpurm_drs_desc_t *spd, int cpuid);
289
290#if 0
291/* Pause/resume (not implemented) */
292starpurm_drs_ret_t starpurm_create_block_condition(starpurm_block_cond_t *cond);
293 void starpurm_block_current_task(starpurm_block_cond_t *cond);
294 void starpurm_signal_block_condition(starpurm_block_cond_t *cond);
295
296 void starpurm_register_polling_service(const char *service_name, starpurm_polling_t function, void *data);
297 void starpurm_unregister_polling_service(const char *service_name, starpurm_polling_t function, void *data);
298#endif
299
315 int starpurm_get_device_type_id(const char *type_str);
316
321 const char *starpurm_get_device_type_name(int type_id);
322
327 int starpurm_get_nb_devices_by_type(int type_id);
328
333 int starpurm_get_device_id(int type_id, int device_rank);
334
339starpurm_drs_ret_t starpurm_assign_device_to_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank);
340
346starpurm_drs_ret_t starpurm_assign_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices);
347
353starpurm_drs_ret_t starpurm_assign_device_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
354
359starpurm_drs_ret_t starpurm_assign_all_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id);
360
365starpurm_drs_ret_t starpurm_withdraw_device_from_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank);
366
371starpurm_drs_ret_t starpurm_withdraw_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices);
372
378starpurm_drs_ret_t starpurm_withdraw_device_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
379
384starpurm_drs_ret_t starpurm_withdraw_all_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id);
385
386/* --- */
387
391starpurm_drs_ret_t starpurm_lend_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank);
392
396starpurm_drs_ret_t starpurm_lend_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices);
397
401starpurm_drs_ret_t starpurm_lend_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
402
406starpurm_drs_ret_t starpurm_lend_all_devices(starpurm_drs_desc_t *spd, int type_id);
407
411starpurm_drs_ret_t starpurm_reclaim_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank);
412
416starpurm_drs_ret_t starpurm_reclaim_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices);
417
421starpurm_drs_ret_t starpurm_reclaim_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
422
426starpurm_drs_ret_t starpurm_reclaim_all_devices(starpurm_drs_desc_t *spd, int type_id);
427
431starpurm_drs_ret_t starpurm_acquire_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank);
432
436starpurm_drs_ret_t starpurm_acquire_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices);
437
441starpurm_drs_ret_t starpurm_acquire_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask);
442
446starpurm_drs_ret_t starpurm_acquire_all_devices(starpurm_drs_desc_t *spd, int type_id);
447
451starpurm_drs_ret_t starpurm_return_all_devices(starpurm_drs_desc_t *spd, int type_id);
452
456starpurm_drs_ret_t starpurm_return_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank);
457
469hwloc_cpuset_t starpurm_get_device_worker_cpuset(int type_id, int unit_rank);
470
474hwloc_cpuset_t starpurm_get_global_cpuset(void);
475
480hwloc_cpuset_t starpurm_get_selected_cpuset(void);
481
485hwloc_cpuset_t starpurm_get_all_cpu_workers_cpuset(void);
486
491hwloc_cpuset_t starpurm_get_all_device_workers_cpuset(void);
492
497hwloc_cpuset_t starpurm_get_all_device_workers_cpuset_by_type(int typeid);
498
502#ifdef __cplusplus
503}
504#endif
505#endif /* __STARPURM_H */
starpurm_assign_cpu_mask_to_starpu
starpurm_drs_ret_t starpurm_assign_cpu_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_return_cpu
starpurm_drs_ret_t starpurm_return_cpu(starpurm_drs_desc_t *spd, int cpuid)
starpurm_get_selected_cpuset
hwloc_cpuset_t starpurm_get_selected_cpuset(void)
starpurm_set_drs_enable
starpurm_drs_ret_t starpurm_set_drs_enable(starpurm_drs_desc_t *spd)
starpurm_lend_cpu
starpurm_drs_ret_t starpurm_lend_cpu(starpurm_drs_desc_t *spd, int cpuid)
starpurm_lend_cpu_mask
starpurm_drs_ret_t starpurm_lend_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_return_all_devices
starpurm_drs_ret_t starpurm_return_all_devices(starpurm_drs_desc_t *spd, int type_id)
starpurm_acquire_all_devices
starpurm_drs_ret_t starpurm_acquire_all_devices(starpurm_drs_desc_t *spd, int type_id)
starpurm_reclaim_cpu
starpurm_drs_ret_t starpurm_reclaim_cpu(starpurm_drs_desc_t *spd, int cpuid)
starpurm_assign_devices_to_starpu
starpurm_drs_ret_t starpurm_assign_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices)
starpurm_withdraw_device_mask_from_starpu
starpurm_drs_ret_t starpurm_withdraw_device_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_acquire_device_mask
starpurm_drs_ret_t starpurm_acquire_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_get_all_device_workers_cpuset
hwloc_cpuset_t starpurm_get_all_device_workers_cpuset(void)
starpurm_reclaim_all_devices
starpurm_drs_ret_t starpurm_reclaim_all_devices(starpurm_drs_desc_t *spd, int type_id)
starpurm_initialize
void starpurm_initialize(void)
e_starpurm_drs_ret
e_starpurm_drs_ret
Definition: starpurm.h:38
starpurm_initialize_with_cpuset
void starpurm_initialize_with_cpuset(hwloc_cpuset_t initially_owned_cpuset)
starpurm_return_device
starpurm_drs_ret_t starpurm_return_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
starpurm_drs_enabled_p
int starpurm_drs_enabled_p(void)
starpurm_assign_cpu_to_starpu
starpurm_drs_ret_t starpurm_assign_cpu_to_starpu(starpurm_drs_desc_t *spd, int cpuid)
starpurm_get_nb_devices_by_type
int starpurm_get_nb_devices_by_type(int type_id)
starpurm_lend_all_devices
starpurm_drs_ret_t starpurm_lend_all_devices(starpurm_drs_desc_t *spd, int type_id)
starpurm_get_all_cpu_workers_cpuset
hwloc_cpuset_t starpurm_get_all_cpu_workers_cpuset(void)
starpurm_shutdown
void starpurm_shutdown(void)
starpurm_assign_device_mask_to_starpu
starpurm_drs_ret_t starpurm_assign_device_mask_to_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_reclaim_devices
starpurm_drs_ret_t starpurm_reclaim_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
starpurm_withdraw_all_cpus_from_starpu
starpurm_drs_ret_t starpurm_withdraw_all_cpus_from_starpu(starpurm_drs_desc_t *spd)
starpurm_set_max_parallelism
starpurm_drs_ret_t starpurm_set_max_parallelism(starpurm_drs_desc_t *spd, int max)
starpurm_return_all
starpurm_drs_ret_t starpurm_return_all(starpurm_drs_desc_t *spd)
starpurm_acquire
starpurm_drs_ret_t starpurm_acquire(starpurm_drs_desc_t *spd)
starpurm_set_drs_disable
starpurm_drs_ret_t starpurm_set_drs_disable(starpurm_drs_desc_t *spd)
starpurm_assign_all_devices_to_starpu
starpurm_drs_ret_t starpurm_assign_all_devices_to_starpu(starpurm_drs_desc_t *spd, int type_id)
starpurm_reclaim_cpus
starpurm_drs_ret_t starpurm_reclaim_cpus(starpurm_drs_desc_t *spd, int ncpus)
starpurm_lend_device_mask
starpurm_drs_ret_t starpurm_lend_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_get_all_device_workers_cpuset_by_type
hwloc_cpuset_t starpurm_get_all_device_workers_cpuset_by_type(int typeid)
starpurm_assign_device_to_starpu
starpurm_drs_ret_t starpurm_assign_device_to_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
starpurm_acquire_devices
starpurm_drs_ret_t starpurm_acquire_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
starpurm_assign_cpus_to_starpu
starpurm_drs_ret_t starpurm_assign_cpus_to_starpu(starpurm_drs_desc_t *spd, int ncpus)
starpurm_reclaim_cpu_mask
starpurm_drs_ret_t starpurm_reclaim_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_lend_devices
starpurm_drs_ret_t starpurm_lend_devices(starpurm_drs_desc_t *spd, int type_id, int ndevices)
starpurm_reclaim_device_mask
starpurm_drs_ret_t starpurm_reclaim_device_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_get_device_worker_cpuset
hwloc_cpuset_t starpurm_get_device_worker_cpuset(int type_id, int unit_rank)
starpurm_reclaim_device
starpurm_drs_ret_t starpurm_reclaim_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
starpurm_get_device_type_id
int starpurm_get_device_type_id(const char *type_str)
starpurm_withdraw_devices_from_starpu
starpurm_drs_ret_t starpurm_withdraw_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id, int ndevices)
starpurm_get_device_type_name
const char * starpurm_get_device_type_name(int type_id)
starpurm_assign_all_cpus_to_starpu
starpurm_drs_ret_t starpurm_assign_all_cpus_to_starpu(starpurm_drs_desc_t *spd)
starpurm_withdraw_cpu_from_starpu
starpurm_drs_ret_t starpurm_withdraw_cpu_from_starpu(starpurm_drs_desc_t *spd, int cpuid)
starpurm_withdraw_cpus_from_starpu
starpurm_drs_ret_t starpurm_withdraw_cpus_from_starpu(starpurm_drs_desc_t *spd, int ncpus)
starpurm_lend
starpurm_drs_ret_t starpurm_lend(starpurm_drs_desc_t *spd)
starpurm_spawn_kernel_on_cpus_callback
void starpurm_spawn_kernel_on_cpus_callback(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset, void(*cb_f)(void *), void *cb_args)
starpurm_withdraw_all_devices_from_starpu
starpurm_drs_ret_t starpurm_withdraw_all_devices_from_starpu(starpurm_drs_desc_t *spd, int type_id)
starpurm_acquire_cpu
starpurm_drs_ret_t starpurm_acquire_cpu(starpurm_drs_desc_t *spd, int cpuid)
starpurm_lend_device
starpurm_drs_ret_t starpurm_lend_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
starpurm_acquire_device
starpurm_drs_ret_t starpurm_acquire_device(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
starpurm_lend_cpus
starpurm_drs_ret_t starpurm_lend_cpus(starpurm_drs_desc_t *spd, int ncpus)
starpurm_reclaim
starpurm_drs_ret_t starpurm_reclaim(starpurm_drs_desc_t *spd)
starpurm_get_device_id
int starpurm_get_device_id(int type_id, int device_rank)
starpurm_acquire_cpus
starpurm_drs_ret_t starpurm_acquire_cpus(starpurm_drs_desc_t *spd, int ncpus)
starpurm_spawn_kernel_on_cpus
void starpurm_spawn_kernel_on_cpus(void *data, void(*f)(void *), void *args, hwloc_cpuset_t cpuset)
starpurm_withdraw_cpu_mask_from_starpu
starpurm_drs_ret_t starpurm_withdraw_cpu_mask_from_starpu(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_get_global_cpuset
hwloc_cpuset_t starpurm_get_global_cpuset(void)
starpurm_withdraw_device_from_starpu
starpurm_drs_ret_t starpurm_withdraw_device_from_starpu(starpurm_drs_desc_t *spd, int type_id, int unit_rank)
starpurm_acquire_cpu_mask
starpurm_drs_ret_t starpurm_acquire_cpu_mask(starpurm_drs_desc_t *spd, const hwloc_cpuset_t mask)
starpurm_DRS_DISABLD
@ starpurm_DRS_DISABLD
Definition: starpurm.h:47
starpurm_DRS_SUCCESS
@ starpurm_DRS_SUCCESS
Definition: starpurm.h:42
starpurm_DRS_PERM
@ starpurm_DRS_PERM
Definition: starpurm.h:52
starpurm_DRS_EINVAL
@ starpurm_DRS_EINVAL
Definition: starpurm.h:57