Hello,<br><br>i'm using petsc to proceed to the cholesky factorization of a square matrix using last stable version of PETSc using real scalars. However i am faced to a memory problem than i am not able to solve depiste spending hours on it.<br>
<br>What i try to do is to proceed to a cholesky factorization using the preconditionner as it was recommanded on this list instead of using directly the matrix cholesky factorization. For this i create a KSP context with no solver, just the preconditionner that is fixed to PCCHOLESKY. When using KSPSetup, the factorization should occur. However, the program crash saying that there's a memory overlap.<br>
<br>I checked with valgrind memcheck but didn't found any obvious error on allocation or deallocation. Also i attached the error and concerned code below.<br><br>If anyone had any idea on what's happening that would be of great help :)<br>
<br>Thanks a lot.<br><br>Regards.<br><br><br><br>Pierre-Yves<br><br><br><br>[3]PETSC ERROR: --------------------- Error Message ------------------------------------<br>[3]PETSC ERROR: Arguments are incompatible!<br>[3]PETSC ERROR: Memory regions overlap: either use PetscMemmov()<br>
or make sure your copy regions and lengths are correct. <br> Length (bytes) -4 first address 178909960 second address 178900956!<br>[3]PETSC ERROR: ------------------------------------------------------------------------<br>
[3]PETSC ERROR: Petsc Release Version 3.1.0, Patch 8, Thu Mar 17 13:37:48 CDT 2011<br>[3]PETSC ERROR: See docs/changes/index.html for recent updates.<br>[3]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>
[3]PETSC ERROR: See docs/index.html for manual pages.<br>[3]PETSC ERROR: ------------------------------------------------------------------------<br>[3]PETSC ERROR: ./hyperh on a linux-c-d named Tripel by perif Thu Jun 16 11:06:23 2011<br>
[3]PETSC ERROR: Libraries linked from /home/perif/Utils/Libs/petsc-3.1-p8/linux-c-debug-real/lib<br>[3]PETSC ERROR: Configure run at Tue May 24 14:49:00 2011<br>[3]PETSC ERROR: Configure options --download-c-blas-lapack=yes --with-scalar-type=complex --with-fortran=0 --with-debugging=yes --with-shared=0 --with-petsc-arch=linux-c-debug-real<br>
[3]PETSC ERROR: ------------------------------------------------------------------------<br>[3]PETSC ERROR: User provided function() line 1755 in src/mat/utils//home/perif/Utils/Libs/petsc-3.1-p8/include/petscsys.h<br>[3]PETSC ERROR: PetscFreeSpaceContiguous_Cholesky() line 164 in src/mat/utils/freespace.c<br>
[3]PETSC ERROR: MatCholeskyFactorSymbolic_SeqAIJ() line 2922 in src/mat/impls/aij/seq/aijfact.c<br>[3]PETSC ERROR: MatCholeskyFactorSymbolic() line 2702 in src/mat/interface/matrix.c<br>[3]PETSC ERROR: PCSetUp_Cholesky() line 132 in src/ksp/pc/impls/factor/cholesky/cholesky.c<br>
[3]PETSC ERROR: PCSetUp() line 795 in src/ksp/pc/interface/precon.c<br>[3]PETSC ERROR: KSPSetUp() line 237 in src/ksp/ksp/interface/itfunc.c<br>[3]PETSC ERROR: User provided function() line 162 in precond.c<br><br><br><br>
MatCreateSeqAIJ(PETSC_COMM_WORLD,(*nb_eigen_all)+1,(*nb_eigen_all)+1,0,PETSC_NULL,&MM);<br> MatSetFromOptions(MM);<br><br><br> for(j=0;j<=*nb_eigen_all;j++)<br> for(i=0;i<j;i++){<br> MatSetValue(MM,i,j,(PetscReal)mm_tmp[i][j],INSERT_VALUES);<br>
MatSetValue(MM,j,i,(PetscReal)mm_tmp[i][j],INSERT_VALUES);<br> PetscPrintf(PETSC_COMM_WORLD,"create %d %d %e\n",i,j,mm_tmp[i][j]);<br> }<br> <br> MatAssemblyBegin(MM,MAT_FINAL_ASSEMBLY);<br>
MatAssemblyEnd(MM,MAT_FINAL_ASSEMBLY);<br><br> <br> ierr=KSPCreate(PETSC_COMM_WORLD,&kspchol);CHKERRQ(ierr);<br> ierr=KSPSetOperators(kspchol,MM,MM,SAME_NONZERO_PATTERN);CHKERRQ(ierr);<br>
ierr=KSPSetType(kspchol,KSPPREONLY);CHKERRQ(ierr);<br> ierr=KSPSetInitialGuessNonzero(kspchol,PETSC_TRUE);CHKERRQ(ierr);<br> <br> ierr=KSPGetPC(kspchol,&chol);CHKERRQ(ierr);<br> ierr=PCSetType(chol,PCCHOLESKY);CHKERRQ(ierr);<br>
ierr=KSPSetUp(kspchol);CHKERRQ(ierr); <br><br> ierr = PCFactorGetMatrix(chol,&fact); CHKERRQ(ierr);<br> <br> MatView(fact,PETSC_VIEWER_STDOUT_WORLD);<br><br><br><br><br>