brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 5fb2098 Raw
42 lines · c
1// clang-format off2// RUN: %libomptarget-compile-run-and-check-generic3// REQUIRES: ompt4// REQUIRES: gpu5// clang-format on6 7#include "omp.h"8#include <stdlib.h>9#include <string.h>10 11#include "callbacks.h"12#include "register_non_emi.h"13 14#define N 102415 16int main(int argc, char **argv) {17  int *h_a;18  int *d_a;19 20  h_a = (int *)malloc(N * sizeof(int));21  memset(h_a, 0, N);22 23  d_a = (int *)omp_target_alloc(N * sizeof(int), omp_get_default_device());24 25  omp_target_associate_ptr(h_a, d_a, N * sizeof(int), 0,26                           omp_get_default_device());27  omp_target_disassociate_ptr(h_a, omp_get_default_device());28 29  omp_target_free(d_a, omp_get_default_device());30  free(h_a);31 32  return 0;33}34 35// clang-format off36/// CHECK: Callback Init:37/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_alloc38/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_associate39/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_disassociate40/// CHECK: Callback DataOp: target_id=[[TARGET_ID:[0-9]+]] host_op_id=[[HOST_OP_ID:[0-9]+]] optype=ompt_target_data_delete41/// CHECK: Callback Fini:42