Hi,
Iam new to OpenMP. Iam trying to parallelize a for loop which internally calls a function whose definition is in another file. Both files share a global variable. One file has extern declaration and other has actual declaration.
How to make the global variable private for each openmp threads?
I tried in the following way and its giving compilation error.
file1.c
-------
int a;
#pragma omp threadprivate(a)
int main()
{
#pragma omp parallel for
for(int i=0;i<n;i++)
SomeFunction(i);
}
file2.c
-------
extern int a;
#pragma omp threadprivate(a) //THROWING AN ERROR
SomeFunction(i)
{
//uses variable a
}
Thanks in Advance
