diff options
author | Shilei Tian <i@tianshilei.me> | 2022-07-22 16:03:04 -0400 |
---|---|---|
committer | Shilei Tian <i@tianshilei.me> | 2022-07-22 16:03:39 -0400 |
commit | b95d31a849b91650367ee205eac5af8750cccf3e (patch) | |
tree | 6191b2991e03b95b934d0d9cead89d939dcb39a8 /openmp | |
parent | 6690c64639370a1845f42736423dea92cd06defd (diff) | |
download | llvm-b95d31a849b91650367ee205eac5af8750cccf3e.zip llvm-b95d31a849b91650367ee205eac5af8750cccf3e.tar.gz llvm-b95d31a849b91650367ee205eac5af8750cccf3e.tar.bz2 |
[OpenMP][Offloading] Enlarge the work size of `wtime.c` in case of any noise
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/libomptarget/test/offloading/wtime.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/openmp/libomptarget/test/offloading/wtime.c b/openmp/libomptarget/test/offloading/wtime.c index 6ad2f9c..c1cff80 100644 --- a/openmp/libomptarget/test/offloading/wtime.c +++ b/openmp/libomptarget/test/offloading/wtime.c @@ -6,19 +6,24 @@ #include <omp.h> #include <stdio.h> +#include <stdlib.h> + +#define N (1024 * 1024 * 256) int main(int argc, char *argv[]) { - int data[1024]; -#pragma omp target + int *data = (int *)malloc(N * sizeof(int)); +#pragma omp target map(from: data[0:N]) { double start = omp_get_wtime(); - for (int i = 0; i < 1024; ++i) + for (int i = 0; i < N; ++i) data[i] = i; double end = omp_get_wtime(); double duration = end - start; printf("duration: %lfs\n", duration); } + free(data); return 0; } // CHECK: duration: {{.+[1-9]+}} + |