1// RUN: %libomp-compile-and-run | FileCheck %s
2// REQUIRES: ompt
3#include "callback.h"
4
5int main()
6{
7 omp_set_dynamic(1);
8
9 #pragma omp parallel num_threads(4)
10 {
11 print_ids(0);
12 print_ids(1);
13 }
14 print_fuzzy_address(1);
15
16 // Check if libomp supports the callbacks for this test.
17 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin'
18 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_end'
19 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'
20 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'
21 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'
22
23 //team-size of 1-4 is expected
24
25 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
26
27 // make sure initial data pointers are null
28 // CHECK-NOT: 0: parallel_data initially not null
29 // CHECK-NOT: 0: task_data initially not null
30 // CHECK-NOT: 0: thread_data initially not null
31
32 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}, invoker=[[PARALLEL_INVOKER:[0-9]+]]
33
34 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]], team_size={{[1-4]}}
35 // CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
36 // CHECK: {{^}}[[MASTER_ID]]: task level 1: parallel_id=[[IMPLICIT_PARALLEL_ID:[0-9]+]], task_id=[[PARENT_TASK_ID]]
37 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[0-9]+}}, task_id=[[IMPLICIT_TASK_ID]]
38
39 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], invoker=[[PARALLEL_INVOKER]]
40 // CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
41
42 return 0;
43}
44

source code of openmp/runtime/test/ompt/parallel/dynamic_enough_threads.c