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

Reduce peak memory in UMAP.fit/UMAP.fit_transform #6323

Open
wants to merge 2 commits into
base: branch-25.04
Choose a base branch
from

Conversation

jcrist
Copy link
Member

@jcrist jcrist commented Feb 14, 2025

This reduces the peak GPU memory usage during a UMAP.fit call by releasing certain temporaries as soon as possible.

This required splitting the FuzzySimplSet::run function into a few sub-functions and intermingling them within _get_graph to let us drop the temporary arrays earlier. While I was at it, I noticed that _get_graph and _get_graph_supervised were almost identical, so I've merged these paths a bit to reduce duplication. There's a lot more duplication in here that could be cleaned up (and I went down that rabbit hole a bit before stopping myself), but for now I think this should be sufficient.

On an input of 190 GiB this dropped 12 GiB off the peak, and moved the high point into the SimplSetEmbed routines instead of in FuzzySimplSet. Further memory improvements will come in a later PR.

By dropping intermediate objects earlier we can reduce peak memory usage.
Also reduces some code duplication between `_get_graph` and
`_get_graph_supervised`.
Copy link

copy-pr-bot bot commented Feb 14, 2025

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@jcrist jcrist marked this pull request as ready for review February 14, 2025 21:17
@jcrist jcrist requested a review from a team as a code owner February 14, 2025 21:17
@jcrist jcrist requested review from tfeher and lowener February 14, 2025 21:17
@jcrist jcrist added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Feb 14, 2025
@jcrist
Copy link
Member Author

jcrist commented Feb 15, 2025

Hold off on merging this - the commits ran fine on a 270 GiB dataset yesterday, but after rebasing on #6314 there's now an underflow happening on large data (I think from inputs.n now being an int instead of a uint64_t). I'll take a look on Tuesday morning, I suspect something in that PR got mistakenly dropped when I rebased.

@jcrist
Copy link
Member Author

jcrist commented Feb 17, 2025

I suspect something in that PR got mistakenly dropped when I rebased.

This is not a bug in the change here, but rather a regression added in #6314. See my comment here: #6314 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CUDA/C++ improvement Improvement / enhancement to an existing function non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant