Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / ompt / veccopy_wrong_return.c
blob2d07b4e1bf04a00d3ac3526860e6bf2137ed13e5
1 // RUN: %libomptarget-compile-run-and-check-generic
2 // REQUIRES: ompt
4 /*
5 * Example OpenMP program that shows that if the initialize function
6 * returns the wrong status code, the callbacks won't be activated.
7 */
9 #include <omp.h>
10 #include <stdio.h>
12 #include "callbacks.h"
13 #include "register_wrong_return.h"
15 int main() {
16 int N = 100000;
18 int a[N];
19 int b[N];
21 int i;
23 for (i = 0; i < N; i++)
24 a[i] = 0;
26 for (i = 0; i < N; i++)
27 b[i] = i;
29 #pragma omp target parallel for
31 for (int j = 0; j < N; j++)
32 a[j] = b[j];
35 #pragma omp target teams distribute parallel for
37 for (int j = 0; j < N; j++)
38 a[j] = b[j];
41 int rc = 0;
42 for (i = 0; i < N; i++)
43 if (a[i] != b[i]) {
44 rc++;
45 printf("Wrong value: a[%d]=%d\n", i, a[i]);
48 if (!rc)
49 printf("Success\n");
51 return rc;
54 /// CHECK-NOT: Callback Init:
55 /// CHECK-NOT: Callback Load:
56 /// CHECK-NOT: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1
57 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1
58 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2
59 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1
60 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2
61 /// CHECK-NOT: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=1
62 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3
63 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3
64 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4
65 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4
66 /// CHECK-NOT: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2
68 /// CHECK-NOT: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=1
69 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1
70 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2
71 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1
72 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=2
73 /// CHECK-NOT: Callback Submit: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] req_num_teams=0
74 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3
75 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=3
76 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4
77 /// CHECK-NOT: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4
78 /// CHECK-NOT: Callback Target: target_id=[[TARGET_ID:[0-9]+]] kind=1 endpoint=2
79 /// CHECK-NOT: Callback Fini