diff options
| author | Jim Cownie <james.h.cownie@intel.com> | 2014-05-10 17:02:09 +0000 |
|---|---|---|
| committer | Jim Cownie <james.h.cownie@intel.com> | 2014-05-10 17:02:09 +0000 |
| commit | 18d8473f185999e418dcb62ee4d8a671c2eacee5 (patch) | |
| tree | d212f5cac426b2be33035984fc56623f92f5ddde /openmp/testsuite/c/omp_single.c | |
| parent | 281f9d0e97dca0594a15341e3c927e2667773104 (diff) | |
| download | bcm5719-llvm-18d8473f185999e418dcb62ee4d8a671c2eacee5.tar.gz bcm5719-llvm-18d8473f185999e418dcb62ee4d8a671c2eacee5.zip | |
Add testsuite from OpenUH
llvm-svn: 208472
Diffstat (limited to 'openmp/testsuite/c/omp_single.c')
| -rw-r--r-- | openmp/testsuite/c/omp_single.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/openmp/testsuite/c/omp_single.c b/openmp/testsuite/c/omp_single.c new file mode 100644 index 00000000000..2c92726b2fa --- /dev/null +++ b/openmp/testsuite/c/omp_single.c @@ -0,0 +1,43 @@ +<ompts:test> +<ompts:testdescription>Test which checks the omp single directive by controling how often a directive is called in an omp single region.</ompts:testdescription> +<ompts:ompversion>2.0</ompts:ompversion> +<ompts:directive>omp single</ompts:directive> +<ompts:dependences>omp parallel private,omp flush</ompts:dependences> +<ompts:testcode> +#include <stdio.h> +#include "omp_testsuite.h" + +int <ompts:testcode:functionname>omp_single</ompts:testcode:functionname>(FILE * logFile) +{ + <ompts:orphan:vars> + int nr_threads_in_single; + int result; + int nr_iterations; + int i; + </ompts:orphan:vars> + + nr_threads_in_single = 0; + result = 0; + nr_iterations = 0; + +#pragma omp parallel private(i) + { + for (i = 0; i < LOOPCOUNT; i++) + { + <ompts:orphan> + <ompts:check>#pragma omp single </ompts:check> + { +#pragma omp flush + nr_threads_in_single++; +#pragma omp flush + nr_iterations++; + nr_threads_in_single--; + result = result + nr_threads_in_single; + } /* end of single */ + </ompts:orphan> + } /* end of for */ + } /* end of parallel */ + return ((result == 0) && (nr_iterations == LOOPCOUNT)); +} /* end of check_single*/ +</ompts:testcode> +</ompts:test> |

