StarPU Handbook
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
starpu_data.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2010-2014 Université de Bordeaux 1
4  * Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
5  *
6  * StarPU 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 2.1 of the License, or (at
9  * your option) any later version.
10  *
11  * StarPU is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  *
15  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
16  */
17 
18 #ifndef __STARPU_DATA_H__
19 #define __STARPU_DATA_H__
20 
21 #include <starpu.h>
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 struct _starpu_data_state;
29 typedef struct _starpu_data_state* starpu_data_handle_t;
30 
32 {
34  STARPU_R=(1<<0),
35  STARPU_W=(1<<1),
38  STARPU_REDUX=(1<<3)
39 };
40 
42 {
43  starpu_data_handle_t handle;
45 };
46 
48 
49 void starpu_data_unregister(starpu_data_handle_t handle);
50 void starpu_data_unregister_no_coherency(starpu_data_handle_t handle);
51 void starpu_data_unregister_submit(starpu_data_handle_t handle);
52 void starpu_data_invalidate(starpu_data_handle_t handle);
53 void starpu_data_invalidate_submit(starpu_data_handle_t handle);
54 
55 void starpu_data_advise_as_important(starpu_data_handle_t handle, unsigned is_important);
56 
57 int starpu_data_acquire(starpu_data_handle_t handle, enum starpu_data_access_mode mode);
58 int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode);
59 int starpu_data_acquire_cb(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
60 int starpu_data_acquire_on_node_cb(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
61 #ifdef __GCC__
62 # define STARPU_DATA_ACQUIRE_CB(handle, mode, code) do \
63  { \ \
64  void callback(void *arg) \
65  { \
66  code; \
67  starpu_data_release(handle); \
68  } \
69  starpu_data_acquire_cb(handle, mode, callback, NULL); \
70  } \
71  while(0)
72 #endif
73 
74 void starpu_data_release(starpu_data_handle_t handle);
75 void starpu_data_release_on_node(starpu_data_handle_t handle, int node);
76 
78 
79 #define starpu_data_malloc_pinned_if_possible starpu_malloc
80 #define starpu_data_free_pinned_if_possible starpu_free
81 
82 int starpu_data_request_allocation(starpu_data_handle_t handle, unsigned node);
83 
84 int starpu_data_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
85 
87 {
88  STARPU_UNUSED = 0x00,
92 };
93 
94 unsigned starpu_worker_get_memory_node(unsigned workerid);
95 unsigned starpu_memory_nodes_get_count(void);
96 enum starpu_node_kind starpu_node_get_kind(unsigned node);
97 
98 void starpu_data_set_wt_mask(starpu_data_handle_t handle, uint32_t wt_mask);
99 
100 void starpu_data_set_sequential_consistency_flag(starpu_data_handle_t handle, unsigned flag);
103 
104 void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
105 
106 struct starpu_codelet;
107 
108 void starpu_data_set_reduction_methods(starpu_data_handle_t handle, struct starpu_codelet *redux_cl, struct starpu_codelet *init_cl);
109 
110 int starpu_data_set_rank(starpu_data_handle_t handle, int rank);
111 int starpu_data_get_rank(starpu_data_handle_t handle);
112 
113 int starpu_data_set_tag(starpu_data_handle_t handle, int tag);
114 int starpu_data_get_tag(starpu_data_handle_t handle);
115 
116 unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle_t handle, unsigned memory_node);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* __STARPU_DATA_H__ */