[Openmp-commits] [openmp] cdf9401 - [OpenMP][OMPT][NFC] Fix flaky	test
    Joachim Protze via Openmp-commits 
    openmp-commits at lists.llvm.org
       
    Sun Nov 29 10:13:06 PST 2020
    
    
  
Author: Joachim Protze
Date: 2020-11-29T19:07:41+01:00
New Revision: cdf9401df84ef382467d1ca1c1c458c11fd6043a
URL: https://github.com/llvm/llvm-project/commit/cdf9401df84ef382467d1ca1c1c458c11fd6043a
DIFF: https://github.com/llvm/llvm-project/commit/cdf9401df84ef382467d1ca1c1c458c11fd6043a.diff
LOG: [OpenMP][OMPT][NFC] Fix flaky test
The test had a chance to finish the first task before the second task is
created. In this case, the dependences-pair event would not trigger.
Added: 
    
Modified: 
    openmp/runtime/test/ompt/tasks/dependences.c
Removed: 
    
################################################################################
diff  --git a/openmp/runtime/test/ompt/tasks/dependences.c b/openmp/runtime/test/ompt/tasks/dependences.c
index 9e9349f95610..16732e3fe1f0 100644
--- a/openmp/runtime/test/ompt/tasks/dependences.c
+++ b/openmp/runtime/test/ompt/tasks/dependences.c
@@ -9,6 +9,7 @@
 
 int main() {
   int x = 0;
+  int condition=0;
 #pragma omp parallel num_threads(2)
   {
 #pragma omp master
@@ -16,10 +17,10 @@ int main() {
       print_ids(0);
       printf("%" PRIu64 ": address of x: %p\n", ompt_get_thread_data()->value,
              &x);
-#pragma omp task depend(out : x)
+#pragma omp task depend(out : x) shared(condition)
       {
         x++;
-        delay(100);
+        OMPT_WAIT(condition,1);
       }
       print_fuzzy_address(1);
       print_ids(0);
@@ -27,6 +28,7 @@ int main() {
 #pragma omp task depend(in : x)
       { x = -1; }
       print_ids(0);
+      OMPT_SIGNAL(condition);
     }
   }
 
        
    
    
More information about the Openmp-commits
mailing list