Hi,
This patch fixes some small valgrind errors I was seeing in this class.
Let me know if there are any issues. Tests related to the aijcusparse
class pass (on master) after this patch.
Thanks,
-Paul
>From 8ad6df0c50cffab50fb4d265b1f320d45d9f920c Mon Sep 17 00:00:00 2001
From: Paul Mullowney <[email protected]>
Date: Thu, 6 Jun 2013 11:35:07 -0600
Subject: [PATCH] I caught a small error in MatGetFactor_seqaij_cusparse. The
factor type
for the new, factored matrix needs to be set before calling MatSetType.
With the factored defined before MatSetType, the correct type is then
allocated for the spptr for the triangular factors in ILU and ICC
preconditioners.
Before this fix, this was leading to some undefined behaviour that I saw in the
performance logging. Now, examples are valgrind clean and the performance
logging is consistent. The three tests in ksp subdirs pass.
---
src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
b/src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
index b4ab967..54ede95 100644
--- a/src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
+++ b/src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
@@ -77,6 +77,7 @@ PETSC_EXTERN PetscErrorCode MatGetFactor_seqaij_cusparse(Mat
A,MatFactorType fty
PetscFunctionBegin;
ierr = MatCreate(PetscObjectComm((PetscObject)A),B);CHKERRQ(ierr);
+ (*B)->factortype = ftype;
ierr = MatSetSizes(*B,n,n,n,n);CHKERRQ(ierr);
ierr = MatSetType(*B,MATSEQAIJCUSPARSE);CHKERRQ(ierr);
@@ -91,7 +92,6 @@ PETSC_EXTERN PetscErrorCode MatGetFactor_seqaij_cusparse(Mat
A,MatFactorType fty
ierr = MatSeqAIJSetPreallocation(*B,MAT_SKIP_ALLOCATION,NULL);CHKERRQ(ierr);
ierr =
PetscObjectComposeFunction((PetscObject)(*B),"MatFactorGetSolverPackage_C",MatFactorGetSolverPackage_seqaij_cusparse);CHKERRQ(ierr);
- (*B)->factortype = ftype;
PetscFunctionReturn(0);
}
--
1.7.1