Functionality of OpenACC¶
1. What is one of the main benefits of OpenACC’s incremental parallelization?
- A. Immediate parallelization of the entire codebase
- B. Step-by-step addition of parallelism while verifying each modification
- C. Replacing serial code entirely with parallel code
- D. Automatic optimization of all code regions
Click to reveal the answer
Answer: B. Step-by-step addition of parallelism while verifying each modificationKey Principles of OpenACC¶
2. True or False: OpenACC allows for single-source code that can run on various hardware architectures without modification.
Click to reveal the answer
Answer: True3. Which directive is used in OpenACC to parallelize a loop, as shown in the SAXPY example?
- A.
#pragma acc kernels
- B.
#pragma acc data
- C.
#pragma acc parallel loop
- D.
#pragma acc async
Click to reveal the answer
Answer: C. `#pragma acc parallel loop`Low Learning Curve¶
4. How does OpenACC simplify parallel programming for developers new to the field?
- A. By requiring hardware-specific memory management
- B. By abstracting low-level details and focusing on high-level directives
- C. By enforcing GPU-specific programming models
- D. By automatically writing parallel code for users
Click to reveal the answer
Answer: B. By abstracting low-level details and focusing on high-level directives5. True or False: The kernels
directive in OpenACC allows the compiler to analyze and parallelize a code region without the developer needing to specify device-specific details.