[OpenMP 4.5] Swap map and reduction clause on dot kernel

This fixes #42. On the Clang compiler, the map clause should appear
before the reduction clause to ensure that the evaluation order
of the clauses copies the reduction value back correctly.
This makes no difference with the Cray compiler.
This commit is contained in:
Tom Deakin 2018-02-07 14:16:39 +00:00
parent 41621ac136
commit 8b83802fb1

View File

@ -173,7 +173,7 @@ T OMPStream<T>::dot()
unsigned int array_size = this->array_size;
T *a = this->a;
T *b = this->b;
#pragma omp target teams distribute parallel for simd reduction(+:sum) map(tofrom: sum)
#pragma omp target teams distribute parallel for simd map(tofrom: sum) reduction(+:sum)
#else
#pragma omp parallel for reduction(+:sum)
#endif