Open main menu

CDOT Wiki β

Changes

DPS921/OpenACC vs OpenMP Comparison

726 bytes added, 00:18, 3 December 2020
m
no edit summary
}
</source>
For example in this piece of code, the <code>kernels</code> directive tells the GPU that it is up to the GPU to decide how to parallelize the following loop.
== GPU offloading ==
[image]
== Installation Compiler support ==
Originally, OpenACC compilation is supported by the PGI compiler which requires an expensive subscription, there has been new options in recent years.
=== GCC[https://gcc.gnu.org/wiki/OpenACC] ===
Latest GCC has added support to OpenACC since GCC 5. The latest GCC version, GCC 10 has support to OpenACC 2.6. To compile OpenACC code with GCC, you need to run<source>gcc -fopenacc demo.c</source> However, this does not enable any GPU offloading capability. In order to enable GCC with GPU offloading, we need to build some accelerators by ourselves. For example, to enable GPU offloading on Nvidia GPUs, you need to rebuild GCC with Nvidia PTX, then use the option <code>-foffload=<target></code> to offload generated instructions to accelerator devices. The instruction of building GCC is over complicated therefore will not be shared here.
= OpenMP vs OpenACC =
So the real difference between the two is how much freedom is given to the compilers.
 
 
== Code comparison ==
36
edits