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-EMI callbacks are not supported.
12 */
13
14#include <assert.h>
15#include <omp.h>
16#include <stdio.h>
17
18#include "callbacks.h"
19#include "register_emi_map.h"
20
21int main() {
22 int N = 100000;
23
24 int a[N];
25 int b[N];
26
27 int i;
28
29 for (i = 0; i < N; i++)
30 a[i] = 0;
31
32 for (i = 0; i < N; i++)
33 b[i] = i;
34
35#pragma omp target parallel for
36 {
37 for (int j = 0; j < N; j++)
38 a[j] = b[j];
39 }
40
41#pragma omp target teams distribute parallel for
42 {
43 for (int j = 0; j < N; j++)
44 a[j] = b[j];
45 }
46
47 int rc = 0;
48 for (i = 0; i < N; i++)
49 if (a[i] != b[i]) {
50 rc++;
51 printf(format: "Wrong value: a[%d]=%d\n", i, a[i]);
52 }
53
54 if (!rc)
55 printf(format: "Success\n");
56
57 return rc;
58}
59
60/// CHECK: 0: Could not register callback 'ompt_callback_target_map_emi'
61/// CHECK: Callback Init:
62/// CHECK: Callback Load:
63/// CHECK: Callback Target EMI: kind=1 endpoint=1
64/// CHECK: Callback DataOp EMI: endpoint=1 optype=1
65/// CHECK: Callback DataOp EMI: endpoint=2 optype=1
66/// CHECK-NOT: dest=(nil)
67/// CHECK: Callback DataOp EMI: endpoint=1 optype=2
68/// CHECK: Callback DataOp EMI: endpoint=2 optype=2
69/// CHECK: Callback DataOp EMI: endpoint=1 optype=1
70/// CHECK: Callback DataOp EMI: endpoint=2 optype=1
71/// CHECK-NOT: dest=(nil)
72/// CHECK: Callback DataOp EMI: endpoint=1 optype=2
73/// CHECK: Callback DataOp EMI: endpoint=2 optype=2
74/// CHECK: Callback Submit EMI: endpoint=1 req_num_teams=1
75/// CHECK: Callback Submit EMI: endpoint=2 req_num_teams=1
76/// CHECK: Callback DataOp EMI: endpoint=1 optype=3
77/// CHECK: Callback DataOp EMI: endpoint=2 optype=3
78/// CHECK: Callback DataOp EMI: endpoint=1 optype=3
79/// CHECK: Callback DataOp EMI: endpoint=2 optype=3
80/// CHECK: Callback DataOp EMI: endpoint=1 optype=4
81/// CHECK: Callback DataOp EMI: endpoint=2 optype=4
82/// CHECK: Callback DataOp EMI: endpoint=1 optype=4
83/// CHECK: Callback DataOp EMI: endpoint=2 optype=4
84/// CHECK: Callback Target EMI: kind=1 endpoint=2
85/// CHECK: Callback Target EMI: kind=1 endpoint=1
86/// CHECK: Callback DataOp EMI: endpoint=1 optype=1
87/// CHECK: Callback DataOp EMI: endpoint=2 optype=1
88/// CHECK-NOT: dest=(nil)
89/// CHECK: Callback DataOp EMI: endpoint=1 optype=2
90/// CHECK: Callback DataOp EMI: endpoint=2 optype=2
91/// CHECK: Callback DataOp EMI: endpoint=1 optype=1
92/// CHECK: Callback DataOp EMI: endpoint=2 optype=1
93/// CHECK-NOT: dest=(nil)
94/// CHECK: Callback DataOp EMI: endpoint=1 optype=2
95/// CHECK: Callback DataOp EMI: endpoint=2 optype=2
96/// CHECK: Callback Submit EMI: endpoint=1 req_num_teams=0
97/// CHECK: Callback Submit EMI: endpoint=2 req_num_teams=0
98/// CHECK: Callback DataOp EMI: endpoint=1 optype=3
99/// CHECK: Callback DataOp EMI: endpoint=2 optype=3
100/// CHECK: Callback DataOp EMI: endpoint=1 optype=3
101/// CHECK: Callback DataOp EMI: endpoint=2 optype=3
102/// CHECK: Callback DataOp EMI: endpoint=1 optype=4
103/// CHECK: Callback DataOp EMI: endpoint=2 optype=4
104/// CHECK: Callback DataOp EMI: endpoint=1 optype=4
105/// CHECK: Callback DataOp EMI: endpoint=2 optype=4
106/// CHECK: Callback Target EMI: kind=1 endpoint=2
107/// CHECK: Callback Fini:
108

source code of offload/test/ompt/veccopy_emi_map.c