Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdgbtrf potential bug under edge cases #114

Open
TLCFEM opened this issue Mar 6, 2025 · 1 comment
Open

pdgbtrf potential bug under edge cases #114

TLCFEM opened this issue Mar 6, 2025 · 1 comment

Comments

@TLCFEM
Copy link

TLCFEM commented Mar 6, 2025

When BWL=BWU=0, LDBB evaluates to 0.

LDBB = 2*BW + BWU

Later when it is passed to dgetrf, it triggers an error as the lead is expect to be positive.

scalapack/SRC/pdgbtrf.f

Lines 860 to 861 in a23c2cd

CALL DGETRF( N-LN, N-LN, AF( BBPTR+BW*LDBB ), LDBB,
$ IPIV( LN+1 ), INFO )

 ** On entry to DGETRF parameter number  4 had an illegal value

pdgbtrs will further raise a few errors when BWL=BWU=0.

Here is a MWE.

program gbsv_test
    implicit none
    integer ictxt

    integer n, kl, ku, ja, laf, lwork, info
    integer, dimension(10) :: desca, ipiv, af, work
    double precision a

    call blacs_get(-1, 0, ictxt)
    call blacs_gridinit(ictxt, 'R', 1, 1)

    n = 1
    kl = 0
    ku = 0
    a = 1.0
    ja = 1
    laf = 10
    lwork = 10
    info = 0

    desca(1) = 501
    desca(2) = ictxt
    desca(3) = 1
    desca(4) = 1
    desca(5) = 0
    desca(6) = 1

    call pdgbtrf(n, kl, ku, a, ja, desca, ipiv, af, laf, work, lwork, info)

    call blacs_gridexit(ictxt)
    call blacs_exit(0)

end program gbsv_test
@TLCFEM
Copy link
Author

TLCFEM commented Mar 6, 2025

Also, I noticed that the parameter IPIV, the documentation states it shall >= DESCA( NB ), which is the block size if I understand correctly.

However, doing so sometimes would lead to overflow.

It appears it shall be >= LOCc( N ) + BWL + BWU.

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

No branches or pull requests

1 participant