Using OpenACC over OpenCL?

I am new to OpenACC, which is the new programming standard for accelerating the GPU as well as the processor. According to my knowledge, OpenACC is a language that is a directive for the compiler, and we can speed up the code whenever we want, without changing the entire code. This programming standard will work on GPUs, unlike OpenMP.

Now my doubt arises here.

we have OpenCL for acceleration, now OpenACC (which is very easy to use, just providing compiler hints). To speed up the host program, we can simply set the compiler directives, but what if we have a kernel? that is, now I want to write my code for the GPU (c-language), what should I do? like opencl i need to write example.c and example.cl ?? do you need to add OpenACC compiler directives? or how? if so, what is OpenACC used for here because we write * .c and * .cl files (we have to check all the memory limitations and everything to write OpenCL, which is difficult work).

+4
source share
3 answers

Actually, OpenACC is a lot like OpenMP, but it targets acceleration devices such as GPUs. Instead of OpenMP #pragma parallel for parallelizing a loop for multi-threaded CPUs, OpenACCs #pragma acc kernels will turn the contained loops into kernel functions that run on the GPU. Most of what needs to be done manually (for example, transferring data from device to device) is hidden by the compiler. Thus, you do not have two separate compilation units.

Now here is the problem with OpenACC and my answer to the question why adoption is now very small: there is no support for GCC or Clang. Of course, there are commercial solutions from PGI and CAPS, but without these other compilers you will alienate many users.

+5
source

Update: gcc6 now has parts of its work:

"The GCC 6 series of releases includes a significantly improved implementation of the OpenACC 2.0a specification."

See https://gcc.gnu.org/wiki/OpenACC

+2
source

Update: GCC6 + 7 actively integrates OpenACC specifications

See https://gcc.gnu.org/wiki/OpenACC

+1
source

All Articles