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

This commit is contained in:
Shilei Tian 2022-07-22 16:03:04 -04:00
parent 6690c64639
commit b95d31a849
1 changed files with 8 additions and 3 deletions

View File

@ -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]+}}