Skip to content

to_geotiff on dask+cupy with gpu=False crashes: streaming writer calls np.asarray before the cupy .get() handoff #3165

@brendancol

Description

@brendancol

Both segment loops in the streaming writer do the conversion in the wrong order (_writer.py:1141-1148 for tiled segments, 1241-1247 for strips):

seg_np = np.asarray(dask_data[r0:r1, seg_c0:seg_c1].compute())
if hasattr(seg_np, 'get'):
    seg_np = seg_np.get()

cupy.ndarray.__array__ raises TypeError: Implicit conversion to a NumPy array is not allowed, so np.asarray throws before the .get() branch can run. The handoff is dead code, and any dask-of-cupy array routed to the CPU streaming writer crashes.

Repro: to_geotiff(dask_cupy_da, path, gpu=False) raises the TypeError above. gpu=False is the documented way to force the CPU writer, and the docstring promises dask-backed inputs are written in streaming mode.

The VRT per-tile writer gets the order right (_writers/eager.py:1107-1112): compute first, .get() if the chunk is cupy, then np.asarray. The streaming loops should do the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdaskDask backend / chunked arraysgeotiffGeoTIFF modulegpuCuPy / CUDA GPU supportseverity:mediumSweep finding: MEDIUM

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions