Skip to content

Commit 0924094

Browse files
committedNov 17, 2017
[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
1 parent 682a654 commit 0924094

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed
 

‎openmp/runtime/test/ompt/worksharing/sections.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %libomp-compile-and-run | FileCheck %s
1+
// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
22
// REQUIRES: ompt
33
// GCC generates code that does not distinguish between sections and loops
44
// XFAIL: gcc
@@ -31,6 +31,5 @@ int main()
3131
// 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
3232
// CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end: parallel_id=[[PARALLEL_ID]], task_id={{[0-9]+}}, codeptr_ra=[[SECT_END]]
3333

34-
3534
return 0;
3635
}

‎openmp/runtime/test/ompt/worksharing/single.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ int main()
1313
{
1414
#pragma omp single
1515
{
16+
printf("%" PRIu64 ": in single\n", ompt_get_thread_data()->value);
1617
x++;
1718
}
1819
}
@@ -24,13 +25,12 @@ int main()
2425

2526
// CHECK: 0: NULL_POINTER=[[NULL:.*$]]
2627

27-
// 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
28-
// 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
29-
30-
// 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
31-
// CHECK: {{^}}[[THREAD_ID_2]]: ompt_event_single_others_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra={{0x[0-f]+}}, count=1
32-
28+
// 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
29+
// CHECK-DAG: {{^}}[[THREAD_ID_1]]: in single
30+
// 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
3331

32+
// 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
33+
// 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
3434

3535
return 0;
3636
}

0 commit comments

Comments
 (0)
Please sign in to comment.