Skip to content

OpenACC Directives

1. Which OpenACC construct requires the programmer to explicitly define the parallel regions in the code?

  • A. kernels
  • B. parallel
  • C. routine
  • D. loop
Click to reveal the answer Answer: B. `parallel`

Difference between parallel and kernels

2. True or False: The kernels construct allows the compiler to analyze and automatically parallelize code regions.

Click to reveal the answer Answer: True

Loop Construct

3. Which clause in the OpenACC loop construct specifies SIMD execution across vector lanes?

  • A. gang
  • B. worker
  • C. vector
  • D. collapse
Click to reveal the answer Answer: C. `vector`

4. True or False: The collapse clause in OpenACC can be used to combine nested loops into a single loop for parallelization.

Click to reveal the answer Answer: True

Routine Construct

5. What is the purpose of the routine construct in OpenACC?

  • A. To parallelize loop iterations
  • B. To specify functions that can be safely called within parallel regions
  • C. To optimize memory transfers between host and device
  • D. To manage data synchronization
Click to reveal the answer Answer: B. To specify functions that can be safely called within parallel regions