Skip to content

Reject distributed matrices in DiagoLapack#7696

Open
Growl1234 wants to merge 1 commit into
deepmodeling:developfrom
Growl1234:toolchain
Open

Reject distributed matrices in DiagoLapack#7696
Growl1234 wants to merge 1 commit into
deepmodeling:developfrom
Growl1234:toolchain

Conversation

@Growl1234

Copy link
Copy Markdown

DiagoLapack is a local LAPACK eigensolver and requires replicated Hamiltonian and overlap matrices. However, some MPI execution paths could pass a distributed local matrix block to it through either diag() or diag_pool().

For example, with 8 MPI processes, each process may own a 52 × 26 block of a global 104 × 104 matrix. DiagoLapack previously passed the global dimension, N = 104, to LAPACK while providing only the local block. LAPACK then accessed memory beyond the allocated buffers, causing heap corruption such as:

free(): invalid size
munmap_chunk(): invalid pointer
double free or corruption

This PR:

  • verifies in both diag() and diag_pool() that the Hamiltonian and overlap matrices are replicated nlocal × nlocal matrices before calling LAPACK;
  • reports a clear error when distributed local blocks are passed and instructs users to select ScaLAPACK or ELPA;
  • verifies that the output eigenvector buffer has sufficient dimensions;
  • allocates the full RWORK and IWORK arrays before the LAPACK workspace query;
  • handles the xSYGVX/xHEGVX INFO value according to the LAPACK specification.

For distributed matrices, users are instructed to select ScaLAPACK or ELPA instead. Single-process LAPACK calculations remain work as before.

Copilot AI review requested due to automatic review settings July 27, 2026 05:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 27, 2026 05:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 27, 2026 05:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ZhouXY-PKU ZhouXY-PKU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!

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.

3 participants