Introduction to OpenACC¶
1. What is the primary purpose of OpenACC?
- A. Debugging GPU code
- B. Simplifying performance-portable parallel programming across heterogeneous hardware
- C. Optimizing sequential CPU execution
- D. Managing memory allocation
Click to reveal the answer
Answer: B. Simplifying performance-portable parallel programming across heterogeneous hardware2. True or False: OpenACC supports C, C++, and Fortran programming languages.
Click to reveal the answer
Answer: TrueOpenACC Compilers and Commands¶
3. Which command is used to compile OpenACC C++ code with NVIDIA’s HPC SDK?
- A.
nvfortran
- B.
cuda-gdb
- C.
nvc++
- D.
nsys
Click to reveal the answer
Answer: C. `nvc++`4. True or False: The Cray compiler supports OpenACC for Fortran on AMD GPUs.
Click to reveal the answer
Answer: TrueOpenACC Syntax and Directives¶
5. In OpenACC, which directive is used for data parallelism?
- A.
data
- B.
kernels
- C.
wait
- D.
deviceptr
Click to reveal the answer
Answer: B. `kernels`6. True or False: In OpenACC, parallel
and kernels
are examples of compute directives.
Click to reveal the answer
Answer: True7. Which directive in OpenACC helps manage synchronization between parallel tasks?
- A.
data
- B.
parallel
- C.
wait
- D.
deviceptr
Click to reveal the answer
Answer: C. `wait`OpenACC Compiler Flags¶
8. Which flag activates OpenACC support in NVIDIA’s HPC SDK compilers?
- A.
-gpu
- B.
-acc
- C.
-fopenacc
- D.
-openacc