Commits

Blaise Bourdin committed 76aff83 Merge

Merged petsc/petsc into master

Comments (0)

Files changed (24)

bin/maint/builddist

 #
 # This script builds the PETSc tar file distribution
 #
-# Usage: builddist petscrepo
-# example usage: builddist /sandbox/petsc/petsc-dist
+# Usage: builddist petscrepo branch
+# example usage: builddist /sandbox/petsc/petsc.clone
 # Notes: version info is automatically obtained from include/petscversion.h
 #
 #echo "------- Have you done ALL of the following?? -----------------------------"
 # If version specified on the commandline, set the version
 echo "Starting date: `date`"
 
-if [ $# = 1 ]; then
+if [ $# = 2 ]; then
   petscrepo=$1
+  branch=$2
+elif [ $# = 1 ]; then
+  petscrepo=$1
+  branch='master'
 else
   echo 'Error: petscrepo not specified. Usge: builddist petscrepo'
   exit
   exit
 fi
 
+if [ ! -d $petscrepo/.git ]; then
+  echo 'Error: dir $petscrepo is not a git repo'
+  exit
+fi
+
 # Initialize vars
 PETSC_ARCH=arch-build; export PETSC_ARCH
 PETSC_DIR=`cd $petscrepo;pwd -P`; export PETSC_DIR
+
+# Clean and Update the git repository and check for branch
+cd $PETSC_DIR
+git checkout -f $branch
+if [ "$?" != "0" ]; then
+  echo 'Error: branch: $branch does not exist in $PETSC_DIR'
+  exit
+fi
+git clean -q -f -d -x
+git pull -q
+
 pdir=`basename $PETSC_DIR`
 
 # Create a tmp dir
   exit
 fi
 
-# Clean and Update the hg repository
-cd $PETSC_DIR/config/BuildSystem; hg revert -a; hg -q clean --all; hg -q pull -u
-cd $PETSC_DIR; hg revert -a; hg -q clean -X bin/win32fe --all; hg -q pull -u
-
 # check petscversion.h and set the version string
 version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`
 version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`
 
 #generated a couple of more values
 version_patch_date=`date`
-version_hg=`hg tip --template '{node}'`
-version_date_hg=`hg tip --template '{date|date}'`
+version_git=`git log -1 --pretty=format:%H`
+version_date_git=`git log -1 --pretty=format:%ci`
 if  [ ${version_release} = 0 ]; then
-  version=-dev
+  if [ "$branch" = "master" ]; then
+    version=-dev
+  else
+    version=-$branch
+  fi
 elif [ ${version_release} = 1 ]; then
   version=-${version_major}.${version_minor}-p${version_patch}
 else
 /bin/grep -v 'chmod' conf/rules.bak > conf/rules
 /bin/rm -f  conf/rules.bak
 
-#add in PETSC_VERSION_PATCH_DATE and PETSC_VERSION_HG
+#add in PETSC_VERSION_PATCH_DATE and PETSC_VERSION_GIT
 echo Using PETSC_VERSION_PATCH_DATE: ${version_patch_date}
-echo Using PETSC_VERSION_HG: ${version_hg}
+echo Using PETSC_VERSION_GIT: ${version_git}
 /bin/mv include/petscversion.h include/petscversion.h.bak
 cat include/petscversion.h.bak | \
   sed -e "s/#define PETSC_VERSION_PATCH_DATE.*/#define PETSC_VERSION_PATCH_DATE \"${version_patch_date}\"/" | \
-  sed -e "s/#define PETSC_VERSION_HG.*/#define PETSC_VERSION_HG         \"${version_hg}\"/" | \
-  sed -e "s/#define PETSC_VERSION_DATE_HG.*/#define PETSC_VERSION_DATE_HG         \"${version_date_hg}\"/" \
+  sed -e "s/#define PETSC_VERSION_GIT.*/#define PETSC_VERSION_GIT         \"${version_git}\"/" | \
+  sed -e "s/#define PETSC_VERSION_DATE_GIT.*/#define PETSC_VERSION_DATE_GIT         \"${version_date_git}\"/" \
   > include/petscversion.h
 /bin/rm -f include/petscversion.h.bak
 

bin/maint/buildtest

 rm -f build.log
 echo "Build on $MACH $ARCH $nPETSC_DIR `date` " > build.log
 
-# Note use 'hg clean --all' intead of manually deleting seleted old files.
+# Note use 'git clean' intead of manually deleting seleted old files.
 # This also requires 'clean' extension enabled on all nightly build machines.
 
-echo "Cleaning throughly and updating mercurial clone at $nPETSC_DIR" >>& build.log
-(hg -q revert -a; hg -q clean --all -X build.log; hg -q pull -u) >>& build.log
-(cd config/BuildSystem; hg -q revert -a; hg -q clean --all; hg -q pull -u; cd $nPETSC_DIR) >>& build.log
+echo "Cleaning throughly and updating git clone at $nPETSC_DIR" >>& build.log
+(git reset --hard; git clean -q -f -d -x -e build.log;git pull -q) >>& build.log
 
-# if externalpackage tarball also packs a hg repo - one has to explicitly remove it
+# if externalpackage tarball also packs a git repo - one has to explicitly remove it
 rm -rf ./externalpackages
 
 setenv PETSC_DIR $nPETSC_DIR

bin/maint/confignightly/default

 # It uses "TEST" variable set by the calling script - and setsup:
 # TNAME : the actual config file for this test
 # RNAME : name of the local repo clone for this test [petsc-dev vs petsc33]
-# PURL  : petsc url
-# BURL  : buildsystem url
+# URL  : petsc repo url
 #
   set SSH=ssh
   set SCP=scp
   set DASHN=-n
-  set MERCURIAL=yes
-  echo $TEST | grep ^rel/ > /dev/null
-  if ("$?" == "0") then
-    set TNAME=`echo ${TEST} | sed 's^rel/^^'`
-    set PURL=https://bitbucket.org/petsc/petsc-3.3
-    set BURL=https://bitbucket.org/petsc/buildsystem-3.3
-    set RNAME=petsc33
-  else
-    set TNAME=${TEST}
-    set PURL=https://bitbucket.org/petsc/petsc-dev
-    set BURL=https://bitbucket.org/petsc/buildsystem
-    set RNAME=petsc-dev
+  set GIT=yes
+  set URL=https://bitbucket.org/petsc/petsc
+  set RNAME=petsc.clone
+  set TNAME=`echo ${TEST} | cut -d ':' -f 1`
+  set BRANCH=`echo ${TEST} | cut -s -d ':' -f 2`
+  if ("$BRANCH" == "") then
+    set BRANCH='next'
   endif

bin/maint/rebuildtar

 # /home/balay/spetsc/bin/maint/createpatch
 
 #create the tarfile
-${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
+${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR} maint
 
 #Now copy the generated tarfiles over to the website
 PATCH_VERSION=`grep '^#define PETSC_VERSION_PATCH ' ${PETSC_DIR}/include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`

bin/maint/startnightly

 #! /bin/csh
 #
-# usage startnightly test1 test2 rel/test3 rel/test4 ...
+# usage startnightly test1 test2 test3:maint test4:next ...
 #
 set dir=`dirname $0`
 set bdir=`dirname $dir`
   source $dir/confignightly/${TNAME}
 
   echo "Starting $TEST : $CONF build at `date`"
-  if ("${MERCURIAL}" == "yes") then
+  if ("${GIT}" == "yes") then
     $SSH $USR@$MACH $DASHN test "\( -d  $LOC \)"
     if ("$?" != "0") then
-      if ("$PURL" != "" || "$BURL" != "") then
-      echo "$LOC does not exist! Creating clones using $PURL and $BURL"
-      $SSH $USR@$MACH $DASHN "hg clone -q $PURL $LOC; hg clone -q $BURL $LOC/config/BuildSystem"
+      if ("$URL" != "") then
+      echo "$LOC does not exist! Creating clone using $URL"
+      $SSH $USR@$MACH $DASHN "git clone -q $URL $LOC"
       endif
     endif
     echo "Cleaning and updating clone at $USR@$MACH $LOC"
-    $SSH $USR@$MACH $DASHN "cd $LOC ; hg -q revert -a; hg -q pull -u"
+    $SSH $USR@$MACH $DASHN "cd $LOC ; git checkout -f ${BRANCH}; git pull -q "
   else
     rsync -e ssh -az --delete  $pdir/ ${USR}@${MACH}:${LOC}
   endif

bin/petscnagupgrade.py

 #
 #
 if __name__ ==  '__main__':
-  if os.environ.has_key('PETSC_DIR'):
+  if 'PETSC_DIR' in os.environ:
     petscdir = os.environ['PETSC_DIR']
   elif os.path.exists(os.path.join('.', 'include', 'petscversion.h')):
     petscdir  = '.'
 #
 #  These rules are for compiling the test examples.
 #
-.cpp.rm .cc.rm .C.rm .F.rm .F90.rm .f.rm .c.rm .cu.rm:
+.cpp.rm .cxx.rm .cc.rm .C.rm .F.rm .F90.rm .f.rm .c.rm .cu.rm:
 	-@${RM} $* *.o $*.mon.* gmon.out mon.out
 	-@${RM} *.exe *.ilk *.pdb *.tds
-.cu.PETSc .c.PETSc:
+.cu.PETSc .c.PETSc .cxx.PETSc:
 	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  $* > trashz 2>&1
 	-@grep -v clog trashz | grep -v "information sections" | \
           grep -v "WARNING: TOC" | \
 testexamples_AFTERIMAGE:
 testexamples_PTHREADCLASSES:
 testexamples_OPENMP:
+testexamples_NETCDF:
 
 buildexamples_C:
 	-@${OMAKE} testexamples_C TESTEXAMPLES_C=`echo ${TESTEXAMPLES_C} | sed s/runex[0-9]*[a-z0-9_]*//g`

config/BuildSystem/config/sourceControl.py

   def setupHelp(self, help):
     import nargs
 
+    help.addArgument('SourceControl', '-with-git=<prog>', nargs.Arg(None, 'git','Specify the Git executable'))
     help.addArgument('SourceControl', '-with-hg=<prog>',  nargs.Arg(None, 'hg', 'Specify the Mercurial executable'))
     help.addArgument('SourceControl', '-with-cvs=<prog>', nargs.Arg(None, 'cvs', 'Specify the CVS executable'))
     help.addArgument('SourceControl', '-with-svn=<prog>', nargs.Arg(None, 'svn', 'Specify the Subversion executable'))
     return
 
+  def configureGit(self):
+    '''Find the Git executable'''
+    if 'with-git' in self.framework.argDB and self.framework.argDB['with-git'] == '0':
+      return
+    self.getExecutable(self.framework.argDB['with-git'], resultName = 'git')
+    if hasattr(self,'git'):
+      try:
+        self.gitversion = self.executeShellCommand(self.git + ' --version')
+      except: pass
+    return
+
   def configureMercurial(self):
     '''Find the Mercurial executable'''
     if 'with-hg' in self.framework.argDB and self.framework.argDB['with-hg'] == '0':
     return
 
   def configure(self):
+    self.executeTest(self.configureGit)
     self.executeTest(self.configureMercurial)
     self.executeTest(self.configureCVS)
     self.executeTest(self.configureSubversion)

config/PETSc/packages/scalapack.py

       try:
         self.logPrintBox('Compiling Scalapack; this may take several minutes')
         libDir = os.path.join(self.installDir, self.libdir)
-        output,err,ret  = PETSc.package.NewPackage.executeShellCommand('cd '+self.packageDir+' && make && mv libscalapack.* '+libDir, timeout=2500, log = self.framework.log)
+        output,err,ret  = PETSc.package.NewPackage.executeShellCommand('cd '+self.packageDir+' && make lib && mv libscalapack.* '+libDir, timeout=2500, log = self.framework.log)
       except RuntimeError, e:
         raise RuntimeError('Error running make on SCALAPACK: '+str(e))
       self.postInstall(output,'SLmake.inc')

config/PETSc/utilities/petscdir.py

 
   def configureInstallationMethod(self):
     if os.path.exists(os.path.join(self.dir,'bin','maint')):
-      self.logPrint('This is a Mercurial clone')
+      self.logPrint('bin/maint exits. This apppears to be a repository clone')
       self.isClone = 1
-      if os.path.exists(os.path.join(self.dir, '.hg')):
+      if os.path.exists(os.path.join(self.dir, '.git')):
+        if hasattr(self.sourceControl,'git'):
+          self.addDefine('VERSION_GIT','"'+os.popen("cd "+self.dir+" && "+self.sourceControl.git+" log -1 --pretty=format:%H").read()+'"')
+          self.addDefine('VERSION_DATE_GIT','"'+os.popen("cd "+self.dir+" && "+self.sourceControl.git+" log -1 --pretty=format:%ci").read()+'"')
+        else:
+          self.logPrintBox('\n*****WARNING: PETSC_DIR appears to be a Git clone - but git is not found in PATH********\n')
+      elif os.path.exists(os.path.join(self.dir, '.hg')):
         if hasattr(self.sourceControl,'hg'):
           self.addDefine('VERSION_HG','"'+os.popen(self.sourceControl.hg +" -R"+self.dir+" tip --template '{node}'").read()+'"')
           self.addDefine('VERSION_DATE_HG','"'+os.popen(self.sourceControl.hg +" -R"+self.dir+" tip --template '{date|date}'").read()+'"')
-          # Check version & date for buildsystem aswell
-          bs_dir = os.path.join(self.dir,'config','BuildSystem')
-          if os.path.exists(os.path.join(bs_dir,'.hg')):
-            self.addDefine('VERSION_BS_HG','"'+os.popen(self.sourceControl.hg +" -R"+bs_dir+" tip --template '{node}'").read()+'"')
-            self.addDefine('VERSION_BS_DATE_HG','"'+os.popen(self.sourceControl.hg + " -R"+bs_dir+" tip --template '{date|date}'").read()+'"')
         else:
           self.logPrintBox('\n*****WARNING: PETSC_DIR appears to be a mercurial clone - but hg is not found in PATH********\n')
       else:
-        self.logPrint('This Mercurial clone is obtained as a tarball as .hg dir does not exist!')
+        self.logPrint('This repository clone is obtained as a tarball as neither .hg nor .git dirs exist!')
     else:
-      self.logPrint('This is a tarball installation')
-      self.isClone = 0
-    if self.isClone and not os.path.exists(os.path.join(self.dir, 'bin', 'maint')):
-      raise RuntimeError('Your petsc-dev directory is broken, remove the entire directory and start all over again')
+      if os.path.exists(os.path.join(self.dir, '.git')) or os.path.exists(os.path.join(self.dir, '.hg')):
+        raise RuntimeError('Your petsc-dev directory is broken, remove the entire directory and start all over again')
+      else:
+        self.logPrint('This is a tarball installation')
+        self.isClone = 0
     return
 
   def configure(self):

config/builder2.py

     if not args.testnum is None and not testnum in str(args.testnum): continue
     if 'setup' in param:
       print(param['setup'])
-      os.system('python '+param['setup'])
+      os.system(sys.executable+' '+param['setup'])
       rebuildTest = True
     if 'source' in param:
       if not isinstance(ex, list):
   params = builder.regressionParameters.get(paramKey, {})
   if not params:
     params = builder.getRegressionParameters(maker, exampleDir).get(paramKey, {})
-    maker.logPrint('Makefile params '+strparams)
+    maker.logPrint('Makefile params '+str(params))
   if not isinstance(params, list):
     params = [params]
   for testnum, param in enumerate(params):

config/cmakegen.py

   if MISTAKES:
     for m in MISTAKES:
       log.write(m + '\n')
-    raise RuntimeError('PETSc makefiles contain mistakes or files are missing on filesystem.\n%s\nPossible reasons:\n\t1. Files were deleted locally, try "hg update".\n\t2. Files were deleted from mercurial, but were not removed from makefile. Send mail to petsc-maint@mcs.anl.gov.\n\t3. Someone forgot "hg add" new files. Send mail to petsc-maint@mcs.anl.gov.' % ('\n'.join(MISTAKES)))
+    raise RuntimeError('PETSc makefiles contain mistakes or files are missing on filesystem.\n%s\nPossible reasons:\n\t1. Files were deleted locally, try "hg revert filename" or "git checkout filename".\n\t2. Files were deleted from repository, but were not removed from makefile. Send mail to petsc-maint@mcs.anl.gov.\n\t3. Someone forgot to "add" new files to the repository. Send mail to petsc-maint@mcs.anl.gov.' % ('\n'.join(MISTAKES)))
 
 if __name__ == "__main__":
   import optparse

config/configure.py

   untar(tar, targetDirname, leading = filename.split('.')[0])
   return
 
-def getBuildSystem(configDir,bsDir):
-  print '==============================================================================='
-  print '''++ Could not locate BuildSystem in %s.''' % configDir
-  (status,output) = commands.getstatusoutput('hg showconfig paths.default')
-  if status or not output:
-    print '++ Mercurial clone not found. Assuming petsc-dev and downloading from https://bitbucket.org/petsc/buildsystem/get/tip.tar.gz'
-    downloadPackage('https://bitbucket.org/petsc/buildsystem/get/tip.tar.gz', 'BuildSystem.tar.gz', configDir)
-  else:
-    print '++ Mercurial clone found. URL : ' + output
-    bsurl = output.replace('petsc-dev','buildsystem').replace('petsc-','buildsystem-')
-    print '++ Using: hg clone '+ bsurl +' '+ bsDir
-    (status,output) = commands.getstatusoutput('hg clone '+ bsurl +' '+ bsDir)
-    if status:
-      print '++ Unable to clone BuildSystem. Please clone manually'
-      print '==============================================================================='
-      sys.exit(3)
-  print '==============================================================================='
-  return
-
-
 # Use en_US as language so that BuildSystem parses compiler messages in english
 if 'LC_LOCAL' in os.environ and os.environ['LC_LOCAL'] != '' and os.environ['LC_LOCAL'] != 'en_US' and os.environ['LC_LOCAL']!= 'en_US.UTF-8': os.environ['LC_LOCAL'] = 'en_US.UTF-8'
 if 'LANG' in os.environ and os.environ['LANG'] != '' and os.environ['LANG'] != 'en_US' and os.environ['LANG'] != 'en_US.UTF-8': os.environ['LANG'] = 'en_US.UTF-8'
 
 def chkdosfiles():
   if not os.path.exists('/usr/bin/cygcheck.exe'): return
-  (status,output) = commands.getstatusoutput('hg showconfig paths.default')
-  if not status and output: return
+  if os.path.exists('.hg'):
+    (status,output) = commands.getstatusoutput('hg showconfig paths.default')
+    if not status and output: return
+  if os.path.exists('.git'):
+    (status,output) = commands.getstatusoutput('git rev-parse')
+    if not status: return
   # cygwin - but not a hg clone - so check files in bin dir
   (status,output) = commands.getstatusoutput('file bin/*')
   if status:
   bsDir     = os.path.join(configDir, 'BuildSystem')
   if not os.path.isdir(configDir):
     raise RuntimeError('Run configure from $PETSC_DIR, not '+os.path.abspath('.'))
-  if not os.path.isdir(bsDir): getBuildSystem(configDir,bsDir)
   sys.path.insert(0, bsDir)
   sys.path.insert(0, configDir)
   import config.base

include/petsclog.h

 } PetscStageInfo;
 
 typedef struct _n_PetscStageLog *PetscStageLog;
-PETSC_EXTERN PetscStageLog petsc_stageLog;
 struct _n_PetscStageLog {
   int              numStages;   /* The number of registered stages */
   int              maxStages;   /* The maximum number of stages */
 
 
 #if defined(PETSC_USE_LOG)  /* --- Logging is turned on --------------------------------*/
+PETSC_EXTERN PetscStageLog petsc_stageLog;
 
 /*
    Flop counting:  We count each arithmetic operation (e.g., addition, multiplication) separately.

include/petscversion.h

 #define PETSC_VERSION_DATE       "Jun, 5, 2012"
 #define PETSC_VERSION_PATCH_DATE "unknown"
 
-#if !defined (PETSC_VERSION_HG)
-#define PETSC_VERSION_HG         "unknown"
+#if !defined (PETSC_VERSION_GIT)
+#define PETSC_VERSION_GIT         "unknown"
 #endif
 
-#if !defined(PETSC_VERSION_DATE_HG)
-#define PETSC_VERSION_DATE_HG    "unknown"
+#if !defined(PETSC_VERSION_DATE_GIT)
+#define PETSC_VERSION_DATE_GIT    "unknown"
 #endif
 
 #define PETSC_VERSION_(MAJOR,MINOR,SUBMINOR) \

include/petscviewer.h

 #define PETSC_VIEWER_AMS_WORLD PETSC_VIEWER_AMS_(PETSC_COMM_WORLD)
 #endif
 
+/* Reset __FUNCT__ in case the user does not define it themselves */
+#undef __FUNCT__
+#define __FUNCT__ "User provided function"
+
 #endif
           echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
           exit; \
         fi; \
-        datestr=`hg tip --template "{date|shortdate}"`; \
+        datestr=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1`; \
         export datestr; \
         find * -type d -wholename src/docs/website -prune -o -type d -wholename src/benchmarks/results -prune -o \
           -type d -wholename 'arch-*' -prune -o -type d -wholename src/tops -prune -o -type d -wholename externalpackages -prune -o \
 
 # Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
 dist:
-	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
+	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR} master
 
 # This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
 # also copy the file over to ftp site.

src/mat/examples/tutorials/ex9.c

   ierr = MatCreateComposite(PETSC_COMM_WORLD,3,A,&B);CHKERRQ(ierr);
   ierr = MatMult(B,x,y);CHKERRQ(ierr);
   ierr = MatDestroy(&B);CHKERRQ(ierr);
-  ierr = VecAXPY(y,-1.0,y);CHKERRQ(ierr);
+  ierr = VecAXPY(y,-1.0,z);CHKERRQ(ierr);
   ierr = VecNorm(y,NORM_2,&rnorm);CHKERRQ(ierr);
   if (rnorm > 1.e-10) {
     ierr = PetscPrintf(PETSC_COMM_WORLD,"Error with composite add %G\n",rnorm);
   ierr = MatCompositeMerge(B);CHKERRQ(ierr);
   ierr = MatMult(B,x,y);CHKERRQ(ierr);
   ierr = MatDestroy(&B);CHKERRQ(ierr);
-  ierr = VecAXPY(y,-1.0,y);CHKERRQ(ierr);
+  ierr = VecAXPY(y,-1.0,z);CHKERRQ(ierr);
   ierr = VecNorm(y,NORM_2,&rnorm);CHKERRQ(ierr);
   if (rnorm > 1.e-10) {
     ierr = PetscPrintf(PETSC_COMM_WORLD,"Error with composite add after merge %G\n",rnorm);
   ierr = MatCompositeSetType(B,MAT_COMPOSITE_MULTIPLICATIVE);CHKERRQ(ierr);
   ierr = MatMult(B,x,y);CHKERRQ(ierr);
   ierr = MatDestroy(&B);CHKERRQ(ierr);
-  ierr = VecAXPY(y,-1.0,y);CHKERRQ(ierr);
+  ierr = VecAXPY(y,-1.0,z);CHKERRQ(ierr);
   ierr = VecNorm(y,NORM_2,&rnorm);CHKERRQ(ierr);
   if (rnorm > 1.e-10) {
     ierr = PetscPrintf(PETSC_COMM_WORLD,"Error with composite multiplicative %G\n",rnorm);
   ierr = MatCompositeMerge(B);CHKERRQ(ierr);
   ierr = MatMult(B,x,y);CHKERRQ(ierr);
   ierr = MatDestroy(&B);CHKERRQ(ierr);
-  ierr = VecAXPY(y,-1.0,y);CHKERRQ(ierr);
+  ierr = VecAXPY(y,-1.0,z);CHKERRQ(ierr);
   ierr = VecNorm(y,NORM_2,&rnorm);CHKERRQ(ierr);
   if (rnorm > 1.e-10) {
     ierr = PetscPrintf(PETSC_COMM_WORLD,"Error with composite multiplicative after merge %G\n",rnorm);

src/mat/impls/aij/mpi/mpiaij.c

     for (i=2; i<=size; i++) {
       mmax = PetscMax(mmax, rowners[i]);
     }
-  } else mmax = m;
+  };
 
   rowners[0] = 0;
   for (i=2; i<=size; i++) {
   rend   = rowners[rank+1];
 
   /* distribute row lengths to all processors */
-  ierr = PetscMalloc2(mmax,PetscInt,&ourlens,mmax,PetscInt,&offlens);CHKERRQ(ierr);
+  ierr = PetscMalloc2(m,PetscInt,&ourlens,m,PetscInt,&offlens);CHKERRQ(ierr);
   if (!rank) {
     ierr = PetscBinaryRead(fd,ourlens,m,PETSC_INT);CHKERRQ(ierr);
     ierr = PetscMalloc(mmax*sizeof(PetscInt),&rowlengths);CHKERRQ(ierr);

src/mat/impls/baij/mpi/mpibaij.c

       mmax = PetscMax(mmax,rowners[i]);
     }
     mmax*=bs;
-  } else mmax = m;
+  };
 
   rowners[0] = 0;
   for (i=2; i<=size; i++) rowners[i] += rowners[i-1];
   rend   = rowners[rank+1];
 
   /* distribute row lengths to all processors */
-  ierr = PetscMalloc((mmax+1)*sizeof(PetscInt),&locrowlens);CHKERRQ(ierr);
+  ierr = PetscMalloc(m*sizeof(PetscInt),&locrowlens);CHKERRQ(ierr);
   if (!rank) {
     mend = m;
     if (size == 1) mend = mend - extra_rows;
     ierr = PetscBinaryRead(fd,locrowlens,mend,PETSC_INT);CHKERRQ(ierr);
     for (j=mend; j<m; j++) locrowlens[j] = 1;
-    ierr = PetscMalloc(m*sizeof(PetscInt),&rowlengths);CHKERRQ(ierr);
+    ierr = PetscMalloc(mmax*sizeof(PetscInt),&rowlengths);CHKERRQ(ierr);
     ierr = PetscMalloc(size*sizeof(PetscInt),&procsnz);CHKERRQ(ierr);
     ierr = PetscMemzero(procsnz,size*sizeof(PetscInt));CHKERRQ(ierr);
     for (j=0; j<m; j++) {

src/mat/impls/composite/mcomposite.c

   Mat_CompositeLink next   = shell->head, prev = shell->tail;
   PetscErrorCode    ierr;
   Mat               tmat,newmat;
+  Vec               left,right;
+  PetscScalar       scale;
 
   PetscFunctionBegin;
   if (!next) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must provide at least one matrix with MatCompositeAddMat()");
       tmat = newmat;
     }
   }
+
+  scale = shell->scale;
+  if ((left = shell->left)) {ierr = PetscObjectReference((PetscObject)left);CHKERRQ(ierr);}
+  if ((right = shell->right)) {ierr = PetscObjectReference((PetscObject)right);CHKERRQ(ierr);}
+
   ierr = MatHeaderReplace(mat,tmat);CHKERRQ(ierr);
-  ierr = MatDiagonalScale(mat,shell->left,shell->right);CHKERRQ(ierr);
-  ierr = MatScale(mat,shell->scale);CHKERRQ(ierr);
+
+  ierr = MatDiagonalScale(mat,left,right);CHKERRQ(ierr);
+  ierr = MatScale(mat,scale);CHKERRQ(ierr);
+  ierr = VecDestroy(&left);CHKERRQ(ierr);
+  ierr = VecDestroy(&right);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }

src/sys/objects/version.c

 #if (PETSC_VERSION_RELEASE == 1)
   ierr = PetscSNPrintf(version,len,"Petsc Release Version %d.%d.%d, Patch %d, %s ",PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR,PETSC_VERSION_PATCH,PETSC_VERSION_PATCH_DATE);CHKERRQ(ierr);
 #else
-  ierr = PetscSNPrintf(version,len,"Petsc Development HG revision: %s  HG Date: %s",PETSC_VERSION_HG, PETSC_VERSION_DATE_HG);CHKERRQ(ierr);
+  ierr = PetscSNPrintf(version,len,"Petsc Development GIT revision: %s  GIT Date: %s",PETSC_VERSION_GIT, PETSC_VERSION_DATE_GIT);CHKERRQ(ierr);
 #endif
   PetscFunctionReturn(0);
 }

src/sys/threadcomm/interface/threadcomm.c

 PetscErrorCode PetscThreadCommStackCreate_kernel(PetscInt trank)
 {
   PetscStack *petscstack_in;
-  if (trank && PetscStackActive()) return 0;
+  if (!trank && PetscStackActive()) return 0;
 
   petscstack_in              = (PetscStack*)malloc(sizeof(PetscStack));
   petscstack_in->currentsize = 0;