Skip to content

perf(ssins): batch reads to reduce peak mem - #2

Draft
rafrafavi wants to merge 4 commits into
MWATelescope:mainfrom
rafrafavi:perf/batch-ssins-reads
Draft

perf(ssins): batch reads to reduce peak mem#2
rafrafavi wants to merge 4 commits into
MWATelescope:mainfrom
rafrafavi:perf/batch-ssins-reads

Conversation

@rafrafavi

@rafrafavi rafrafavi commented Apr 4, 2025

Copy link
Copy Markdown
Contributor

This PR adds support for batching pyuvdata reads in read_raw to reduce peak memory usage in the module:

Profiling has shown that peak memory usage can be up to x6 of the size of the fits files we are reading, which could cause out-of-memory conditions on the target platform.

Further profiling within pyuvdata shows that the mem usage is diffused in several areas, with no evident "low-hanging fruit".

The solution for now is to batch the fit files such that the file size does not exceed one-sixth of the available memory to avoid a blowout.

Add pytest for testing read_select before refactoring
Includes testing of memusage

Both peak memory test and integrity test are coupled to save runtime

Should be decoupled when possible.
Comment thread tests/test_ssins.py
Comment thread tests/test_ssins.py Outdated
MAX_FILE = 60 # GB
MAX_MEM_FACTOR = MAX_MEM // MAX_FILE

args = Namespace(files=['/Users/raf/source/repos/mwa-demo/demo/data//1061312152/raw/1061312152.metafits',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: use relative paths when test data is cemented.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants