1 | // RUN: %libomptarget-compileopt-and-run-generic |
2 | |
3 | // UNSUPPORTED: amdgcn-amd-amdhsa |
4 | |
5 | #include <assert.h> |
6 | #include <omp.h> |
7 | #include <stdio.h> |
8 | #include <stdlib.h> |
9 | |
10 | #define N (1024 * 1024 * 256) |
11 | |
12 | int main(int argc, char *argv[]) { |
13 | int *data = (int *)malloc(N * sizeof(int)); |
14 | double duration = 0.0; |
15 | |
16 | #pragma omp target map(from : data[0 : N]) map(from : duration) |
17 | { |
18 | double start = omp_get_wtime(); |
19 | for (int i = 0; i < N; ++i) |
20 | data[i] = i; |
21 | double end = omp_get_wtime(); |
22 | duration = end - start; |
23 | } |
24 | assert(duration > 0.0); |
25 | free(ptr: data); |
26 | return 0; |
27 | } |
28 | |