brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 0fcf537 Raw
51 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 <unistd.h>9#include <stdio.h>10 11int main() {12  int condition = 0;13  int x = 0;14#pragma omp parallel num_threads(2)15  {16#pragma omp master17    {18#pragma omp taskgroup19      {20        print_current_address(1);21#pragma omp task22        {23#pragma omp atomic24          x++;25        }26      }27      print_current_address(2);28    }29  }30 31  // clang-format off32  // Check if libomp supports the callbacks for this test.33  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_create'34  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_task_schedule'35  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_cancel'36  // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_thread_begin'37 38 39  // CHECK: {{^}}0: NULL_POINTER=[[NULL:.*$]]40 41  // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskgroup_begin: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[TASK_ID:[0-f]+]], codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]]42  // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]43  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_begin: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS:(0x)?[0-f]+]]44  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]]45  // CHECK: {{^}}[[MASTER_ID]]: ompt_event_taskgroup_end: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]], codeptr_ra=[[RETURN_ADDRESS]]46  // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]47  // clang-format on48 49  return 0;50}51