summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/test
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2017-11-17 15:26:44 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2017-11-17 15:26:44 +0000
commit0924094e347ed2bf3c6824f27931ec3571089e7b (patch)
treef40fcdb3b62a3a8c5a0946618974443b9f20d5c7 /openmp/runtime/test
parent682a6547582c70702e698d6263bbf78592d66084 (diff)
downloadbcm5719-llvm-0924094e347ed2bf3c6824f27931ec3571089e7b.tar.gz
bcm5719-llvm-0924094e347ed2bf3c6824f27931ec3571089e7b.zip
[OMPT] Fix inaccuracies in worksharing tests
These tests were failing rarely on my MacBook when there was some activity in the background. Read: one of a thousand executions? * sections.c missed the sorting based on thread ids. This worked as long as the master thread finished its section before the worker thread started the second one but failed if the master thread was put to sleep by the OS. * The checks in single.c assumed that the master thread executes the single region which works most of the time because it is usually faster than the newly spawned worker thread. Differential Revision: https://reviews.llvm.org/D39853 llvm-svn: 318527
Diffstat (limited to 'openmp/runtime/test')
-rw-r--r--openmp/runtime/test/ompt/worksharing/sections.c3
-rw-r--r--openmp/runtime/test/ompt/worksharing/single.c12
2 files changed, 7 insertions, 8 deletions
diff --git a/openmp/runtime/test/ompt/worksharing/sections.c b/openmp/runtime/test/ompt/worksharing/sections.c
index 7d274c4dfe6..43656de9c85 100644
--- a/openmp/runtime/test/ompt/worksharing/sections.c
+++ b/openmp/runtime/test/ompt/worksharing/sections.c
@@ -1,4 +1,4 @@
-// RUN: %libomp-compile-and-run | FileCheck %s
+// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
// REQUIRES: ompt
// GCC generates code that does not distinguish between sections and loops
// XFAIL: gcc
@@ -31,6 +31,5 @@ int main()
// CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin: parallel_id=[[PARALLEL_ID]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[SECT_BEGIN]], count=2
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END]]
-
return 0;
}
diff --git a/openmp/runtime/test/ompt/worksharing/single.c b/openmp/runtime/test/ompt/worksharing/single.c
index 94865c4ee99..6b24f2d9398 100644
--- a/openmp/runtime/test/ompt/worksharing/single.c
+++ b/openmp/runtime/test/ompt/worksharing/single.c
@@ -13,6 +13,7 @@ int main()
{
#pragma omp single
{
+ printf("%" PRIu64 ": in single\n", ompt_get_thread_data()->value);
x++;
}
}
@@ -24,13 +25,12 @@ int main()
// CHECK: 0: NULL_POINTER=[[NULL:.*$]]
- // CHECK: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_single_in_block_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
- // CHECK: {{^}}[[THREAD_ID_1]]: ompt_event_single_in_block_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
-
- // CHECK: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_single_others_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
- // CHECK: {{^}}[[THREAD_ID_2]]: ompt_event_single_others_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
-
+ // CHECK-DAG: {{^}}[[THREAD_ID_1:[0-9]+]]: ompt_event_single_in_block_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], parent_task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
+ // CHECK-DAG: {{^}}[[THREAD_ID_1]]: in single
+ // CHECK-DAG: {{^}}[[THREAD_ID_1]]: ompt_event_single_in_block_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
+ // CHECK-DAG: {{^}}[[THREAD_ID_2:[0-9]+]]: ompt_event_single_others_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra={{0x[0-f]+}}, count=1
+ // CHECK-DAG: {{^}}[[THREAD_ID_2]]: ompt_event_single_others_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
return 0;
}
OpenPOWER on IntegriCloud