Skip to content

Conversation

@horizon-blue
Copy link
Contributor

(Part of MET-14)

Summary of Changes

Introduce bindings for the Array2D class to facilitate data exchange with numpy arrays. This includes methods for creating an Array2D from a numpy array and converting it back, along with tests to validate functionality and error handling.

Since Array2D are non-owning views of the underlying buffer, any changes made on the new view will be visible to the original array.

Test Plans

pixi run pytest

Copy link
Contributor Author

MET-14 Copy-free data movement to/from Python

and ideally, we should have something that works for both device & host.

One idea to achieve this is to use DLPack which has been widely adopted by ML & scientific computing libraries.

@horizon-blue horizon-blue force-pushed the xiaoyan/array2d-nanobind branch from 6050dca to 16e874e Compare November 25, 2025 06:52
@horizon-blue horizon-blue marked this pull request as ready for review November 25, 2025 06:56
Copy link
Contributor

@mugamma mugamma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@horizon-blue horizon-blue merged commit d224feb into master Nov 25, 2025
1 check passed
@horizon-blue horizon-blue deleted the xiaoyan/array2d-nanobind branch November 25, 2025 20:37
@horizon-blue horizon-blue restored the xiaoyan/array2d-nanobind branch November 25, 2025 20:38
@horizon-blue horizon-blue deleted the xiaoyan/array2d-nanobind branch November 25, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants