Skip to content

Array API: decide a policy for inherently CPU-only operations #935

Description

@mwcraig

Background

Several ccdproc operations depend on libraries that are inherently CPU/numpy-only. For non-numpy input they either densify silently (Dask, JAX) or error (CuPy). Affected:

Function CPU-only dependency
cosmicray_lacosmic astroscrappy (C extension)
wcs_project reproject
median_filter, background_deviation_filter, cosmicray_median internals, ccdmask (non-block branch) scipy.ndimage
block_reduce, block_average, block_replicate astropy forces np.asanyarray on inputs

Decision needed

Pick one policy and apply it consistently:

  1. Convert + warn: explicitly convert to host memory, run the operation, convert the result (data and mask/uncertainty) back to the input namespace, and emit a warning the first time.
  2. Raise: refuse non-numpy input with an informative error telling the user to convert explicitly.

Silent densification is the one unacceptable option (CuPy turns it into a confusing error deep inside the dependency anyway). Whichever policy wins should be documented in docs/array_api.rst and reflected in per-backend test markers.


Follow-up to #909; relevant to #910 / #912. Found during a review of the array API implementation from #885.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions