HClib  0.3
Documentation for Habanero-C Library API
 All Data Structures Functions Typedefs Enumerations Groups
runtime-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 RUNTIME_HCLIB_H_
33 #define RUNTIME_HCLIB_H_
34 
35 #include "rt-hclib-def.h"
36 
41 /*
42  * Finish check in/out protocol for asyncs
43  */
44 void async_check_in_finish(async_task_t * async_task);
45 void async_check_out_finish(async_task_t * async_task);
46 
47 void check_in_finish(finish_t * finish);
48 void check_out_finish(finish_t * finish);
49 
50 void async_drop_phasers(async_task_t * async_task);
51 
52 /*
53  * Current async accessors
54  */
55 void set_current_async(async_task_t * async);
56 async_task_t * get_current_async();
57 
58 /*
59  * Finish utilities functions
60  */
61 finish_t * get_current_finish();
62 void end_finish_notify(finish_t * current_finish);
63 
64 
65 /*
66  * Allocators / Deallocators
67  */
68 
69 forasync1D_task_t * allocate_forasync1D_task();
70 forasync2D_task_t * allocate_forasync2D_task();
71 forasync3D_task_t * allocate_forasync3D_task();
72 void deallocate_forasync_task(forasync_task_t * forasync);
73 
74 async_task_t * allocate_async_task(async_t * async_def);
75 void deallocate_async_task(async_task_t * async);
76 
77 finish_t * allocate_finish();
78 void deallocate_finish(finish_t * finish);
79 
80 
81 /*
82  * Schedule an async for execution, transmitting finish, phasers, etc..
83  */
84 
85 void schedule_async(async_task_t * async_task, finish_t * finish_scope, int property);
86 
87 /*
88  * Hand over an async to the underlying runtime.
89  * The task must have been properly configured beforehand.
90  */
91 void try_schedule_async(async_task_t * async_task);
92 
93 
94 /*
95  * Workers info
96  */
97 int get_nb_workers();
98 int get_worker_id_hc();
99 
100 
105 void help_finish(finish_t * finish);
106 
107 #endif /* RUNTIME_HCLIB_H_ */