Open keflavich opened 2 years ago
This points at a bug, actually - somewhere internally we're converting from a dask array to a memory-allocated numpy array.
the problem appears to be the use of u.Quantity
. It reads the data at init time.
If I read the u.Quantity
docstring correctly, that's inevitable if the dask
__array__()
method returns a copy.
see https://github.com/astropy/astropy/issues/8227#issuecomment-951431146 also - yes, it is inevitable with the current construction. We need a workaround that avoids creating Quantity objects until the last moment
and https://github.com/radio-astro-tools/spectral-cube/pull/775 was my start at trying to fix this, but it doesn't.
When doing huge cube arithmetic, which is needed in many cases, what workflow do we suggest to avoid OOM errors like this?
The example code is https://github.com/ALMA-IMF/reduction/blob/1fecfdceb94ab5a673cc4ce7bce9ee82224033f9/reduction/cube_finalizing.py
In brief, it's doing something like:
I think
dask
should be able to handle this, and should be automatically handling this. I haven't figured out yet where we go awry...