Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[OpenMP 6.0 ]Codegen for Reduction over private variables with reduction clause #134709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
Loading
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a05af19
Codegen for Reduction over private variables with reduction clause
Apr 7, 2025
4e6eea6
review comment changes incorporated
Apr 8, 2025
18e1708
review comment , removing redundant code
Apr 9, 2025
59ab4be
fix for user-defined reduction op
Apr 10, 2025
e45c30a
Handle user-defined reduction and updated lit test
May 1, 2025
980bc06
conditional checks
May 1, 2025
a103dfa
lit update
May 1, 2025
526314c
Support for UDR for private variables
May 5, 2025
c77fb0e
Implicit reduction identifier fix
May 5, 2025
f202eaa
updated with comments, unified logic and docs
May 7, 2025
9d2370b
Update OpenMPSupport.rst
chandraghale May 7, 2025
0ca2f86
Handle UDR init and updated lit
May 7, 2025
9335af1
multiple reduced value change
May 8, 2025
e1a1998
UDR init logic leveraged from emitInitWithReductionInitializer fn
May 8, 2025
efd69bb
runtime tests
May 9, 2025
c01671e
Update omp_for_private_reduction.cpp
chandraghale May 9, 2025
ad0d2f0
Update omp_for_private_reduction.cpp
chandraghale May 9, 2025
4df2910
update test
May 9, 2025
2468be3
test update
May 9, 2025
9576c87
Resolve mergeconflict rel notes
May 9, 2025
7e324bd
Resolve mergeconflict rel notes
May 9, 2025
262a861
Release notes update
May 9, 2025
a0d29ab
address comments,support all types
May 13, 2025
0c2978c
complex type test for priv redn
May 13, 2025
384cd4a
add addtional complex test
May 14, 2025
76db75a
Merge branch 'main' into codegen_private_variable_reducn
chandraghale May 14, 2025
0b59740
format error fix
chandraghale May 14, 2025
694e241
Merge branch 'main' into codegen_private_variable_reducn
chandraghale May 15, 2025
4c36ba7
Format fix
May 23, 2025
b146a1a
Few more fixes with ref from spec
May 30, 2025
3bb17c1
removing wrong asserts
May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add addtional complex test
  • Loading branch information
Chandra Ghale committed May 14, 2025
commit 384cd4af85bc48eb7df493b212643536586acbcc
31 changes: 31 additions & 0 deletions 31 openmp/runtime/test/worksharing/for/omp_for_private_reduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ int performComplexReduction() {
}
return error;
}

std::complex<double> doComplexReduction(std::complex<double> *arr) {
std::complex<double> result(1, 0);

#pragma omp declare reduction(* : std::complex<double> : omp_out *= omp_in) \
initializer(omp_priv = std::complex<double>(1, 0))

#pragma omp for reduction(original(private), * : result)
for (int i = 0; i < N; ++i)
result *= arr[i];

return result;
}

void performReductions(int n_elements, const int *input_values,
int &sum_val_out, int &prod_val_out,
float &float_sum_val_out) {
Expand Down Expand Up @@ -127,6 +141,14 @@ int main(void) {
const float kExpectedFsum = kPiVal * N; // 3.14f * 10
const int kExpectedMin = 3;
const int kExpectedMax = 12;
std::complex<double> arr[N];
std::complex<double> kExpectedComplex(1, 0);
// Initialize the array
for (int i = 1; i <= N; ++i) {
arr[i - 1] = std::complex<double>(
1.0 + 0.1 * i, 0.5 * i); // Avoid zero to prevent multiplication by zero
kExpectedComplex *= arr[i - 1];
}

for (int i = 0; i < N; i++)
input_array[i] = i;
Expand Down Expand Up @@ -156,6 +178,15 @@ int main(void) {
}
total_errors += checkUserDefinedReduction();
total_errors += performComplexReduction();
#pragma omp parallel num_threads(4)
{
std::complex<double> result(1, 0);
result = doComplexReduction(arr);
if (std::abs(result.real() - kExpectedComplex.real()) > 1e-6 ||
std::abs(result.imag() - kExpectedComplex.imag()) > 1e-6) {
total_errors++;
}
}
if (total_errors != 0)
fprintf(stderr, "ERROR: reduction on private variable %d\n", total_errors);

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.