Measure a raster pipeline on your workload#
Measure the work through the point at which your consumer can use the pixels, and pair the timing with evidence that the requested pixels were produced.
Set the timing boundaries#
Record the hardware, Raster build and enabled features, input format and profile, ordered windows, destination, and the completion point included in the interval. Record open and preparation separately when they fall outside it. For device work, distinguish submitting work from waiting until the consumer can use the output.
The following pattern adapts the 64-request reusable-plan contract checked by the read-many tests and exposed by RasterSource. It submits 32 windows followed by the same 32 windows again. Supply a TIFF that Raster can open and that is at least 512 pixels wide and 256 pixels high.
import numpy as np
import cugeo.raster
source_path = "<path to your TIFF>"
windows = [
cugeo.raster.windows.Window((i % 8) * 64, (i // 8) * 64, 64, 64)
for i in range(32)
]
requests = tuple(
cugeo.raster.io.ReadRequest(window, image=0, request_id=10_000 + i)
for i, window in enumerate(windows + windows)
)
with cugeo.raster.lowlevel.RasterSource(source_path) as source:
image = source.info["images"][0]
dtype = np.dtype(image["dtype"])
bands = image["bands"]
outputs = tuple(
np.empty((bands, request.window.height, request.window.width), dtype=dtype)
for request in requests
)
policy = cugeo.raster.io.ReadPolicy(memory_budget_bytes=64 << 20, max_workers=0)
with source.plan_reads(requests, out=outputs, policy=policy) as plan:
first = source.read_many_into(plan, outputs)
# Check first and its outputs against the requests and controls here.
second = source.read_many_into(plan, outputs)
# Check second and its outputs against the requests and controls here.
Choose and record which calls you time. Each execution requests 64 results. If the measured interval contains repeated execution, retain the plan and buffers across those calls and include execution’s capacity revalidation in the interval.
Check what finished#
After each execution, count completed results and match each result to its request in order. Compare the pixels in each completed output with an independent control for the same window. For this example, also compare each repeated window with its corresponding earlier request. Check the first execution before the second overwrites its buffers, then check the second.
Record cancellations and I/O failures with their partial results. Per-request statuses determine what completed. A completed prefix need not account for every completed request. On an I/O failure, ReadBatchError preserves the partial batch, outputs, results and receipt. Report a short run against the work it actually completed.
Account for reads, transfers and processing#
Use the selected operation’s public receipts. For a read-many plan, distinguish logical requested bytes, stored bytes, decoded bytes and output bytes. Overlapping requests can share physical reads. Plan estimates cover the requested schedule, while execution receipts describe observed work. Stage timings do not necessarily add up to end-to-end elapsed time.
For orthorectification, account separately for the following.
Open and window work, and planned and actual allocation.
Host and device execution, submission and completion, and tile failures.
Logical pixel bytes, output bytes, and directional host-to-device and device-to-host copies.
Mark measurements the selected receipt does not expose as unavailable. Present elapsed time with its scope, observed route, completed request count and pixel checks. For receipt fields and failure details, see Raster errors and execution receipts.