-
Notifications
You must be signed in to change notification settings - Fork 124
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
set_fancy
does not work for some arrays with certain Bigarray.kind
types.
#671
Comments
This commit implements basic functionality. - Supported codecs include Sharding Indexed, Gzip, Crc32c, Transpose and Bytes. - Supported stores include MemoryStore and FilesystemStore. - Supported data types include Float32, Float64, Complex32 and Complex64. This limitation is simply a result of Owl limited array write functionality as reported here: owlbarn/owl#671 - All the core Zarr V3 specification details have been implemented.
This commit implements basic functionality. - Supported codecs include Sharding Indexed, Gzip, Crc32c, Transpose and Bytes. - Supported stores include MemoryStore and FilesystemStore. - Supported data types include Float32, Float64, Complex32 and Complex64. This limitation is simply a result of Owl limited array write functionality as reported here: owlbarn/owl#671 - All the core Zarr V3 specification details have been implemented.
`Ndarray.set_fancy*` functions unfortunately don't work for array kinds other than Float32, Float64, Complex32 and Complex64. See: owlbarn/owl#671 . As a workaround we manually set each coordinate one-at-time using the basic set function which does not suffer from this bug. It is likely much slower for large Zarr chunks but necessary for usability.
`Ndarray.set_fancy*` functions unfortunately don't work for array kinds other than Float32, Float64, Complex32 and Complex64. See: owlbarn/owl#671 . As a workaround we manually set each coordinate one-at-time using the basic set function which does not suffer from this bug. It is likely much slower for large Zarr chunks but necessary for usability.
I was able to implement a temporary workaround to this issue by using element-wise
List.iter2
(fun coord val ->
Owl.Dense.Ndarray.Generic.set coord val) coord_list value_list I would like to add that this issue also affects the owl/src/owl/core/owl_ndarray_transpose.ml Lines 41 to 54 in 455bde1
Unfortunately, I haven't been able to find a workaround for this |
UPDATE: So I managed to find a workaround for computing the transpose of any kind using Owl functions. Essentially, this involves converting between module Ndarray = Owl.Dense.Ndarray.Generic
module Anyarray = Owl.Dense.Ndarray.Any
let transpose ?axis x =
let shape = Ndarray.shape x in
let y = Anyarray.init_nd shape @@ fun c -> Ndarray.get x c in
let y' = Anyarray.transpose ?axis y in
Ndarray.init_nd (Ndarray.kind x) (Anyarray.shape y') @@ fun c ->
Anyarray.get y' c
I suppose this workaround can be generalized to any of the Generic functions that are limited to only 4 bigarray kinds? Cc @jzstark |
Nice. The main downside is that this won't scale well since it involves copying everything twice, but at least would circumvent the current unnecessary limitation |
Perhaps it can be used only for the Bigarray kinds not currently supported by the I am very interested in getting |
Thanks a lot the investigation about using other types of Bigarray! Unfortunately, due to that the type system holds a central position in the design of Owl, adding even one new type such as |
When using
Owl.Dense.Ndarray.Generic.set_fancy
with arrays of kinds notFloat32
,Float64
,Complex32
orComplex64
, the operation fails with error messageException: Failure "_ndarray_set_fancy: unsupported operation"
, even though the kind is a validBigarray.kind
type.It appears this exception is thrown by the snippet:
owl/src/owl/core/owl_slicing_fancy.ml
Lines 92 to 105 in 600c21a
I think it is very limiting to only support just 4 kinds when the set operation should work for any of the
Bigarray.kind
types.Here is a minimal example to reproduce the error:
I expected this simple operation to work but it throws a
|Exception: Failure "_ndarray_set_fancy: unsupported operation".
exception.I would love for Owl to support more kinds as im using it to write an array library that needs to support more than the 4 basic kinds listed above.
Cc @mseri @jzstark
The text was updated successfully, but these errors were encountered: