80 lines · c
1// clang-format off2// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s3// REQUIRES: ompt4// clang-format on5 6#include "callback.h"7#include <omp.h>8 9int main() {10 int x = 0;11#pragma omp parallel num_threads(2)12 {13#pragma omp master14 {15 print_ids(0);16 printf("%" PRIu64 ": address of x: %p\n", ompt_get_thread_data()->value,17 &x);18#pragma omp task depend(out : x)19 { x++; }20 print_fuzzy_address(1);21#pragma omp task if (0) depend(in : x)22 {}23 print_fuzzy_address(2);24 }25 }26 27 return 0;28}29 30// clang-format off31// 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_dependences'34// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_depende35 36// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]37 38// make sure initial data pointers are null39// CHECK-NOT: 0: new_task_data initially not null40 41// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin:42// CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f]+]],43// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-f]+]]44 45// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]],46// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:(0x)?[0-f]+]],47// CHECK-SAME: reenter_frame=[[NULL]]48 49// CHECK: {{^}}[[MASTER_ID]]: address of x: [[ADDRX:(0x)?[0-f]+]]50 51// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:52// CHECK-SAME: parent_task_id={{[0-f]+}}, parent_task_frame.exit=[[EXIT]],53// CHECK-SAME: parent_task_frame.reenter={{(0x)?[0-f]+}},54// CHECK-SAME: new_task_id=[[FIRST_TASK:[0-f]+]],55// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]]{{[0-f][0-f]}},56// CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes57 58// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:59// CHECK-SAME: task_id=[[FIRST_TASK]], deps=[([[ADDRX]],60// CHECK-SAME: ompt_dependence_type_inout)], ndeps=161 62// CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]63 64// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:65// CHECK-SAME: parent_task_id={{[0-f]+}}, parent_task_frame.exit=[[EXIT]],66// CHECK-SAME: parent_task_frame.reenter={{(0x)?[0-f]+}},67// CHECK-SAME: new_task_id=[[SECOND_TASK:[0-f]+]],68// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]]{{[0-f][0-f]}},69// CHECK-SAME: task_type=ompt_task_taskwait|ompt_task_undeferred|70// CHECK-SAME: ompt_task_mergeable=1207959568, has_dependences=yes71 72// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:73// CHECK-SAME: task_id=[[SECOND_TASK]], deps=[([[ADDRX]],74// CHECK-SAME: ompt_dependence_type_in)], ndeps=175 76// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_end: task_id=[[SECOND_TASK]]77 78// CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]79// clang-format on80