[petsc-users] multigrid as preconditioner--message 8

Barry Smith bsmith at mcs.anl.gov
Wed Dec 14 10:39:41 CST 2011


On Dec 14, 2011, at 9:45 AM, M.Younas wrote:

> Dear Barry,
> 
> Does BoomeAMG precondition (one v-cycle) the system after every iteration of GMRES(m) 

   It is not "after" every iteration of GMRES it is "as part of each iteration" of preconditioned GMRES.

> OR
> it precondition the linear system once only and then GMRES(m) iterations until convergence is reached?
> 

   No.

    You may want to read up on Krylov methods in a numerical analysis book.

    Barry

> Kind regards, Younas   
> 
> 
> On 14-12-11, petsc-users-request at mcs.anl.gov wrote:
>> Send petsc-users mailing list submissions to
>> petsc-users at mcs.anl.gov
>> 
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://lists.mcs.anl.gov/mailman/listinfo/petsc-users
>> or, via email, send a message with subject or body 'help' to
>> petsc-users-request at mcs.anl.gov
>> 
>> You can reach the person managing the list at
>> petsc-users-owner at mcs.anl.gov
>> 
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of petsc-users digest..."
>> 
>> 
>> Today's Topics:
>> 
>>    1.  run successfully on 20 processors but failed on 24
>>       processors (Xiangdong Liang)
>>    2. Re:  run successfully on 20 processors but failed on	24
>>       processors (Matthew Knepley)
>>    3.  Two Questions about Matrix Preallocation (behzad baghapour)
>>    4.  Multigrid as preconditioner (M.Younas)
>>    5.  save vector to bin-file at each time step (robert)
>>    6.  AMG as preconditioner (M.Younas)
>>    7. Re:  Two Questions about Matrix Preallocation (Barry Smith)
>>    8. Re:  Multigrid as preconditioner (Barry Smith)
>>    9. Re:  save vector to bin-file at each time step (Barry Smith)
>>   10. Re:  save vector to bin-file at each time step (robert)
>> 
>> 
>> ----------------------------------------------------------------------
>> 
>> Message: 1
>> Date: Tue, 13 Dec 2011 22:49:40 -0500
>> From: Xiangdong Liang <xdliang at gmail.com>
>> Subject: [petsc-users] run successfully on 20 processors but failed on
>> 24	processors
>> To: PETSc users list <petsc-users at mcs.anl.gov>
>> Message-ID:
>> <CAGzjfYZMW3dY7-PDH8AReAnQRuUVC0W6Jtbfu-ETMTc5JaopcQ at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>> 
>> Hello everyone,
>> 
>> I am solving complex Ax=b with PaStix on 20 processors successfully
>> but failed on 24 processors. The relatively error indicated by
>> mat_pastix_verbose becomes "nan"  for 24 processors. Where could be
>> wrong? Can someone give me some hints on how I can debug? Thanks.
>> 
>> Xiangdong
>> 
>> 
>> ------------------------------
>> 
>> Message: 2
>> Date: Tue, 13 Dec 2011 22:59:09 -0600
>> From: Matthew Knepley <knepley at gmail.com>
>> Subject: Re: [petsc-users] run successfully on 20 processors but
>> failed on	24 processors
>> To: PETSc users list <petsc-users at mcs.anl.gov>
>> Message-ID:
>> <CAMYG4Gm_fnVMEpks_wt07_fg8PF3q-oCNAzw4U1G48JTJVwvPA at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> On Tue, Dec 13, 2011 at 9:49 PM, Xiangdong Liang <xdliang at gmail.com> wrote:
>> 
>> > Hello everyone,
>> >
>> > I am solving complex Ax=b with PaStix on 20 processors successfully
>> > but failed on 24 processors. The relatively error indicated by
>> > mat_pastix_verbose becomes "nan"  for 24 processors. Where could be
>> > wrong? Can someone give me some hints on how I can debug? Thanks.
>> 
>> 
>> First, make sure you did not put any NaNs in your matrix or rhs.
>> 
>>    Matt
>> 
>> 
>> >
>> > Xiangdong
>> 
>> -- 
>> 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
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111213/339c4743/attachment-0001.htm>
>> 
>> ------------------------------
>> 
>> Message: 3
>> Date: Wed, 14 Dec 2011 11:32:48 +0330
>> From: behzad baghapour <behzad.baghapour at gmail.com>
>> Subject: [petsc-users] Two Questions about Matrix Preallocation
>> To: PETSc users list <petsc-users at mcs.anl.gov>
>> Message-ID:
>> <CA+jOtDLYQy-2Xt8UsvNdnZySbqNBQTwyFi5vrp39=6j9hagD0Q at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> Dear Developers,
>> 
>> I am facing with two questions about Block-Sparse Preallocation:
>> 
>> 1- I set array "nnz[]" and did:
>> 
>>     MatSetType ( JAC, MATSEQBAIJ );
>>     MatSetSizes( JAC, PETSC_DECIDE, PETSC_DECIDE, nt, nt );
>>     MatSeqAIJSetPreallocation( JAC, 0, nnz );
>> 
>> but when I saw log file with -info -mat_view_info, I found this message:
>> 
>> [0] MatSetUpPreallocation(): Warning not preallocating matrix storage
>> 
>> What this means? Did I correctly preallocate the matrix?
>> 
>> 2- I need to test MatSeqBAIJSetPreallocation() too but I little confused
>> with descriptions of the command in man-page:
>> 
>> what are "nz" and "nnz[]" in this case?
>> 
>> what about number of blocks per row?
>> 
>> Thanks bothering too much :-)
>> BehZad
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111214/abec449b/attachment-0001.htm>
>> 
>> ------------------------------
>> 
>> Message: 4
>> Date: Wed, 14 Dec 2011 14:07:10 +0100
>> From: "M.Younas" <m.younas at rug.nl>
>> Subject: [petsc-users] Multigrid as preconditioner
>> To: petsc-users at mcs.anl.gov
>> Message-ID: <73f0f8e5cc491.4ee8ad8e at rug.nl>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> ?Hi, PETSc, Team,
>> 
>> I have solved a non-symmetric Poisson problem using GMRES(m) as solver and BoomerAMG (from Hypre) as preconditioner. But I don't understand how the BoomerAMG works as preconditioner with GMRES(m). Can anyone explain the procedure? Does it work like BoomerAMG precondition the liner system first (once only) and then GMRES(m) is being used for stopping criterion?
>> 
>> Kind regards,
>> 
>> Younas
>> 
>> RUG, Groningen, The Netherlands.
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111214/684a66f7/attachment-0001.htm>
>> 
>> ------------------------------
>> 
>> Message: 5
>> Date: Wed, 14 Dec 2011 15:00:03 +0100
>> From: robert <robert.bodner at unil.ch>
>> Subject: [petsc-users] save vector to bin-file at each time step
>> To: petsc-users at mcs.anl.gov
>> Message-ID: <4EE8ABE3.5050108 at unil.ch>
>> Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
>> 
>> Hello,
>> 
>> I am quite new to petsc and therefore my question might be quite trivial.
>> 
>> I have a 1D finite difference code and want to store several vectors in 
>> a binary:
>> 
>>      ierr = PetscViewerCreate(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr);
>>      ierr = 
>> PetscViewerBinaryOpen(PETSC_COMM_WORLD,"out.bin",FILE_MODE_APPEND,&viewer); 
>> CHKERRQ(ierr);
>>      ierr = PetscObjectSetName((PetscObject)u,"u");CHKERRQ(ierr);
>>      ierr = PetscObjectSetName((PetscObject)rhs,"rhs");CHKERRQ(ierr);
>>      ierr = VecView(u,viewer); CHKERRQ(ierr);
>>      ierr = VecView(rhs,viewer);CHKERRQ(ierr);
>> 
>> However, when I read the file with matlab (PetscBinaryRead.m) I only get 
>> the first vector.
>> 
>> In further application I would like to use something similar but putting 
>> out the solution vector every timestep.
>> 
>> Could someone just provide me some sample code?
>> 
>> Thanks,
>> Robert
>> 
>> 
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111214/5a31167d/attachment-0001.htm>
>> 
>> ------------------------------
>> 
>> Message: 6
>> Date: Wed, 14 Dec 2011 15:04:47 +0100
>> From: "M.Younas" <m.younas at rug.nl>
>> Subject: [petsc-users] AMG as preconditioner
>> To: petsc-users at mcs.anl.gov
>> Message-ID: <7420f1bdca4d2.4ee8bb0f at rug.nl>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> ?Hi, PETSc, Team,
>> 
>> I have 
>> solved a non-symmetric Poisson problem using GMRES(m) as solver and 
>> BoomerAMG (from Hypre) as preconditioner. But I don't understand how the
>>  BoomerAMG works as preconditioner with GMRES(m). Can anyone explain the
>>  procedure? Does it work like BoomerAMG precondition the liner system 
>> first (once only) and then GMRES(m) is being used for stopping 
>> criterion?
>> 
>> Kind regards,
>> 
>> Younas
>> 
>> RUG, Groningen, The Netherlands.
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111214/70b57dea/attachment-0001.htm>
>> 
>> ------------------------------
>> 
>> Message: 7
>> Date: Wed, 14 Dec 2011 08:22:33 -0600
>> From: Barry Smith <bsmith at mcs.anl.gov>
>> Subject: Re: [petsc-users] Two Questions about Matrix Preallocation
>> To: PETSc users list <petsc-users at mcs.anl.gov>,	behzad baghapour
>> <behzad.baghapour at gmail.com>
>> Message-ID: <CF31FC30-6E95-4F0E-AA13-6D7260172041 at mcs.anl.gov>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> 
>> On Dec 14, 2011, at 2:02 AM, behzad baghapour wrote:
>> 
>> > Dear Developers,
>> > 
>> > I am facing with two questions about Block-Sparse Preallocation:
>> > 
>> > 1- I set array "nnz[]" and did:
>> > 
>> >     MatSetType ( JAC, MATSEQBAIJ );
>> >     MatSetSizes( JAC, PETSC_DECIDE, PETSC_DECIDE, nt, nt );    
>> >     MatSeqAIJSetPreallocation( JAC, 0, nnz );
>> > 
>> > but when I saw log file with -info -mat_view_info, I found this message:
>> > 
>> > [0] MatSetUpPreallocation(): Warning not preallocating matrix storage
>> 
>>    Since you are using BAIJ matrix type you need to also call MatSeqBAIJSetPreallocation()
>> 
>> > 
>> > What this means? Did I correctly preallocate the matrix?
>> > 
>> > 2- I need to test MatSeqBAIJSetPreallocation() too but I little confused with descriptions of the command in man-page:
>> > 
>> > what are "nz" and "nnz[]" in this case?
>> > 
>> > what about number of blocks per row?
>> 
>>    nz is the maximum number of blocks per row, just like with other matrix formats or you can set nnz[] which for each row is the number of blocks from the diagonal block to the end of the row.  For example with a block size of one the matrix
>> 
>>   1   0  2
>>    0  3 4
>>    2  4  5 
>> 
>> would have a nnz[] = 2,2,1
>> 
>>  Barry
>> 
>> > 
>> > Thanks bothering too much :-)
>> > BehZad
>> > 
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 8
>> Date: Wed, 14 Dec 2011 08:26:27 -0600
>> From: Barry Smith <bsmith at mcs.anl.gov>
>> Subject: Re: [petsc-users] Multigrid as preconditioner
>> To: PETSc users list <petsc-users at mcs.anl.gov>
>> Message-ID: <2770E217-0CC1-4E85-AB40-35B00F705D53 at mcs.anl.gov>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> 
>> On Dec 14, 2011, at 7:07 AM, M.Younas wrote:
>> 
>> >  Hi, PETSc, Team,
>> > 
>> > I have solved a non-symmetric Poisson problem using GMRES(m) as solver and BoomerAMG (from Hypre) as preconditioner. But I don't understand how the BoomerAMG works as preconditioner with GMRES(m). Can anyone explain the procedure? Does it work like BoomerAMG precondition the liner system first (once only) and then GMRES(m) is being used for stopping criterion?
>> 
>>    By default PETSc uses ONE v-cycle of the BoomerAMG as a preconditioner for GMRES. 
>> 
>>    With the option -ksp_type richardson then PETSc is using a bunch of BoomerAMG v-cycles until the convergence criteria is satisfied without using a GMRES
>> 
>>    Barry
>> 
>> Note that a preconditioner can be any stationary linear iterative scheme. That is any linear operation that approximately solves A x = b, no matter how complicated the stationary linear iterative scheme is it can be used as a preconditioner.
>> 
>> 
>> > 
>> > Kind regards,
>> > 
>> > Younas
>> > 
>> > RUG, Groningen, The Netherlands.
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 9
>> Date: Wed, 14 Dec 2011 08:32:58 -0600
>> From: Barry Smith <bsmith at mcs.anl.gov>
>> Subject: Re: [petsc-users] save vector to bin-file at each time step
>> To: PETSc users list <petsc-users at mcs.anl.gov>
>> Message-ID: <76717B20-13EF-4FD2-BF50-CC12E9E87842 at mcs.anl.gov>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> 
>> On Dec 14, 2011, at 8:00 AM, robert wrote:
>> 
>> > Hello, 
>> > 
>> > I am quite new to petsc and therefore my question might be quite trivial.
>> > 
>> > I have a 1D finite difference code and want to store several vectors in a binary:
>> > 
>> >     ierr = PetscViewerCreate(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr);
>> >     ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,"out.bin",FILE_MODE_APPEND,&viewer); CHKERRQ(ierr);
>> >     ierr = PetscObjectSetName((PetscObject)u,"u");CHKERRQ(ierr);
>> >     ierr = PetscObjectSetName((PetscObject)rhs,"rhs");CHKERRQ(ierr);
>> >     ierr = VecView(u,viewer); CHKERRQ(ierr);
>> >     ierr = VecView(rhs,viewer);CHKERRQ(ierr);
>> > 
>> > However, when I read the file with matlab (PetscBinaryRead.m) I only get the first vector.
>> 
>>    1) Did you call PetscViewerDestroy() before the end of the program? If not called all the data may not be flushed into the file.
>> 
>>    2) How are you reading the vectors into Matlab? For example   [u,rhs] = PetscBinaryRead('filename') will read in two vectors.  If you want to call PetscBinaryRead() repeatedly to read more information than read the help for PetscBinaryRead() carefully, you cannot simply call u = PetscBinaryRead('filename'); rhs = PetscBinaryRead('filename') and hope to get the second vector 
>> 
>>   For example: fd = PetscOpenFile('filename');
>>                 u = PetscBinaryRead(fd);   % get first vector
>>                 rhs = PetscBinaryRead(fd);  % get second vector
>> 
>>   Barry
>> 
>> 
>> > 
>> > In further application I would like to use something similar but putting out the solution vector every timestep.
>> > 
>> > Could someone just provide me some sample code?
>> > 
>> > Thanks, 
>> > Robert
>> > 
>> > 
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 10
>> Date: Wed, 14 Dec 2011 15:44:39 +0100
>> From: robert <robert.bodner at unil.ch>
>> Subject: Re: [petsc-users] save vector to bin-file at each time step
>> To: PETSc users list <petsc-users at mcs.anl.gov>
>> Message-ID: <4EE8B657.4090506 at unil.ch>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>> 
>> On 12/14/2011 03:32 PM, Barry Smith wrote:
>> > On Dec 14, 2011, at 8:00 AM, robert wrote:
>> >
>> >> Hello,
>> >>
>> >> I am quite new to petsc and therefore my question might be quite trivial.
>> >>
>> >> I have a 1D finite difference code and want to store several vectors in a binary:
>> >>
>> >>      ierr = PetscViewerCreate(PETSC_COMM_WORLD,&viewer);CHKERRQ(ierr);
>> >>      ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,"out.bin",FILE_MODE_APPEND,&viewer); CHKERRQ(ierr);
>> >>      ierr = PetscObjectSetName((PetscObject)u,"u");CHKERRQ(ierr);
>> >>      ierr = PetscObjectSetName((PetscObject)rhs,"rhs");CHKERRQ(ierr);
>> >>      ierr = VecView(u,viewer); CHKERRQ(ierr);
>> >>      ierr = VecView(rhs,viewer);CHKERRQ(ierr);
>> >>
>> >> However, when I read the file with matlab (PetscBinaryRead.m) I only get the first vector.
>> >>
>> >>
>> >>     2) How are you reading the vectors into Matlab? For example   [u,rhs] = PetscBinaryRead('filename') will read in two vectors.  If you want to call PetscBinaryRead() repeatedly to read more information than ...
>> 
>> Hi,
>> 
>> thank you for your fast reply. It's as easy as that and I spent hours 
>> ... :-)
>> >>
>> 
>> 
>> >> In further application I would like to use something similar but putting out the solution vector every timestep.
>> >>
>> >> Could someone just provide me some sample code?
>> >>
>> >> Thanks,
>> >> Robert
>> >>
>> >>
>> >
>> 
>> 
>> 
>> ------------------------------
>> 
>> _______________________________________________
>> petsc-users mailing list
>> petsc-users at mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/petsc-users
>> 
>> 
>> End of petsc-users Digest, Vol 36, Issue 50
>> *******************************************



More information about the petsc-users mailing list