Hi Everyone,
I know that building in Release mode sets the optimisation level to 3. However, it doesn't seem that OpenMP is benefiting from the optimisation. I am trying this on a C6678 with OpenMP 1.1.3.02.
I have written a simple accumulate.
float testing;
int i;
double elapsed = 0;float constant = 10;
elapsed = omp_get_wtime();
#pragma omp parallel for private(i) reduction(+:testing) num_threads(8)
for (i = 0; i < 1000000; ++i) {
testing += constant;
}
elapsed = omp_get_wtime() - elapsed;
printf("%f\n",elapsed);
With optimisation off, the run time of the same loop takes only half the time. With optimisation turned on, it took 21951018 cycles without OpenMP and 33757853 with OpenMP and 8 threads. Therefore, is OpenMP not getting faster with optimisation?
Just wondering if I have made a mistake and pointers are much appreciated. Thanks.