Last change
on this file since 2261bcc was
5a1ae14,
checked in by Peter A. Buhr <pabuhr@…>, 14 months ago
|
remove superfluous inner_loop routine
|
-
Property mode set to
100644
|
File size:
516 bytes
|
Rev | Line | |
---|
[1ed5e9e] | 1 | #include <cofor.hfa> |
---|
| 2 | |
---|
| 3 | long total = 0; |
---|
| 4 | void add_num( void * arg ) { __atomic_fetch_add( &total, (long)arg, __ATOMIC_SEQ_CST ); } |
---|
| 5 | |
---|
| 6 | int main() { |
---|
| 7 | printf("start\n"); |
---|
| 8 | processor p[4]; |
---|
[e3784a50] | 9 | COFOR( i, 0, 10, __atomic_fetch_add( &total, i, __ATOMIC_SEQ_CST ); ); |
---|
[1ed5e9e] | 10 | parallel_stmt_t stmts[5] = { add_num, add_num, add_num, add_num, add_num }; |
---|
| 11 | void * nums[5] = { (void *)11, (void *)12, (void *)13, (void *)14, (void *)15 }; |
---|
| 12 | parallel( stmts, nums, 5 ); |
---|
| 13 | printf("total: %ld\n", total); |
---|
| 14 | printf("done\n"); |
---|
[5a1ae14] | 15 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.