[petsc-dev] Possible error running C/C++ src/snes/examples/tutorials/ex19 with 1 MPI process

Satish Balay balay at mcs.anl.gov
Mon Oct 10 09:08:20 CDT 2016


Removing superlu_fixed the previous error? Thats wierd..

You can try the attached patch - and see if that fixes this valgrind issue..

Satish

On Mon, 10 Oct 2016, Antonio Trande wrote:

> This is the only explicit error that i see (just on serial 32bit libs).
> I have disabled SuperLU support, too.
> 
> + cd petsc-3.7.4
> + export
> LD_LIBRARY_PATH=/usr/lib:/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4/i386/lib
> +
> LD_LIBRARY_PATH=/usr/lib:/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4/i386/lib
> + export PETSC_DIR=/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4
> + PETSC_DIR=/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4
> + export PETSC_ARCH=i386
> + PETSC_ARCH=i386
> + export 'PETSCVALGRIND_OPTIONS= --tool=memcheck --leak-check=yes
> --track-origins=yes'
> + PETSCVALGRIND_OPTIONS=' --tool=memcheck --leak-check=yes
> --track-origins=yes'
> + make -C petsc-3.7.4 test
> 'MPIEXEC=/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4/bin/petscmpiexec
> -valgrind'
> make: Entering directory '/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4'
> Running test examples to verify correct installation
> Using PETSC_DIR=/builddir/build/BUILD/petsc-3.7.4/petsc-3.7.4 and
> PETSC_ARCH=i386
> C/C++ example src/snes/examples/tutorials/ex19 run successfully with 1
> MPI process
> Possible error running C/C++ src/snes/examples/tutorials/ex19 with 2 MPI
> processes
> See http://www.mcs.anl.gov/petsc/documentation/faq.html
> Uniprocessor version of MPI can only use one processor
> Possible error running Fortran example src/snes/examples/tutorials/ex5f
> with 1 MPI process
> See http://www.mcs.anl.gov/petsc/documentation/faq.html
> ==1577== Conditional jump or move depends on uninitialised value(s)
> ==1577==    at 0x40323ED: strncpy (vg_replace_strmem.c:545)
> ==1577==    by 0x47ECBE7: PetscStrncpy (str.c:414)
> ==1577==    by 0x481C56E: PetscSetProgramName (options.c:314)
> ==1577==    by 0x484BB5D: petscinitialize_ (zstart.c:306)
> ==1577==    by 0x8049344: MAIN__ (ex5f.F:72)
> ==1577==    by 0x8049808: main (ex5f.F:184)
> ==1577==  Uninitialised value was created by a stack allocation
> ==1577==    at 0x484BAC1: petscinitialize_ (zstart.c:270)
> ==1577==
> ==1577== Conditional jump or move depends on uninitialised value(s)
> ==1577==    at 0x40323ED: strncpy (vg_replace_strmem.c:545)
> ==1577==    by 0x47ECBE7: PetscStrncpy (str.c:414)
> ==1577==    by 0x481C2FA: PetscGetProgramName (options.c:303)
> ==1577==    by 0x47B0745: PetscErrorPrintfInitialize (errtrace.c:71)
> ==1577==    by 0x484BCEF: petscinitialize_ (zstart.c:342)
> ==1577==    by 0x8049344: MAIN__ (ex5f.F:72)
> ==1577==    by 0x8049808: main (ex5f.F:184)
> ==1577==  Uninitialised value was created by a stack allocation
> ==1577==    at 0x484BAC1: petscinitialize_ (zstart.c:270)
> ==1577==
> Number of SNES iterations =     4
> Completed test examples
> =========================================
> 
> Full log:
> https://copr-be.cloud.fedoraproject.org/results/sagitter/petsc/fedora-rawhide-i386/00463045-petsc/build.log.gz
> 
> 
-------------- next part --------------
diff --git a/src/sys/objects/ftn-custom/zstart.c b/src/sys/objects/ftn-custom/zstart.c
index fe16e32..fb132b1 100644
--- a/src/sys/objects/ftn-custom/zstart.c
+++ b/src/sys/objects/ftn-custom/zstart.c
@@ -264,10 +264,10 @@ PETSC_EXTERN void PETSC_STDCALL petscinitialize_(CHAR filename PETSC_MIXED_LEN(l
 #endif
   int            flag;
   PetscMPIInt    size;
-  char           *t1,name[256],hostname[64];
+  char           *t1,name[PETSC_MAX_PATH_LEN],hostname[64];
   PetscMPIInt    f_petsc_comm_world;
 
-  *ierr = PetscMemzero(name,256); if (*ierr) return;
+  *ierr = PetscMemzero(name,PETSC_MAX_PATH_LEN); if (*ierr) return;
   if (PetscInitializeCalled) {*ierr = 0; return;}
 
   /* this must be initialized in a routine, not as a constant declaration*/
@@ -283,17 +283,17 @@ PETSC_EXTERN void PETSC_STDCALL petscinitialize_(CHAR filename PETSC_MIXED_LEN(l
   if (*ierr) return;
   i = 0;
 #if defined (PETSC_HAVE_FORTRAN_GET_COMMAND_ARGUMENT) /* same as 'else' case */
-  getarg_(&i,name,256);
+  getarg_(&i,name,PETSC_MAX_PATH_LEN);
 #elif defined (PETSC_HAVE_PXFGETARG_NEW)
   { int ilen,sierr;
-    getarg_(&i,name,&ilen,&sierr,256);
-    if (sierr) PetscStrncpy(name,"Unknown Name",256);
+    getarg_(&i,name,&ilen,&sierr,PETSC_MAX_PATH_LEN);
+    if (sierr) PetscStrncpy(name,"Unknown Name",PETSC_MAX_PATH_LEN);
     else name[ilen] = 0;
   }
 #elif defined(PETSC_USE_NARGS)
-  GETARG(&i,name,256,&flg);
+  GETARG(&i,name,PETSC_MAX_PATH_LEN,&flg);
 #else
-  getarg_(&i,name,256);
+  getarg_(&i,name,PETSC_MAX_PATH_LEN);
   /* Eliminate spaces at the end of the string */
   for (j=254; j>=0; j--) {
     if (name[j] != ' ') {
@@ -301,7 +301,7 @@ PETSC_EXTERN void PETSC_STDCALL petscinitialize_(CHAR filename PETSC_MIXED_LEN(l
       break;
     }
   }
-  if (j<0) PetscStrncpy(name,"Unknown Name",256);
+  if (j<0) PetscStrncpy(name,"Unknown Name",PETSC_MAX_PATH_LEN);
 #endif
   *ierr = PetscSetProgramName(name);
   if (*ierr) {(*PetscErrorPrintf)("PetscInitialize: Calling PetscSetProgramName()\n");return;}


More information about the petsc-dev mailing list