[Openmp-commits] [openmp] r336326 - [OMPT] Add synchronization to threads_nested.c testcase

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 5 02:14:01 PDT 2018


Author: jprotze
Date: Thu Jul  5 02:14:01 2018
New Revision: 336326

URL: http://llvm.org/viewvc/llvm-project?rev=336326&view=rev
Log:
[OMPT] Add synchronization to threads_nested.c testcase

The testcase potentially fails when a thread is reused.
The added synchronization makes sure this does not happen.

Patch provided by Simon Convent

Differential Revision: https://reviews.llvm.org/D48932

Modified:
    openmp/trunk/runtime/test/ompt/misc/threads_nested.c

Modified: openmp/trunk/runtime/test/ompt/misc/threads_nested.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/misc/threads_nested.c?rev=336326&r1=336325&r2=336326&view=diff
==============================================================================
--- openmp/trunk/runtime/test/ompt/misc/threads_nested.c (original)
+++ openmp/trunk/runtime/test/ompt/misc/threads_nested.c Thu Jul  5 02:14:01 2018
@@ -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);
     }
   }
 




More information about the Openmp-commits mailing list