39 lines · c
1#include "callback.h"2#include <omp.h>3#include <stdio.h>4 5#define STRINGIFY(x) #x6#define STR(x) STRINGIFY(x)7#ifndef SCHED_OUTPUT8#define SCHED_OUTPUT STR(SCHEDULE)9#endif10 11int main() {12 unsigned int i;13 printf("0: Schedule: " SCHED_OUTPUT "\n");14 15#pragma omp parallel for num_threads(1) schedule(SCHEDULE)16 for (i = 0; i < 64; i++) {17 }18 19 // clang-format off20 // Check if libomp supports the callbacks for this test.21 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_begin'22 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_parallel_end'23 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_implicit_task'24 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_work'25 26 27 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]28 // CHECK: 0: Schedule: [[SCHED:[a-z]+]]29 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-f]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{(0x)?[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-f]+]], requested_team_size=1, codeptr_ra={{(0x)?[0-f]+}}, invoker={{[0-9]+}}30 31 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID:[0-f]+]], task_id=[[IMPLICIT_TASK_ID:[0-f]+]]32 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], codeptr_ra={{(0x)?[0-f]+}}33 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_loop_[[SCHED]]_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]34 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id={{[PARALLEL_ID,0]}}, task_id=[[IMPLICIT_TASK_ID]]35 // clang-format on36 37 return 0;38}39