OpenMP Offloading: Compute Constructs¶
1. Which construct in OpenMP Offloading transfers both data and code execution to a device, such as a GPU?
- A.
teams
- B.
distribute
- C.
target
- D.
parallel
Click to reveal the answer
Answer: C. `target`Teams and Distribution¶
2. The teams
construct in OpenMP Offloading is used to:
- A. Offload code execution to a device without creating teams.
- B. Create a league of teams on the device, where each team has threads to execute code.
- C. Parallelize a loop across multiple teams on the CPU only.
- D. Optimize data transfer to the device without parallel execution.
Click to reveal the answer
Answer: B. Create a league of teams on the device, where each team has threads to execute code.3. True or False: The distribute
construct in OpenMP Offloading is used to divide loop iterations across team leaders, often in combination with target teams
for distributing work on devices like GPUs.
Click to reveal the answer
Answer: TrueCombining Constructs¶
4. Which combination of OpenMP Offloading constructs allows both loop distribution across teams and concurrent execution within those teams?
- A.
target teams distribute
- B.
target parallel for
- C.
teams distribute parallel for
- D.
target teams distribute parallel for
Click to reveal the answer
Answer: D. `target teams distribute parallel for`SIMD and Hierarchical Parallelism¶
5. In OpenMP Offloading, which construct enables vectorized execution of loop iterations to maximize throughput on hardware with SIMD capabilities?
- A.
teams
- B.
distribute
- C.
parallel
- D.
simd
Click to reveal the answer
Answer: D. `simd`6. True or False: Using target teams distribute parallel for simd
in OpenMP Offloading provides the highest level of parallelism by combining offloading, team distribution, parallel execution, and SIMD vectorization.
Click to reveal the answer
Answer: TruePractical Understanding¶
7. If you want to offload data to the GPU but keep it there for multiple compute operations without bringing it back to the CPU, which OpenMP Offloading construct would you use?
- A.
target
- B.
target data
- C.
parallel
- D.
simd