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-2015 Université de Bordeaux
4  * Copyright (C) 2010, 2011, 2012, 2013, 2014 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  STARPU_SSEND=(1<<5),
40  STARPU_ACCESS_MODE_MAX=(1<<6)
41  /* Note: other STARPU_* values in include/starpu_task_util.h */
42 };
43 
45 {
46  starpu_data_handle_t handle;
48 };
49 
51 
52 void starpu_data_unregister(starpu_data_handle_t handle);
53 void starpu_data_unregister_no_coherency(starpu_data_handle_t handle);
54 void starpu_data_unregister_submit(starpu_data_handle_t handle);
55 void starpu_data_invalidate(starpu_data_handle_t handle);
56 void starpu_data_invalidate_submit(starpu_data_handle_t handle);
57 
58 void starpu_data_advise_as_important(starpu_data_handle_t handle, unsigned is_important);
59 
60 int starpu_data_acquire(starpu_data_handle_t handle, enum starpu_data_access_mode mode);
61 int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode);
62 int starpu_data_acquire_cb(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
63 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);
64 #ifdef __GCC__
65 # define STARPU_DATA_ACQUIRE_CB(handle, mode, code) do \
66  { \ \
67  void callback(void *arg) \
68  { \
69  code; \
70  starpu_data_release(handle); \
71  } \
72  starpu_data_acquire_cb(handle, mode, callback, NULL); \
73  } \
74  while(0)
75 #endif
76 
77 void starpu_data_release(starpu_data_handle_t handle);
78 void starpu_data_release_on_node(starpu_data_handle_t handle, int node);
79 
81 
82 #define starpu_data_malloc_pinned_if_possible starpu_malloc
83 #define starpu_data_free_pinned_if_possible starpu_free
84 
85 int starpu_data_request_allocation(starpu_data_handle_t handle, unsigned node);
86 
87 int starpu_data_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
88 
90 {
91  STARPU_UNUSED = 0x00,
95 };
96 
97 unsigned starpu_worker_get_memory_node(unsigned workerid);
98 unsigned starpu_memory_nodes_get_count(void);
99 enum starpu_node_kind starpu_node_get_kind(unsigned node);
100 
101 void starpu_data_set_wt_mask(starpu_data_handle_t handle, uint32_t wt_mask);
102 
103 void starpu_data_set_sequential_consistency_flag(starpu_data_handle_t handle, unsigned flag);
106 
107 void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
108 
109 struct starpu_codelet;
110 
111 void starpu_data_set_reduction_methods(starpu_data_handle_t handle, struct starpu_codelet *redux_cl, struct starpu_codelet *init_cl);
112 
113 unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle_t handle, unsigned memory_node);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif /* __STARPU_DATA_H__ */