HClib  0.3
Documentation for Habanero-C Library API
 All Data Structures Functions Typedefs Enumerations Groups
rt-hclib-def.h
1 /* Copyright (c) 2013, Rice University
2 
3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions are
5 met:
6 
7 1. Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9 2. Redistributions in binary form must reproduce the above
10  copyright notice, this list of conditions and the following
11  disclaimer in the documentation and/or other materials provided
12  with the distribution.
13 3. Neither the name of Rice University
14  nor the names of its contributors may be used to endorse or
15  promote products derived from this software without specific
16  prior written permission.
17 
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 
30 */
31 
32 #ifndef HCLIB_DEF_H_
33 #define HCLIB_DEF_H_
34 
35 
40 #include "hclib.h"
41 
42 #define CHECKED_EXECUTION 0
43 
47 typedef struct {
48  void * fct_ptr;
49  void * arg;
50  struct ddf_st ** ddf_list; // Null terminated list
51  struct _phased_t * phased_clause;
52 } async_t;
53 
54 typedef struct finish {
55  volatile int counter;
56 #if CHECKED_EXECUTION
57  int owner; //TODO correctness tracking
58 #endif
59  struct finish * parent;
60  struct _accum_t ** accumulators; //TODO generify that ?
61 } finish_t;
62 
63 struct _async_task_t;
64 struct _forasync_task_t;
65 
69 typedef void (*asyncExecutorFct_t) (struct _async_task_t * async_task);
70 typedef void (*forasyncExecutorFct_t) (struct _forasync_task_t *forasync_task);
71 
72 // Fwd declaration for phaser context
73 struct _phaser_context_t;
74 
79 typedef struct _async_task_t {
80  finish_t * current_finish;
81  async_t def;
82  #ifdef HAVE_PHASER
83  struct _phaser_context_t * phaser_context;
84  #endif
85 } async_task_t;
86 
87 typedef struct {
88  async_t * user;
89 } forasync_t;
90 
91 typedef struct _forasync_task_t {
92  async_task_t forasync_task;
94 
95 typedef struct {
96  forasync_t base;
97  loop_domain_t loop0;
98 } forasync1D_t;
99 
100 typedef struct _forasync_1D_task_t {
101  forasync_task_t task;
102  forasync1D_t def;
104 
105 typedef struct {
106  forasync_t base;
107  loop_domain_t loop0;
108  loop_domain_t loop1;
109 } forasync2D_t;
110 
111 typedef struct _forasync_2D_task_t {
112  forasync_task_t task;
113  forasync2D_t def;
115 
116 typedef struct {
117  forasync_t base;
118  loop_domain_t loop0;
119  loop_domain_t loop1;
120  loop_domain_t loop2;
121 } forasync3D_t;
122 
123 typedef struct _forasync_3D_task_t {
124  forasync_task_t task;
125  forasync3D_t def;
127 
128 
129 #endif /* HCLIB_DEF_H_ */