0
Dear friends... I am a beginner in Omp (parallel programming in general) and am going through the following problem, which may be obvious. So I came to ask for help. The call is as follows
#pragma omp parallel for
for(int i = 0; i < 2; i++){
if(i == 0)
h[i] = fastContComplete(r, cromo->g, 1);
else
h[i] = fastContComplete(s, cromo->g, 0);
}
If I remove the omp call the algorithm works super well. If I run as it is, it returns the structures h[i] in a "miscalculated" way. Detail, the parameters of fastContComplete function are query only, they are not changed at any time of fastContComplete execution. I can’t understand where the mistake is there. I also tried
#pragma omp parallel private(r, s, cromo)
{
i = omp_get_thread_num();
if(i == 0)
h[i] = fastContComplete(r, cromo->g, 1);
else
h[i] = fastContComplete(s, cromo->g, 0);
}
and behaves the same way. Someone can explain what’s going on?
Thank you in advance, hugs, Josefran
I start by saying that your
for
does not make much sense because it is individualizing specific cases offor
. Actually this one of yoursfor
would be better transformed into two loose instructions, those written in theif
.– Isac
I tried this way. At the end of the text I made available the second code
– Ajob
fastContComplete
does not change any global variable?– 648trindade