[Openmp-commits] [PATCH] D48932: [OMPT] Add synchronization to threads_nested.c testcase

Simon Convent via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Jul 4 05:31:16 PDT 2018


sconvent created this revision.
sconvent added reviewers: protze.joachim, Hahnfeld, jlpeyton, hbae.

As @protze.joachim pointed out in https://reviews.llvm.org/D47824 , the testcase may fail when a thread is reused.
The added synchronization makes sure this does not happen.


https://reviews.llvm.org/D48932

Files:
  runtime/test/ompt/misc/threads_nested.c


Index: runtime/test/ompt/misc/threads_nested.c
===================================================================
--- runtime/test/ompt/misc/threads_nested.c
+++ runtime/test/ompt/misc/threads_nested.c
@@ -4,14 +4,16 @@
 #include <omp.h>
 
 int main() {
+
+  int condition = 0;
   int x = 0;
   omp_set_nested(1);
 #pragma omp parallel num_threads(2)
   {
 #pragma omp parallel num_threads(2)
     {
-#pragma omp atomic
-      x++;
+      OMPT_SIGNAL(condition);
+      OMPT_WAIT(condition, 4);
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48932.154093.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20180704/8d826eec/attachment-0001.bin>


More information about the Openmp-commits mailing list