1// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2// REQUIRES: ompt
3// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
4
5#include "callback.h"
6#include <unistd.h>
7#include <stdio.h>
8
9int main()
10{
11 int condition=0;
12 int x=0;
13 #pragma omp parallel num_threads(2)
14 {
15 #pragma omp master
16 {
17 #pragma omp taskgroup
18 {
19 print_current_address(1);
20 #pragma omp task
21 {
22 #pragma omp atomic
23 x++;
24 }
25 }
26 print_current_address(2);
27 }
28 }
29
30
31 // Check if libomp supports the callbacks for this test.
32 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
33 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'
34 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel'
35 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin'
36
37
38 // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
39
40 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskgroup_begin: parallel_id=[[PARALLEL_ID:[0-9]+]], task_id=[[TASK_ID:[0-9]+]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
41 // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
42 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
43 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]]
44 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]]
45 // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
46
47 return 0;
48}
49

source code of openmp/runtime/test/ompt/synchronization/taskgroup.c