You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to parallelize the below code using Par4all and I am able to get the parallelized code. But you can see that in the parallelized code, "n" is assigned with value 1410065407, instead of 1.0E10. Pls help me to solve the issue.
/** input code fragment **/
#define n 10000000000
for(i = 0 ; i < n ; i++)
A[i] = i;
for(i = 0 ; i < n ; i++)
sum += A[i];
/Parallelized code/
#pragma omp parallel for
for(i = 0; i <= 1410065407; i += 1)
A[i] = i;
#pragma omp parallel for reduction(+:sum)
for(i = 0; i <= 1410065407; i += 1)
sum += A[i];
The text was updated successfully, but these errors were encountered:
Sorry for the delay. Thank you for your reply.
No, I didn't get any user warning related to memory.
Thank you, this method works. Instead of defining 'n' as a macro, I defined 'n' as variable and assigned '10000000000'. Now it works.
/*input code */
long long int n= 10000000000;
for(i = 0 ; i < n ; i++)
sum += A[i];
/*parallelized code */
long long int n= 10000000000;
#pragma omp parallel for reduction(+:sum)
for(i = 0; i <= n-1; i += 1)
sum += A[i];
I tried to parallelize the below code using Par4all and I am able to get the parallelized code. But you can see that in the parallelized code, "n" is assigned with value 1410065407, instead of 1.0E10. Pls help me to solve the issue.
/** input code fragment **/
#define n 10000000000
for(i = 0 ; i < n ; i++)
A[i] = i;
for(i = 0 ; i < n ; i++)
sum += A[i];
/Parallelized code/
#pragma omp parallel for
for(i = 0; i <= 1410065407; i += 1)
A[i] = i;
#pragma omp parallel for reduction(+:sum)
for(i = 0; i <= 1410065407; i += 1)
sum += A[i];
The text was updated successfully, but these errors were encountered: