Fix: add EXX erfc parameter handling for pw basis type#7166
Merged
mohanchen merged 7 commits intodeepmodeling:developfrom Apr 5, 2026
Merged
Fix: add EXX erfc parameter handling for pw basis type#7166mohanchen merged 7 commits intodeepmodeling:developfrom
mohanchen merged 7 commits intodeepmodeling:developfrom
Conversation
Add runtime check (PARAM.inp.device == "gpu") before calling cudaHostRegister and cudaHostUnregister to avoid failures when CUDA is enabled but running on CPU device (e.g., on clusters with both CPU and GPU nodes but only compiling once).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes HSE exact-exchange (EXX) failures when running with basis_type=pw by ensuring ERFC (screened exchange) parameters are propagated into GlobalC::exx_info.info_global.coulomb_param, and includes a small PW EXX potential buffer handling correction.
Changes:
- Add ERFC (
exx_erfc_alpha/exx_erfc_omega)coulomb_paraminitialization forbasis_type=pwandbasis_type=lcao_in_pw. - In PW EXX potential routines, only pin host memory when
device=gpuand fix array deallocation (delete[]).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
source/source_pw/module_pwdft/op_pw_exx_pot.cpp |
Guards CUDA host-memory pinning by device=gpu and corrects deallocation for pot_cpu. |
source/source_io/module_parameter/input_conv.cpp |
Extends ERFC Coulomb parameter conversion to PW / LCAO-in-PW basis types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Fix the issue where HSE EXX calculation is broken by #7019 with "trtri: failed to invert matrix" error when using basis_type = pw.
Problem
When using HSE functional with basis_type = pw, the exx_erfc_alpha parameter is not being properly set in coulomb_param, causing:
Root Cause
In input_conv.cpp, the handling for exx_erfc_alpha was only implemented for basis_type == "lcao", missing the pw and lcao_in_pw cases.
HSE CI/CD is also required.