Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / offloading / interop.c
blob26287e3ec5333d6bdaa74e36bbd7df76a2593e98
1 // RUN: %libomptarget-compile-run-and-check-generic
2 // REQUIRES: nvptx64-nvidia-cuda
4 #include <assert.h>
5 #include <omp.h>
6 #include <stdint.h>
7 #include <stdio.h>
8 #include <stdlib.h>
10 typedef void *cudaStream_t;
12 int main() {
14 int device_id = omp_get_default_device();
16 #pragma omp parallel master
19 double D0, D2;
20 omp_interop_t interop;
22 #pragma omp interop init(targetsync : interop) device(device_id) nowait
23 assert(interop != NULL);
25 int err;
26 for (int i = omp_ipr_first; i < 0; i++) {
27 const char *n =
28 omp_get_interop_name(interop, (omp_interop_property_t)(i));
29 long int li =
30 omp_get_interop_int(interop, (omp_interop_property_t)(i), &err);
31 const void *p =
32 omp_get_interop_ptr(interop, (omp_interop_property_t)(i), &err);
33 const char *s =
34 omp_get_interop_str(interop, (omp_interop_property_t)(i), &err);
35 const char *n1 =
36 omp_get_interop_type_desc(interop, (omp_interop_property_t)(i));
38 #pragma omp interop use(interop) depend(in : D0, D2)
40 cudaStream_t stream =
41 (omp_get_interop_ptr(interop, omp_ipr_targetsync, NULL));
42 assert(stream != NULL);
44 #pragma omp interop destroy(interop) depend(in : D0, D2) device(device_id)
46 printf("PASS\n");
48 // CHECK: PASS