HClib  0.3
Documentation for Habanero-C Library API
 All Data Structures Functions Typedefs Enumerations Groups
hclib.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_H_
33 #define HCLIB_H_
34 
46 #include "accumulator.h"
47 #include "ddf.h"
48 
49 //TODO make this conditional in phased.h
50 struct _phased_t;
51 
56 void hclib_init(int * argc, char ** argv);
57 
62 void hclib_finalize();
63 
64 
65 //
66 // Default async arguments
67 //
68 
70 #define NO_PROP 0
71 
72 #define NO_ARG NULL
73 
74 #define NO_DATUM NULL
75 
76 #define NO_DDF NULL
77 
78 #define NO_PHASER NULL
79 
80 #define PHASER_TRANSMIT_ALL ((int) 0x1)
81 
82 #define NO_ACCUM NULL
83 
84 
85 //
86 // Async definition and API
87 //
88 
93 typedef void (*asyncFct_t) (void * arg);
94 
95 // forward declaration for phased clause defined in phased.h
96 struct _phased_t;
97 
106 void async(asyncFct_t fct_ptr, void * arg,
107  struct ddf_st ** ddf_list, struct _phased_t * phased_clause, int property);
108 
109 
110 //
111 // Forasync definition and API
112 //
113 
115 typedef int forasync_mode_t;
116 
118 #define FORASYNC_MODE_RECURSIVE 1
119 
120 #define FORASYNC_MODE_FLAT 0
121 
127 typedef void (*forasync1D_Fct_t) (void * arg,int index);
128 
135 typedef void (*forasync2D_Fct_t) (void * arg,int index_outer,int index_inner);
136 
144 typedef void (*forasync3D_Fct_t) (void * arg,int index_outer,int index_mid,int index_inner);
145 
153 typedef struct _loop_domain_t {
154  int low;
155  int high;
156  int stride;
157  int tile;
158 } loop_domain_t;
159 
176 void forasync(void* forasync_fct, void * argv, struct ddf_st ** ddf_list, struct _phased_t * phased_clause,
177  struct _accumed_t * accumed, int dim, loop_domain_t * domain, forasync_mode_t mode);
178 
182 void start_finish();
183 
187 void end_finish();
188 
193 #endif /* HCLIB_H_ */