LLVM OpenMP 20.0.0git
pause_stop_tool.c
Go to the documentation of this file.
1// RUN: %libomp-compile-and-run | FileCheck %s
2// REQUIRES: ompt
3#include "callback.h"
4#include <omp.h>
5int main() {
6 int x = 0;
7 int ret = 0;
8#pragma omp parallel
9#pragma omp single
10 x++;
11 // Expected to fail; omp_pause_stop_tool must not be specified
12 ret = omp_pause_resource(omp_pause_stop_tool, omp_get_initial_device());
13 printf("omp_pause_resource %s\n", ret ? "failed" : "succeeded");
14#pragma omp parallel
15#pragma omp single
16 x++;
17 // Expected to succeed
18 ret = omp_pause_resource_all(omp_pause_stop_tool);
19 printf("omp_pause_resource_all %s\n", ret ? "failed" : "succeeded");
20#pragma omp parallel
21#pragma omp single
22 x++;
23 printf("x = %d\n", x);
24 return 0;
25
26 // Check if
27 // -- omp_pause_resource/resource_all returns expected code
28 // -- OMPT interface is shut down as expected
29
30 // CHECK-NOT: {{^}}0: Could not register callback
31 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
32
33 // CHECK: ompt_event_parallel_begin
34 // CHECK: ompt_event_parallel_end
35
36 // CHECK: omp_pause_resource failed
37
38 // CHECK: ompt_event_parallel_begin
39 // CHECK: ompt_event_parallel_end
40
41 // CHECK: omp_pause_resource_all succeeded
42
43 // CHECK-NOT: ompt_event
44}
return ret
int omp_get_initial_device(void)
int main()