Data Transfer and Work on an Accelerator

Moving data to or from another execution device can contribute to total time even when the computation on that device is short.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a simplified operation
  2. Consider repeated work on resident data
  3. Add host-to-device, computation and return costs
  4. Measure reuse and overlap explicitly

Trace a simplified operation

A calculation taking one millisecond on a device can require three milliseconds of total transfers. An end-to-end improvement depends on both. Defining the timed operation provides the observation boundary.

Consider repeated work on resident data

A batch can reuse data already transferred when its contract allows that. Include eventual output transfer if callers need it. See fixed overhead and batching.[1]

Add host-to-device, computation and return costs

A task can take five milliseconds on a device after a four-millisecond transfer each way. Total is thirteen in this nonoverlapping model. A host execution taking eleven can therefore be faster end to end despite slower computation. See latency and transfer.

Input transfer 4 ms
Device work 5 ms
Output transfer 4 ms
Total 13 ms compared with 11 ms on the host

Measure reuse and overlap explicitly

Keeping data resident for several operations can amortize transfers. Overlapping computation with transfer changes the timeline. Verify returned values and time synchronization at the true completion boundary.

References

  1. OpenMP Architecture Review Board, OpenMP API Specifications ↩