main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100755
|
|
File size:
1.2 KB
|
| Rev | Line | |
|---|
| [e3f356c] | 1 | /*
|
|---|
| 2 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 3 | !!! Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
|
|---|
| 4 | !!! and DataRaceBench project contributors. See the DataRaceBench/COPYRIGHT file for details.
|
|---|
| 5 | !!!
|
|---|
| 6 | !!! SPDX-License-Identifier: (BSD-3-Clause)
|
|---|
| 7 | !!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | /* This kernel imitates the nature of a program from the NAS Parallel Benchmarks 3.0 MG suit.
|
|---|
| 11 | * Due to missing construct to write r1[k]@38:9 synchronously, there is a Data Race.
|
|---|
| 12 | * Data Race Pair, r1[k]@38:9 and r1[k]@38:9.
|
|---|
| 13 | * */
|
|---|
| 14 |
|
|---|
| 15 | #include <stdio.h>
|
|---|
| 16 | #include <omp.h>
|
|---|
| 17 |
|
|---|
| 18 | #define N 8
|
|---|
| 19 |
|
|---|
| 20 | int main()
|
|---|
| 21 | {
|
|---|
| 22 | int i,j,k;
|
|---|
| 23 | double r1[N], r[N][N][N];
|
|---|
| 24 |
|
|---|
| 25 | for (i = 0; i < N; i++) {
|
|---|
| 26 | for (j = 0; j < N; j++) {
|
|---|
| 27 | for (k = 0; k < N; k++) {
|
|---|
| 28 | r[i][j][k] = i;
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | #pragma omp parallel for default(shared) private(j,k)
|
|---|
| 35 | for (i = 1; i < N-1; i++) {
|
|---|
| 36 | for (j = 1; j < N-1; j++) {
|
|---|
| 37 | for (k = 0; k < N; k++) {
|
|---|
| 38 | r1[k] = r[i][j-1][k] + r[i][j+1][k] + r[i-1][j][k] + r[i+1][j][k];
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | for (k = 0; k < N; k++) printf("%f ",r1[k]);
|
|---|
| 44 |
|
|---|
| 45 | printf("\n");
|
|---|
| 46 |
|
|---|
| 47 | return 0;
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.