I have code that looks something like this:
for(i=0; i<max;i++){
for(j=0; j<max2;j++)
//stuff
}
for(i=0; i<max;i++){
for(j=0; j<max2;j++)
//other stuff
}
for(i=0; i<max;i++){
for(j=0; j<max2;j++)
//final stuff
}
I want to parallelize this using OpenMP. What's the best method? I tried doing the #pragma omp parallel private(i)
at the beginning and #pragma omp for
before every j
loop. This is what I mean:
#pragma omp parallel private(i)
{
for(i=0; i<max;i++){
#pragma omp for
for (j=0; j<max2;j++){
//and so on and so forth
The thing is, this gives me no performance boost whatsoever. I suspect this is because the 3 for
loops aren't run in parallel...if I could get those 3 to run at the same time, I think I could get a performance boost. Any ideas? Thanks!