StarPU Internal Handbook
memalloc.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2008-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 __MEMALLOC_H__
18#define __MEMALLOC_H__
19
22#include <starpu.h>
23#include <common/config.h>
24
25#include <common/list.h>
30
32
35LIST_TYPE(_starpu_mem_chunk,
37 starpu_data_handle_t data;
38
39 uint32_t footprint;
40
41 /*
42 * When re-using a memchunk, the footprint of the data is not
43 * sufficient to determine whether two pieces of data have the same
44 * layout (there could be collision in the hash function ...) so we
45 * still keep a copy of the actual layout (ie. the data interface) to
46 * stay on the safe side while the memchunk is detached from an actual
47 * data.
48 */
49 struct starpu_data_interface_ops *ops;
50 void *chunk_interface;
51 size_t size_interface;
52
54 unsigned automatically_allocated:1;
57 unsigned relaxed_coherency:2;
59 unsigned home:1;
61 unsigned clean:1;
63 unsigned diduse:1;
65 unsigned wontuse:1;
66
73 size_t size;
74
75 struct _starpu_data_replicate *replicate;
76
81 struct _starpu_mem_chunk **remove_notify;
82)
83
84void _starpu_init_mem_chunk_lists(void);
85void _starpu_deinit_mem_chunk_lists(void);
86void _starpu_mem_chunk_init_last(void);
87void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned node, size_t size);
88int _starpu_allocate_memory_on_node(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, enum _starpu_is_prefetch is_prefetch);
89size_t _starpu_free_all_automatically_allocated_buffers(unsigned node);
90void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node);
91void _starpu_memchunk_wont_use(struct _starpu_mem_chunk *m, unsigned nodec);
92void _starpu_memchunk_dirty(struct _starpu_mem_chunk *mc, unsigned node);
93
94void _starpu_display_memory_stats_by_node(int node);
95size_t _starpu_memory_reclaim_generic(unsigned node, unsigned force, size_t reclaim);
96int _starpu_is_reclaiming(unsigned node);
97
98void _starpu_mem_chunk_disk_register(unsigned disk_memnode);
99
100#endif
Definition: coherency.h:45
_starpu_is_prefetch
Definition: copy_driver.h:51