Hi,
I am currently adding GPU support to a fluid dynamics code in C language using OpenACC directives and the PGI compilers. While this approach works really well for most parts, the code uses function pointers in some loops to allow for modularity (e.g., to choose boundary conditions). It seems that this is not currently supported by the PGI compilers. Compiling a code like
#pragma acc routine seq
int myfunction() {
return 1;
}
void setarr( float * a, int n) {
#pragma acc parallel copy(a[0:n])
{
int (*function_ptr)();
function_ptr = &myfunction;
#pragma acc loop
for( int i = 0; i < n; ++i ) a[i] = (*function_ptr)();
}
}
will fail with the error message:
Accelerator restriction: Indirect function/procedure calls are not supported
The OpenACC 2.5 standard does not seem to explicitly disallow function pointers, so I was wondering whether there are any plans to support them in the future?
Thanks!