Recursion on OpenACC


I would like to ask if it is possible to create a recursive subroutine for openacc code(for example factorial calculation).

Thanks Sotiris

Hi Sotiris,

The OpenACC 2.0 standard added a “routine” directive which will enable function calling from within compute regions. We’re in the process of adding this feature and hope to have it available in an early 14.x release.

This feature will allow you to call recursive functions. However, there may be other factors that limit recursion. For example, on NVIDIA devices recursion is currently limited to 16 levels. I’m not sure about AMD/ATI devices.

Hope this helps,