I am trying to use GPUs in an OpenMP program. Is it possible to do this in a pure OpenMP program using OpenMP pragmas including OpenMP target pragmas or am I also required to use OpenACC pragmas to get this to work?
While PGI does support the OpenMP 4.5 directives in our LLVM based compilers, we don’t yet support offload to the GPUs. Hence, you will need to use OpenACC.
Note that parallelizing across multiple CPUs and multiple GPUs can be a bit tricky given that each device has it’s own discrete memory. Hence, if you have shared OpenMP variables, each device will need it’s own copy of the data. Not that that it can’t be done, it’s just a bit more difficult. If you’re only using one device, then it’s fairly straight forward to use OpenMP+OpenACC.
For multi-GPU programming it’s recommended to use MPI+OpenACC. If you’re interested in this, there are several articles and online classes which can help get you started.