StarPU Handbook

starpu_data.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2009-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_DATA_H__
18#define __STARPU_DATA_H__
19
20#include <starpu.h>
21
22#ifdef __cplusplus
23 extern "C"
24{
25#endif
26
35 struct _starpu_data_state;
44 typedef struct _starpu_data_state* starpu_data_handle_t;
45
54 enum starpu_data_access_mode
55{
56 STARPU_NONE=0,
57 STARPU_R=(1<<0),
58 STARPU_W=(1<<1),
59 STARPU_RW=(STARPU_R|STARPU_W),
60 STARPU_SCRATCH=(1<<2),
85 STARPU_REDUX=(1<<3),
86 STARPU_COMMUTE=(1<<4),
96 STARPU_SSEND=(1<<5),
101 STARPU_LOCALITY=(1<<6),
113 STARPU_NOPLAN=(1<<8),
115 STARPU_ACCESS_MODE_MAX=(1<<9)
117};
118
119 struct starpu_data_interface_ops;
120
124 void starpu_data_set_name(starpu_data_handle_t handle, const char *name);
125
131 void starpu_data_set_coordinates_array(starpu_data_handle_t handle, unsigned dimensions, int dims[]);
132
138 void starpu_data_set_coordinates(starpu_data_handle_t handle, unsigned dimensions, ...);
139
146 unsigned starpu_data_get_coordinates_array(starpu_data_handle_t handle, unsigned dimensions, int dims[]);
147
158 void starpu_data_unregister(starpu_data_handle_t handle);
159
165 void starpu_data_unregister_no_coherency(starpu_data_handle_t handle);
166
177 void starpu_data_unregister_submit(starpu_data_handle_t handle);
178
185 void starpu_data_invalidate(starpu_data_handle_t handle);
186
191 void starpu_data_invalidate_submit(starpu_data_handle_t handle);
192
197 void starpu_data_advise_as_important(starpu_data_handle_t handle, unsigned is_important);
198
210#define STARPU_ACQUIRE_NO_NODE -1
211
217#define STARPU_ACQUIRE_NO_NODE_LOCK_ALL -2
218
238 int starpu_data_acquire(starpu_data_handle_t handle, enum starpu_data_access_mode mode);
239
246 int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode);
247
260 int starpu_data_acquire_cb(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
261
269 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);
270
285 int starpu_data_acquire_cb_sequential_consistency(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency);
286
294 int starpu_data_acquire_on_node_cb_sequential_consistency(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency);
295
296 int starpu_data_acquire_on_node_cb_sequential_consistency_quick(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency, int quick);
297
305 int starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency, int quick, long *pre_sync_jobid, long *post_sync_jobid);
306
316 int starpu_data_acquire_try(starpu_data_handle_t handle, enum starpu_data_access_mode mode);
317
325 int starpu_data_acquire_on_node_try(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode);
326
327#ifdef __GCC__
328
337# define STARPU_DATA_ACQUIRE_CB(handle, mode, code) do \
338 { \ \
339 void callback(void *arg) \
340 { \
341 code; \
342 starpu_data_release(handle); \
343 } \
344 starpu_data_acquire_cb(handle, mode, callback, NULL); \
345 } \
346 while(0)
347#endif
348
354 void starpu_data_release(starpu_data_handle_t handle);
355
362 void starpu_data_release_on_node(starpu_data_handle_t handle, int node);
363
371 typedef struct starpu_arbiter *starpu_arbiter_t;
372
377 starpu_arbiter_t starpu_arbiter_create(void) STARPU_ATTRIBUTE_MALLOC;
378
382 void starpu_data_assign_arbiter(starpu_data_handle_t handle, starpu_arbiter_t arbiter);
383
388 void starpu_arbiter_destroy(starpu_arbiter_t arbiter);
389
394 int starpu_data_request_allocation(starpu_data_handle_t handle, unsigned node);
395
405 int starpu_data_fetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
406
416 int starpu_data_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
417
418 int starpu_data_prefetch_on_node_prio(starpu_data_handle_t handle, unsigned node, unsigned async, int prio);
419
428 int starpu_data_idle_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
429 int starpu_data_idle_prefetch_on_node_prio(starpu_data_handle_t handle, unsigned node, unsigned async, int prio);
430
435 unsigned starpu_data_is_on_node(starpu_data_handle_t handle, unsigned node);
436
443 void starpu_data_wont_use(starpu_data_handle_t handle);
444
454 void starpu_data_set_wt_mask(starpu_data_handle_t handle, uint32_t wt_mask);
455
476 void starpu_data_set_sequential_consistency_flag(starpu_data_handle_t handle, unsigned flag);
477
481 unsigned starpu_data_get_sequential_consistency_flag(starpu_data_handle_t handle);
482
486 unsigned starpu_data_get_default_sequential_consistency_flag(void);
487
497 void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
498
505 void starpu_data_set_ooc_flag(starpu_data_handle_t handle, unsigned flag);
510 unsigned starpu_data_get_ooc_flag(starpu_data_handle_t handle);
511
515 void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
516
517 struct starpu_codelet;
518
525 void starpu_data_set_reduction_methods(starpu_data_handle_t handle, struct starpu_codelet *redux_cl, struct starpu_codelet *init_cl);
526
527 struct starpu_data_interface_ops* starpu_data_get_interface_ops(starpu_data_handle_t handle);
528
529 unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle_t handle, unsigned memory_node);
530
531 void starpu_memchunk_tidy(unsigned memory_node);
532
539 void starpu_data_set_user_data(starpu_data_handle_t handle, void* user_data);
540
544 void *starpu_data_get_user_data(starpu_data_handle_t handle);
545
548#ifdef __cplusplus
549}
550#endif
551
552#endif /* __STARPU_DATA_H__ */
starpu_codelet
Definition: starpu_task.h:250
starpu_data_interface_ops::name
char * name
Definition: starpu_data_interfaces.h:568
starpu_data_interface_ops
Definition: starpu_data_interfaces.h:366
starpu_data_set_user_data
void starpu_data_set_user_data(starpu_data_handle_t handle, void *user_data)
starpu_data_invalidate_submit
void starpu_data_invalidate_submit(starpu_data_handle_t handle)
starpu_data_set_default_sequential_consistency_flag
void starpu_data_set_default_sequential_consistency_flag(unsigned flag)
starpu_data_set_reduction_methods
void starpu_data_set_reduction_methods(starpu_data_handle_t handle, struct starpu_codelet *redux_cl, struct starpu_codelet *init_cl)
starpu_data_access_mode
starpu_data_access_mode
Definition: starpu_data.h:55
starpu_data_set_sequential_consistency_flag
void starpu_data_set_sequential_consistency_flag(starpu_data_handle_t handle, unsigned flag)
starpu_arbiter_destroy
void starpu_arbiter_destroy(starpu_arbiter_t arbiter)
starpu_data_acquire_cb
int starpu_data_acquire_cb(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void(*callback)(void *), void *arg)
starpu_data_acquire_on_node
int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode)
starpu_data_invalidate
void starpu_data_invalidate(starpu_data_handle_t handle)
starpu_data_unregister_submit
void starpu_data_unregister_submit(starpu_data_handle_t handle)
starpu_data_prefetch_on_node
int starpu_data_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async)
starpu_data_unregister
void starpu_data_unregister(starpu_data_handle_t handle)
starpu_data_release_on_node
void starpu_data_release_on_node(starpu_data_handle_t handle, int node)
starpu_data_acquire_cb_sequential_consistency
int starpu_data_acquire_cb_sequential_consistency(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void(*callback)(void *), void *arg, int sequential_consistency)
starpu_data_acquire_on_node_try
int starpu_data_acquire_on_node_try(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode)
starpu_data_get_ooc_flag
unsigned starpu_data_get_ooc_flag(starpu_data_handle_t handle)
starpu_arbiter_create
starpu_arbiter_t starpu_arbiter_create(void) STARPU_ATTRIBUTE_MALLOC
starpu_data_get_coordinates_array
unsigned starpu_data_get_coordinates_array(starpu_data_handle_t handle, unsigned dimensions, int dims[])
starpu_data_set_ooc_flag
void starpu_data_set_ooc_flag(starpu_data_handle_t handle, unsigned flag)
starpu_data_is_on_node
unsigned starpu_data_is_on_node(starpu_data_handle_t handle, unsigned node)
starpu_data_acquire_on_node_cb
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)
starpu_data_acquire_try
int starpu_data_acquire_try(starpu_data_handle_t handle, enum starpu_data_access_mode mode)
starpu_data_query_status
void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested)
starpu_data_assign_arbiter
void starpu_data_assign_arbiter(starpu_data_handle_t handle, starpu_arbiter_t arbiter)
starpu_data_fetch_on_node
int starpu_data_fetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async)
starpu_data_set_coordinates_array
void starpu_data_set_coordinates_array(starpu_data_handle_t handle, unsigned dimensions, int dims[])
starpu_data_unregister_no_coherency
void starpu_data_unregister_no_coherency(starpu_data_handle_t handle)
starpu_data_set_name
void starpu_data_set_name(starpu_data_handle_t handle, const char *name)
starpu_data_get_user_data
void * starpu_data_get_user_data(starpu_data_handle_t handle)
starpu_data_set_coordinates
void starpu_data_set_coordinates(starpu_data_handle_t handle, unsigned dimensions,...)
starpu_arbiter_t
struct starpu_arbiter * starpu_arbiter_t
Definition: starpu_data.h:371
starpu_data_request_allocation
int starpu_data_request_allocation(starpu_data_handle_t handle, unsigned node)
starpu_data_get_sequential_consistency_flag
unsigned starpu_data_get_sequential_consistency_flag(starpu_data_handle_t handle)
starpu_data_idle_prefetch_on_node
int starpu_data_idle_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async)
starpu_data_handle_t
struct _starpu_data_state * starpu_data_handle_t
Definition: starpu_data.h:44
starpu_data_release
void starpu_data_release(starpu_data_handle_t handle)
starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids
int starpu_data_acquire_on_node_cb_sequential_consistency_sync_jobids(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void(*callback)(void *), void *arg, int sequential_consistency, int quick, long *pre_sync_jobid, long *post_sync_jobid)
starpu_data_set_wt_mask
void starpu_data_set_wt_mask(starpu_data_handle_t handle, uint32_t wt_mask)
starpu_data_acquire
int starpu_data_acquire(starpu_data_handle_t handle, enum starpu_data_access_mode mode)
starpu_data_advise_as_important
void starpu_data_advise_as_important(starpu_data_handle_t handle, unsigned is_important)
starpu_data_get_default_sequential_consistency_flag
unsigned starpu_data_get_default_sequential_consistency_flag(void)
starpu_data_acquire_on_node_cb_sequential_consistency
int starpu_data_acquire_on_node_cb_sequential_consistency(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void(*callback)(void *), void *arg, int sequential_consistency)
starpu_data_wont_use
void starpu_data_wont_use(starpu_data_handle_t handle)
STARPU_SCRATCH
@ STARPU_SCRATCH
Definition: starpu_data.h:60
STARPU_ACCESS_MODE_MAX
@ STARPU_ACCESS_MODE_MAX
Definition: starpu_data.h:115
STARPU_SSEND
@ STARPU_SSEND
Definition: starpu_data.h:96
STARPU_W
@ STARPU_W
Definition: starpu_data.h:58
STARPU_RW
@ STARPU_RW
Definition: starpu_data.h:59
STARPU_REDUX
@ STARPU_REDUX
Definition: starpu_data.h:85
STARPU_R
@ STARPU_R
Definition: starpu_data.h:57
STARPU_COMMUTE
@ STARPU_COMMUTE
Definition: starpu_data.h:86
STARPU_LOCALITY
@ STARPU_LOCALITY
Definition: starpu_data.h:101
STARPU_NOPLAN
@ STARPU_NOPLAN
Definition: starpu_data.h:113
STARPU_NONE
@ STARPU_NONE
Definition: starpu_data.h:56
STARPU_ATTRIBUTE_MALLOC
#define STARPU_ATTRIBUTE_MALLOC
Definition: starpu_util.h:112
starpu.h