source: CIVL/examples/library/omp/shared.cvl@ e275f74

1.23 2.0 main test-branch
Last change on this file since e275f74 was 3af26ac, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

make library names consistent; clean up stdlib library; fixed examples accordingly.

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

  • Property mode set to 100644
File size: 664 bytes
Line 
1#include<civlc.cvh>
2#include<civl-omp.cvh>
3#include<stdio.h>
4
5void main(){
6 int data = 0;
7 $omp_gteam gteam = $omp_gteam_create($here, 3);
8 $omp_gshared gshared = $omp_gshared_create(gteam, &data);
9
10 void thread(int tid) {
11 int data_local;
12 int data_status = EMPTY;
13 $omp_team team = $omp_team_create($here, gteam, tid);
14 $omp_shared shared = $omp_shared_create(team, gshared, &data_local, &data_status);
15
16 printf("Hello from thread %d\n", tid);
17 $omp_shared_destroy(shared);
18 $omp_team_destroy(team);
19 }
20
21 $parfor (int i: ($domain){ 0 .. 2 }) {
22 thread(i);
23 }
24 $omp_gshared_destroy(gshared);
25 $omp_gteam_destroy(gteam);
26}
Note: See TracBrowser for help on using the repository browser.