Question: "recursion" in 15.5 version of PGI cuda

Hi, I am enjoying cuda fortran for my calculation of explicit dynamic finite element analysis.

I am using 15.5 version of PGI cuda fortran compiler on the Windows7(64bit) OS using Tesla K20c (Cuda 6.5).

I want to ask you whether “recursion” can be used in device subprograms and function or not. Please tell me, can I officially use this in the 15.5 version of PGI cuda fortran ?

According to
https://www.nersc.gov/assets/Uploads/PGI-CUF-July2013.pdf

it seems that recursion can be used in cuda fortran.

However, CUDA Fortran Programming Guide and Reference Version 2015 (https://www.pgroup.com/doc/pgicudaforug.pdf), especially 3.1.4. Restrictions on Device Subprograms, says:

" A subroutine or function with the device or global attribute must satisfy the following restrictions: It may not be recursive, nor have the recursive prefix on the subprogram statement.", meaning that recursion cannot be used…

Which information is true?
In case that we can use recursion, it can be used like:
attributes(device) recursive subroutine ****
attributes(device) datatype function *****
(I am considering the use of recursion from kernel, not from host)


Thank you in advance for your attention to this matter,

Daisuke

Hi Daisuke,

Dynamic parallelism is supported, but the “recursive” keyword is not. In other words, you can launch a global kernel from within another kernel but you can not recursively call a device routine.

Does this help clarify things?

  • Mat

Dear Mat

Thanks for your kind comment.
I’ll try to use dynamic parallelism in that case.
Please tell me what is the maximum sub level of Dynamic parallelism.
What I mean here is:
Suppose:
Root kernel calls child kernel 1. Child kernel 1 calls child kernel 2…, and Child kernel (n-1) calls child kernel n.
Then what is the maximum value of “n” supported in the current cuda fortran such as 15.5?

Thanks in advance,

Daisuke