You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the slow-moving (early) axes in .reshape are all size 1
Our YP[i] happens to fall into that category. And afaiu dask/dask#6748 introduced a bug, it might be hard to see that in the reginie code, here's a distilled reproduction:
># c4038add1a087ba3a82207a557cdcad9753b689d is the https://github.com/dask/dask/pull/6748>daskgit:(c4038add) gckc4038add1a087ba3a82207a557cdcad9753b689dHEADisnowatc4038addAvoidrechunkinginreshapewithchunksize=1 (#6748)>daskgit:(c4038add) python>>>importnumpyasnp>>>importdask.arrayasda>>>a=da.from_array(np.arange(24).reshape(2, 3, 4), chunks=((1, 1), (1, 1, 1), (4,)))
>>>a.reshape(6,4)
dask.array<reshape, shape=(6, 4), dtype=int64, chunksize=(1, 4), chunktype=numpy.ndarray>>>># merging dimensions at the front works fine, now let's try the last two (which is our use case)>>>a.reshape(2,12)
dask.array<reshape, shape=(2, 24), dtype=int64, chunksize=(1, 4), chunktype=numpy.ndarray>>>># NOTICE: the shape is (2, 24) NOT (2,12)!, now let's try to compute this:>>>a.reshape(2,12).compute()
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/Users/rav/projects/dask/dask/base.py", line167, incompute
(result,) =compute(self, traverse=False, **kwargs)
File"/Users/rav/projects/dask/dask/base.py", line454, incomputeresults=schedule(dsk, keys, **kwargs)
File"/Users/rav/projects/dask/dask/threaded.py", line76, ingetresults=get_async(
File"/Users/rav/projects/dask/dask/local.py", line503, inget_asyncreturnnested_get(result, state["cache"])
File"/Users/rav/projects/dask/dask/local.py", line299, innested_getreturntuple([nested_get(i, coll) foriinind])
File"/Users/rav/projects/dask/dask/local.py", line299, in<listcomp>returntuple([nested_get(i, coll) foriinind])
File"/Users/rav/projects/dask/dask/local.py", line299, innested_getreturntuple([nested_get(i, coll) foriinind])
File"/Users/rav/projects/dask/dask/local.py", line299, in<listcomp>returntuple([nested_get(i, coll) foriinind])
File"/Users/rav/projects/dask/dask/local.py", line299, innested_getreturntuple([nested_get(i, coll) foriinind])
File"/Users/rav/projects/dask/dask/local.py", line299, in<listcomp>returntuple([nested_get(i, coll) foriinind])
File"/Users/rav/projects/dask/dask/local.py", line301, innested_getreturncoll[ind]
KeyError: ('reshape-aa29de8b0f6be5be25495836ed047c4a', 1, 0)
This issue seems to be affected by the chunking of the array (a), in the case above (and in our reginie case) the lower axis are completely chunked, see:
Btw, this is an good example of how valuable Eric's asserts in this case are, it's already pretty hard to debug this code, and image if it just failed at compute() with a cryptic KeyError: ('reshape-aa29de8b0f6be5be25495836ed047c4a', 1, 0), so big +1 to https://github.com/pystatgen/sgkit/issues/267
Long story short, the problematic line in our code is: https://github.com/pystatgen/sgkit/blob/41827f3fd116d59ab4dc8b119a15ad5f3be730b9/sgkit/stats/regenie.py#L364
dask/dask#6748 is a special case optimisation:
Our
YP[i]
happens to fall into that category. And afaiu dask/dask#6748 introduced a bug, it might be hard to see that in the reginie code, here's a distilled reproduction:Notice the invalid shape after
a.reshape(2,12)
.The same code works fine without dask/dask#6748:
This issue seems to be affected by the chunking of the array (
a
), in the case above (and in our reginie case) the lower axis are completely chunked, see:Btw, this is an good example of how valuable Eric's asserts in this case are, it's already pretty hard to debug this code, and image if it just failed at
compute()
with a crypticKeyError: ('reshape-aa29de8b0f6be5be25495836ed047c4a', 1, 0)
, so big +1 to https://github.com/pystatgen/sgkit/issues/267Originally posted by @ravwojdyla in https://github.com/pystatgen/sgkit/issues/430#issuecomment-772868301
The text was updated successfully, but these errors were encountered: