-
Notifications
You must be signed in to change notification settings - Fork 80
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
Support structured datatypes #1164
Comments
Can you easily create a cupynumeric array backed by an equivalent
NumPy additional supports comparisons and casts on/between these. My guess would be that you can get quite far with just those in practice (including custom kernels that actually ingest the structured dtype). In NumPy |
Yes, that's trivial.
We need to make two changes for this: (1) We should keep track of field names and offsets for
How does NumPy implement those operators? the easiest way I can think of is doing them field-wise and aggregating the results.
in fact, there's no easy way to support that unfortunately. in the way |
@manopapad given that we have enough building blocks to support structured types, let's scope the work and assign it to someone. |
Yes, nothing much to it:
For memory access optimization, a lower-level approach is better of course, since you would want to do the operation in cache-friendly chunks. One thing that comparisons in the NumPy case does include is that we support sorting/searchsorted. But in the end even comparisons are probably something that users rarely need or can work around if missing, but comparisons are also pretty easy to implement if you don't care mostly about support.
I think this is completely fine. If possible, it may help users if you can make that 0-D array read-only and raise a helpful error message on why. (It might also end up being more trouble than worth it, although I suspect it is good.) Another thing that NumPy supports are
Then |
Reported by @elliottslaughter
When you save a complex-typed array to an HDF5 file in MATLAB, it uses the structured datatype
[('real', '<f8'), ('imag', '<f8')]
instead ofcomplex128
. If you globally replace NumPy with cuPyNumeric, now that HDF5 file cannot be read into an array, because at conversion time cuPyNumeric doesn't allow this datatype:We should at least be accepting this datatype, even if we fall back to NumPy for it. Then we can re-enter accelerated territory once we convert to
np.complex128
.The text was updated successfully, but these errors were encountered: