Skip to content

Basics in OpenACC

1. What is the main purpose of adding the kernels directive to a loop in OpenACC?

  • A. To initialize memory on the GPU
  • B. To instruct the compiler to attempt parallelization of the loop
  • C. To run the loop sequentially on the CPU
  • D. To copy data from the GPU to the CPU
Click to reveal the answer Answer: B. To instruct the compiler to attempt parallelization of the loop

Parallel Execution in OpenACC

2. True or False: In OpenACC, the term vector refers to a group of threads within a gang, similar to CUDA’s threads within a block.

Click to reveal the answer Answer: True

3. When compiling the serial version of the Print_Hello_World function in C/C++, the compiler output indicated:

  • A. The loop was fully parallelized by default
  • B. A parallelization error due to missing directives
  • C. “Loop not vectorized/parallelized: contains call”
  • D. The code was not executable on the GPU
Click to reveal the answer Answer: C. “Loop not vectorized/parallelized: contains call”

Key Concepts and Considerations

4. In OpenACC, what does gang typically refer to in GPU execution?

  • A. A single thread
  • B. A memory allocation block
  • C. A group of threads, similar to CUDA blocks
  • D. A function that must run sequentially
Click to reveal the answer Answer: C. A group of threads, similar to CUDA blocks

5. True or False: Fortran has limited I/O capabilities on the GPU, making it challenging to use print statements directly on the device.

Click to reveal the answer Answer: True