HClib  0.3
Documentation for Habanero-C Library API
 All Data Structures Functions Typedefs Enumerations Groups
runtime-support.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 RUNTIME_IMPL_H_
33 #define RUNTIME_IMPL_H_
34 
35 #include "hclib.h"
36 #include "rt-hclib-def.h"
37 
43 //
44 // Runtime life-cycle management
45 //
46 
50 void runtime_init(int * argc, char ** argv);
51 
55 void runtime_finalize();
56 
57 /*
58  * @brief Retrieve the async task being currently executed
59  */
60 async_task_t * get_current_async();
61 
62 
63 
64 //
65 // Task conversion
66 //
67 
72 struct ddt_st;
73 
77 async_task_t * rt_ddt_to_async_task(struct ddt_st * ddt);
78 
82 struct ddt_st * rt_async_task_to_ddt(async_task_t * async_task);
83 
84 
85 //
86 // Task allocation
87 //
88 
95 async_task_t * rt_allocate_async_task();
96 void rt_deallocate_async_task(async_task_t * async_task);
97 
98 forasync1D_task_t * rt_allocate_forasync1D_task();
99 forasync2D_task_t * rt_allocate_forasync2D_task();
100 forasync3D_task_t * rt_allocate_forasync3D_task();
101 
105 async_task_t * rt_allocate_ddt(struct ddf_st ** ddf_list);
106 
107 
108 //
109 // Finish allocation
110 //
111 
118 finish_t * rt_allocate_finish();
119 
123 void rt_deallocate_finish(finish_t *);
124 
125 
126 //
127 // Scheduling
128 //
129 
133 void rt_schedule_async(async_task_t * async);
134 
138 void rt_finish_reached_zero(finish_t * finish);
139 
145 void rt_help_finish(finish_t * finish);
146 
147 
148 //
149 // Worker info
150 //
151 
155 int rt_get_nb_workers();
156 
160 int rt_get_worker_id();
161 
162 #endif /* RUNTIME_IMPL_H_ */