Skip to content

A lot of computational memory and time is being devoted to reshaping and rechunking #193

Description

@dhjx1996

Describe the bug
A lot of computational memory and time seems to be devoted to reshaping and rechunking in compute_cloud_optics (and possibly in compute_gas_optics -- untested). This is likely related to the inconsistency between the chunking of the input and output (#191).

To Reproduce
Steps to reproduce the behavior

  1. Load atmosphere of type xarray.Dataset:

Image

  1. cloud_optics = load_cloud_optics(cloud_optics_file=CloudOpticsFiles.SW_BND)
  2. clouds_optical_props = cloud_optics.compute_cloud_optics(atmosphere, problem_type="two-stream")
  3. I ran the following code to monitor progress, but the essential line is clouds_optical_props = clouds_optical_props.persist()
# Progress bar with the distributed scheduler
from dask.distributed import Client, progress

client = Client()  # use dask.distributed by default

clouds_optical_props = clouds_optical_props.persist()  # start computation in the background
progress(clouds_optical_props )      # watch progress

Here is the progress report of the above block of code:

Image

I observed server memory spiking to around 80gb during the computations and my server eventually crashes (the server memory limit is 128gb so maybe a memory overflow caused the crash but I am not fully certain as to what causes the crash). As an alternative to step 3, I have tried tau_arr_swbndsum = clouds_optical_props.tau.sum("bnd", skipna=True).persist() (and analogously for g and ssa) and that code works but I still observe memory spikes to around 50gb. The progress report:

Image

Expected behavior
Is all that rechunking and reshaping necessary?

Software Versions:

  • OS: Ubuntu 22.04.5 LTS
  • pyrte_rrtmgp, rte_rrtmgp, dask, xarray versions: 0.0.9, 1.9.1, 2025.3.1, 2025.3.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

scaling exampleRelated to example showing scaling for large problems

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions