Skip to content

Data Clauses in OpenACC

1. Which OpenACC clause allocates memory on the device, copies data from the host at the start, and then back to the host upon exiting the region?

  • A. copyin
  • B. copyout
  • C. copy
  • D. present
Click to reveal the answer Answer: C. `copy`

Main Data Clauses

2. True or False: The create clause in OpenACC allocates memory on the device without any data transfer from the host.

Click to reveal the answer Answer: True

3. Which clause would you use if the data is already allocated on the device from a parent data region, avoiding redundant allocation and transfer?

  • A. copyout
  • B. create
  • C. deviceptr
  • D. present
Click to reveal the answer Answer: D. `present`

4. In OpenACC, the deviceptr clause is mainly used for which of the following?

  • A. Device pointers allocated outside OpenACC
  • B. Allocating memory for host-only variables
  • C. Handling nested loops
  • D. Caching frequently accessed data
Click to reveal the answer Answer: A. Device pointers allocated outside OpenACC

Structured vs. Unstructured Data Regions

5. True or False: An unstructured data region in OpenACC allows data to remain on the device across multiple functions until it is explicitly deallocated.

Click to reveal the answer Answer: True

Cache Clause

6. What is the primary purpose of the cache clause in OpenACC?

  • A. To allocate memory on the GPU without transferring data
  • B. To keep frequently accessed data on the device for faster access
  • C. To assume data is already on the device
  • D. To combine multiple nested loops
Click to reveal the answer Answer: B. To keep frequently accessed data on the device for faster access