1 // RUN: %libomptarget-compile-run-and-check-generic 2 // REQUIRES: ompt 3 // REQUIRES: gpu 4 5 #include "omp.h" 6 #include <stdlib.h> 7 #include <string.h> 8 9 #include "callbacks.h" 10 #include "register_non_emi.h" 11 12 #define N 1024 13 14 int main(int argc, char **argv) { 15 int *h_a; 16 int *d_a; 17 18 h_a = (int *)malloc(N * sizeof(int)); 19 memset(h_a, 0, N); 20 21 d_a = (int *)omp_target_alloc(N * sizeof(int), omp_get_default_device()); 22 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()); 26 27 omp_target_free(d_a, omp_get_default_device()); 28 free(h_a); 29 30 return 0; 31 } 32 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: 40