source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks/DRB157-missingorderedsimd-orig-gpu-yes.c

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.1 KB
Line 
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/*
11This kernel is modifie version from “DataRaceOnAccelerator A Micro-benchmark Suite for Evaluating
12Correctness Tools Targeting Accelerators” by Adrian Schmitz et al.
13Due to distribute parallel for simd directive at line 31, there is a data race at line 33.
14Data Rae Pairs, var@33:5 and var@33:12
15.*/
16
17#include <stdio.h>
18#include <omp.h>
19#include <stdlib.h>
20#define N 100
21#define C 16
22
23int main(){
24 int var[N];
25
26 for(int i=0; i<N; i++){
27 var[i]=0;
28 }
29
30 #pragma omp target map(tofrom:var[0:N]) device(0)
31 #pragma omp teams distribute parallel for simd safelen(C)
32 for (int i=C; i<N; i++){
33 var[i]=var[i-C]+1;
34 }
35
36 printf("%d\n",var[97]);
37
38 return 0;
39}
Note: See TracBrowser for help on using the repository browser.