Skip to content

Async copy of self-energyy from Device to Host#9

Merged
gauravharsha merged 36 commits intoGreen-Phys:mainfrom
gauravharsha:stream-cleanup
Nov 6, 2025
Merged

Async copy of self-energyy from Device to Host#9
gauravharsha merged 36 commits intoGreen-Phys:mainfrom
gauravharsha:stream-cleanup

Conversation

@gauravharsha
Copy link
Contributor

The PR proposes asynchronous logic for the copy of self-energy results from D2H.

In the current version, we use cudaMemcpy which is a blocking call, i.e., all subsequent qkpt workers wait for the data transfer before starting to read integrals from filesystem.

The Self-energy computation blocks become highly efficient and keep the GPU busy most of the time.

@gauravharsha gauravharsha requested review from Copilot and egull October 29, 2025 05:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the self-energy (Sigma) computation workflow in GPU-accelerated GW calculations to improve asynchronous data handling and memory management. The changes introduce a cleanup mechanism for asynchronous device-to-host data transfers and separate cublas handles for each qkpt worker stream.

  • Removed Sigmak_stij_host parameter from computation functions, introducing a deferred cleanup pattern
  • Added cleanup() method and cleanup_req_ flag to manage asynchronous Sigma data transfers
  • Introduced separate cublas handles for each qkpt worker to enable concurrent operations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/green/gpu/cugw_qpt.h Added cleanup infrastructure (methods, member variables) and helper functions for managing qkpt workers; modified function signatures to remove host pointer parameters
src/cugw_qpt.cu Implemented cleanup logic, moved Sigma copy operations into cleanup method, replaced synchronous memcpy with async version
src/green/gpu/cu_routines.h Added _qkpt_handles vector to store separate cublas handles for qkpt streams
src/cu_routines.cu Integrated new cleanup pattern into solve workflow, created separate cublas handles for each qkpt worker

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gauravharsha and others added 7 commits November 5, 2025 16:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gauravharsha
Copy link
Contributor Author

Build will fail until PR#3 on Green-Utils is merged.

@gauravharsha gauravharsha requested a review from WSLinkK November 6, 2025 05:56
Copy link
Contributor

@egull egull left a comment

Choose a reason for hiding this comment

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

Cool, thanks. I think this is ready to merge. It would be easier to review if there were more pull requests about smaller changes (e.g. timers separate from async copy and k-index buffering), but this is not a perfect world...

@egull
Copy link
Contributor

egull commented Nov 6, 2025 via email

@gauravharsha gauravharsha requested a review from Copilot November 6, 2025 16:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gauravharsha gauravharsha requested a review from Copilot November 6, 2025 17:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gauravharsha gauravharsha requested a review from Copilot November 6, 2025 21:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gauravharsha and others added 2 commits November 6, 2025 16:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gauravharsha gauravharsha merged commit d7b9d7d into Green-Phys:main Nov 6, 2025
1 check passed
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.

4 participants