Add further target region to test that release resource of first target region does not actually remove the lock
@@ -13,8 +13,6 @@ int main() {
omp_allocator_handle_t pinned_alloc = omp_init_allocator(omp_default_mem_space, 1, pinned_trait);
double *a = (double *)omp_alloc(n*sizeof(double), pinned_alloc);
double *b = (double *)omp_alloc(n*sizeof(double), pinned_alloc);
- //double *a = new double[n];
- //double *b = new double[n];
for(int i = 0; i < n; i++) {
a[i] = 0;
@@ -25,17 +23,16 @@ int main() {
for(int i = 0; i < n; i++) {
a[i] = b[i];
}
- // sleep(5);
#pragma omp target teams distribute parallel for map(to:b[:n]) map(from:a[:n])
for(int i = 0; i < n; i++) {
- a[i] = b[i];
+ a[i] += b[i];
}
for(int i = 0; i < n; i++)
- if (a[i] != b[i]) {
+ if (a[i] != 2.0*b[i]) {
err++;
- printf("Error at %d, expected %lf, got %lf\n", i, b[i], a[i]);
+ printf("Error at %d, expected %lf, got %lf\n", i, 2.0*b[i], a[i]);
if (err > 10) return err;
}
