3

I am trying to use recursion inside an OpenCL kernel. Compilation is successful but while running it is giving compilation error so I want to know, as Dynamic Parallelism is now supported by CUDA, does OpenCL support Dynamic Parallelism or not?

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
DEV
  • 2,106
  • 3
  • 25
  • 40
  • At least not straight away as a core feature. The only possibility could be as an extension. But given the rather young age of dynamic parallelism even in CUDA (and keep in mind that you also need the corresponding hardware for it) and especially NVIDIA's rather slow acceptance of OpenCL in general (they don't even support CL 1.2), I'd say *no*, with much security. – Christian Rau Jul 17 '13 at 10:44
  • *"Compilation is successful but while running it is giving compilation error"* - Which *"compilation"* is successful while resulting in an error and what does *"running"* mean in that case. I guess with the first *"compilation"* you mean host compilation while the second one means OpenCL compilation, but some clarification might be a good idea. – Christian Rau Jul 17 '13 at 10:48

2 Answers2

6

Recursion is not supported by OpenCL. See point i in section 6.9 of the standard v1.2.

EDIT: The new Dynamic Parallelism capability of CUDA does't have anything to do with recursion (it was already supported a while ago by CUDA. See this question. This new capability allow threads running on the device to configure and launch new grids which was previously only done by the host. See this document for an overview.

SECOND EDIT: regarding the answer of @Michael: This is only the spec, you will have to wait for the implementation release. Besides, at that point in the future you will also have to make sure to have the proper hardware (even dynamic parallelism is supported by CUDA only for devices of capability 3.5 and higher). So when you asked your question, and still today: NO OpenCL implementation supports dynamic parallelism.

Community
  • 1
  • 1
CaptainObvious
  • 2,525
  • 20
  • 26
2

Dynamic Parallelism in now supported in OpenCL 2. Khronos Group announced it at Siggraph 2013.

You can find the specifications here

Michael M.
  • 2,556
  • 1
  • 16
  • 26