diff options
author | Tom Stellard <tstellar@redhat.com> | 2019-04-11 23:41:27 +0000 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2019-04-11 23:41:27 +0000 |
commit | 0c48ee0c90739da26986252ab5147810351eeff3 (patch) | |
tree | c4688322ef6ff3153683eab622de31ef851da282 /final/runtime/test/worksharing/sections/omp_parallel_sections_private.c | |
parent | e82e2d89e6770bb05a0eec2db8f30058228d7ac6 (diff) |
Creating release candidate final from release_710 branchsvn-tags/RELEASE_710
git-svn-id: https://llvm.org/svn/llvm-project/openmp/tags/RELEASE_710@358242 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'final/runtime/test/worksharing/sections/omp_parallel_sections_private.c')
-rw-r--r-- | final/runtime/test/worksharing/sections/omp_parallel_sections_private.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/final/runtime/test/worksharing/sections/omp_parallel_sections_private.c b/final/runtime/test/worksharing/sections/omp_parallel_sections_private.c new file mode 100644 index 0000000..7dab295 --- /dev/null +++ b/final/runtime/test/worksharing/sections/omp_parallel_sections_private.c @@ -0,0 +1,64 @@ +// RUN: %libomp-compile-and-run +#include <stdio.h> +#include "omp_testsuite.h" + +int test_omp_parallel_sections_private() +{ + int sum; + int sum0; + int i; + int known_sum; + + sum = 7; + sum0=0; + + #pragma omp parallel sections private(sum0, i) + { + #pragma omp section + { + sum0=0; + for (i=1;i<400;i++) + sum0=sum0+i; + #pragma omp critical + { + sum= sum+sum0; + } + } + #pragma omp section + { + sum0=0; + for(i=400;i<700;i++) + sum0=sum0+i; + #pragma omp critical + { + sum= sum+sum0; + } + } + #pragma omp section + { + sum0=0; + for(i=700;i<1000;i++) + sum0=sum0+i; + #pragma omp critical + { + sum= sum+sum0; + } + } + } + + known_sum=(999*1000)/2+7; + return (known_sum==sum); +} /* end of check_section_private*/ + +int main() +{ + int i; + int num_failed=0; + + for(i = 0; i < REPETITIONS; i++) { + if(!test_omp_parallel_sections_private()) { + num_failed++; + } + } + return num_failed; +} |