LLVM OpenMP 20.0.0git
taskwait-depend.c
Go to the documentation of this file.
1// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2// REQUIRES: ompt
3
4// taskwait with depend clause was introduced with gcc-9
5// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-8
6
7// icc does not yet support taskwait with depend clause
8// XFAIL: icc
9
10// support for taskwait with depend clause introduced in clang-14
11// UNSUPPORTED: clang-5, clang-6, clang-6, clang-8, clang-9, clang-10, clang-11, clang-12, clang-13
12
13#include "callback.h"
14#include <omp.h>
15
16int main() {
17 int x = 0;
18#pragma omp parallel num_threads(2)
19 {
20#pragma omp master
21 {
22 print_ids(0);
23 printf("%" PRIu64 ": address of x: %p\n", ompt_get_thread_data()->value,
24 &x);
25#pragma omp task depend(out : x)
26 { x++; }
28 #pragma omp taskwait depend(in: x)
30 }
31 }
32
33 return 0;
34}
35
36// Check if libomp supports the callbacks for this test.
37// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'
38// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_dependences'
39// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_depende
40
41// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]
42
43// make sure initial data pointers are null
44// CHECK-NOT: 0: new_task_data initially not null
45
46// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin:
47// CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-9]+]],
48// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-9]+]]
49
50// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]],
51// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:0x[0-f]+]],
52// CHECK-SAME: reenter_frame=[[NULL]]
53
54// CHECK: {{^}}[[MASTER_ID]]: address of x: [[ADDRX:0x[0-f]+]]
55
56// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
57// CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]],
58// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}},
59// CHECK-SAME: new_task_id=[[FIRST_TASK:[0-f]+]],
60// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}},
61// CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes
62
63// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:
64// CHECK-SAME: task_id=[[FIRST_TASK]], deps=[([[ADDRX]],
65// CHECK-SAME: ompt_dependence_type_inout)], ndeps=1
66
67// CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
68
69// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:
70// CHECK-SAME: parent_task_id={{[0-9]+}}, parent_task_frame.exit=[[EXIT]],
71// CHECK-SAME: parent_task_frame.reenter={{0x[0-f]+}},
72// CHECK-SAME: new_task_id=[[SECOND_TASK:[0-f]+]],
73// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}},
74// CHECK-SAME: task_type=ompt_task_taskwait|ompt_task_undeferred|
75// CHECK-SAME: ompt_task_mergeable=1207959568, has_dependences=yes
76
77// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:
78// CHECK-SAME: task_id=[[SECOND_TASK]], deps=[([[ADDRX]],
79// CHECK-SAME: ompt_dependence_type_in)], ndeps=1
80
81// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_end: task_id=[[SECOND_TASK]]
82
83// CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
#define print_fuzzy_address(id)
Definition: callback.h:307
static void print_ids(int level)
Definition: callback.h:150
static ompt_get_thread_data_t ompt_get_thread_data
Definition: callback.h:137
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
int main()