Repository navigation
Self Energy Calculation Acceleration: Optimizing the parallelization logic - #49
Merged
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 significantly improves the parallelization logic and documentation for the self-energy calculation in
dpnegf/negf/lead_property.py. The main focus is on making CPU and memory budget handling more robust, clarifying and enforcing input parameter validation, and introducing per-batch, adaptive BLAS threading strategies for better performance and resource safety. Documentation for these options is also updated for clarity and accuracy.Parallelization and resource management improvements:
_resolve_cpu_budgetto consistently interpret and validatecpu_budget, defaulting to a safe value if unspecified or invalid. Now used throughout worker and BLAS thread selection. [1] [2]_get_safe_n_workersto handlen_workers=Noneas auto, validate types more strictly, and always cap by the resolved CPU budget. [1] [2]compute_all_self_energyforn_workers,blas_threads, andek_batch_size, raising clear errors for invalid values.Per-batch BLAS threading and scheduling:
Documentation updates:
run_options.rstto clarify the meaning, default, and validation rules forn_workers,cpu_budget,blas_threads, andek_batch_size, reflecting the new logic and constraints.Code quality and safety:
numbers.Integralfor robust integer validation, and added explicit checks to prevent boolean values from being interpreted as integers. [1] [2] [3]These changes collectively make parallel execution safer, more efficient, and easier to configure and debug.