StarPU Handbook
starpu_stdlib.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2010-2013,2015-2017,2019 CNRS
4  * Copyright (C) 2017 Inria
5  * Copyright (C) 2010-2016,2019 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_STDLIB_H__
20 #define __STARPU_STDLIB_H__
21 
22 #include <starpu.h>
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
38 #define STARPU_MALLOC_PINNED ((1ULL)<<1)
39 
51 #define STARPU_MALLOC_COUNT ((1ULL)<<2)
52 
67 #define STARPU_MALLOC_NORECLAIM ((1ULL)<<3)
68 
74 #define STARPU_MEMORY_WAIT ((1ULL)<<4)
75 
81 #define STARPU_MEMORY_OVERFLOW ((1ULL)<<5)
82 
92 #define STARPU_MALLOC_SIMULATION_FOLDED ((1ULL)<<6)
93 
99 #define starpu_data_malloc_pinned_if_possible starpu_malloc
100 
106 #define starpu_data_free_pinned_if_possible starpu_free
107 
114 void starpu_malloc_set_align(size_t align);
115 
124 int starpu_malloc(void **A, size_t dim);
125 
130 int starpu_free(void *A);
131 
136 int starpu_malloc_flags(void **A, size_t dim, int flags);
137 
143 int starpu_free_flags(void *A, size_t dim, int flags);
144 
145 typedef int (*starpu_malloc_hook)(unsigned dst_node, void **A, size_t dim, int flags);
146 typedef int (*starpu_free_hook)(unsigned dst_node, void *A, size_t dim, int flags);
147 
163 void starpu_malloc_set_hooks(starpu_malloc_hook malloc_hook, starpu_free_hook free_hook);
164 
171 int starpu_memory_pin(void *addr, size_t size);
172 
177 int starpu_memory_unpin(void *addr, size_t size);
178 
184 starpu_ssize_t starpu_memory_get_total(unsigned node);
185 
191 starpu_ssize_t starpu_memory_get_available(unsigned node);
192 
197 starpu_ssize_t starpu_memory_get_total_all_nodes(void);
198 
204 starpu_ssize_t starpu_memory_get_available_all_nodes(void);
205 
217 int starpu_memory_allocate(unsigned node, size_t size, int flags);
218 
230 void starpu_memory_deallocate(unsigned node, size_t size);
231 
242 void starpu_memory_wait_available(unsigned node, size_t size);
243 
244 void starpu_sleep(float nb_sec);
245 void starpu_usleep(float nb_micro_sec);
246 
249 #ifdef __cplusplus
250 }
251 #endif
252 
253 #endif /* __STARPU_STDLIB_H__ */
starpu_sleep
void starpu_sleep(float nb_sec)
starpu_memory_deallocate
void starpu_memory_deallocate(unsigned node, size_t size)
starpu_memory_get_available
starpu_ssize_t starpu_memory_get_available(unsigned node)
starpu_malloc
int starpu_malloc(void **A, size_t dim)
starpu_memory_allocate
int starpu_memory_allocate(unsigned node, size_t size, int flags)
starpu.h
starpu_malloc_flags
int starpu_malloc_flags(void **A, size_t dim, int flags)
starpu_memory_get_total_all_nodes
starpu_ssize_t starpu_memory_get_total_all_nodes(void)
starpu_memory_get_available_all_nodes
starpu_ssize_t starpu_memory_get_available_all_nodes(void)
starpu_memory_pin
int starpu_memory_pin(void *addr, size_t size)
starpu_memory_wait_available
void starpu_memory_wait_available(unsigned node, size_t size)
starpu_memory_unpin
int starpu_memory_unpin(void *addr, size_t size)
starpu_free_flags
int starpu_free_flags(void *A, size_t dim, int flags)
starpu_malloc_set_align
void starpu_malloc_set_align(size_t align)
starpu_malloc_set_hooks
void starpu_malloc_set_hooks(starpu_malloc_hook malloc_hook, starpu_free_hook free_hook)
starpu_free
int starpu_free(void *A)
starpu_memory_get_total
starpu_ssize_t starpu_memory_get_total(unsigned node)