-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into nx_delay_rank
- Loading branch information
Showing
8 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Platforms/OMPTarget/test_user_defined_reduction_complex.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <vector> | ||
#include <complex> | ||
#include <cassert> | ||
|
||
#if !defined(OPENMP_NO_UDR) | ||
#pragma omp declare reduction(+: std::complex<float>: omp_out += omp_in) | ||
#endif | ||
|
||
int main() | ||
{ | ||
const int N = 100; | ||
std::vector<std::complex<float>> array(N); | ||
|
||
auto array_ptr = array.data(); | ||
for (int i = 0; i < N; i++) | ||
array_ptr[i] = std::complex<float>(i); | ||
|
||
std::complex<float> sum; | ||
#pragma omp parallel for reduction(+: sum) | ||
for (int i = 0; i < N; i++) | ||
sum += array_ptr[i]; | ||
|
||
assert(std::real(sum) == 4950); | ||
assert(std::imag(sum) == 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters