[Openmp-commits] [openmp] b95d31a - [OpenMP][Offloading] Enlarge the work size of `wtime.c` in case of any noise

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Fri Jul 22 13:03:45 PDT 2022


Author: Shilei Tian
Date: 2022-07-22T16:03:39-04:00
New Revision: b95d31a849b91650367ee205eac5af8750cccf3e

URL: https://github.com/llvm/llvm-project/commit/b95d31a849b91650367ee205eac5af8750cccf3e
DIFF: https://github.com/llvm/llvm-project/commit/b95d31a849b91650367ee205eac5af8750cccf3e.diff

LOG: [OpenMP][Offloading] Enlarge the work size of `wtime.c` in case of any noise

Added: 
    

Modified: 
    openmp/libomptarget/test/offloading/wtime.c

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/test/offloading/wtime.c b/openmp/libomptarget/test/offloading/wtime.c
index 6ad2f9cc88a7..c1cff80b7c7f 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]+}}
+


        


More information about the Openmp-commits mailing list