Skip to content

Measure a command

Use this to find out how long a command takes. The lesson behind it is Measuring.

Steps

  1. Load the program once, and start timing after load: loading takes about a second.
  2. Send the command many times, 20 or more, one after the other, each with its own wait.
  3. For each run, keep two numbers: event.microseconds, the card's clock, and the difference of two time.perf_counter() readings around submit and wait, the host's.
  4. Report the middle value (statistics.median) with the smallest and the largest. Do not report the first run: on the host's clock it was nearly four times the middle.
  5. Say which clock the number is from. The card's clock is the time the cores worked; the host's is the time your program waited, and it includes the trips to the card.

To hide the trips, send many commands before the first wait (Many commands).