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-2020 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>
27 #include <datawizard/coherency.h>
28 #include <datawizard/copy_driver.h>
29 
31 
34 LIST_TYPE(_starpu_mem_chunk,
36  starpu_data_handle_t data;
37 
38  uint32_t footprint;
39 
40  /*
41  * When re-using a memchunk, the footprint of the data is not
42  * sufficient to determine whether two pieces of data have the same
43  * layout (there could be collision in the hash function ...) so we
44  * still keep a copy of the actual layout (ie. the data interface) to
45  * stay on the safe side while the memchunk is detached from an actual
46  * data.
47  */
48  struct starpu_data_interface_ops *ops;
49  void *chunk_interface;
50  size_t size_interface;
51 
53  unsigned automatically_allocated:1;
56  unsigned relaxed_coherency:2;
58  unsigned home:1;
60  unsigned clean:1;
62  unsigned diduse:1;
64  unsigned wontuse:1;
65 
72  size_t size;
73 
74  struct _starpu_data_replicate *replicate;
75 
80  struct _starpu_mem_chunk **remove_notify;
81 )
82 
83 void _starpu_init_mem_chunk_lists(void);
84 void _starpu_deinit_mem_chunk_lists(void);
85 void _starpu_mem_chunk_init_last(void);
86 void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned node, size_t size);
87 int _starpu_allocate_memory_on_node(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned is_prefetch);
88 size_t _starpu_free_all_automatically_allocated_buffers(unsigned node);
89 void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node);
90 void _starpu_memchunk_wont_use(struct _starpu_mem_chunk *m, unsigned nodec);
91 void _starpu_memchunk_dirty(struct _starpu_mem_chunk *mc, unsigned node);
92 
93 void _starpu_display_memory_stats_by_node(int node);
94 size_t _starpu_memory_reclaim_generic(unsigned node, unsigned force, size_t reclaim);
95 int _starpu_is_reclaiming(unsigned node);
96 
97 void _starpu_mem_chunk_disk_register(unsigned disk_memnode);
98 
99 #endif
coherency.h
_starpu_data_replicate
Definition: coherency.h:44
data_interface.h
copy_driver.h