On 01/05/2015 04:02 PM, Jed Brown wrote:
Robert Femmer <[email protected]> writes:

When testing jacobian diffs via -snes_type test, block size is not
explicitly set
during setup of the difference matrix B. This can cause problems when the
block size is explicitly set in the origin jacobian and is not derivable
from local
matrix sizes, for instance on a single core. The patch sets block size
explicitly.
The patch is trivial, and unfortunately includes the explicit naming of the
python version in the configure script. This ensures portability to
linux distros
where the default python version is >=3.0 (e.g., arch linux).
Robert, these are unrelated changes, so we'd prefer it if you submit
these as separate commits.  The problem with naming "python2" in the
script is that a lot of older machines don't have a "python2" (an old,
bad mistake by the Python community).  So until BuildSystem grows the
ability to use Python-3, those of us running systems where "python" is
python3 have to run

   python2 configure --options

Thanks Jed, I dropped the python part from the patch.
>From 5ccd6d8e5bde9ab0646836566905c3fa2587d508 Mon Sep 17 00:00:00 2001
From: Robert Femmer <[email protected]>
Date: Mon, 5 Jan 2015 16:14:45 +0100
Subject: [PATCH] set block size for jacobian difference matrix

---
 src/snes/impls/test/snestest.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/snes/impls/test/snestest.c b/src/snes/impls/test/snestest.c
index 468f5c7..a1eb995 100644
--- a/src/snes/impls/test/snestest.c
+++ b/src/snes/impls/test/snestest.c
@@ -33,7 +33,7 @@ PetscErrorCode SNESSolve_Test(SNES snes)
   for (i=0; i<3; i++) {
     void                     *functx;
     static const char *const loc[] = {"user-defined state","constant state -1.0","constant state 1.0"};
-    PetscInt                 m,n,M,N;
+    PetscInt                 m,n,M,N,bs;
 
     if (i == 1) {
       ierr = VecSet(x,-1.0);CHKERRQ(ierr);
@@ -54,8 +54,10 @@ PetscErrorCode SNESSolve_Test(SNES snes)
 
     ierr = MatCreate(PetscObjectComm((PetscObject)A),&B);CHKERRQ(ierr);
     ierr = MatGetSize(A,&M,&N);CHKERRQ(ierr);
+    ierr = MatGetBlockSize(A,&bs);CHKERRQ(ierr);
     ierr = MatGetLocalSize(A,&m,&n);CHKERRQ(ierr);
     ierr = MatSetSizes(B,m,n,M,N);CHKERRQ(ierr);
+    ierr = MatSetBlockSize(B,bs);CHKERRQ(ierr);
     ierr = MatSetType(B,((PetscObject)A)->type_name);CHKERRQ(ierr);
     ierr = MatSetUp(B);CHKERRQ(ierr);
     ierr = MatSetOption(B,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
-- 
2.2.1

Reply via email to