summaryrefslogtreecommitdiffstats
path: root/openmp/testsuite/c/omp_single_copyprivate.c
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/testsuite/c/omp_single_copyprivate.c')
-rw-r--r--openmp/testsuite/c/omp_single_copyprivate.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/openmp/testsuite/c/omp_single_copyprivate.c b/openmp/testsuite/c/omp_single_copyprivate.c
new file mode 100644
index 00000000000..bc7cd549ad4
--- /dev/null
+++ b/openmp/testsuite/c/omp_single_copyprivate.c
@@ -0,0 +1,50 @@
+<ompts:test>
+<ompts:testdescription>Test which checks the omp single copyprivate directive.</ompts:testdescription>
+<ompts:ompversion>2.0</ompts:ompversion>
+<ompts:directive>omp single copyprivate</ompts:directive>
+<ompts:dependences>omp parllel,omp critical</ompts:dependences>
+<ompts:testcode>
+#include "omp_testsuite.h"
+
+int j;
+#pragma omp threadprivate(j)
+
+int <ompts:testcode:functionname>omp_single_copyprivate</ompts:testcode:functionname>(FILE * logFile)
+{
+ <ompts:orphan:vars>
+ int result;
+ int nr_iterations;
+ </ompts:orphan:vars>
+
+ result = 0;
+ nr_iterations = 0;
+#pragma omp parallel
+ {
+ <ompts:orphan>
+ int i;
+ for (i = 0; i < LOOPCOUNT; i++)
+ {
+ /*
+ int thread;
+ thread = omp_get_thread_num ();
+ */
+#pragma omp single <ompts:check>copyprivate(j)</ompts:check>
+ {
+ nr_iterations++;
+ j = i;
+ /*printf ("thread %d assigns, j = %d, i = %d\n", thread, j, i);*/
+ }
+ /* #pragma omp barrier*/
+#pragma omp critical
+ {
+ /*printf ("thread = %d, j = %d, i = %d\n", thread, j, i);*/
+ result = result + j - i;
+ }
+#pragma omp barrier
+ } /* end of for */
+ </ompts:orphan>
+ } /* end of parallel */
+ return ((result == 0) && (nr_iterations == LOOPCOUNT));
+}
+</ompts:testcode>
+</ompts:test>
OpenPOWER on IntegriCloud