Commit 87a06a24 authored by Ivo Roghair's avatar Ivo Roghair
Browse files

Update comments in main.cpp

parent 2c78b959
Pipeline #3579 canceled with stages
......@@ -36,25 +36,31 @@ int main(int argc, char* argv[])
}
file.close();
double c = 0.0;
double sum1 = 0.0, sum2 = 0.0;
double sum3 = 0.0, sum4 = 0.0;
double y, t;
// Parallel with OpenMP (dynamic scheduler may yield different
// results each time the program is run!)
#pragma omp parallel for schedule(dynamic) reduction(+:sum1)
for (int i=0;i<npart;i++) {
sum1 +=pos[i][0]+pos[i][1]+pos[i][2];
}
// Serial forward
for (int i=0;i<npart;i++) {
sum2 +=pos[i][0]+pos[i][1]+pos[i][2];
}
// Serial backward
for (int i=npart-1;i>=0;i--) {
sum3 +=pos[i][0]+pos[i][1]+pos[i][2];
}
// Kahan summation algorithm
double c = 0.0;
double y, t;
for (int i=0;i<npart;i++) {
y = pos[i][0]+pos[i][1]+pos[i][2] - c;
t = sum4+y;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment