I have two vectors one of them is already filled with data and it has to be assigned to the first vector. But using the OpenMp parallel for pragma withou tusing locks gives me sometimes the right output and sometimes the wroing output. But I'm not sure why (I am new to OpenMP) and how can I:
#pragma omp parallel for shared(vec1,vec2) firstprivate(params)
for(int i=0;i<params.a;i++)
{
int offset= i*params.b; // is omp private?
for(int j=0;i<params.b;j++)
{ //if I use omp_locks here it works correctly
vec1[j]+=vec2[offset+j];
}
}