This code is kind of silly because it doesn't actually ever use that Matrix norm by default so in petsc-3.1 just edit src/ksp/ksp/impls/lsqr/lsqr.c and comment out the line where it calls MatNorm() then run make in that one directory
Good luck Barry On Jun 27, 2011, at 12:44 PM, Alexander Grayver wrote: > Actually, I tried, but haven't managed to do this in fortran: > > test.exe -log_summary -ksp_view > [0]PETSC ERROR: MatShellSetOperation_Fortran() line 107 in > src/mat/impls/shell/ftn-custom/D:\dev\PETSC-~3.1-P\src\mat\impls\shell\FTN-CU~1\zshellf.c > > job aborted: > [ranks] message > > [0] application aborted > aborting MPI_COMM_WORLD, error 1, comm rank 0 > > It seems that MATOP_NORM is not supported from Fortran. Why is that so? > > Regards, > Alexander > > On 27.06.2011 17:12, Matthew Knepley wrote: >> On Mon, Jun 27, 2011 at 9:54 AM, Alexander Grayver <agrayver at >> gfz-potsdam.de> wrote: >> >> Please send the entire error message (this is missing the stack), but I >> >> am guessing you >> >> are not changed the default preconditioner (ILU) which cannot act on a >> >> shell matrix. Use >> >> -ksp_view to see what solver is begin used. >> >> The full error message: >> >> test.exe -log_summary -ksp_view >> >> The LSQR solver uses the Frobenius norm of the matrix. In order to use a >> MATSHELL, you >> must implement MatNorm using >> >> >> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Mat/MatShellSetOperation.html >> >> Thanks, >> >> Matt >> >> >> [0]PETSC ERROR: --------------------- Error Message >> ------------------------------------ >> [0]PETSC ERROR: No support for this operation for this object type! >> [0]PETSC ERROR: Mat type shell! >> [0]PETSC ERROR: >> ------------------------------------------------------------------------ >> [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20 14:26:37 >> CST 2010 >> [0]PETSC ERROR: See docs/changes/index.html for recent updates. >> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. >> [0]PETSC ERROR: See docs/index.html for manual pages. >> [0]PETSC ERROR: >> ------------------------------------------------------------------------ >> [0]PETSC ERROR: test.exe on a cygwin-cx named M0. by Unknown Mon Jun 27 >> 16:51:32 2011 >> [0]PETSC ERROR: Libraries linked from >> /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib >> >> [0]PETSC ERROR: Configure run at Fri Mar 4 10:10:06 2011 >> [0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-fc="win32fe >> ifort" --with-cxx="win32fe cl" --with-windows-graphics=0 >> --with-precision=double --with-scalar-type=complex --with-clanguage=cxx >> --with-mpi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include --wi >> /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib]" >> --useThreads=0 --useThreads=0 >> >> [0]PETSC ERROR: >> ------------------------------------------------------------------------ >> [0]PETSC ERROR: MatNorm() line 4512 in >> src/mat/interface/D:\dev\PETSC-~3.1-P\src\mat\INTERF~1\matrix.c >> [0]PETSC ERROR: KSPSolve_LSQR() line 90 in >> src/ksp/ksp/impls/lsqr/D:\dev\PETSC-~3.1-P\src\ksp\ksp\impls\lsqr\lsqr.c >> [0]PETSC ERROR: KSPSolve() line 396 in >> src/ksp/ksp/interface/D:\dev\PETSC-~3.1-P\src\ksp\ksp\INTERF~1\itfunc.c >> >> job aborted: >> [ranks] message >> >> [0] application aborted >> aborting MPI_COMM_WORLD, error 56, comm rank 0 >> >> >> On 27.06.2011 16:47, Matthew Knepley wrote: >>> On Mon, Jun 27, 2011 at 9:34 AM, Alexander Grayver <agrayver at >>> gfz-potsdam.de> wrote: >>> Thanks Barry, >>> >>> Now I get this: >>> >>> Please send the entire error message (this is missing the stack), but I am >>> guessing you >>> are not changed the default preconditioner (ILU) which cannot act on a >>> shell matrix. Use >>> -ksp_view to see what solver is begin used. >>> >>> Matt >>> >>> [0]PETSC ERROR: --------------------- Error Message >>> ---------------------------- >>> -------- >>> [0]PETSC ERROR: No support for this operation for this object type! >>> [0]PETSC ERROR: Mat type shell! >>> >>> [0]PETSC ERROR: >>> ---------------------------------------------------------------- >>> -------- >>> [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20 14:26:37 >>> CST 20 >>> 10 >>> [0]PETSC ERROR: See docs/changes/index.html for recent updates. >>> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. >>> [0]PETSC ERROR: See docs/index.html for manual pages. >>> [0]PETSC ERROR: >>> ---------------------------------------------------------------- >>> -------- >>> [0]PETSC ERROR: test.exe on a cygwin >>> -cx named MT0. by Unknown Mon Jun 27 16:30:42 2011 >>> >>> [0]PETSC ERROR: Libraries linked from >>> /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-de >>> bug/lib >>> [0]PETSC ERROR: Configure run at Fri Mar 4 10:10:06 2011 >>> [0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-fc="win32fe >>> ifor >>> t" --with-cxx="win32fe cl" --with-windows-graphics=0 >>> --download-f-blas-lapack=1 >>> --with-precision=double --with-scalar-type=complex --with-clanguage=cxx >>> --with-m >>> pi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include >>> --with-mpi-lib="[/cygdrive/d/Dev >>> /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife >>> c.lib]" --useThreads=0 --useThreads=0 >>> [0]PETSC ERROR: >>> ---------------------------------------------------------------- >>> -------- >>> [0]PETSC ERROR: MatNorm() line 4512 in >>> src/mat/interface/D:\dev\PETSC-3.1-P\src\mat\INTERF~1\matrix.c >>> >>> >>> On 27.06.2011 16:32, Barry Smith wrote: >>> You should pass H as third argument to KSPSetOperators() as well as the >>> second. >>> >>> Barry >>> >>> On Jun 27, 2011, at 9:23 AM, Alexander Grayver wrote: >>> >>> Hello! >>> >>> I'm using matrix-free formulation and KSPLSQR to solve normal equations >>> system: >>> >>> (A'*A)b = -g >>> >>> I managed to write all necessary code: >>> >>> call MatCreateShell(MPI_COMM_WORLD,m,N,N,N,PETSC_NULL_INTEGER,H,ierr) >>> call MatShellSetOperation(H,MATOP_MULT,MFMatMult,ierr) >>> >>> call KSPCreate(MPI_COMM_WORLD,ksp,ierr);CHKERRQ(ierr) >>> call KSPSetType(ksp,KSPLSQR,ierr);CHKERRQ(ierr) >>> call KSPGetPC(ksp,pc,ierr);CHKERRQ(ierr) >>> call PCSetType(pc,PCNONE,ierr);CHKERRQ(ierr) >>> call >>> KSPSetOperators(ksp,H,PETSC_NULL_OBJECT,SAME_PRECONDITIONER,ierr);CHKERRQ(ierr) >>> call KSPSolve(ksp,g,b,ierr);CHKERRQ(ierr) >>> >>> >>> but fail in KSPSolve stage with that: >>> [0]PETSC ERROR: --------------------- Error Message >>> ---------------------------- >>> -------- >>> [0]PETSC ERROR: Object is in wrong state! >>> [0]PETSC ERROR: Mat object's type is not set: Argument # 1! >>> [0]PETSC ERROR: >>> ---------------------------------------------------------------- >>> -------- >>> [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20 14:26:37 >>> CST 20 >>> 10 >>> [0]PETSC ERROR: See docs/changes/index.html for recent updates. >>> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. >>> [0]PETSC ERROR: See docs/index.html for manual pages. >>> [0]PETSC ERROR: >>> ---------------------------------------------------------------- >>> -------- >>> [0]PETSC ERROR: test.exe on a cygwin >>> >>> -cx named MT0. by Unknown Mon Jun 27 16:18:43 2011 >>> [0]PETSC ERROR: Libraries linked from >>> /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-de >>> bug/lib >>> [0]PETSC ERROR: Configure run at Fri Mar 4 10:10:06 2011 >>> [0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-fc="win32fe >>> ifor >>> t" --with-cxx="win32fe cl" --with-windows-graphics=0 >>> --download-f-blas-lapack=1 >>> --with-precision=double --with-scalar-type=complex --with-clanguage=cxx >>> --with-m >>> pi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include >>> --with-mpi-lib="[/cygdrive/d/Dev >>> /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife >>> c.lib]" --useThreads=0 --useThreads=0 >>> [0]PETSC ERROR: >>> ---------------------------------------------------------------- >>> -------- >>> [0]PETSC ERROR: MatNorm() line 4507 in >>> src/mat/interface/D:\dev\PETSC-3.1-P\src\mat\INTERF~1\matrix.c >>> [0]PETSC ERROR: KSPSolve_LSQR() line 90 in >>> src/ksp/ksp/impls/lsqr/D:\dev\PETSC-3.1-P\src\ksp\ksp\impls\lsqr\lsqr.c >>> >>> Any suggestions? Do I have to set MATOP_NORM operation? Then how? >>> >>> Regards, >>> Alexander >>> >>> >>> >>> >>> -- >>> What most experimenters take for granted before they begin their >>> experiments is infinitely more interesting than any results to which their >>> experiments lead. >>> -- Norbert Wiener >> >> >> >> >> -- >> What most experimenters take for granted before they begin their experiments >> is infinitely more interesting than any results to which their experiments >> lead. >> -- Norbert Wiener >
