source:
CIVL/mods/dev.civl.abc/examples/alias/arrayaccess.cvl
| Last change on this file was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 311 bytes | |
| Line | |
|---|---|
| 1 | |
| 2 | $input int N=3; |
| 3 | int a[N];//array a is shared by all threads but each thread writes to different elements of a |
| 4 | |
| 5 | void thread1(int tid){ |
| 6 | a[tid]=tid; |
| 7 | } |
| 8 | |
| 9 | void thread2(int tid, int* p){ |
| 10 | *p=*p+tid; |
| 11 | } |
| 12 | |
| 13 | int main(void){ |
| 14 | $parfor(int i: 0 .. N-1) |
| 15 | thread1(i); |
| 16 | $parfor(int i: 0 .. N-1) |
| 17 | thread2(i, &a[i]); |
| 18 | } |
| 19 |
Note:
See TracBrowser
for help on using the repository browser.
