# Parallel GPU Directives

([Main README](README.md))

These directives can be used for invoking GPU parallelization.

**target**  
Declares portion of code to be executed on GPU.

**teams**  
With teams, the code runs on GPU using multiple "teams".

- Invokes fork/join model
- No collective synchronization! (i.e. barriers)
- Must be within "omp target"

**distribute**  
Iterations of the loop below are partitioned across "teams".

- Loop partitioning (like omp do/far)
- Iterations are partitioned across "teams"
- NO implied barrier at end of loop!
- Best practice to combine with teams (target teams distribute)

**simd**  
Maps the work below to GPU threads within the "teams" blocks.  

- Used for two-level GPU parallelism
- "teams" maps to GPU threadblocks
- "simd" maps to GPU threads within the teams

! NOTE - parallel and simd are inconsistent across implementations !

- CCE-Classic maps "simd" to GPU threads and skips "parallel for"
- Clang maps "parallel for" to GPU threads and skips "simd"

**do**  
Causes the work done in a loop inside a parallel region to be divided among threads.  
Might be redundant next to simd?
