1.23
2.0
main
test-branch
| Rev | Line | |
|---|
| [8f2b167] | 1 | #include<civlc.cvh>
|
|---|
| [3af26ac] | 2 | #include<civl-omp.cvh>
|
|---|
| [8f2b167] | 3 | #include<stdio.h>
|
|---|
| 4 |
|
|---|
| 5 | void 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.