Enable GPU-supported RGF calculation by adding 'rgf_device'#29
Merged
Conversation
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.
This pull request introduces comprehensive improvements to device management and tensor placement throughout the NEGF codebase. The main focus is to allow explicit control over which device (CPU or CUDA) is used for the recursive Green's function (RGF) step, while ensuring all relevant tensors and operations are consistently placed on the correct device. This is achieved by propagating an
rgf_deviceparameter and updating tensor allocations, conversions, and file I/O accordingly. Additionally, the pull request clarifies device usage in documentation and argument parsing.The most important changes are:
Device management and propagation:
rgf_deviceparameter (defaulting to CPU) to core classes and functions, includingDeviceProperty,NEGF, and argument parsing, to control where the RGF step runs. All relevant tensor allocations and computations in the NEGF pipeline now use this device. [1] [2] [3] [4] [5] [6]Consistent tensor placement:
rgf_device), including Hamiltonian blocks, self-energies, and intermediate matrices in both batched and non-batched scenarios. [1] [2] [3] [4] [5] [6].numpy()and ensuring device consistency during block construction and property calculations. [1] [2] [3] [4] [5] [6] [7]Documentation and argument updates:
rgf_deviceargument to the CLI and configuration. [1] [2]These changes enable flexible GPU acceleration for the RGF step, improve code clarity, and ensure robust and error-free device handling across the codebase.
TODO:
For now, in RGF, all sub-blocks Hamiltonian and Overlap are transfered to GPU at once. For large systems, OOM would happen. More detailed optimizaiton should be implemented.