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