KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am experimenting with OpenMP. I wrote some code to check its performance. On a 4-core single Intel CPU with Kubuntu 11.04, the following program compiled with OpenMP is around 20 times slower than the program compiled without OpenMP. Why? I compiled it by g++ -g -O2 -funroll-loops -fomit-frame-pointer -march=native -fopenmp #include <math.h> #include <iostream> using namespace std; int main () { long double i=0; long double k=0.7; #pragma omp parallel for reduction(+:i) for(int t=1; t<300000000; t++){ for(int n=1; n<16; n++){ i=i+pow(k,n); } } cout << i<<"\t"; return 0; }
Tags (comma-separated)
Save Edits
Cancel