Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of OpenACC over OpenCL?

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).

like image 649
Fakruddeen Avatar asked Jan 31 '13 09:01

Fakruddeen


4 Answers

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.

like image 100
matthias Avatar answered Sep 28 '22 16:09

matthias


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

like image 20
Linas Avatar answered Sep 28 '22 16:09

Linas


Update (August 2020):

  • GCC supports OpenACC up to version 2.6 in GCC 10 and can target nVidia PTX, AMD GCN and Intel MIC (Xeon Phi products). It means all the latest nVidia and AMD Radeon cards are supported
  • Clang (LLVM) seems to have some experimental support
like image 22
David Bellot Avatar answered Sep 28 '22 18:09

David Bellot


Update: GCC6 + 7 actively integrating OpenACC specs

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

like image 44
Dr Jyy Avatar answered Sep 28 '22 17:09

Dr Jyy