3.9.2. OpenMP directives

Since no loop-level constructs are used, only a small number of OpenMP 4.5 directives are relevant and needed. The most important ones are listed here and detailed in subsections:

  • !$omp target/!$omp end target is analogous to !$omp parallel, in that it defines a section of the code that will be executed on the GPU
  • !$omp teams is used to set the number of GPU threads that execute in parallel in a thread block
  • !$omp declare target (v1, v2, ...) is used to specify if an array should exist only on the GPU, or should exist on both the GPU and CPU
  • !$omp target update is used to update (synchronize) data on the GPU and CPU