56 lines · c
1// clang-format off2// RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s3// REQUIRES: ompt4// UNSUPPORTED: intel-15.0, intel-16.0, intel-17.0, intel-18.05// GCC generates code that does not distinguish between sections and loops6// UNSUPPORTED: gcc7// clang-format on8 9#include "callback.h"10#include <omp.h>11 12int main() {13#pragma omp parallel sections num_threads(2)14 {15#pragma omp section16 {17 printf("%lu: section 1\n", ompt_get_thread_data()->value);18 }19#pragma omp section20 {21 printf("%lu: section 2\n", ompt_get_thread_data()->value);22 }23 }24 25 // clang-format off26 // Check if libomp supports the callbacks for this test.27 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work'28 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_dispatch'29 30 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]31 32 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_sections_begin:33 // CHECK-SAME: parallel_id=[[PARALLEL_ID:[0-f]+]],34 // CHECK-SAME: task_id=[[TASK_ID:[0-f]+]],35 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN:(0x)?[0-f]+]], count=236 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_section_begin:37 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]38 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]]39 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_sections_end:40 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-f]+}},41 // CHECK-SAME: codeptr_ra=[[SECT_END:(0x)?[0-f]+]]42 43 // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_sections_begin:44 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID:[0-f]+]],45 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]], count=246 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_section_begin:47 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id=[[TASK_ID]]48 // CHECK-SAME: codeptr_ra=[[SECT_BEGIN]]49 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_sections_end:50 // CHECK-SAME: parallel_id=[[PARALLEL_ID]], task_id={{[0-f]+}},51 // CHECK-SAME: codeptr_ra=[[SECT_END]]52 // clang-format on53 54 return 0;55}56