6

I am new to OpenACC which is a new programming standard for GPU Acceleration as well as CPU. As per my knowledge OpenACC is a language which is a compiler directive, directly we can accelerate the code where ever we want, without changing the whole code. This Programming standard will work for GPU also unlike OpenMP.

Now my doubt raises here..

we have OpenCL for acceleration, now OpenACC(which is very easy to use, just by giving compiler hints). For host program acceleration we can simply put compiler directives, then what about if we have a kernel? i.e. now i want to write my code for GPU(c-language), what i have to do? like OpenCL do i need to write example.c & example.cl?? then need to add OpenACC compiler directives? or else in which way? if it is so, then what is the use of OpenACC here, coz we are writing both *.c & *.cl files, (we need to check all the memory constraints and all for writing OpenCL, which is a tough work).

Fakruddeen
  • 175
  • 1
  • 3
  • 11
  • 2
    There are 3 levels to consider: 1) OpenCL is low-level, write-it-yourself accelerator parallelism, 2) OpenCL libraries are easiter-to-use, based on OpenCL, hand-written to achieve accelerator parallelism, 3) OpenACC relies on compilers to somehow automatically find accelerator parallelism in your code. In practice, compilers are not up to the task of auto-finding parallelism for most problems. We wrote about this topic last year: http://blog.accelereyes.com/blog/2012/04/11/no-free-lunch-for-gpu-compiler-directives/ – arrayfire Jan 31 '13 at 21:36
  • If you haven't found it already, you might consider investigating the "Education" and [sample code](http://www.openacc.org/node/290) sections of [OpenACC](http://www.openacc.org/) – John Coombs Jul 10 '13 at 23:58

4 Answers4

8

Actually, OpenACC is a lot like OpenMP but targeting acceleration devices such as GPUs. Instead of having an OpenMP #pragma parallel for parallelizing a loop for a multi-threaded CPU, OpenACCs #pragma acc kernels will turn the contained loops into kernel functions that are executed on the GPU. Much of what has to be done now manually (e.g. transferring the data from and to device) is hidden by the compiler. Thus, you don't have two separate compilation units.

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

matthias
  • 2,161
  • 15
  • 22
  • Thank you so much for your answer.. My doubt is clarified.. i want to explore more on this OpenACC.. i studied some of the pdf's and docs about this.. I wanna study much more, can you provide me any source which is best to learn? – Fakruddeen Jan 31 '13 at 16:37
  • Unfortunately, there isn't much more information available besides what you can get from the official website. This may also be attributed to OpenACC's low adoption. – matthias Jan 31 '13 at 17:17
  • 2
    GCC may gain progress in 4.9 – Demi Sep 20 '13 at 01:21
  • Mentor Graphics are [working on it](http://www.mentor.com/embedded-software/blog/post/we-are-bringing-openacc-to-the-gnu-compiler-suite--8d06289f-c4e9-44c8-801b-7a11496e7300?contactid=1&PC=L&c=2013_12_18_embedded_technical_news) – errordeveloper Dec 20 '13 at 13:37
3

Update (August 2020):

David Bellot
  • 643
  • 7
  • 13
2

Update: gcc6 now has parts of it working:

"GCC 6 release series includes a much improved implementation of the OpenACC 2.0a specification."

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

Linas
  • 773
  • 6
  • 13
2

Update: GCC6 + 7 actively integrating OpenACC specs

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