-2

Each language offers its advantages and disadvantages, but what advantages does it offer to combine them all?

talonmies
  • 70,661
  • 34
  • 192
  • 269
D V
  • 11
  • This is too broad of a question. Also, none of these is a "language", although they include languages for writing computational kernels. Finally, CUDA regards work on GPUs, and the others are broader in scope. So - what exactly are you trying to achieve? ... adding 3 buzzwords together only gives you the advantage of fashionability. Maybe. – einpoklum Jan 09 '20 at 16:28

1 Answers1

2

OpenACC apparently has some degree of interoperability with CUDA. OpenCL, on the other hand, has no way of working with either OpenACC or CUDA. So there is no way to do what you ask about, irrespective of the perceived benefits of being able to do so.

In general, use OpenACC for your high level development and data management within standard C/C++ and Fortran. Then if you need to have a higher degree of control over a kernel (i.e. if you think you can get better performance at the cost of loosing some portability), then you can code the kernel in the lower level models of CUDA or OpenCL. But you can't really do all of them at the same time.

talonmies
  • 70,661
  • 34
  • 192
  • 269
Mat Colgrove
  • 5,441
  • 1
  • 10
  • 11
  • But what about combining them, which was the actual question? – talonmies Jun 13 '18 at 19:05
  • OpenACC is interoperable with CUDA, so yes they can be combined. Though, I'm not sure about mixing CUDA with OpenCL. – Mat Colgrove Jun 13 '18 at 19:24
  • @talonmies OpenACC is fully inter-operable with CUDA as well as OpenCL, While I haven't worked with OpenCL myself, it should be a similar process as when mixing with CUDA. This blog gives a good overview https://devblogs.nvidia.com/3-versatile-openacc-interoperability-techniques/ with examples https://github.com/jefflarkin/openacc-interoperability – Mat Colgrove Jun 14 '18 at 16:43
  • OpenCL cannot interact with CUDA on NVIDIA platforms, and by extension OpenACC can't either. The OpenCL runtime isn't the same, nor is the PTX dialect, nor is the compiler – talonmies Jun 14 '18 at 17:13
  • You are correct that you can't mix OpenCL and CUDA on NVIDIA platforms. But OpenACC is inter-operable with OpenCL. When we (PGI) supported AMD devices, we used OpenCL as the back-end to OpenACC. So while the actual support level will depend upon the compiler implementation for a specific target accelerator, the OpenACC standard itself supports both. – Mat Colgrove Jun 14 '18 at 17:59
  • And given that the only platform where it is even theoretically possible to "combine CUDA, OpenCL, and OpenACC in the same program" is an NVIDIA platform, while it might be true that OpenACC has been implemented on top of OpenCL on *other platforms*, that is irrelevant to the question. If you want to expand on the details by editing the answer knock yourself out. But the point is to *answer the question* and that is what I intended to do by editing answer. – talonmies Jun 16 '18 at 13:01