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-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 __STARPU_STDLIB_H__
18#define __STARPU_STDLIB_H__
19
20#include <starpu.h>
21
22#ifdef __cplusplus
23 extern "C"
24{
25#endif
26
36#define STARPU_MALLOC_PINNED ((1ULL)<<1)
37
49#define STARPU_MALLOC_COUNT ((1ULL)<<2)
50
65#define STARPU_MALLOC_NORECLAIM ((1ULL)<<3)
66
72#define STARPU_MEMORY_WAIT ((1ULL)<<4)
73
79#define STARPU_MEMORY_OVERFLOW ((1ULL)<<5)
80
90#define STARPU_MALLOC_SIMULATION_FOLDED ((1ULL)<<6)
91
97#define starpu_data_malloc_pinned_if_possible starpu_malloc
98
104#define starpu_data_free_pinned_if_possible starpu_free
105
112 void starpu_malloc_set_align(size_t align);
113
122 int starpu_malloc(void **A, size_t dim);
123
128 int starpu_free(void *A);
129
134 int starpu_malloc_flags(void **A, size_t dim, int flags);
135
141 int starpu_free_flags(void *A, size_t dim, int flags);
142
143 typedef int (*starpu_malloc_hook)(unsigned dst_node, void **A, size_t dim, int flags);
144 typedef int (*starpu_free_hook)(unsigned dst_node, void *A, size_t dim, int flags);
145
161 void starpu_malloc_set_hooks(starpu_malloc_hook malloc_hook, starpu_free_hook free_hook);
162
169 int starpu_memory_pin(void *addr, size_t size);
170
175 int starpu_memory_unpin(void *addr, size_t size);
176
182starpu_ssize_t starpu_memory_get_total(unsigned node);
183
189starpu_ssize_t starpu_memory_get_available(unsigned node);
190
195starpu_ssize_t starpu_memory_get_total_all_nodes(void);
196
202starpu_ssize_t starpu_memory_get_available_all_nodes(void);
203
215 int starpu_memory_allocate(unsigned node, size_t size, int flags);
216
228 void starpu_memory_deallocate(unsigned node, size_t size);
229
240 void starpu_memory_wait_available(unsigned node, size_t size);
241
242 void starpu_sleep(float nb_sec);
243 void starpu_usleep(float nb_micro_sec);
244
247#ifdef __cplusplus
248}
249#endif
250
251#endif /* __STARPU_STDLIB_H__ */
starpu_memory_get_available
starpu_ssize_t starpu_memory_get_available(unsigned node)
starpu_memory_get_available_all_nodes
starpu_ssize_t starpu_memory_get_available_all_nodes(void)
starpu_memory_unpin
int starpu_memory_unpin(void *addr, size_t size)
starpu_malloc
int starpu_malloc(void **A, size_t dim)
starpu_malloc_set_hooks
void starpu_malloc_set_hooks(starpu_malloc_hook malloc_hook, starpu_free_hook free_hook)
starpu_malloc_set_align
void starpu_malloc_set_align(size_t align)
starpu_memory_get_total
starpu_ssize_t starpu_memory_get_total(unsigned node)
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_allocate
int starpu_memory_allocate(unsigned node, size_t size, int flags)
starpu_free
int starpu_free(void *A)
starpu_memory_deallocate
void starpu_memory_deallocate(unsigned node, size_t size)
starpu_memory_get_total_all_nodes
starpu_ssize_t starpu_memory_get_total_all_nodes(void)
starpu_free_flags
int starpu_free_flags(void *A, size_t dim, int flags)
starpu_malloc_flags
int starpu_malloc_flags(void **A, size_t dim, int flags)
starpu_sleep
void starpu_sleep(float nb_sec)
starpu.h