source: CIVL/text/include/civlc-omp.cvl@ f6ce0eb

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since f6ce0eb was f6ce0eb, checked in by Manchun Zheng <zmanchun@…>, 12 years ago

created library omp for omp to civlc transformation.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1055 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/* This header file defines standard types and provides
2 * function prototypes used in the OpenMP to CIVLC transformation.
3 */
4
5#ifdef __CIVLC_OMP__
6#else
7#define __CIVLC_OMP__
8
9#include<civlc.h>
10
11/* Specifies the sequence of iterations to be assigned to one
12 * thread executing an omp for loop. */
13typedef struct {
14 int numIters;
15 int collapse;
16 int iters[][];
17} CIVL_omp_loop_info;
18
19/* Specifies the subset of section assigned to one thread executing
20 * an omp sections construct. */
21typedef struct {
22 int numSections;
23 int sections[];
24} CIVL_omp_sections_info;
25
26/* The global work-sharing state. */
27typedef struct __omp_gws__ {
28 int size;
29 _Bool occupied[];
30 CIVL_omp_loop_info loops[];
31 CIVL_omp_sections_info sections[];
32} $omp_gws;
33
34/* The local state: a reference to a global object and a thread ID. */
35typedef struct __omp_ws__ {
36 int tid;
37 $omp_gws gws;
38} $omp_ws;
39
40/* Does a barrier on _barrier and a flush on all shared variables.
41 * After this completes, all local copies will agree with each other
42 * and with the shared copy of the variable, and all state variables
43 * will be -1. */
44void barrier_and_flush();
45
46/* Creates new global work-sharing state object, returning
47 * handle to it. nthreads is the number of threads in
48 * the parallel region. There is one of these per parallel region,
49 * created upon entering the region */
50$omp_gws $omp_gws_create($scope scope, int nthreads);
51
52void $omp_gws_destroy($omp_gws gws);
53
54/* Creates a local work-sharing object, which is basically
55 * a pair consisting of a global work-sharing handle and
56 * a thread id. */
57$omp_ws $omp_ws_create($scope scope, $omp_gws, int tid);
58
59void $omp_ws_destroy($omp_ws ws);
60
61/* for "for" loops only: called when a thread arrives, it
62 * returns the sequence of loop iterations to be performed by
63 * the thread. Parameter location is the ID of the model location
64 * of the top of the loop. It is needed to check that all threads
65 * encounter the same worksharing statements in the same order.
66 * The implementation will need the value start, the initial value of the loop variable;
67 * end is its final value; and inc, the increment (which can be
68 * positive or negative). These values can all be obtained by getting
69 * the loop statement from the location and evaluating the expressions
70 * occurring there.*/
71CIVL_omp_loop_info $omp_ws_arrive_loop($omp_ws ws, int location);
72
73/* for sections: called at arrival, returns the sequence of sections to
74 * be executed by calling thread. The sections are numbered in order,
75 * starting from 0. */
76CIVL_omp_sections_info $omp_ws_arrive_sections($omp_ws ws, int location);
77
78/* for single: called on arrival, returns whether or not to execute
79 * the single code */
80_Bool $omp_ws_arrive_single($omp_ws ws, int location);
81
82/* called when arriving at a barrier. This does not
83 * impose the barrier, you still need to call system function
84 * $barrier... for that. This is needed to ensure all threads
85 * in the team call the same sequence of worksharing and barrier
86 * constructs. */
87void $omp_ws_arrive_barrier($omp_ws ws, int location);
88
89#endif
Note: See TracBrowser for help on using the repository browser.