From cdf9401df84ef382467d1ca1c1c458c11fd6043a Mon Sep 17 00:00:00 2001 From: Joachim Protze Date: Sun, 29 Nov 2020 19:03:29 +0100 Subject: [PATCH] [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. --- openmp/runtime/test/ompt/tasks/dependences.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openmp/runtime/test/ompt/tasks/dependences.c b/openmp/runtime/test/ompt/tasks/dependences.c index 9e9349f..16732e3 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); } } -- 2.7.4