Repository navigation
Conversation
|
I don't think Likewise, netCDF4 doesn't support "outer" slicing in an efficient manner -- under the hood it basically generates a loop (in Python) of calls to the underlying HDF5 library. It's not immediately obvious what the right solution here is, but maybe this provide some valuable context? |
|
You're right, following the example described in #1770. From my testing, it seems clear that such slices should not generally be fused, otherwise issue #1770 could pop-up. I agree with you that it is not completely clear whether the right course of action is either one of these options. |
Maybe raise an issue about this in the h5py issue tracker? It seems like something that they should at least know about. |
|
In fact it's in issue h5py/h5py/issues/652. It has been raised about a year ago. |
|
Another option, would be to revert to |
This seems like a bad idea. Dask should not be evaluating pieces of arrays values. I like explicit options... just need to think through this a little more. |
|
I agree with you that explicit options are usually better! One approach is to default optimizations to vector indexing when
This would seem to impose minimal changes to the user interface while allowing the optimization to be aware of the allowed optimal (in the sense of minimal amount of data brought to memory) underlying slicing methods. One advantage of this approach is that with the current PR, I could remove the possibility of specifying |
|
What is the status of this? |
|
This is how I would sum it up:
The current PR proposes a simple solution that allows to specify |
|
I encountered and fixed this issue in #2313 without realizing that this was already raised (and a fix proposed). Sorry about that. In #2313 I prevent fusing these indices in all cases. I like this because it's simple and correct for all backends, but it does prevent the optimizations coming into effect for hdf5 where they're valid(?) (although maybe they shouldn't be). I'm not sure what's best here. |
|
No worries. Do you want to still keep this PR open then? |
|
No, not really. I'm closing it! |
This commit fixes issue #1770.
As mentioned in my comment on that issue, the solution is to prevent fusing slices in specific cases in order to prevent unintended numpy-style slicing.
However, this might not always be desirable, especially when the underlying array support "outer" slicing like in h5py and netcdf4-python. This was discussed in #433 in the context of slicing dask arrays. The problem of slicing optimizations on the underlying array was discussed in #1529. In that discussion, the addition of a
fancykeyword was introduced to allow finer-grained optimizations. In the current PR, I propose to extend this concept by allowing a user to specify that the underlying array supportouterindexing. By default,fancy=Truewould mean that the underlying array supports numpy-style vector indexing.By adding this disctinction, it now possible to avoid issue #1770 by preventing the offending optimization only for vector indexing. By providing
fancy='outer'a user could then allow this optimization when it is safe to use on the underlying array.Comments?