I am trying to parallelize a program that builds Voronoi-diagrams with OpenACC. I am currently struggling with parallizing a nested for-loop that calls a function that is defined in a different file. I know that you are supposed to use the #pragma acc routine decorator on the function but I cant make it work in my program.
I am using the PGI compiler and I am getting the following output
69, Loop is parallelizable
Generating Multicore code
69, #pragma acc loop gang
72, Loop is parallelizable
Loop not vectorized/parallelized: contains call
the relevant code from the main file that produces this output is the following
main.c
#pragma acc routine seq
extern int determineColor(int, int, int*, int);
int main(int argc, char** argv){
....
unsigned int(*imageBuffer)[yDim] = malloc(sizeof(int[xDim][yDim]));
#pragma acc kernels loop
for (int y = 0; y < yDim; y++)
{
for (int x = 0; x < xDim; x++)
{
imageBuffer[x][y] = determineColor(x, y, points, numPoints);
}
}
}
Voronoi.c
#pragma acc routine seq
int determineColor(int x, int y, int* points, int numPoints)
{
...
}