Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Divide by zero with ScaLAPACK's PDDBSV

styc
Beginner
1,761 Views

I was trying to solve some linear systems involving dense diagonally-dominant matrices with ScaLAPACK's PDDBSV routine. The code is listed below. I used ifort 10.1.018 and MKL 10.0.5.025 to compile the program and ran it under MPICH2 1.0.7 on a Q6600 Linux machine. The compiler flags were "-xT -O3 -g -lmkl_scalapack -lmkl_lapack -lmkl_blacs_intelmpi20_lp64 -lmkl -openmp". Every time I ran it, it crashed with the message "forrtl: severe (71): integer divide by zero". According to the crash address, it seemed that the division occurred in the PDDBTRF routine.

I have checked the code back and forth against MKL's documentation and was unable to locate the cause of trouble. Am I missing anything?

      PROGRAM PDDBSV_TEST

      EXTERNAL BLACS_PINFO, BLACS_GET, BLACS_GRIDINIT, BLACS_GRIDINFO
      EXTERNAL BLACS_EXIT
      EXTERNAL DESCINIT, DGESD2D, DGERV2D, NUMROC
      EXTERNAL PDDBSV, PDLANGE
      INTEGER NUMROC
      DOUBLE PRECISION PDLANGE

      INTEGER MYPNUM, NPROCS
      INTEGER NPROW, NPCOL
      INTEGER MYPROW, MYPCOL
      INTEGER PROW, PCOL
      INTEGER ICONTXT

      INTEGER N, NRHS, MB, NB, BWL, BWU, BWM, LWORK
      PARAMETER(N = 64, NRHS = 1, MB = 4, NB = 4)
      PARAMETER(BWL = N - 1, BWU = N - 1, BWM = MAX(BWL, BWU))
      PARAMETER(LWORK = NB * (BWL + BWU)
     >                  + BWM * (6 * BWM + MAX(BWM, NRHS)))

      DOUBLE PRECISION, ALLOCATABLE ::  A(:, :)
      DOUBLE PRECISION, ALLOCATABLE ::  B(:, :)
      DOUBLE PRECISION, ALLOCATABLE :: SENDBUF(:, :), WORK(:)
      DOUBLE PRECISION NORM

      INTEGER DLEN_
      PARAMETER(DLEN_ = 9)
      INTEGER DESCA(DLEN_), DESCB(DLEN_)
      INTEGER NAROW, NACOL, NBROW, NBCOL
      INTEGER NXROW, NXCOL
      INTEGER INFO
      INTEGER I, J, IGLB, JGLB

      NPROW = 2
      NPCOL = 2

      CALL BLACS_PINFO(MYPNUM, NPROCS)
      CALL BLACS_GET(0, 0, ICONTXT)
      CALL BLACS_GRIDINIT(ICONTXT, 'R', NPROW, NPCOL)
      CALL BLACS_GRIDINFO(ICONTXT, NPROW, NPCOL, MYPROW, MYPCOL)

      IF ((MYPROW .LT. 0) .OR. (MYPROW .GE. NPROW)) GOTO 999
      IF ((MYPCOL .LT. 0) .OR. (MYPCOL .GE. NPCOL)) GOTO 999
      
      NAROW = NUMROC(N, MB, MYPROW, 0, NPROW)
      NACOL = NUMROC(N, NB, MYPCOL, 0, NPCOL)
      NBROW = NAROW
      NBCOL = NUMROC(NRHS, MB, MYPCOL, 0, NPCOL)

      ALLOCATE(A(MAX(NAROW, BWL + BWU + 1), MAX(NACOL, 1)))
      ALLOCATE(B(MAX(NBROW, NB), MAX(NBCOL, 1)))
      ALLOCATE(WORK(LWORK))

      CALL DESCINIT(DESCA, N, N, MB, NB, 0, 0, ICONTXT,
     >          MAX(NAROW, BWL + BWU + 1), INFO)
      CALL DESCINIT(DESCB, N, NRHS, MB, NB, 0, 0, ICONTXT,
     >          MAX(NBROW, NB), INFO)

!     MATRIX CREATION & DISTRIBUTION CODE GOES HERE

CALL PDDBSV(N, BWL, BWU, NRHS, A, 1, DESCA, B, 1, DESCB, WORK, > LWORK, INFO) DEALLOCATE(A) DEALLOCATE(B) DEALLOCATE(WORK) 999 CONTINUE CALL BLACS_EXIT(0) END
0 Kudos
4 Replies
Gennady_F_Intel
Moderator
1,761 Views
Hello, could you please try to use the folowwing linking dependencies:
libmkl_scalapack_core.a libmkl_blacs_intel20.a libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a
--Gennady

0 Kudos
styc
Beginner
1,761 Views
Quoting - Gennady Fedorov
Hello, could you please try to use the folowwing linking dependencies:
libmkl_scalapack_core.a libmkl_blacs_intel20.a libmkl_intel_lp64.a libmkl_intel_thread.a libmkl_core.a
--Gennady

There seems to be neither a libmkl_scalapack_core.a nor a libmkl_blacs_intel20.a. I substituted libmkl_scalapack.a and libmkl_blacs_intelmpi20_lp64.a for them. The program still crashed with the same error message.

0 Kudos
Tabrez_Ali
Beginner
1,761 Views

I dont think this is a linking error.

I would check all the parameters once again.

0 Kudos
Gennady_F_Intel
Moderator
1,761 Views

At the first glance all are Ok with your code and probably this is really issue with MKL.

I would recommend you submit the issue against MKL to Premier support( https://premier.intel.com/ )

--Gennady

0 Kudos
Reply