Skip to content

Commit

Permalink
Fix work array size
Browse files Browse the repository at this point in the history
The work space query for lwork does not return always sufficiently large values. This looks like a ScaLAPACK bug.
Let's add some margin as workaround to avoid crashes.
  • Loading branch information
mkrack committed Mar 28, 2022
1 parent 94f77d7 commit 1336b54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fm/cp_cfm_diag.F
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ SUBROUTINE cp_cfm_heevd(matrix, eigenvectors, eigenvalues)
descv(:) = eigenvectors%matrix_struct%descriptor(:)
CALL PZHEEVD('V', 'U', n, m(1, 1), 1, 1, descm, eigenvalues(1), v(1, 1), 1, 1, descv, &
work(1), lwork, rwork(1), lrwork, iwork(1), liwork, info)
lwork = CEILING(REAL(work(1), KIND=dp))
! The work space query for lwork does not return always sufficiently large values.
! Let's add some margin to avoid crashes.
lwork = CEILING(REAL(work(1), KIND=dp)) + 1000
! needed to correct for a bug in scalapack, unclear how much the right number is
lrwork = CEILING(REAL(rwork(1), KIND=dp)) + 1000000
liwork = iwork(1)
Expand Down

0 comments on commit 1336b54

Please sign in to comment.