Repository navigation
GPU matvec: no unused host copy of the result tile - #46
Open
AdvaitTahilyani wants to merge 5 commits into
Open
AdvaitTahilyani wants to merge 5 commits into
AdvaitTahilyani wants to merge 5 commits into
Conversation
The 1-D chare that assembles a matrix-vector product took the result's host pointer before summing the partials. Only the CPU build uses it; on Kokkos builds data_ptr() creates the array's host mirror, so every matvec allocated and zero-filled a host copy of the result tile (4 MB per chare for linreg -n 4000 at 16 processes, 16 MB at 1), dropped again when the array was retired. The brk heap of those processes also grew by about 45 MB/s (freed 4 MB holes that later requests did not fit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong. The 1-D chare that assembles a matrix-vector product took
data_ptr()of the result before adding the partials. Only the CPU (Eigen) path uses that pointer; on Kokkos buildsdata_ptr()creates the array's host mirror, so every GPU matvec allocated and zero-filled a host copy of the result tile that nothing read (4 MB per chare for linreg-n 4000at 16 processes, 16 MB at 1), dropped again when the array was retired. The heap of those processes also grew by about 45 MB/s (freed 4 MB holes that later requests did not fit). Found with a sampling heap profiler: 23.5 GB allocated in 55 s from that call site.Change. The
data_ptr()call is under#ifndef USE_KOKKOS. CPU builds are unchanged.Measured (linreg
-n 4000 -i 2000, seconds per repeat, ofi build; measured on the older integration treescale-intwith #45's commit, with and without this one):Not a cause of the repeat-to-repeat drift fixed in #45; repeats were flat with and without it.
Validated. nc and GPU (netlrts-cuda) builds; GPU runs: covered by the validation of the top of this stack (#48).
Known limits. Other places that call
data_ptr()on device arrays were not audited.🤖 Generated with Claude Code