95 lines · c
1// clang-format off2// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s3// REQUIRES: ompt4// UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-75// clang-format on6 7#include "callback.h"8#include <omp.h>9#include <math.h>10#include <unistd.h>11 12int main() {13 int x = 0;14 int condition = 0;15#pragma omp parallel num_threads(2)16 {17#pragma omp master18 {19 print_ids(0);20 printf("%" PRIu64 ": address of x: %p\n", ompt_get_thread_data()->value,21 &x);22#pragma omp task depend(out : x) shared(condition)23 {24 x++;25 OMPT_WAIT(condition, 1);26 }27 print_fuzzy_address(1);28 print_ids(0);29 30#pragma omp task depend(in : x)31 { x = -1; }32 print_ids(0);33 OMPT_SIGNAL(condition);34 }35 }36 37 x++;38 39 return 0;40}41 42// clang-format off43// Check if libomp supports the callbacks for this test.44// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'45// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_dependences'46// CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_depende47 48// CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]49 50// make sure initial data pointers are null51// CHECK-NOT: 0: new_task_data initially not null52 53// CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_implicit_task_begin:54// CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f]+]],55// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID:[0-f]+]]56 57// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]],58// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT:(0x)?[0-f]+]],59// CHECK-SAME: reenter_frame=[[NULL]]60 61// CHECK: {{^}}[[MASTER_ID]]: address of x: [[ADDRX:(0x)?[0-f]+]]62// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:63// CHECK-SAME: parent_task_id={{[0-f]+}}, parent_task_frame.exit=[[EXIT]],64// CHECK-SAME: parent_task_frame.reenter={{(0x)?[0-f]+}},65// CHECK-SAME: new_task_id=[[FIRST_TASK:[0-f]+]],66// CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]]{{[0-f][0-f]}},67// CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes68 69// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:70// CHECK-SAME: task_id=[[FIRST_TASK]], deps=[([[ADDRX]],71// CHECK-SAME: ompt_dependence_type_inout)], ndeps=172 73// CHECK: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]74// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]],75// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]],76// CHECK-SAME: reenter_frame=[[NULL]]77 78// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_create:79// CHECK-SAME: parent_task_id={{[0-f]+}}, parent_task_frame.exit=[[EXIT]],80// CHECK-SAME: parent_task_frame.reenter={{(0x)?[0-f]+}},81// CHECK-SAME: new_task_id=[[SECOND_TASK:[0-f]+]], codeptr_ra={{(0x)?[0-f]+}},82// CHECK-SAME: task_type=ompt_task_explicit=4, has_dependences=yes83 84// CHECK: {{^}}[[MASTER_ID]]: ompt_event_dependences:85// CHECK-SAME: task_id=[[SECOND_TASK]], deps=[([[ADDRX]],86// CHECK-SAME: ompt_dependence_type_in)], ndeps=187 88// CHECK: {{^}}[[MASTER_ID]]: ompt_event_task_dependence_pair:89// CHECK-SAME: first_task_id=[[FIRST_TASK]], second_task_id=[[SECOND_TASK]]90 91// CHECK: {{^}}[[MASTER_ID]]: task level 0: parallel_id=[[PARALLEL_ID]],92// CHECK-SAME: task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]],93// CHECK-SAME: reenter_frame=[[NULL]]94// clang-format on95