Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile Cubed task memory usage with Memray #372

Closed
tomwhite opened this issue Feb 6, 2024 · 1 comment · Fixed by #558
Closed

Profile Cubed task memory usage with Memray #372

tomwhite opened this issue Feb 6, 2024 · 1 comment · Fixed by #558

Comments

@tomwhite
Copy link
Member

tomwhite commented Feb 6, 2024

I've been using Memray to profile the memory usage of Cubed tasks running locally using a local Lithops executor (since it runs tasks in a separate process).

This give great insight into how memory is allocated for blockwise operations. Here is an example timeline for an array add operation, where you can see Zarr chunks being loaded and stored:

memray-add

More details in this presentation.

This issue is to add the instrumentation code to make it easy to profile any computation.

@tomwhite
Copy link
Member Author

tomwhite commented Feb 6, 2024

The code I used to produce the above plot is in this branch, in particular this commit.

It would be be good to have more control over i) the file that the profile info is written to, and ii) which tasks to run it for (it currently just runs it for the first task - i.e. with block ID composed of zeros).

Then to generate the visualization I ran:

rm -fr memray/*
pytest -vs 'cubed/tests/test_mem_utilization.py::test_add' --runslow
for f in $(ls memray); do echo $f; python -m memray flamegraph --temporal -f -o memray/$f.html memray/$f; done
# view html files in memray directory

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

Successfully merging a pull request may close this issue.

1 participant