Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choice of C++ ndarray type #22

Closed
johnstairs opened this issue Dec 4, 2022 · 1 comment
Closed

Choice of C++ ndarray type #22

johnstairs opened this issue Dec 4, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@johnstairs
Copy link
Member

Creating a separate issue based on #20 opened by @KrisThielemans

Also, somewhere in the doc we'll need a description of mappings between yardl types and C++ and other target languages. In particular, I believe you generate your own multi-dim array type as there still doesn't seem to be an std container sadly.

It could be useful to support a few existing multi-dim arrays to avoid copies in client-code (Boost.MultiArray and https://amypad.github.io/CuVec/ come to mind), but I can see that becoming very difficult. (If a mapping to a flat array is exposed somewhere, it'd need to be stated if row-major or column-major order is used).

These are good points. We currently use xtensor types for multidimensional arrays that we alias here. These have a .data() method that exposes the raw flat array.

I think we have some choices for this problem:

  1. We implement our own ndarray types that provide the minimum API surface and aim to make interop with other libraries "easy".
  2. We support a number of different libraries and generate different code depending on a setting in the _package.yaml.
  3. Implement both of the above, since they are not mutually exclusive, with (1) being the default.

Related problem: in some instances, perhaps the memory should be allocated on the GPU. Should this be a be a property on the !array in yardl?

@johnstairs johnstairs added the enhancement New feature or request label Dec 5, 2022
@KrisThielemans
Copy link

Related problem: in some instances, perhaps the memory should be allocated on the GPU. Should this be a be a property on the !array in yardl?

I don't think so. Client code needs to decide what to optimise, not the data-spec. However, you might want to have that as an option in the (generated) "read" code, i.e. return an array that lives on the GPU (or at least is CUDA-shared)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants