Array Reduction #357
Replies: 1 comment 2 replies
|
Bug: Variation: changing the indices in Additional Information:
Example: #include <stdlib.h>
#include <stdio.h>
#define N 5
int main() {
// loop indices
int i,j;
// initialize matrix
double matrix[N*N];
for (i = 0; i < N*N; i++)
{
matrix[i] = (double) i;
}
// calculate sums per column
double sums[N] = {0};
// # pragma omp parallel for private(i,j) shared(matrix) reduction(+:sums)
for (i=0; i<N; i++)
{
for(int j=0; j<N; j++) {
sums[j] += matrix[j*N + i];
}
}
// print result
for (i = 0; i < N; i++)
{
printf("%.0f ", sums[i]);
}
printf("\n");
return 0;
} |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We currently struggle with reductions into array variables. For some examples a false doall pattern is reported. For others, no pattern is reported.
The OpenMP Microbench currently also does not support measuring reduction overhead for array variables.
All reactions