I am writing an c++ application in visual studio 2010. I run my code under performance wizard and it takes nearly 17 seconds. The codes is really suitable to multhreading so I add openmp directives. After that, I run my codes again and it takes also nearly 17 seconds. So, I wonder what that performance wizard does to optimize the code? Does it analyze the code and makes it multithreaded or simple perform compiler optimizations? How that wizard optimize code?
Edit: I enabled compiler options by adding /openmp option. I am using #pragma omp parallel for directive.I added parallel section codes. it has no bottlenecks, loop iterations do not depend on each other.
#pragma omp parallel for
for (int i = START; i < END; i++) {
solutionList[i] = new Solution(list[i]->solution, direction, i);
}
OMP_NUM_THREADS
environment variable? – Hristo Ilievomp for
in your case) inside a parallel region? Could you show us some example code that you've applied the OMP directives to? Parallel speedup is highly context specific after all. – Hristo IlievSTART
and what is the value ofEND
? How long does it take to execute the constructor of theSolution
class? Did you check theOMP_NUM_THREADS
environment, although by default the number of threads is equal to the number of logical CPUs. – Hristo Iliev