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

1.23 2.0 main test-branch
Last change on this file since 50f834b was 118a7b7, checked in by Manchun Zheng <zmanchun@…>, 12 years ago

implemented omp_gws_create and omp_ws_create.

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

  • Property mode set to 100644
File size: 3.2 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 nthreads;
29 _Bool isInit[];
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
52/* Deallocates the object that associates with the given
53 * $omp_gws handle. */
54void $omp_gws_destroy($omp_gws gws);
55
56/* Creates a local work-sharing object, which is basically
57 * a pair consisting of a global work-sharing handle and
58 * a thread id. */
59$omp_ws $omp_ws_create($scope scope, $omp_gws, int tid);
60
61/* Deallocates the object that associates with the given
62 * $omp_ws handle. */
63void $omp_ws_destroy($omp_ws ws);
64
65/* for "for" loops only: called when a thread arrives, it
66 * returns the sequence of loop iterations to be performed by
67 * the thread. Parameter location is the ID of the model location
68 * of the top of the loop. It is needed to check that all threads
69 * encounter the same worksharing statements in the same order.
70 * The implementation will need the value start, the initial value of the loop variable;
71 * end is its final value; and inc, the increment (which can be
72 * positive or negative). These values can all be obtained by getting
73 * the loop statement from the location and evaluating the expressions
74 * occurring there.*/
75CIVL_omp_loop_info $omp_ws_arrive_loop($omp_ws ws, int location);
76
77/* for sections: called at arrival, returns the sequence of sections to
78 * be executed by calling thread. The sections are numbered in order,
79 * starting from 0. */
80CIVL_omp_sections_info $omp_ws_arrive_sections($omp_ws ws, int location);
81
82/* for single: called on arrival, returns whether or not to execute
83 * the single code */
84_Bool $omp_ws_arrive_single($omp_ws ws, int location);
85
86/* called when arriving at a barrier. This does not
87 * impose the barrier, you still need to call system function
88 * $barrier... for that. This is needed to ensure all threads
89 * in the team call the same sequence of worksharing and barrier
90 * constructs. */
91void $omp_ws_arrive_barrier($omp_ws ws, int location);
92
93#endif
Note: See TracBrowser for help on using the repository browser.