fix: segfault in DFPT strain non-self-consistent elastic-tensor accumulator#97
Open
SchrodingersCattt wants to merge 1 commit into
Open
Conversation
…lator In dfpt_nsteltwf (m_dfpt_scfcv.F90) the slices that copy ground-state and first-order wavefunctions out of cg/cg1 mixed the global band index (iband) on the upper bound with the local-to-MPI-process index (iband_me) on the lower bound: cwave0(:,:)=cg(:,1+(iband_me-1)*npw_k*nspinor+icg:iband*npw_k*nspinor+icg) cwavef(:,:)=cg1(:,1+(iband_me-1)*npw1_k*nspinor+icg1:iband*npw1_k*nspinor+icg1) Whenever DFPT band parallelism is active (npband > 1, which ABINIT auto-selects in many strain-response runs even with paral_kgb = 0), iband > iband_me on every rank that does not own the lowest band group, so the slice is longer than the destination buffer (npw_k*nspinor) and overruns cg/cg1. This produces a SIGSEGV inside dfpt_nsteltwf during the strain (rfstrs) dataset of a 5-dataset DFPT pipeline; the crash was observed in a 200-atom MOF DFPT run on ABINIT 9.8.2 and reproduces on current master (v10.6.7). Fix: use iband_me consistently on both bounds, so the slice length is always exactly npw_k*nspinor (resp. npw1_k*nspinor), matching the allocation of cwave0/cwavef. Related to the issue describing this segfault and reproducer.
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.
In dfpt_nsteltwf (m_dfpt_scfcv.F90) the slices that copy ground-state and first-order wavefunctions out of cg/cg1 mixed the global band index (iband) on the upper bound with the local-to-MPI-process index (iband_me) on the lower bound:
cwave0(:,:)=cg(:,1+(iband_me-1)npw_knspinor+icg:ibandnpw_knspinor+icg)
cwavef(:,:)=cg1(:,1+(iband_me-1)npw1_knspinor+icg1:ibandnpw1_knspinor+icg1)
Whenever DFPT band parallelism is active (npband > 1, which ABINIT auto-selects in many strain-response runs even with paral_kgb = 0), iband > iband_me on every rank that does not own the lowest band group, so the slice is longer than the destination buffer (npw_k*nspinor) and overruns cg/cg1. This produces a SIGSEGV inside dfpt_nsteltwf during the strain (rfstrs) dataset of a 5-dataset DFPT pipeline; the crash was observed in a 200-atom MOF DFPT run on ABINIT 9.8.2 and reproduces on current master (v10.6.7).
Related to #96