Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / ompt / omp_api.c
bloba16ef7a64aa7d7f5d0ac6e7a44743eab74b65f9d
1 // RUN: %libomptarget-compile-run-and-check-generic
2 // REQUIRES: ompt
3 // REQUIRES: gpu
5 #include "omp.h"
6 #include <stdlib.h>
7 #include <string.h>
9 #include "callbacks.h"
10 #include "register_non_emi.h"
12 #define N 1024
14 int main(int argc, char **argv) {
15 int *h_a;
16 int *d_a;
18 h_a = (int *)malloc(N * sizeof(int));
19 memset(h_a, 0, N);
21 d_a = (int *)omp_target_alloc(N * sizeof(int), omp_get_default_device());
23 omp_target_associate_ptr(h_a, d_a, N * sizeof(int), 0,
24 omp_get_default_device());
25 omp_target_disassociate_ptr(h_a, omp_get_default_device());
27 omp_target_free(d_a, omp_get_default_device());
28 free(h_a);
30 return 0;
33 // clang-format off
34 /// CHECK: Callback Init:
35 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=1
36 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=5
37 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=6
38 /// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=4
39 /// CHECK: Callback Fini: