Dynamic Load Balance 3.6.1+32-59d1
dlb_sp.h
Go to the documentation of this file.
1/*********************************************************************************/
2/* Copyright 2009-2021 Barcelona Supercomputing Center */
3/* */
4/* This file is part of the DLB library. */
5/* */
6/* DLB 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 3 of the License, or */
9/* (at your option) any later version. */
10/* */
11/* DLB is distributed in the hope that it will be useful, */
12/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14/* GNU Lesser General Public License for more details. */
15/* */
16/* You should have received a copy of the GNU Lesser General Public License */
17/* along with DLB. If not, see <https://www.gnu.org/licenses/>. */
18/*********************************************************************************/
19
20#ifndef DLB_SP_H
21#define DLB_SP_H
22
23#include "dlb_types.h"
24#include "dlb_errors.h"
25
26#ifdef __cplusplus
27extern "C"
28{
29#endif
30
31/*********************************************************************************/
32/* Status */
33/*********************************************************************************/
34
48dlb_handler_t DLB_Init_sp(int ncpus, const_dlb_cpu_set_t mask, const char *dlb_args);
49
57
67int DLB_Enable_sp(dlb_handler_t handler);
68
78int DLB_Disable_sp(dlb_handler_t handler);
79
92int DLB_SetMaxParallelism_sp(dlb_handler_t handler, int max);
93
102
103
104/*********************************************************************************/
105/* Callbacks */
106/*********************************************************************************/
107
122 dlb_callback_t callback, void *arg);
123
136 dlb_callback_t *callback, void **arg);
137
138
139/*********************************************************************************/
140/* Lend */
141/*********************************************************************************/
142
152int DLB_Lend_sp(dlb_handler_t handler);
153
164int DLB_LendCpu_sp(dlb_handler_t handler, int cpuid);
165
177int DLB_LendCpus_sp(dlb_handler_t handler, int ncpus);
178
190
191
192/*********************************************************************************/
193/* Reclaim */
194/*********************************************************************************/
195
206int DLB_Reclaim_sp(dlb_handler_t handler);
207
220int DLB_ReclaimCpu_sp(dlb_handler_t handler, int cpuid);
221
233int DLB_ReclaimCpus_sp(dlb_handler_t handler, int ncpus);
234
248
249
250/*********************************************************************************/
251/* Acquire */
252/*********************************************************************************/
253
268int DLB_AcquireCpu_sp(dlb_handler_t handler, int cpuid);
269
283int DLB_AcquireCpus_sp(dlb_handler_t handler, int ncpus);
284
300
317
318
319/*********************************************************************************/
320/* Borrow */
321/*********************************************************************************/
322
333int DLB_Borrow_sp(dlb_handler_t handler);
334
346int DLB_BorrowCpu_sp(dlb_handler_t handler, int cpuid);
347
359int DLB_BorrowCpus_sp(dlb_handler_t handler, int ncpus);
360
373
386int DLB_BorrowCpusInMask_sp(dlb_handler_t handler, int ncpus, const_dlb_cpu_set_t mask);
387
388
389/*********************************************************************************/
390/* Return */
391/*********************************************************************************/
392
405int DLB_Return_sp(dlb_handler_t handler);
406
420int DLB_ReturnCpu_sp(dlb_handler_t handler, int cpuid);
421
436
437
438/*********************************************************************************/
439/* DROM Responsive */
440/*********************************************************************************/
441
454int DLB_PollDROM_sp(dlb_handler_t handler, int *ncpus, dlb_cpu_set_t mask);
455
467
468
469/*********************************************************************************/
470/* Misc */
471/*********************************************************************************/
472
482int DLB_CheckCpuAvailability_sp(dlb_handler_t handler, int cpuid);
483
496int DLB_SetVariable_sp(dlb_handler_t handler, const char *variable, const char *value);
497
507int DLB_GetVariable_sp(dlb_handler_t handler, const char *variable, char *value);
508
515int DLB_PrintVariables_sp(dlb_handler_t handler, int print_extended);
516
517
518#ifdef __cplusplus
519}
520#endif
521
522#endif /* DLB_SP_H */
int DLB_AcquireCpuMask_sp(dlb_handler_t handler, const_dlb_cpu_set_t mask)
Acquire a set of CPUs.
Definition: DLB_interface_sp.c:177
int DLB_ReturnCpuMask_sp(dlb_handler_t handler, const_dlb_cpu_set_t mask)
Return a set of CPUs if some of them have been reclaimed.
Definition: DLB_interface_sp.c:237
int DLB_Borrow_sp(dlb_handler_t handler)
Borrow all the possible CPUs registered on DLB.
Definition: DLB_interface_sp.c:192
int DLB_SetVariable_sp(dlb_handler_t handler, const char *variable, const char *value)
Change the value of a DLB internal variable.
Definition: DLB_interface_sp.c:267
int DLB_GetVariable_sp(dlb_handler_t handler, const char *variable, char *value)
Query the value of a DLB internal variable.
Definition: DLB_interface_sp.c:274
int DLB_PollDROM_sp(dlb_handler_t handler, int *ncpus, dlb_cpu_set_t mask)
Poll DROM module to check if the subprocess needs to adapt to a new mask or number of CPUs.
Definition: DLB_interface_sp.c:246
int DLB_BorrowCpus_sp(dlb_handler_t handler, int ncpus)
Borrow a specific amount of CPUs.
Definition: DLB_interface_sp.c:204
int DLB_Reclaim_sp(dlb_handler_t handler)
Reclaim all the CPUs that are owned by the subprocess.
Definition: DLB_interface_sp.c:138
int DLB_LendCpus_sp(dlb_handler_t handler, int ncpus)
Lend a specific amount of CPUs, only useful for systems that do not work with cpu masks.
Definition: DLB_interface_sp.c:123
int DLB_ReclaimCpu_sp(dlb_handler_t handler, int cpuid)
Reclaim a specific CPU that are owned by the subprocess.
Definition: DLB_interface_sp.c:144
int DLB_AcquireCpusInMask_sp(dlb_handler_t handler, int ncpus, const_dlb_cpu_set_t mask)
Acquire some CPUs from a subset of CPUs.
Definition: DLB_interface_sp.c:183
int DLB_AcquireCpu_sp(dlb_handler_t handler, int cpuid)
Acquire a specific CPU.
Definition: DLB_interface_sp.c:165
dlb_handler_t DLB_Init_sp(int ncpus, const_dlb_cpu_set_t mask, const char *dlb_args)
Initialize DLB library and all its internal data structures.
Definition: DLB_interface_sp.c:41
int DLB_CheckCpuAvailability_sp(dlb_handler_t handler, int cpuid)
Check whether the specified CPU is being used by another subprocess.
Definition: DLB_interface_sp.c:261
int DLB_SetMaxParallelism_sp(dlb_handler_t handler, int max)
Set the maximum number of resources to be used by the handler.
Definition: DLB_interface_sp.c:77
int DLB_Lend_sp(dlb_handler_t handler)
Lend all the current CPUs.
Definition: DLB_interface_sp.c:111
int DLB_CallbackGet_sp(dlb_handler_t handler, dlb_callbacks_t which, dlb_callback_t *callback, void **arg)
Getter for DLB callbacks.
Definition: DLB_interface_sp.c:100
int DLB_BorrowCpu_sp(dlb_handler_t handler, int cpuid)
Borrow a specific CPU.
Definition: DLB_interface_sp.c:198
int DLB_PrintVariables_sp(dlb_handler_t handler, int print_extended)
Print DLB internal variables.
Definition: DLB_interface_sp.c:281
int DLB_ReclaimCpus_sp(dlb_handler_t handler, int ncpus)
Reclaim a specific amount of CPUs that are owned by the subprocess.
Definition: DLB_interface_sp.c:150
int DLB_Disable_sp(dlb_handler_t handler)
Disable DLB actions for the specified handler.
Definition: DLB_interface_sp.c:71
int DLB_LendCpuMask_sp(dlb_handler_t handler, const_dlb_cpu_set_t mask)
Lend a set of CPUs.
Definition: DLB_interface_sp.c:129
int DLB_AcquireCpus_sp(dlb_handler_t handler, int ncpus)
Acquire a specific amount of CPUs.
Definition: DLB_interface_sp.c:171
int DLB_Finalize_sp(dlb_handler_t handler)
Finalize DLB library and clean up all its data structures for the specified handler....
Definition: DLB_interface_sp.c:56
int DLB_BorrowCpuMask_sp(dlb_handler_t handler, const_dlb_cpu_set_t mask)
Borrow a set of CPUs.
Definition: DLB_interface_sp.c:210
int DLB_UnsetMaxParallelism_sp(dlb_handler_t handler)
Unset the maximum number of resources to be used by the handler.
Definition: DLB_interface_sp.c:83
int DLB_Enable_sp(dlb_handler_t handler)
Enable DLB and all its features in case it was previously disabled, otherwise it has no effect.
Definition: DLB_interface_sp.c:65
int DLB_LendCpu_sp(dlb_handler_t handler, int cpuid)
Lend a specific CPU.
Definition: DLB_interface_sp.c:117
int DLB_PollDROM_Update_sp(dlb_handler_t handler)
Poll DROM module to check if the subprocess needs to adapt to a new mask and update it if necessary u...
Definition: DLB_interface_sp.c:252
int DLB_ReclaimCpuMask_sp(dlb_handler_t handler, const_dlb_cpu_set_t mask)
Reclaim a set of CPUs.
Definition: DLB_interface_sp.c:156
int DLB_CallbackSet_sp(dlb_handler_t handler, dlb_callbacks_t which, dlb_callback_t callback, void *arg)
Setter for DLB callbacks.
Definition: DLB_interface_sp.c:92
int DLB_ReturnCpu_sp(dlb_handler_t handler, int cpuid)
Return the specific CPU if it has been reclaimed.
Definition: DLB_interface_sp.c:231
int DLB_BorrowCpusInMask_sp(dlb_handler_t handler, int ncpus, const_dlb_cpu_set_t mask)
Borrow some CPUs from a subset of CPUs.
Definition: DLB_interface_sp.c:216
int DLB_Return_sp(dlb_handler_t handler)
Return claimed CPUs of other subprocesses.
Definition: DLB_interface_sp.c:225
dlb_callbacks_t
Definition: dlb_types.h:61
void * dlb_cpu_set_t
Definition: dlb_types.h:26
void * dlb_handler_t
Definition: dlb_types.h:25
void(* dlb_callback_t)(void)
Definition: dlb_types.h:58
const void * const_dlb_cpu_set_t
Definition: dlb_types.h:27