home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where repo = 13221727, state = "open" and user = 8914493 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

type 1

  • issue 1

state 1

  • open · 1 ✖

repo 1

  • xarray · 1 ✖
id node_id number title user state locked assignee milestone comments created_at updated_at ▲ closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1322112135 I_kwDOAMm_X85OzdSH 6847 Please expose __cuda_array_interface__ via the xarray.__array__() function if present MurrayData 8914493 open 0     5 2022-07-29T11:08:51Z 2022-08-01T12:38:13Z   NONE      

Is your feature request related to a problem?

When using an array type with GPU support, such as CuPy arrays, Numba device arrays or Numba mapped arrays (shared), __cuda_array_interface__ is not exposed by the xarray.__array() function.

I'm using large NetCDF files which I wish to process against reference dataframes and use GPU acceleration to do this.

For example, Numba mapped array:

```

points = np.random.randn(2, 3) map_points = nb.cuda.mapped_array_like(points) map_points.array_interface {'data': (140399865758208, False), 'strides': None, 'descr': [('', '<f8')], 'typestr': '<f8', 'shape': (2, 3), 'version': 3}

map_points.cuda_array_interface {'shape': (2, 3), 'strides': None, 'data': (140399865758208, False), 'typestr': '<f8', 'stream': None, 'version': 3} ```

When copied to xarray:

```

data = xr.DataArray(map_points, dims=("x", "y"), coords={"x": [10, 20]}) data xarray.DataArray x: 2y: 3 array([[0., 0., 0.], [0., 0., 0.]]) Coordinates: x (x) int64 10 20 Attributes: (0) ```

Array interface confirms same address for the base (CPU) array as above, i.e. Zero Copy

```

data.array().array_interface {'data': (140399865758208, False), 'strides': None, 'descr': [('', '<f8')], 'typestr': '<f8', 'shape': (2, 3), 'version': 3} ```

However the __cuda_array_interface__ is not exposed

```

data.array().cuda_array_interface


AttributeError Traceback (most recent call last) Input In [23], in <cell line: 1>() ----> 1 data.array().cuda_array_interface

AttributeError: 'numpy.ndarray' object has no attribute 'cuda_array_interface' ```

Describe the solution you'd like

Expose __cuda_array_interface__ via the xarray.__array() function so it is available to CuPy and Numba CUDA functions.

Describe alternatives you've considered

As a workaround, I'm not using xarray for NetCDF files. Instead I'm converting them into an dictionary of arrays which provides me with the GPU interfaces.

Additional context

No response

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6847/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 28.174ms · About: xarray-datasette