scalapack & valgrind

Open discussion regarding features, bugs, issues, vendors, etc.

scalapack & valgrind

Postby vondele » Mon Jan 28, 2008 4:47 am

Dear scalapack developers,

we regularly run our code under valgrind's tool 'memcheck' to find uninitialized variables and other coding issues. A number of the errors flagged by valgrind trace back to scalapack, and also happen running just examples from scalapack's test directories. An example would be:

scalapack_installer_0.9/build/scalapack-1.8.0/TESTING> mpirun -np 4 valgrind --tool=memcheck ./xzevc

==25001== Conditional jump or move depends on uninitialised value(s)
==25001== at 0x4841BD: dgamx2d_ (dgamx2d_.c:134)
==25001== by 0x4132E4: pdlamch_ (pdlamch.f:71)
==25001== by 0x408E2E: pzevcinfo_ (pzevcinfo.f:321)
==25001== by 0x4030AF: MAIN_ (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25001== by 0x510AED: main (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25000== Conditional jump or move depends on uninitialised value(s)
==25000== at 0x4841BD: dgamx2d_ (dgamx2d_.c:134)
==25000== by 0x4132E4: pdlamch_ (pdlamch.f:71)
==25000== ==25002== Conditional jump or move depends on uninitialised value(s)
by 0x408E2E: pzevcinfo_ (pzevcinfo.f:321)
==25000== by 0x4030AF: MAIN_ (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25000== by 0x510AED: main (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25002== at 0x4841BD: dgamx2d_ (dgamx2d_.c:134)
==25002== by 0x4132E4: pdlamch_ (pdlamch.f:71)
==25002== by 0x4077C6: pzevcinfo_ (pzevcinfo.f:221)
==25002== by 0x4030AF: MAIN_ (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25002== by 0x510AED: main (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25003== Conditional jump or move depends on uninitialised value(s)
==25003== at 0x4841BD: dgamx2d_ (dgamx2d_.c:134)
==25003== by 0x4132E4: pdlamch_ (pdlamch.f:71)
==25003== by 0x408E2E: pzevcinfo_ (pzevcinfo.f:321)
==25003== by 0x4030AF: MAIN_ (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)
==25003== by 0x510AED: main (in /data03/vondele/scalapack/scalapack_installer_0.9/build/scalapack-1.8.0/TESTING/xzevc)

using a scalapack build as (the installer is great btw!) using a g95 based mpif90:

./setup.py --downblas --downblacs --downlapack --fcflags='-g' --noopt='-g' --ccflags='-g'

While some of the issues might be not so important, others maybe are. I'm wondering if there are any fixes for these errors in SVN scalapack, or if there is an interest in patches? As you can see it is quite straightforward to reproduce.

For example for the first error, valgrind points out that :

if (Mpval(cdest) == -1) trdest = -1;
else trdest = Mpval(rdest);

uses an undefined variable, and indeed the 'cdest' seems to be passed as an uninitialized 'idumm' from PDLAMCH (which I guess could lead to an out of bounds error).
vondele
 
Posts: 11
Joined: Mon Jan 28, 2008 4:28 am

a patch fixing uninitialized variables

Postby vondele » Wed Jan 30, 2008 11:01 am

Hi,

the following is a patch that fixes all references to uninitialized variables as reported by valgrind when running the test programs on 4 CPUs. It would really appreciate if a scalapack maintainer could have a look at this, and apply it to the SVN version so that it would appear in an 1.8.1 version. Of course, I'm not 100% sure the fixes are correct, for example the fixes to p?trsm_.c

the following if a diff between the original 1.8.0 code as downloaded by the installer, and the fixed code. I paste it here as I see no way to attach a file in the forum. I can of course email the patch upon request.
Code: Select all
diff -cr scalapack-1.8.0-orig/PBLAS/SRC/pctrsm_.c scalapack-1.8.0/PBLAS/SRC/pctrsm_.c
*** scalapack-1.8.0-orig/PBLAS/SRC/pctrsm_.c    2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/SRC/pctrsm_.c 2008-01-30 10:36:11.000000000 +0100
***************
*** 408,413 ****
--- 408,422 ----
        }
     }

+ /*
+ * Var can remain uninitialized but is nevertheless used in PB_CptrsmAB.c
+ *  provide a default here. TODO: does this make sense ?
+ *==19891==    at 0x44F81B: PB_CptrsmAB (PB_CptrsmAB.c:538)
+ *==19891==    by 0x427BE7: pdtrsm_ (pdtrsm_.c:488)
+ *==19891==    by 0x405E46: MAIN_ (pdblas3tim.f:727)
+ */
+    Var = CRIGHT;
+
     if( ChooseAB )
     {
  /*
diff -cr scalapack-1.8.0-orig/PBLAS/SRC/pdtrsm_.c scalapack-1.8.0/PBLAS/SRC/pdtrsm_.c
*** scalapack-1.8.0-orig/PBLAS/SRC/pdtrsm_.c    2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/SRC/pdtrsm_.c 2008-01-30 09:43:04.000000000 +0100
***************
*** 408,413 ****
--- 408,422 ----
        }
     }

+ /*
+ * Var can remain uninitialized but is nevertheless used in PB_CptrsmAB.c
+ *  provide a default here. TODO: does this make sense ?
+ *==19891==    at 0x44F81B: PB_CptrsmAB (PB_CptrsmAB.c:538)
+ *==19891==    by 0x427BE7: pdtrsm_ (pdtrsm_.c:488)
+ *==19891==    by 0x405E46: MAIN_ (pdblas3tim.f:727)
+ */
+    Var = CRIGHT;
+
     if( ChooseAB )
     {
  /*
diff -cr scalapack-1.8.0-orig/PBLAS/SRC/pstrsm_.c scalapack-1.8.0/PBLAS/SRC/pstrsm_.c
*** scalapack-1.8.0-orig/PBLAS/SRC/pstrsm_.c    2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/SRC/pstrsm_.c 2008-01-30 10:18:24.000000000 +0100
***************
*** 408,413 ****
--- 408,423 ----
        }
     }

+ /*
+ * Var can remain uninitialized but is nevertheless used in PB_CptrsmAB.c
+ *  provide a default here. TODO: does this make sense ?
+ *==19891==    at 0x44F81B: PB_CptrsmAB (PB_CptrsmAB.c:538)
+ *==19891==    by 0x427BE7: pdtrsm_ (pdtrsm_.c:488)
+ *==19891==    by 0x405E46: MAIN_ (pdblas3tim.f:727)
+ */
+    Var = CRIGHT;
+
+
     if( ChooseAB )
     {
  /*
diff -cr scalapack-1.8.0-orig/PBLAS/SRC/pztrsm_.c scalapack-1.8.0/PBLAS/SRC/pztrsm_.c
*** scalapack-1.8.0-orig/PBLAS/SRC/pztrsm_.c    2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/SRC/pztrsm_.c 2008-01-30 10:36:29.000000000 +0100
***************
*** 408,413 ****
--- 408,423 ----
        }
     }

+ /*
+ * Var can remain uninitialized but is nevertheless used in PB_CptrsmAB.c
+ *  provide a default here. TODO: does this make sense ?
+ *==19891==    at 0x44F81B: PB_CptrsmAB (PB_CptrsmAB.c:538)
+ *==19891==    by 0x427BE7: pdtrsm_ (pdtrsm_.c:488)
+ *==19891==    by 0x405E46: MAIN_ (pdblas3tim.f:727)
+ */
+    Var = CRIGHT;
+
+
     if( ChooseAB )
     {
  /*
diff -cr scalapack-1.8.0-orig/PBLAS/TESTING/pcblastst.f scalapack-1.8.0/PBLAS/TESTING/pcblastst.f
*** scalapack-1.8.0-orig/PBLAS/TESTING/pcblastst.f      2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/TESTING/pcblastst.f   2008-01-30 10:47:23.000000000 +0100
***************
*** 7487,7496 ****
--- 7487,7498 ----
        IF( LSAME( CMACH, 'E' ).OR.LSAME( CMACH, 'S' ).OR.
       $    LSAME( CMACH, 'M' ).OR.LSAME( CMACH, 'U' ) ) THEN
           CALL PB_TOPGET( ICTXT, 'Combine', 'All', TOP )
+          IDUMM = 0
           CALL SGAMX2D( ICTXT, 'All', TOP, 1, 1, TEMP, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        ELSE IF( LSAME( CMACH, 'L' ).OR.LSAME( CMACH, 'O' ) ) THEN
           CALL PB_TOPGET( ICTXT, 'Combine', 'All', TOP )
+          IDUMM = 0
           CALL SGAMN2D( ICTXT, 'All', TOP, 1, 1, TEMP, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        END IF
diff -cr scalapack-1.8.0-orig/PBLAS/TESTING/pdblastst.f scalapack-1.8.0/PBLAS/TESTING/pdblastst.f
*** scalapack-1.8.0-orig/PBLAS/TESTING/pdblastst.f      2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/TESTING/pdblastst.f   2008-01-30 09:31:59.000000000 +0100
***************
*** 6838,6843 ****
--- 6838,6844 ----
  *     .. Executable Statements ..
  *
        TEMP = DLAMCH( CMACH )
+       IDUMM = 0
  *
        IF( LSAME( CMACH, 'E' ).OR.LSAME( CMACH, 'S' ).OR.
       $    LSAME( CMACH, 'M' ).OR.LSAME( CMACH, 'U' ) ) THEN
diff -cr scalapack-1.8.0-orig/PBLAS/TESTING/psblastst.f scalapack-1.8.0/PBLAS/TESTING/psblastst.f
*** scalapack-1.8.0-orig/PBLAS/TESTING/psblastst.f      2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/TESTING/psblastst.f   2008-01-30 10:15:37.000000000 +0100
***************
*** 6842,6851 ****
--- 6842,6853 ----
        IF( LSAME( CMACH, 'E' ).OR.LSAME( CMACH, 'S' ).OR.
       $    LSAME( CMACH, 'M' ).OR.LSAME( CMACH, 'U' ) ) THEN
           CALL PB_TOPGET( ICTXT, 'Combine', 'All', TOP )
+          IDUMM = 0
           CALL SGAMX2D( ICTXT, 'All', TOP, 1, 1, TEMP, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        ELSE IF( LSAME( CMACH, 'L' ).OR.LSAME( CMACH, 'O' ) ) THEN
           CALL PB_TOPGET( ICTXT, 'Combine', 'All', TOP )
+          IDUMM = 0
           CALL SGAMN2D( ICTXT, 'All', TOP, 1, 1, TEMP, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        END IF
diff -cr scalapack-1.8.0-orig/PBLAS/TESTING/pzblastst.f scalapack-1.8.0/PBLAS/TESTING/pzblastst.f
*** scalapack-1.8.0-orig/PBLAS/TESTING/pzblastst.f      2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/PBLAS/TESTING/pzblastst.f   2008-01-30 10:47:37.000000000 +0100
***************
*** 7488,7497 ****
--- 7488,7499 ----
        IF( LSAME( CMACH, 'E' ).OR.LSAME( CMACH, 'S' ).OR.
       $    LSAME( CMACH, 'M' ).OR.LSAME( CMACH, 'U' ) ) THEN
           CALL PB_TOPGET( ICTXT, 'Combine', 'All', TOP )
+          IDUMM = 0
           CALL DGAMX2D( ICTXT, 'All', TOP, 1, 1, TEMP, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        ELSE IF( LSAME( CMACH, 'L' ).OR.LSAME( CMACH, 'O' ) ) THEN
           CALL PB_TOPGET( ICTXT, 'Combine', 'All', TOP )
+          IDUMM = 0
           CALL DGAMN2D( ICTXT, 'All', TOP, 1, 1, TEMP, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        END IF
diff -cr scalapack-1.8.0-orig/SRC/pdlabad.f scalapack-1.8.0/SRC/pdlabad.f
*** scalapack-1.8.0-orig/SRC/pdlabad.f  2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/SRC/pdlabad.f       2008-01-30 09:49:35.000000000 +0100
***************
*** 62,67 ****
--- 62,68 ----
           SMALL = SQRT( SMALL )
           LARGE = SQRT( LARGE )
        END IF
+       IDUMM = 0
  *
        CALL DGAMX2D( ICTXT, 'All', ' ', 1, 1, SMALL, 1, IDUMM,
       $              IDUMM, -1, -1, IDUMM )
diff -cr scalapack-1.8.0-orig/SRC/pdlamch.f scalapack-1.8.0/SRC/pdlamch.f
*** scalapack-1.8.0-orig/SRC/pdlamch.f  2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/SRC/pdlamch.f       2008-01-30 09:13:27.000000000 +0100
***************
*** 65,70 ****
--- 65,71 ----
  *     .. Executable Statements ..
  *
        TEMP = DLAMCH( CMACH )
+       IDUMM = 0
  *
        IF( LSAME( CMACH, 'E' ).OR.LSAME( CMACH, 'S' ).OR.
       $    LSAME( CMACH, 'M' ).OR.LSAME( CMACH, 'U' ) ) THEN
diff -cr scalapack-1.8.0-orig/SRC/pjlaenv.f scalapack-1.8.0/SRC/pjlaenv.f
*** scalapack-1.8.0-orig/SRC/pjlaenv.f  2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/SRC/pjlaenv.f       2008-01-30 09:52:23.000000000 +0100
***************
*** 351,356 ****
--- 351,357 ----
    100 CONTINUE
  *
        IF( GLOBAL ) THEN
+          IDUMM = 0
           CALL IGAMX2D( ICTXT, 'All', ' ', 1, 1, PJLAENV, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        END IF
diff -cr scalapack-1.8.0-orig/SRC/pslabad.f scalapack-1.8.0/SRC/pslabad.f
*** scalapack-1.8.0-orig/SRC/pslabad.f  2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/SRC/pslabad.f       2008-01-30 09:49:47.000000000 +0100
***************
*** 62,67 ****
--- 62,68 ----
           SMALL = SQRT( SMALL )
           LARGE = SQRT( LARGE )
        END IF
+       IDUMM = 0
  *
        CALL SGAMX2D( ICTXT, 'All', ' ', 1, 1, SMALL, 1, IDUMM,
       $              IDUMM, -1, -1, IDUMM )
diff -cr scalapack-1.8.0-orig/SRC/pslamch.f scalapack-1.8.0/SRC/pslamch.f
*** scalapack-1.8.0-orig/SRC/pslamch.f  2008-01-30 09:11:21.000000000 +0100
--- scalapack-1.8.0/SRC/pslamch.f       2008-01-30 09:30:36.000000000 +0100
***************
*** 65,70 ****
--- 65,71 ----
  *     .. Executable Statements ..
  *
        TEMP = SLAMCH( CMACH )
+       IDUMM = 0
  *
        IF( LSAME( CMACH, 'E' ).OR.LSAME( CMACH, 'S' ).OR.
       $    LSAME( CMACH, 'M' ).OR.LSAME( CMACH, 'U' ) ) THEN
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pcgseptst.f scalapack-1.8.0/TESTING/EIG/pcgseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pcgseptst.f        2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pcgseptst.f     2008-01-30 10:33:53.000000000 +0100
***************
*** 547,552 ****
--- 547,557 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0E+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
+
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pcseptst.f scalapack-1.8.0/TESTING/EIG/pcseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pcseptst.f 2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pcseptst.f      2008-01-30 10:33:07.000000000 +0100
***************
*** 537,542 ****
--- 537,546 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0E+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pdgseptst.f scalapack-1.8.0/TESTING/EIG/pdgseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pdgseptst.f        2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pdgseptst.f     2008-01-30 10:13:36.000000000 +0100
***************
*** 531,536 ****
--- 531,540 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0D+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pdsepinfo.f scalapack-1.8.0/TESTING/EIG/pdsepinfo.f
*** scalapack-1.8.0-orig/TESTING/EIG/pdsepinfo.f        2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pdsepinfo.f     2008-01-30 10:42:35.000000000 +0100
***************
*** 162,167 ****
--- 162,168 ----
        IF( BLOCK_CYCLIC_2D*CSRC_*CTXT_*DLEN_*DTYPE_*LLD_*MB_*M_*NB_*N_*
       $    RSRC_.LT.0 )RETURN
  *
+       INFO = 0
        IF( IAM.EQ.0 ) THEN
           READ( NIN, FMT = 9997 )TESTSUMMRY
           TESTSUMMRY = ' '
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pdseptst.f scalapack-1.8.0/TESTING/EIG/pdseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pdseptst.f 2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pdseptst.f      2008-01-30 10:12:06.000000000 +0100
***************
*** 533,538 ****
--- 533,542 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0D+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/psgseptst.f scalapack-1.8.0/TESTING/EIG/psgseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/psgseptst.f        2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/psgseptst.f     2008-01-30 10:34:04.000000000 +0100
***************
*** 531,536 ****
--- 531,540 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0E+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pssepinfo.f scalapack-1.8.0/TESTING/EIG/pssepinfo.f
*** scalapack-1.8.0-orig/TESTING/EIG/pssepinfo.f        2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pssepinfo.f     2008-01-30 10:42:18.000000000 +0100
***************
*** 169,174 ****
--- 169,177 ----
           WRITE( NOUT, FMT = 9997 )TESTSUMMRY
        END IF
  *
+ *     assign a default
+       INFO = 0
+ *
        IF( IAM.EQ.0 ) THEN
           READ( NIN, FMT = * )NMATSIZES
           CALL IGEBS2D( CONTEXT, 'All', ' ', 1, 1, NMATSIZES, 1 )
diff -cr scalapack-1.8.0-orig/TESTING/EIG/psseptst.f scalapack-1.8.0/TESTING/EIG/psseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/psseptst.f 2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/psseptst.f      2008-01-30 10:32:56.000000000 +0100
***************
*** 533,538 ****
--- 533,543 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0E+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
+
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pzgseptst.f scalapack-1.8.0/TESTING/EIG/pzgseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pzgseptst.f        2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pzgseptst.f     2008-01-30 10:33:45.000000000 +0100
***************
*** 547,552 ****
--- 547,556 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0D+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pzsdpsubtst.f scalapack-1.8.0/TESTING/EIG/pzsdpsubtst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pzsdpsubtst.f      2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pzsdpsubtst.f   2008-01-30 11:25:34.000000000 +0100
***************
*** 352,357 ****
--- 352,360 ----
           CALL PDFILLPAD( DESCA( CTXT_ ), RSIZECHK, 1, RWORK, RSIZECHK,
       $                   IPREPAD, IPOSTPAD, 4.3D+0 )
  *
+ *        this is strange, looks like a bug to me. NZ is only used uninitialized here
+ *        in pzsdpsubtst.f n is pased instead of nz
+          NZ = N
           CALL PZSEPCHK( N, NZ, COPYA, IA, JA, DESCA,
       $                  MAX( ABSTOL+EPSNORMA, SAFMIN ), THRESH,
       $                  Z( 1+IPREPAD ), IA, JA, DESCA, A( 1+IPREPAD ),
diff -cr scalapack-1.8.0-orig/TESTING/EIG/pzseptst.f scalapack-1.8.0/TESTING/EIG/pzseptst.f
*** scalapack-1.8.0-orig/TESTING/EIG/pzseptst.f 2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/pzseptst.f      2008-01-30 10:33:17.000000000 +0100
***************
*** 537,542 ****
--- 537,546 ----
       $                      WORK( INDWORK ), SIZETMS, IPREPAD, IPOSTPAD,
       $                      PADVAL+4.0D+0 )
  *
+ *
+ *     WKNOWN ... NOT SET, GUESS A DEFAULT
+ *
+             WKNOWN = .TRUE.
           ELSE
              IINFO = 1
           END IF
diff -cr scalapack-1.8.0-orig/TESTING/EIG/xpjlaenv.f scalapack-1.8.0/TESTING/EIG/xpjlaenv.f
*** scalapack-1.8.0-orig/TESTING/EIG/xpjlaenv.f 2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/EIG/xpjlaenv.f      2008-01-30 09:51:17.000000000 +0100
***************
*** 464,469 ****
--- 464,470 ----
    100 CONTINUE
  *
        IF( GLOBAL ) THEN
+          IDUMM = 0
           CALL IGAMX2D( ICTXT, 'All', ' ', 1, 1, PJLAENV, 1, IDUMM,
       $                 IDUMM, -1, -1, IDUMM )
        END IF
diff -cr scalapack-1.8.0-orig/TESTING/LIN/pcqrt16.f scalapack-1.8.0/TESTING/LIN/pcqrt16.f
*** scalapack-1.8.0-orig/TESTING/LIN/pcqrt16.f  2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/LIN/pcqrt16.f       2008-01-30 10:37:14.000000000 +0100
***************
*** 255,260 ****
--- 255,261 ----
  *
           TEMP( 1 ) = BNORM
           TEMP( 2 ) = XNORM
+          IDUMM = 0
           CALL SGAMX2D( ICTXT, 'All', ' ', 2, 1, TEMP, 2, IDUMM, IDUMM,
       $                 -1, -1, IDUMM )
           BNORM = TEMP( 1 )
diff -cr scalapack-1.8.0-orig/TESTING/LIN/pdqrt16.f scalapack-1.8.0/TESTING/LIN/pdqrt16.f
*** scalapack-1.8.0-orig/TESTING/LIN/pdqrt16.f  2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/LIN/pdqrt16.f       2008-01-30 10:03:16.000000000 +0100
***************
*** 251,256 ****
--- 251,257 ----
  *
           TEMP( 1 ) = BNORM
           TEMP( 2 ) = XNORM
+          IDUMM = 0
           CALL DGAMX2D( ICTXT, 'All', ' ', 2, 1, TEMP, 2, IDUMM, IDUMM,
       $                 -1, -1, IDUMM )
           BNORM = TEMP( 1 )
diff -cr scalapack-1.8.0-orig/TESTING/LIN/psqrt16.f scalapack-1.8.0/TESTING/LIN/psqrt16.f
*** scalapack-1.8.0-orig/TESTING/LIN/psqrt16.f  2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/LIN/psqrt16.f       2008-01-30 10:03:39.000000000 +0100
***************
*** 251,256 ****
--- 251,257 ----
  *
           TEMP( 1 ) = BNORM
           TEMP( 2 ) = XNORM
+          IDUMM = 0
           CALL SGAMX2D( ICTXT, 'All', ' ', 2, 1, TEMP, 2, IDUMM, IDUMM,
       $                 -1, -1, IDUMM )
           BNORM = TEMP( 1 )
diff -cr scalapack-1.8.0-orig/TESTING/LIN/pzqrt16.f scalapack-1.8.0/TESTING/LIN/pzqrt16.f
*** scalapack-1.8.0-orig/TESTING/LIN/pzqrt16.f  2008-01-30 09:11:22.000000000 +0100
--- scalapack-1.8.0/TESTING/LIN/pzqrt16.f       2008-01-30 10:37:04.000000000 +0100
***************
*** 255,260 ****
--- 255,261 ----
  *
           TEMP( 1 ) = BNORM
           TEMP( 2 ) = XNORM
+          IDUMM = 0
           CALL DGAMX2D( ICTXT, 'All', ' ', 2, 1, TEMP, 2, IDUMM, IDUMM,
       $                 -1, -1, IDUMM )
           BNORM = TEMP( 1 )



Cheers,

Joost VandeVondele
vondele
 
Posts: 11
Joined: Mon Jan 28, 2008 4:28 am

Postby vondele » Wed Mar 26, 2008 7:29 am

Can any of the scalapack developers comment on this? Is there an other way to send patches?

Thanks,

Joost
vondele
 
Posts: 11
Joined: Mon Jan 28, 2008 4:28 am

Re: scalapack & valgrind

Postby admin » Tue Aug 16, 2011 10:44 am

Dear Joost,
We just committed your patch in the ScaLAPACK repository.
ScaLAPACK will undergo a major release this coming year and this will be included in the release.
For info, your patch is correcting also some testing issues that we had.
So again thank you for your contribution, it is very much appreciated.
admin
Site Admin
 
Posts: 486
Joined: Wed Dec 08, 2004 7:07 pm

Re: scalapack & valgrind

Postby vondele » Sat Aug 27, 2011 8:12 am

admin wrote:Dear Joost,
We just committed your patch in the ScaLAPACK repository.
ScaLAPACK will undergo a major release this coming year and this will be included in the release.
For info, your patch is correcting also some testing issues that we had.
So again thank you for your contribution, it is very much appreciated.


Thanks for the timely integration ;-) in the svn version of scalapack. Thanks to Nichols for the convincing test case. I'd like to emphasize again the usefulness of the tool, just run:

mpiexec -np 6 valgrind --tool=memcheck --track-origins=yes ./xdsyevr

and find the bugs easily.

I've done another build of trunk, and tested again using valgrind. It found another couple of issues, for example that WKNOWN is accessed uninitialized in pdseprtst.f at line 523 (by inspection resulting from ITYPE.EQ.11) and similarly that VL, VU, IL, IU are being referenced in PDSEPRSUBTST for 'A' (and 'I' and 'V' respectively) range cases, even if the vars are should not be referenced in that case. In valgrind speak, the following is reported (with similar issues for the other precisions):

Code: Select all
"out.xcheevr" 1161 lines --28%-- (8 of 106)   

==20907== Conditional jump or move depends on uninitialised value(s)
==20907==    at 0x40B567: pcseprsubtst_ (pcseprsubtst.f:704)
==20907==    by 0x40F300: pcseprtst_ (pcseprtst.f:553)
==20907==    by 0x40A079: pcseprreq_ (pcseprreq.f:203)
==20907==    by 0x40857E: MAIN__ (pcseprdriver.f:205)
==20907==    by 0x40763C: main (pcseprdriver.f:257)
==20907==

==20906== Conditional jump or move depends on uninitialised value(s)
==20906==    at 0x40BCE7: pcseprsubtst_ (pcseprsubtst.f:779)
==20906==    by 0x40F300: pcseprtst_ (pcseprtst.f:553)
==20906==    by 0x40A079: pcseprreq_ (pcseprreq.f:203)
==20906==    by 0x40857E: MAIN__ (pcseprdriver.f:205)
==20906==    by 0x40763C: main (pcseprdriver.f:257)

==20909== Conditional jump or move depends on uninitialised value(s)
==20909==    at 0x407E29: pclasizeheevr_ (pclasizeheevr.f:139)
==20909==    by 0x40F112: pcseprtst_ (pcseprtst.f:544)
==20909==    by 0x40A079: pcseprreq_ (pcseprreq.f:203)
==20909==    by 0x40857E: MAIN__ (pcseprdriver.f:205)
==20909==    by 0x40763C: main (pcseprdriver.f:257)
==20909==

"out.xdsyevr" 1165 lines --33%-- (50 of 106
==21233== Conditional jump or move depends on uninitialised value(s)
==21233==    at 0x40A38E: pdseprsubtst_ (pdseprsubtst.f:754)
==21233==    by 0x40E2BF: pdseprtst_ (pdseprtst.f:536)
==21233==    by 0x408F5A: pdseprreq_ (pdseprreq.f:196)
==21233==    by 0x40755E: MAIN__ (pdseprdriver.f:205)
==21233==    by 0x4067CC: main (pdseprdriver.f:257)

==21235== Conditional jump or move depends on uninitialised value(s)
==21235==    at 0x40E056: pdseprtst_ (pdseprtst.f:523)
==21235==    by 0x408F5A: pdseprreq_ (pdseprreq.f:196)
==21235==    by 0x40755E: MAIN__ (pdseprdriver.f:205)
==21235==    by 0x4067CC: main (pdseprdriver.f:257)

==21235== Conditional jump or move depends on uninitialised value(s)
==21235==    at 0x406DF9: pdlasizesyevr_ (pdlasizesyevr.f:139)
==21235==    by 0x40E0F2: pdseprtst_ (pdseprtst.f:528)
==21235==    by 0x408F5A: pdseprreq_ (pdseprreq.f:196)
==21235==    by 0x40755E: MAIN__ (pdseprdriver.f:205)
==21235==    by 0x4067CC: main (pdseprdriver.f:257)

"out.xssyevr" 1161 lines --28%-- (78 of 106)
==21450== Conditional jump or move depends on uninitialised value(s)
==21450==    at 0x40A936: psseprsubtst_ (psseprsubtst.f:754)
==21450==    by 0x40E7FC: psseprtst_ (psseprtst.f:536)
==21450==    by 0x40952A: psseprreq_ (psseprreq.f:196)
==21450==    by 0x407B2E: MAIN__ (psseprdriver.f:205)
==21450==    by 0x406DAC: main (psseprdriver.f:257)
==21450==

 ==21450== Conditional jump or move depends on uninitialised value(s)
==21450==    at 0x4073D9: pslasizesyevr_ (pslasizesyevr.f:139)
==21450==    by 0x40E62F: psseprtst_ (psseprtst.f:528)
==21450==    by 0x40952A: psseprreq_ (psseprreq.f:196)
==21450==    by 0x407B2E: MAIN__ (psseprdriver.f:205)
==21450==    by 0x406DAC: main (psseprdriver.f:257)

==21450== Conditional jump or move depends on uninitialised value(s)
==21450==    at 0x40A91F: psseprsubtst_ (psseprsubtst.f:679)
==21450==    by 0x40E7FC: psseprtst_ (psseprtst.f:536)
==21450==    by 0x40952A: psseprreq_ (psseprreq.f:196)
==21450==    by 0x407B2E: MAIN__ (psseprdriver.f:205)
==21450==    by 0x406DAC: main (psseprdriver.f:257)

"out.xzheevr" 1165 lines --28%-- (88 of 106)
==21541==    at 0x40B3AE: pzseprsubtst_ (pzseprsubtst.f:780)
==21541==    by 0x40F369: pzseprtst_ (pzseprtst.f:553)
==21541==    by 0x409EDF: pzseprreq_ (pzseprreq.f:203)
==21541==    by 0x40837E: MAIN__ (pzseprdriver.f:205)
==21541==    by 0x40742C: main (pzseprdriver.f:257)

==21543== Conditional jump or move depends on uninitialised value(s)
==21543==    at 0x407C19: pzlasizeheevr_ (pzlasizeheevr.f:139)
==21543==    by 0x40F17B: pzseprtst_ (pzseprtst.f:544)
==21543==    by 0x409EDF: pzseprreq_ (pzseprreq.f:203)
==21543==    by 0x40837E: MAIN__ (pzseprdriver.f:205)
==21543==    by 0x40742C: main (pzseprdriver.f:257)
==21543==

==21541== Conditional jump or move depends on uninitialised value(s)
==21541==    at 0x40F0DF: pzseprtst_ (pzseprtst.f:539)
==21541==    by 0x409EDF: pzseprreq_ (pzseprreq.f:203)
==21541==    by 0x40837E: MAIN__ (pzseprdriver.f:205)
==21541==    by 0x40742C: main (pzseprdriver.f:257)


Unfortunately no patch this time. The good news is that these are the only issues found this time (and they are all in the testing code).
vondele
 
Posts: 11
Joined: Mon Jan 28, 2008 4:28 am


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 2 guests