1.23
2.0
main
test-branch
|
Last change
on this file since 5c27aa5 was 8f2b167, checked in by Manchun Zheng <zmanchun@…>, 12 years ago |
|
added a few more tests for omp library implementation, one of which reveals a bug related to $omp_read().
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1589 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
665 bytes
|
| Line | |
|---|
| 1 | #include<civlc.cvh>
|
|---|
| 2 | #include<civlc-omp.cvh>
|
|---|
| 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.