source:
CIVL/examples/omp/DataRaceBench/micro-benchmarks/matrixvector2-orig-no.c@
af3b8e4
| Last change on this file since af3b8e4 was 36a61f3, checked in by , 9 years ago | |
|---|---|
|
|
| File size: 387 bytes | |
| Line | |
|---|---|
| 1 | // Matrix-vector multiplication, inner level parallelization. |
| 2 | #define N 1000 |
| 3 | |
| 4 | double a[N][N],v[N],v_out[N]; |
| 5 | |
| 6 | void mv() |
| 7 | { |
| 8 | int i,j; |
| 9 | for (i = 0; i < N; i++) |
| 10 | { |
| 11 | float sum = 0.0; |
| 12 | #pragma omp parallel for reduction(+:sum) |
| 13 | for (j = 0; j < N; j++) |
| 14 | { |
| 15 | sum += a[i][j]*v[j]; |
| 16 | } |
| 17 | v_out[i] = sum; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | mv(); |
| 24 | return 0; |
| 25 | } |
| 26 |
Note:
See TracBrowser
for help on using the repository browser.
