I am trying to parallelize both loops of this fragment of code:
for ( j = 0 ; j < nt2 ; j++ ) {
dm = MAX_LON + 1;
for ( i = 0 ; i < nt1 ; i++ ) {
d = distancia(tabla1[i],tabla2[j]);
if ( d < dm ) {
dm = d;
im = i;
}
}
ps[j] = im;
}
Parallelizing of outer loop succeed:
#pragma omp parallel for private(i,d,dm,im)
But I still have a problem with the inner one. I tried with e.g. private(d,m) and reduction(max:im), but it doesn't work with any combination. The closest to sequencial results I've got with private(d). Any ideas? Thanks!