1 | // RUN: %libomptarget-compile-run-and-check-generic |
2 | // REQUIRES: ompt |
3 | // UNSUPPORTED: aarch64-unknown-linux-gnu |
4 | // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
5 | // UNSUPPORTED: x86_64-pc-linux-gnu |
6 | // UNSUPPORTED: x86_64-pc-linux-gnu-LTO |
7 | // UNSUPPORTED: s390x-ibm-linux-gnu |
8 | // UNSUPPORTED: s390x-ibm-linux-gnu-LTO |
9 | |
10 | /* |
11 | * Example OpenMP program that shows that map callbacks are not supported. |
12 | */ |
13 | |
14 | #include <omp.h> |
15 | #include <stdio.h> |
16 | |
17 | #include "callbacks.h" |
18 | #include "register_non_emi_map.h" |
19 | |
20 | int main() { |
21 | int N = 100000; |
22 | |
23 | int a[N]; |
24 | int b[N]; |
25 | |
26 | int i; |
27 | |
28 | for (i = 0; i < N; i++) |
29 | a[i] = 0; |
30 | |
31 | for (i = 0; i < N; i++) |
32 | b[i] = i; |
33 | |
34 | #pragma omp target parallel for |
35 | { |
36 | for (int j = 0; j < N; j++) |
37 | a[j] = b[j]; |
38 | } |
39 | |
40 | #pragma omp target teams distribute parallel for |
41 | { |
42 | for (int j = 0; j < N; j++) |
43 | a[j] = b[j]; |
44 | } |
45 | |
46 | int rc = 0; |
47 | for (i = 0; i < N; i++) |
48 | if (a[i] != b[i]) { |
49 | rc++; |
50 | printf(format: "Wrong value: a[%d]=%d\n" , i, a[i]); |
51 | } |
52 | |
53 | if (!rc) |
54 | printf(format: "Success\n" ); |
55 | |
56 | return rc; |
57 | } |
58 | |
59 | |
60 | /// CHECK: 0: Could not register callback 'ompt_callback_target_map' |
61 | /// CHECK: Callback Init: |
62 | /// CHECK: Callback Load: |
63 | /// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1 |
64 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 |
65 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 |
66 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 |
67 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 |
68 | /// CHECK: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=1 |
69 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 |
70 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 |
71 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 |
72 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 |
73 | /// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2 |
74 | |
75 | /// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1 |
76 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 |
77 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 |
78 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1 |
79 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2 |
80 | /// CHECK: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=0 |
81 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 |
82 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3 |
83 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 |
84 | /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4 |
85 | /// CHECK: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2 |
86 | /// CHECK: Callback Fini: |
87 | |