88 lines · c
1// clang-format off2// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s3// REQUIRES: ompt4 5// taskwait with depend clause was introduced with gcc-96// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7, gcc-87 8// icc does not yet support taskwait with depend clause9// XFAIL: icc10 11// support for taskwait with depend clause introduced in clang-1412// UNSUPPORTED: clang-5, clang-6, clang-6, clang-8, clang-9, clang-10, clang-11, clang-12, clang-1313// clang-format on14 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 master23 {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++; }29 print_fuzzy_address(1);30#pragma omp taskwait depend(in : x)31 print_fuzzy_address(2);32 }33 }34 35 return 0;36}37 38// clang-format off39// 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_depende43 44// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]45 46// make sure initial data pointers are null47// CHECK-NOT: 0: new_task_data initially not null48 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=yes65 66// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:67// CHECK-SAME: task_id=[[FIRST_TASK]], deps=[([[ADDRX]],68// CHECK-SAME: ompt_dependence_type_inout)], ndeps=169 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=yes79 80// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:81// CHECK-SAME: task_id=[[SECOND_TASK]], deps=[([[ADDRX]],82// CHECK-SAME: ompt_dependence_type_in)], ndeps=183 84// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_end: task_id=[[SECOND_TASK]]85 86// CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]87// clang-format on88