source: CIVL/examples/omp/DataRaceBench/micro-benchmarks/matrixvector2-orig-no.c@ af3b8e4

1.23 2.0 main test-branch
Last change on this file since af3b8e4 was 36a61f3, checked in by Ziqing Luo <ziqing@…>, 9 years ago

Commit DataRaceBench into CIVL examples

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@4225 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 387 bytes
Line 
1// Matrix-vector multiplication, inner level parallelization.
2#define N 1000
3
4double a[N][N],v[N],v_out[N];
5
6void 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
21int main()
22{
23 mv();
24 return 0;
25}
26
Note: See TracBrowser for help on using the repository browser.