source: CIVL/examples/omp/dataracebench-1.3.2/micro-benchmarks/DRB077-single-orig-no.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 100644
File size: 2.2 KB
Line 
1/*
2Copyright (c) 2017, Lawrence Livermore National Security, LLC.
3Produced at the Lawrence Livermore National Laboratory
4Written by Chunhua Liao, Pei-Hung Lin, Joshua Asplund,
5Markus Schordan, and Ian Karlin
6(email: liao6@llnl.gov, lin32@llnl.gov, asplund1@llnl.gov,
7schordan1@llnl.gov, karlin1@llnl.gov)
8LLNL-CODE-732144
9All rights reserved.
10This file is part of DataRaceBench. For details, see
11https://github.com/LLNL/dataracebench. Please also see the LICENSE file
12for our additional BSD notice.
13Redistribution and use in source and binary forms, with
14or without modification, are permitted provided that the following
15conditions are met:
16* Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the disclaimer below.
18* Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the disclaimer (as noted below)
20 in the documentation and/or other materials provided with the
21 distribution.
22* Neither the name of the LLNS/LLNL nor the names of its contributors
23 may be used to endorse or promote products derived from this
24 software without specific prior written permission.
25THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
26CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
27INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL
30SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE
31LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
32OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
38THE POSSIBILITY OF SUCH DAMAGE.
39*/
40
41/*
42A single directive is used to protect a write.
43*/
44#include <stdio.h>
45
46int main()
47{
48 int count=0;
49
50#pragma omp parallel shared(count)
51 {
52#pragma omp single
53 count += 1;
54 }
55
56 printf ("count= %d\n", count);
57 return 0;
58}
Note: See TracBrowser for help on using the repository browser.