Skip to content

Matrix Multiplication

1. In the parallelized version of matrix multiplication using OpenACC, which clause is used to combine nested loops for simultaneous parallelization?

  • A. tile
  • B. collapse
  • C. copyin
  • D. async
Click to reveal the answer Answer: B. `collapse`

Data Clauses and Memory Allocation

2. True or False: The copyin clause in OpenACC transfers input data from the host (CPU) to the device (GPU) before computation begins.

Click to reveal the answer Answer: True

Reduction and Optimization Clauses

3. Which OpenACC clause is used to ensure safe accumulation of the sum variable across parallel threads in matrix multiplication?

  • A. tile
  • B. loop
  • C. reduction
  • D. present
Click to reveal the answer Answer: C. `reduction`

4. True or False: The tile clause in OpenACC breaks down the iteration space into smaller blocks, which can help reduce memory latency on the GPU.

Click to reveal the answer Answer: True

Fortran and C/C++ Differences

5. When using OpenACC in Fortran, why is array indexing adjusted by +1 in single-dimensional storage?

  • A. To align with C/C++ indexing
  • B. For compatibility with OpenACC
  • C. Because Fortran arrays start indexing from 1 by default
  • D. To avoid memory conflicts
Click to reveal the answer Answer: C. Because Fortran arrays start indexing from 1 by default