Skip to content

Commit

Permalink
Make all additions matter in private mapping test.
Browse files Browse the repository at this point in the history
  • Loading branch information
doru1004 committed Mar 29, 2023
1 parent 3be6c4d commit f2b15b9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions openmp/libomptarget/test/mapping/private_mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@
#include <stdio.h>

int main() {
int data1[3] = {1}, data2[3] = {2}, data3[3] = {5};
int data1[3] = {1, 2, 5};
int data2[3] = {10, 20, 50};
int data3[3] = {100, 200, 500};
int sum[16] = {0};

for (int i=0; i<16; i++) sum[i] = 10000;

#pragma omp target teams distribute parallel for map(tofrom : sum) \
firstprivate(data1, data2, data3)
for (int i = 0; i < 16; ++i) {
Expand All @@ -18,7 +23,7 @@ int main() {

int correct = 1;
for (int i = 0; i < 16; ++i) {
if (sum[i] != 8) {
if (sum[i] != 10888) {
correct = 0;
printf("ERROR: The sum for index %d is %d\n", i, sum[i]);
printf("ERROR: data1 = {%d, %d, %d}\n", data1[0], data1[1], data1[2]);
Expand All @@ -27,6 +32,7 @@ int main() {
break;
}
}
fflush(stdout);
assert(correct);

printf("PASS\n");
Expand Down

0 comments on commit f2b15b9

Please sign in to comment.