Skip to content

RGF_ACC: Reduce dead memory in RGF and Improve energy chunk size handling#35

Merged
AsymmetryChou merged 6 commits into
deepmodeling:mainfrom
AsymmetryChou:rgf_acc
Jul 5, 2026
Merged

RGF_ACC: Reduce dead memory in RGF and Improve energy chunk size handling#35
AsymmetryChou merged 6 commits into
deepmodeling:mainfrom
AsymmetryChou:rgf_acc

Conversation

@AsymmetryChou

Copy link
Copy Markdown
Collaborator

This pull request introduces several memory management improvements and safeguards for the recursive Green's function (NEGF) calculations, particularly targeting CUDA out-of-memory (OOM) avoidance and better resource release. The changes focus on explicitly releasing large intermediate tensors and lists as soon as possible, tightening the automatic batch size calculation to be more conservative, and warning users when their manual settings exceed safe limits.

Memory management improvements:

  • Explicitly null out or delete temporary tensors and lists (sd, sl, su, temp_mat_d_list, etc.) immediately after their last use in recursive_green_cal.py to encourage earlier memory release and reduce peak usage. [1] [2] [3]

Batch size calculation and OOM avoidance:

  • Increase the memory safety margin in _auto_chunk_size by raising the constant C from 10 to 14 and lowering the free-memory budget from 0.7x to 0.5x, reflecting updated estimates of per-energy memory usage and real-world OOM observations. [1] [2]
  • When a user specifies e_batch_size manually, log a warning if it exceeds the automatically determined safe cap for the current CUDA device. Also, always log the batch size being used for traceability.

These changes collectively make the NEGF runner more robust against CUDA OOM errors and improve transparency for users adjusting batch sizes.

@AsymmetryChou AsymmetryChou merged commit b755ae4 into deepmodeling:main Jul 5, 2026
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.

1 participant