From Stephen.R.Ball at awe.co.uk Fri Sep 1 04:08:18 2006 From: Stephen.R.Ball at awe.co.uk (Stephen R Ball) Date: Fri, 1 Sep 2006 10:08:18 +0100 Subject: FW: Spooles Cholesky problem Message-ID: <691AAF021011@awe.co.uk> Hi I am sending the message below again as no one has replied yet. Regards Stephen Hi When using the Spooles Cholesky solver I am getting the error: 0:[0]PETSC ERROR: MatSetValues_SeqSBAIJ() line 792 in src/mat/impls/sbaij/seq/sbaij.c 0:[0]PETSC ERROR: ! 0:[0]PETSC ERROR: Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR)! 0:[0]PETSC ERROR: MatSetValues() line 702 in src/mat/interface/matrix.c When I attempt to call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,ierr) via the Fortran interface, I get the compilation error that entity mat_ignore_lower_triangular has undefined type. Can you tell me if this option is supported via the Fortran interface? Note that using runtime option -mat_ignore_lower_triangular works, but I would prefer to set this option in my code using the MatSetOption() routine. Regards Stephen -- _______________________________________________________________________________ The information in this email and in any attachment(s) is commercial in confidence. If you are not the named addressee(s) or if you receive this email in error then any distribution, copying or use of this communication or the information in it is strictly prohibited. Please notify us immediately by email at admin.internet(at)awe.co.uk, and then delete this message from your computer. While attachments are virus checked, AWE plc does not accept any liability in respect of any virus which is not detected. AWE Plc Registered in England and Wales Registration No 02763902 AWE, Aldermaston, Reading, RG7 4PR From knepley at gmail.com Fri Sep 1 07:05:15 2006 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 1 Sep 2006 07:05:15 -0500 Subject: FW: Spooles Cholesky problem In-Reply-To: <691AAF021011@awe.co.uk> References: <691AAF021011@awe.co.uk> Message-ID: Hi > > When using the Spooles Cholesky solver I am getting the error: > > 0:[0]PETSC ERROR: MatSetValues_SeqSBAIJ() line 792 in > src/mat/impls/sbaij/seq/sbaij.c 0:[0]PETSC ERROR: ! 0:[0]PETSC ERROR: > Lower > triangular value cannot be set for sbaij format. Ignoring these values, > run > with -mat_ignore_lower_triangular or call > MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR)! > 0:[0]PETSC ERROR: MatSetValues() line 702 in src/mat/interface/matrix.c > > When I attempt to call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,ierr) > via the Fortran interface, I get the compilation error that entity > mat_ignore_lower_triangular has undefined type. Can you tell me if this > option is supported via the Fortran interface? This is certainly there in the development version, and we plan to release in a week or so. However, a very easy fix is to update the list of enums at the top of include/finclude/petscmat.h with the enum from include/petscmat.h Thanks, Matt Note that using runtime option -mat_ignore_lower_triangular works, but I > would prefer to set this option in my code using the MatSetOption() > routine. > > Regards > > Stephen > -- > > _______________________________________________________________________________ > > The information in this email and in any attachment(s) is commercial in > confidence. If you are not the named addressee(s) or if you receive this > email in error then any distribution, copying or use of this communication > or the information in it is strictly prohibited. Please notify us > immediately by email at admin.internet(at)awe.co.uk, and then delete this > message from your computer. While attachments are virus checked, AWE plc > does not accept any liability in respect of any virus which is not detected. > > AWE Plc > Registered in England and Wales > Registration No 02763902 > AWE, Aldermaston, Reading, RG7 4PR > > -- "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness -------------- next part -------------- An HTML attachment was scrubbed... URL: From henke at math.tu-clausthal.de Fri Sep 1 09:55:46 2006 From: henke at math.tu-clausthal.de (Christian Henke) Date: Fri, 1 Sep 2006 16:55:46 +0200 Subject: Using of MatGetSubMatrices In-Reply-To: References: <200608281342.50630.henke@math.tu-clausthal.de> Message-ID: <200609011655.46255.henke@math.tu-clausthal.de> Thanks! Now it works. Christian Am Montag, 28. August 2006 18:41 schrieb Barry Smith: > All processes that share the matrix must call MatGetSubMatrices() > the same number of times. If a process doesn't need a matrix it should > pass in zero length IS's. If you are always calling it with all processes > then you can run with -start_in_debugger and when it is hanging hit > control C in the debugger and type where to see where/why it is hanging. > > Barry > > On Mon, 28 Aug 2006, Christian Henke wrote: > > Hi all, > > > > I am trying with petsc2.2.0 to get access to my sparse > > blockdiagonalmatrix matrix which contains for example 4 blocks m1 ... m4. > > If I use 2 Processors then m1 and m2 are owned by p1 and m3, m4 owned by > > p2. Now I want to read m1, m2 from p2 and m3, m4 from p1. First I have > > used MatGetValues, but then I took the message: Only local values > > currently supported. > > My next try was the function MatGetSubMatrices: > > > > IS isrow, iscol; > > Mat *M; > > > > ISCreateStride(PETSC_COMM_SELF,m,(int)i*m,1,&isrow); > > ISCreateStride(PETSC_COMM_SELF,m,(int)j*m,1,&iscol); > > > > const int ierr > > = MatGetSubMatrices(matrix,1,&isrow,&iscol,MAT_INITIAL_MATRIX,&M); > > > > ... > > > > ISDestroy(isrow); > > ISDestroy(iscol); > > > > where i,j the blockindices and m is the blocksize. It works well for a > > few functioncalls, but then it stops with the log_trace-message: > > > > [0] 0.055568 Event begin: MatGetSubMatrice. > > > > What is my error? Is MatGetSubMatrices the wrong function for my problem > > or are the above lines wrong? > > > > Regards Christian -- ----------------------------------------------------------------- Dipl.-Math. Christian Henke Tel.: +49 (0) 5323 72-2968 Institut f?r Mathematik Fax: +49 (0) 5323 72-3601 Erzstr. 1 henke at math.tu-clausthal.de 38678 Clausthal-Zellerfeld http://www.math.tu-clausthal.de ----------------------------------------------------------------- From bsmith at mcs.anl.gov Sat Sep 2 14:01:42 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sat, 2 Sep 2006 14:01:42 -0500 (CDT) Subject: New release 2.3.2 of PETSc Message-ID: ---------------------------------------------------------------------------- Portable, Extensible Toolkit for Scientific Computation (PETSc) ---------------------------------------------------------------------------- http://www.mcs.anl.gov/petsc We are pleased to announce the release of the PETSc 2.3.2 parallel software libraries for the implicit solution of PDEs and related problems. There are no MAJOR interface changes, the minor changes are listed at http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/changes/232.html please check these changes before compiling your codes. You can download from http://www-unix.mcs.anl.gov/petsc/petsc-as/download/index.html and and the installataion instructions are at http://www-unix.mcs.anl.gov/petsc/petsc-as/documentation/installation.html As always, please send bug reports, questions, and requests for new features to petsc-maint at mcs.anl.gov. Thanks for your continued support. The PETSc developers, Satish, Matt, Victor, Barry and Hong From Stephen.R.Ball at awe.co.uk Tue Sep 5 06:34:18 2006 From: Stephen.R.Ball at awe.co.uk (Stephen R Ball) Date: Tue, 5 Sep 2006 12:34:18 +0100 Subject: Extracting the Hypre preconditioner type Message-ID: <695CZ6016016@awe.co.uk> Hi In a previous email I requested that you include in PETSc a means for extracting the Hypre preconditioner type used. You told me that this would be included in the next PETSc release. (see original message below). I have just downloaded version 2.3.2 but can't find something like a PCHYPREGetType() routine. Has such a feature been included in this release? Regards Stephen -----Original Message----- From: Matthew Knepley [mailto:knepley at gmail.com] Sent: 15 May 2006 14:46 To: petsc-users at mcs.anl.gov Cc: Matthew Knepley Subject: EXTERNAL: Re: Extracting the Hypre preconditioner type used and PGI compiler su pport for VecGetArrayF90() and VecRestoreArrayF90() On 5/15/06, Stephen R Ball wrote: Hi Can you tell me if there is any way I can extract the name of the Hypre preconditioner type used i.e. boomeramg, euclid, parasails or pilut? Failing that is there any chance you could create a routine (with a Fortran interface) called PCHYPREGetType() that returns the Hypre preconditioner type used? I agree that this is an oversight. I will put it in the development version, and it will appear in the next release. Also, can you tell me if there is there any likelihood in the near future for Portland Group Inc (PGI) compiler support to be provided for routines VecGetArrayF90() and VecRestoreArrayF90()? This is more problematic. Most F90 compilers have an array descriptor that is a variant of the NAG format. However P a GF90 does not, and these refuse to tell us the layout. Thus we cannot add those routines. Thanks, Matt Regards Stephen R. Ball -- _______________________________________________________________________________ The information in this email and in any attachment(s) is commercial in confidence. If you are not the named addressee(s) or if you receive this email in error then any distribution, copying or use of this communication or the information in it is strictly prohibited. Please notify us immediately by email at admin.internet(at)awe.co.uk, and then delete this message from your computer. While attachments are virus checked, AWE plc does not accept any liability in respect of any virus which is not detected. AWE Plc Registered in England and Wales Registration No 02763902 AWE, Aldermaston, Reading, RG7 4PR From bsmith at mcs.anl.gov Sun Sep 10 18:50:22 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sun, 10 Sep 2006 18:50:22 -0500 (CDT) Subject: DMMG Time dependent matrix In-Reply-To: References: Message-ID: Jens, You are correct; functionality to do this does not exist in DMMG. So you have to write it yourself as you have, let us know if you have any trouble with it. Barry On Sun, 10 Sep 2006, jens.madsen at risoe.dk wrote: > Hi again > > My linear problem Ax = b. In my case the matrix A is timepdependent. In my KSP code I calculate A and call KSPSetOperators() in each timestep. When using DMMG I have not been able to find such a functionallity ? I am using galerkin matrices on all coarser MG levels. Here is the code that I am currently using > > /*Matrix is time dependent*/ > if(para.PolEq==GLOBAL) > { > ierr = MGComputePolaMatrix(*dmmg,dmmg[para.MG_levels-1]->J,dmmg[para.MG_levels-1]->B); > /*ierr = MatView(dmmg[DMMGGetLevels(dmmg)-1]->B,PETSC_VIEWER_STDOUT_WORLD);*/ > for (i=DMMGGetLevels(dmmg)-2; i>-1; i--) > { > if (dmmg[i]->galerkin) > { > MatPtAP(dmmg[i+1]->B,dmmg[i+1]->R,MAT_REUSE_MATRIX,1.0,&dmmg[i]->B); > if (!dmmg[i]->J) > { > dmmg[i]->J = dmmg[i]->B; > } > } > ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_NONZERO_PATTERN);CHKERRQ(ierr); > } > } > else > { > ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_PRECONDITIONER);CHKERRQ(ierr); > } > ierr = DMMGSolve(dmmg);CHKERRQ(ierr); > > I this the way to do it or have missed some functionallity in DMMG ? > > Cheers Jens > > -----Original Message----- > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > Sent: Thu 8/31/2006 10:12 PM > To: jens.madsen at risoe.dk > Subject: Re: SV: SV: SV: [PETSC #14613] DMMG question; more stupid danish questions :-) > > > Yes, one of the arguments to DACreate is which directions you want > periodicity. > > Barry > > > On Thu, 31 Aug 2006, jens.madsen at risoe.dk wrote: > >> Ok I had not figured that out. Think I misunderstood a response from you that you mailed in the winter :-) >> >> I am now trying to implement DMMG in my code. Just one question: is DMMG able to handle periodic boundary conditions ? I think I have made it work but I have not performed intensive testing .... >> >> thx Jens :-) >> >> ________________________________ >> >> Fra: Barry Smith [mailto:bsmith at mcs.anl.gov] >> Sendt: on 23-08-2006 00:06 >> Til: jens.madsen at risoe.dk >> Cc: petsc-maint at mcs.anl.gov >> Emne: Re: SV: SV: [PETSC #14613] DMMG question >> >> >> >> >> Actually DMMG does not always start at the coarsest level. >> It will only do that if you pass in the -dmmg_grid_sequence option. >> You can run with -pc_mg_type multiplicative -pc_mg_cycles 1 for >> V cycle and -pc_mg_cycles 2 for W cycles. >> >> There may be other reasons you might not be able to use DMMG like >> it only works on logically rectangular grids, etc. >> >> The only example for the mg directly is src/ksp/ksp/examples/tests/ex19.c >> it is terribly ugly. >> >> >> Barry >> >> It is a different ex19.c >> >> >> >> On Tue, 22 Aug 2006 jens.madsen at risoe.dk wrote: >> >>> Hi again >>> >>> As far as I can see petsc/src/snes/examples/tutorials/ex19.c uses DMMG ? >>> >>> I am trying to use the preconditioner itself. I do not want to use DMMG because DMMG always starts at the coarsest grid in order to improve the initial guess. I want to start on the finest grid in each timestep and do a V or W... >>> >>> >>> >>> Kind regards >>> >>> >>> >>> JEns >>> >>> >>> >>> >>> >>> >>> ________________________________ >>> >>> Fra: Hong Zhang [mailto:petsc-maint at mcs.anl.gov] >>> Sendt: l? 19-08-2006 03:04 >>> Til: jens.madsen at risoe.dk >>> Cc: petsc-maint at mcs.anl.gov >>> Emne: RE: SV: [PETSC #14613] DMMG question >>> >>> >>> >>> >>> See >>> ~petsc/src/snes/examples/tutorials/ex19.c >>> >>> Hong >>> >>> On Fri, 18 Aug 2006 jens.madsen at risoe.dk wrote: >>> >>>> Hi again >>>> >>>> First I will thank you guys for developing such a great product. Since i wrote the mails below I have developed a code simulating 2D plasmaphysics. At the moment I am using the Krylov subspace methods, KSP. Now that this is runnning I would like to see which improvements a MG precoditioner would give. Before starting doing so I would ask you guys whether you have any examples ? The documentation on the PCMG is a bit sparse (:-)) >>>> >>>> cheers Jens >>>> >>>> PS. I will not forget to site you @:-) >>>> >>>> >>>> -----Original Message----- >>>> From: Barry Smith [mailto:petsc-maint at mcs.anl.gov] >>>> Sent: Thu 3/30/2006 2:35 AM >>>> To: jens.madsen at risoe.dk >>>> Cc: petsc-maint at mcs.anl.gov >>>> Subject: Re: SV: [PETSC #14613] DMMG question >>>> >>>> >>>> >>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: >>>> >>>>> Hi Barry and Matt >>>>> >>>>> Thank you for you quick response :-) >>>>> >>>>> I have actually tried those command line options that you suggest. It is probably me not using the right terminology; I am not that experienced. I try to rephrase my problem. >>>>> >>>>> As far as I understand the full multigrid always starts on the coarsest grid G_0. On the coarsest grid you calculate an approximate solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This approximate solution is interpolated to a fine grid and used as an initial guess on this finer grid G_1. Now you make a few iterative sweeps on G_1 smoothening out the high k modes and get v_1. Restrict this approximate solution to G_0. Relax on G_0. Correct the solution v_1 and use this as an initial guess on an even finer grid G_2 etc. etc. In other words it combines "nested iteration" and "coarse grid correction". >>>> >>>> You are correct this is exactly traditional full multigrid. The "PETSc full multigrid" is slightly >>>> different. We start with a right hand side (and initial guess) on the finest grid, restrict the residual >>>> to the coarsest grid and then start up the grids with nested iteration AND coarse grid correction. >>>> Thus unlike "traditional" full multigrid you only need to define your problem on the finest grid. >>>> >>>> We've found that this usually works better than just using regular V or W cycles. (BTW: PETSc full multigrid >>>> can, of course, use either V or W cycles. >>>> >>>>> >>>>> My "algorithm" is as follows: >>>>> >>>>> 1) apply initial conditions to Density,n, and Temperature,T. >>>>> 2) find \phi solving a Poisson like equation using a multigrid scheme. Use \phi from previous timestep as an initial guess. n and T are variables in this equation. >>>>> 3) Step n and T forward in time using the "stiffly stable" time stepping scheme. This is to be done using a pre-LU-factorized matrix. >>>>> 4) goto 2) >>>>> >>>>> I would like to make a V (or W) cycle starting on the finest grid instead. On the finest grid I would like to apply boundary conditions, provide the previous time step as an initial guess and use "coarse grid correction" only. My own code is (probably) full of errors :-) so I have tried running the multigrid examples under KSP and SNES with -pc_type richardson and/or, -pc_mg_type additive and/or -ksp_type preonly etc.What I can see using -ksp/snes_view is that the starting point is always the coarsest grid with dimensions given by DACreateNd ? The next MG-Grids are always finer. Can I make DMMG start on the finest grid with dimensions given in DACreateNd ? >>>> >>>> You need to create a DA with a coarser size so that after it is refined the number of times it gives you >>>> the grid you want. That is if you want 5 grid points with two levels you would create a DA with 3 grid >>>> points and pass that into the DMMG. Sorry there is no way to start with a DA on the finest (but you get the >>>> same effect by starting with a coarser DA. >>>> >>>> Barry >>>>> >>>>> Cheers and thanks Jens >>>>> >>>>> ________________________________ >>>>> >>>>> Fra: Barry Smith [mailto:petsc-maint at mcs.anl.gov] >>>>> Sendt: on 29-03-2006 17:20 >>>>> Til: jens.madsen at risoe.dk >>>>> Cc: petsc-maint at mcs.anl.gov >>>>> Emne: Re: [PETSC #14613] DMMG question >>>>> >>>>> >>>>> >>>>> >>>>> Jens, >>>>> >>>>> YOu can access any of the low level PCMG options from >>>>> DMMG. For example, -pc_type richardson gives you "multigrid >>>>> as a solve". -pc_mg_type additive gives you additive >>>>> -pc_mg_type multiplicative gives you standard v or w cycel >>>>> -pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2 >>>>> gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother >>>>> etc etc etc. Run with -help to see all the choices for the parts >>>>> of the multigrid process. >>>>> >>>>> Barry >>>>> >>>>> As Matt noted, using the PCMG directly requires YOU provide >>>>> a mesh infrastructure that manages the meshes, thus it is not >>>>> realistic for us to provide this whole infrastructure in an >>>>> example. We currently only provide the full infrastructure >>>>> for structured grids (in DMMG). >>>>> >>>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: >>>>> >>>>>> Hi Petsc :-) >>>>>> >>>>>> >>>>>> >>>>>> I am trying to use Petsc for solving plasma fluid equations. Is it >>>>>> possible to use the DMMG with multiplicative or additive multigrid >>>>>> schemes ? Also can I use multigrid as a solver not only as a >>>>>> preconditioner in DMMG ? >>>>>> >>>>>> >>>>>> >>>>>> Also I cannot find any examples using the "low-level" PCMG multigrid >>>>>> interface ? Only a testprogram in the PC/TEST directory ? >>>>>> >>>>>> >>>>>> >>>>>> Cheers Jens Madsen >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >> >> >> > > From mafunk at nmsu.edu Mon Sep 11 12:52:28 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Mon, 11 Sep 2006 11:52:28 -0600 Subject: DA question In-Reply-To: References: Message-ID: <200609111152.41978.mafunk@nmsu.edu> Hi, i had a general question. I have a simple rectangular domain on which i evaluate a pde. I am using PETSCs DA object. To set the right hand side of the linear system i need to evaluate the laplacian before solving the system. To do that i need to access the ghostnodes. So, i was wondering if the standard procedure is to access the (global) vectors i need is as follows: DACreateLocalVector(...) //create temporary (local) vector with ghostnodes DAGlobalToLocalBegin DAGlobalToLocalEnd //map global to local vector DAVecGetArray //get work array ... do my thing ... DAVecRestoreArray DALocalToGlobalBegin DALocalToGlobalEnd VecDestroy //destroy temporary local vector or if there is another (better?!) way ... I guess what bothers me (and i don't know if it should) is that i need to create the local temporary vectors every time step. What i mean is that the global vector already resides distributed on the different procs, so does DACreateLocalVector(...) allocate all that memory again or does it just allocate memory for the ghostnodes? thanks mat On Sunday 10 September 2006 17:50, Barry Smith wrote: > Jens, > > You are correct; functionality to do this does not exist in DMMG. So > you have to write it yourself as you have, let us know if you have any > trouble with it. > > Barry > > On Sun, 10 Sep 2006, jens.madsen at risoe.dk wrote: > > Hi again > > > > My linear problem Ax = b. In my case the matrix A is timepdependent. In > > my KSP code I calculate A and call KSPSetOperators() in each timestep. > > When using DMMG I have not been able to find such a functionallity ? I am > > using galerkin matrices on all coarser MG levels. Here is the code that I > > am currently using > > > > /*Matrix is time dependent*/ > > if(para.PolEq==GLOBAL) > > { > > ierr = > > MGComputePolaMatrix(*dmmg,dmmg[para.MG_levels-1]->J,dmmg[para.MG_levels-1 > >]->B); /*ierr = > > MatView(dmmg[DMMGGetLevels(dmmg)-1]->B,PETSC_VIEWER_STDOUT_WORLD);*/ for > > (i=DMMGGetLevels(dmmg)-2; i>-1; i--) > > { > > if (dmmg[i]->galerkin) > > { > > > > MatPtAP(dmmg[i+1]->B,dmmg[i+1]->R,MAT_REUSE_MATRIX,1.0,&dmmg[i]->B); > > if (!dmmg[i]->J) > > { > > dmmg[i]->J = dmmg[i]->B; > > } > > } > > ierr = > > KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_NONZERO_PATTERN); > >CHKERRQ(ierr); } > > } > > else > > { > > ierr = > > KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_PRECONDITIONER);C > >HKERRQ(ierr); } > > ierr = DMMGSolve(dmmg);CHKERRQ(ierr); > > > > I this the way to do it or have missed some functionallity in DMMG ? > > > > Cheers Jens > > > > -----Original Message----- > > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > > Sent: Thu 8/31/2006 10:12 PM > > To: jens.madsen at risoe.dk > > Subject: Re: SV: SV: SV: [PETSC #14613] DMMG question; more stupid danish > > questions :-) > > > > > > Yes, one of the arguments to DACreate is which directions you want > > periodicity. > > > > Barry > > > > On Thu, 31 Aug 2006, jens.madsen at risoe.dk wrote: > >> Ok I had not figured that out. Think I misunderstood a response from you > >> that you mailed in the winter :-) > >> > >> I am now trying to implement DMMG in my code. Just one question: is DMMG > >> able to handle periodic boundary conditions ? I think I have made it > >> work but I have not performed intensive testing .... > >> > >> thx Jens :-) > >> > >> ________________________________ > >> > >> Fra: Barry Smith [mailto:bsmith at mcs.anl.gov] > >> Sendt: on 23-08-2006 00:06 > >> Til: jens.madsen at risoe.dk > >> Cc: petsc-maint at mcs.anl.gov > >> Emne: Re: SV: SV: [PETSC #14613] DMMG question > >> > >> > >> > >> > >> Actually DMMG does not always start at the coarsest level. > >> It will only do that if you pass in the -dmmg_grid_sequence option. > >> You can run with -pc_mg_type multiplicative -pc_mg_cycles 1 for > >> V cycle and -pc_mg_cycles 2 for W cycles. > >> > >> There may be other reasons you might not be able to use DMMG like > >> it only works on logically rectangular grids, etc. > >> > >> The only example for the mg directly is > >> src/ksp/ksp/examples/tests/ex19.c it is terribly ugly. > >> > >> > >> Barry > >> > >> It is a different ex19.c > >> > >> On Tue, 22 Aug 2006 jens.madsen at risoe.dk wrote: > >>> Hi again > >>> > >>> As far as I can see petsc/src/snes/examples/tutorials/ex19.c uses DMMG > >>> ? > >>> > >>> I am trying to use the preconditioner itself. I do not want to use DMMG > >>> because DMMG always starts at the coarsest grid in order to improve the > >>> initial guess. I want to start on the finest grid in each timestep and > >>> do a V or W... > >>> > >>> > >>> > >>> Kind regards > >>> > >>> > >>> > >>> JEns > >>> > >>> > >>> > >>> > >>> > >>> > >>> ________________________________ > >>> > >>> Fra: Hong Zhang [mailto:petsc-maint at mcs.anl.gov] > >>> Sendt: l? 19-08-2006 03:04 > >>> Til: jens.madsen at risoe.dk > >>> Cc: petsc-maint at mcs.anl.gov > >>> Emne: RE: SV: [PETSC #14613] DMMG question > >>> > >>> > >>> > >>> > >>> See > >>> ~petsc/src/snes/examples/tutorials/ex19.c > >>> > >>> Hong > >>> > >>> On Fri, 18 Aug 2006 jens.madsen at risoe.dk wrote: > >>>> Hi again > >>>> > >>>> First I will thank you guys for developing such a great product. Since > >>>> i wrote the mails below I have developed a code simulating 2D > >>>> plasmaphysics. At the moment I am using the Krylov subspace methods, > >>>> KSP. Now that this is runnning I would like to see which improvements > >>>> a MG precoditioner would give. Before starting doing so I would ask > >>>> you guys whether you have any examples ? The documentation on the PCMG > >>>> is a bit sparse (:-)) > >>>> > >>>> cheers Jens > >>>> > >>>> PS. I will not forget to site you @:-) > >>>> > >>>> > >>>> -----Original Message----- > >>>> From: Barry Smith [mailto:petsc-maint at mcs.anl.gov] > >>>> Sent: Thu 3/30/2006 2:35 AM > >>>> To: jens.madsen at risoe.dk > >>>> Cc: petsc-maint at mcs.anl.gov > >>>> Subject: Re: SV: [PETSC #14613] DMMG question > >>>> > >>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: > >>>>> Hi Barry and Matt > >>>>> > >>>>> Thank you for you quick response :-) > >>>>> > >>>>> I have actually tried those command line options that you suggest. It > >>>>> is probably me not using the right terminology; I am not that > >>>>> experienced. I try to rephrase my problem. > >>>>> > >>>>> As far as I understand the full multigrid always starts on the > >>>>> coarsest grid G_0. On the coarsest grid you calculate an approximate > >>>>> solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This > >>>>> approximate solution is interpolated to a fine grid and used as an > >>>>> initial guess on this finer grid G_1. Now you make a few iterative > >>>>> sweeps on G_1 smoothening out the high k modes and get v_1. Restrict > >>>>> this approximate solution to G_0. Relax on G_0. Correct the solution > >>>>> v_1 and use this as an initial guess on an even finer grid G_2 etc. > >>>>> etc. In other words it combines "nested iteration" and "coarse grid > >>>>> correction". > >>>> > >>>> You are correct this is exactly traditional full multigrid. The > >>>> "PETSc full multigrid" is slightly different. We start with a right > >>>> hand side (and initial guess) on the finest grid, restrict the > >>>> residual to the coarsest grid and then start up the grids with nested > >>>> iteration AND coarse grid correction. Thus unlike "traditional" full > >>>> multigrid you only need to define your problem on the finest grid. > >>>> > >>>> We've found that this usually works better than just using regular V > >>>> or W cycles. (BTW: PETSc full multigrid can, of course, use either V > >>>> or W cycles. > >>>> > >>>>> My "algorithm" is as follows: > >>>>> > >>>>> 1) apply initial conditions to Density,n, and Temperature,T. > >>>>> 2) find \phi solving a Poisson like equation using a multigrid > >>>>> scheme. Use \phi from previous timestep as an initial guess. n and T > >>>>> are variables in this equation. 3) Step n and T forward in time using > >>>>> the "stiffly stable" time stepping scheme. This is to be done using a > >>>>> pre-LU-factorized matrix. 4) goto 2) > >>>>> > >>>>> I would like to make a V (or W) cycle starting on the finest grid > >>>>> instead. On the finest grid I would like to apply boundary > >>>>> conditions, provide the previous time step as an initial guess and > >>>>> use "coarse grid correction" only. My own code is (probably) full of > >>>>> errors :-) so I have tried running the multigrid examples under KSP > >>>>> and SNES with -pc_type richardson and/or, -pc_mg_type additive and/or > >>>>> -ksp_type preonly etc.What I can see using -ksp/snes_view is that the > >>>>> starting point is always the coarsest grid with dimensions given by > >>>>> DACreateNd ? The next MG-Grids are always finer. Can I make DMMG > >>>>> start on the finest grid with dimensions given in DACreateNd ? > >>>> > >>>> You need to create a DA with a coarser size so that after it is > >>>> refined the number of times it gives you the grid you want. That is if > >>>> you want 5 grid points with two levels you would create a DA with 3 > >>>> grid points and pass that into the DMMG. Sorry there is no way to > >>>> start with a DA on the finest (but you get the same effect by starting > >>>> with a coarser DA. > >>>> > >>>> Barry > >>>> > >>>>> Cheers and thanks Jens > >>>>> > >>>>> ________________________________ > >>>>> > >>>>> Fra: Barry Smith [mailto:petsc-maint at mcs.anl.gov] > >>>>> Sendt: on 29-03-2006 17:20 > >>>>> Til: jens.madsen at risoe.dk > >>>>> Cc: petsc-maint at mcs.anl.gov > >>>>> Emne: Re: [PETSC #14613] DMMG question > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Jens, > >>>>> > >>>>> YOu can access any of the low level PCMG options from > >>>>> DMMG. For example, -pc_type richardson gives you "multigrid > >>>>> as a solve". -pc_mg_type additive gives you additive > >>>>> -pc_mg_type multiplicative gives you standard v or w cycel > >>>>> -pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2 > >>>>> gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother > >>>>> etc etc etc. Run with -help to see all the choices for the parts > >>>>> of the multigrid process. > >>>>> > >>>>> Barry > >>>>> > >>>>> As Matt noted, using the PCMG directly requires YOU provide > >>>>> a mesh infrastructure that manages the meshes, thus it is not > >>>>> realistic for us to provide this whole infrastructure in an > >>>>> example. We currently only provide the full infrastructure > >>>>> for structured grids (in DMMG). > >>>>> > >>>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: > >>>>>> Hi Petsc :-) > >>>>>> > >>>>>> > >>>>>> > >>>>>> I am trying to use Petsc for solving plasma fluid equations. Is it > >>>>>> possible to use the DMMG with multiplicative or additive multigrid > >>>>>> schemes ? Also can I use multigrid as a solver not only as a > >>>>>> preconditioner in DMMG ? > >>>>>> > >>>>>> > >>>>>> > >>>>>> Also I cannot find any examples using the "low-level" PCMG > >>>>>> multigrid interface ? Only a testprogram in the PC/TEST directory ? > >>>>>> > >>>>>> > >>>>>> > >>>>>> Cheers Jens Madsen From knepley at gmail.com Mon Sep 11 13:27:05 2006 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 11 Sep 2006 13:27:05 -0500 Subject: DA question In-Reply-To: <200609111152.41978.mafunk@nmsu.edu> References: <200609111152.41978.mafunk@nmsu.edu> Message-ID: On 9/11/06, Matt Funk wrote: > > Hi, > > i had a general question. I have a simple rectangular domain on which i > evaluate a pde. I am using PETSCs DA object. To set the right hand side of > the linear system i need to evaluate the laplacian before solving the > system. > To do that i need to access the ghostnodes. > > So, i was wondering if the standard procedure is to access the (global) > vectors i need is as follows: > > DACreateLocalVector(...) //create temporary (local) vector with ghostnodes > DAGlobalToLocalBegin > DAGlobalToLocalEnd //map global to local vector > DAVecGetArray //get work array > > ... do my thing ... > > DAVecRestoreArray > DALocalToGlobalBegin > DALocalToGlobalEnd > VecDestroy //destroy temporary local vector > > or if there is another (better?!) way ... You probably only need DALocalToGlobal() which discards the ghosts. I guess what bothers me (and i don't know if it should) is that i need to > create the local temporary vectors every time step. What i mean is that > the > global vector already resides distributed on the different procs, so does > DACreateLocalVector(...) allocate all that memory again or does it just > allocate memory for the ghostnodes? Well, you should use DAGetLocalVector(). It does duplicate the local storage, but if you want the nice data layout, this is necessary. Unless you are running an explicit solver with extreme memory limitations, I wouldn't worry. Matt thanks > mat > > > On Sunday 10 September 2006 17:50, Barry Smith wrote: > > Jens, > > > > You are correct; functionality to do this does not exist in DMMG. So > > you have to write it yourself as you have, let us know if you have any > > trouble with it. > > > > Barry > > > > On Sun, 10 Sep 2006, jens.madsen at risoe.dk wrote: > > > Hi again > > > > > > My linear problem Ax = b. In my case the matrix A is timepdependent. > In > > > my KSP code I calculate A and call KSPSetOperators() in each timestep. > > > When using DMMG I have not been able to find such a functionallity ? I > am > > > using galerkin matrices on all coarser MG levels. Here is the code > that I > > > am currently using > > > > > > /*Matrix is time dependent*/ > > > if(para.PolEq==GLOBAL) > > > { > > > ierr = > > > MGComputePolaMatrix(*dmmg,dmmg[para.MG_levels-1]->J,dmmg[ > para.MG_levels-1 > > >]->B); /*ierr = > > > MatView(dmmg[DMMGGetLevels(dmmg)-1]->B,PETSC_VIEWER_STDOUT_WORLD);*/ > for > > > (i=DMMGGetLevels(dmmg)-2; i>-1; i--) > > > { > > > if (dmmg[i]->galerkin) > > > { > > > > > > > MatPtAP(dmmg[i+1]->B,dmmg[i+1]->R,MAT_REUSE_MATRIX,1.0,&dmmg[i]->B); > > > if (!dmmg[i]->J) > > > { > > > dmmg[i]->J = dmmg[i]->B; > > > } > > > } > > > ierr = > > > > KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_NONZERO_PATTERN); > > >CHKERRQ(ierr); } > > > } > > > else > > > { > > > ierr = > > > > KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_PRECONDITIONER);C > > >HKERRQ(ierr); } > > > ierr = DMMGSolve(dmmg);CHKERRQ(ierr); > > > > > > I this the way to do it or have missed some functionallity in DMMG ? > > > > > > Cheers Jens > > > > > > -----Original Message----- > > > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > > > Sent: Thu 8/31/2006 10:12 PM > > > To: jens.madsen at risoe.dk > > > Subject: Re: SV: SV: SV: [PETSC #14613] DMMG question; more stupid > danish > > > questions :-) > > > > > > > > > Yes, one of the arguments to DACreate is which directions you want > > > periodicity. > > > > > > Barry > > > > > > On Thu, 31 Aug 2006, jens.madsen at risoe.dk wrote: > > >> Ok I had not figured that out. Think I misunderstood a response from > you > > >> that you mailed in the winter :-) > > >> > > >> I am now trying to implement DMMG in my code. Just one question: is > DMMG > > >> able to handle periodic boundary conditions ? I think I have made it > > >> work but I have not performed intensive testing .... > > >> > > >> thx Jens :-) > > >> > > >> ________________________________ > > >> > > >> Fra: Barry Smith [mailto:bsmith at mcs.anl.gov] > > >> Sendt: on 23-08-2006 00:06 > > >> Til: jens.madsen at risoe.dk > > >> Cc: petsc-maint at mcs.anl.gov > > >> Emne: Re: SV: SV: [PETSC #14613] DMMG question > > >> > > >> > > >> > > >> > > >> Actually DMMG does not always start at the coarsest level. > > >> It will only do that if you pass in the -dmmg_grid_sequence option. > > >> You can run with -pc_mg_type multiplicative -pc_mg_cycles 1 for > > >> V cycle and -pc_mg_cycles 2 for W cycles. > > >> > > >> There may be other reasons you might not be able to use DMMG like > > >> it only works on logically rectangular grids, etc. > > >> > > >> The only example for the mg directly is > > >> src/ksp/ksp/examples/tests/ex19.c it is terribly ugly. > > >> > > >> > > >> Barry > > >> > > >> It is a different ex19.c > > >> > > >> On Tue, 22 Aug 2006 jens.madsen at risoe.dk wrote: > > >>> Hi again > > >>> > > >>> As far as I can see petsc/src/snes/examples/tutorials/ex19.c uses > DMMG > > >>> ? > > >>> > > >>> I am trying to use the preconditioner itself. I do not want to use > DMMG > > >>> because DMMG always starts at the coarsest grid in order to improve > the > > >>> initial guess. I want to start on the finest grid in each timestep > and > > >>> do a V or W... > > >>> > > >>> > > >>> > > >>> Kind regards > > >>> > > >>> > > >>> > > >>> JEns > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> > > >>> ________________________________ > > >>> > > >>> Fra: Hong Zhang [mailto:petsc-maint at mcs.anl.gov] > > >>> Sendt: l? 19-08-2006 03:04 > > >>> Til: jens.madsen at risoe.dk > > >>> Cc: petsc-maint at mcs.anl.gov > > >>> Emne: RE: SV: [PETSC #14613] DMMG question > > >>> > > >>> > > >>> > > >>> > > >>> See > > >>> ~petsc/src/snes/examples/tutorials/ex19.c > > >>> > > >>> Hong > > >>> > > >>> On Fri, 18 Aug 2006 jens.madsen at risoe.dk wrote: > > >>>> Hi again > > >>>> > > >>>> First I will thank you guys for developing such a great product. > Since > > >>>> i wrote the mails below I have developed a code simulating 2D > > >>>> plasmaphysics. At the moment I am using the Krylov subspace > methods, > > >>>> KSP. Now that this is runnning I would like to see which > improvements > > >>>> a MG precoditioner would give. Before starting doing so I would ask > > >>>> you guys whether you have any examples ? The documentation on the > PCMG > > >>>> is a bit sparse (:-)) > > >>>> > > >>>> cheers Jens > > >>>> > > >>>> PS. I will not forget to site you @:-) > > >>>> > > >>>> > > >>>> -----Original Message----- > > >>>> From: Barry Smith [mailto:petsc-maint at mcs.anl.gov] > > >>>> Sent: Thu 3/30/2006 2:35 AM > > >>>> To: jens.madsen at risoe.dk > > >>>> Cc: petsc-maint at mcs.anl.gov > > >>>> Subject: Re: SV: [PETSC #14613] DMMG question > > >>>> > > >>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: > > >>>>> Hi Barry and Matt > > >>>>> > > >>>>> Thank you for you quick response :-) > > >>>>> > > >>>>> I have actually tried those command line options that you suggest. > It > > >>>>> is probably me not using the right terminology; I am not that > > >>>>> experienced. I try to rephrase my problem. > > >>>>> > > >>>>> As far as I understand the full multigrid always starts on the > > >>>>> coarsest grid G_0. On the coarsest grid you calculate an > approximate > > >>>>> solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This > > >>>>> approximate solution is interpolated to a fine grid and used as an > > >>>>> initial guess on this finer grid G_1. Now you make a few iterative > > >>>>> sweeps on G_1 smoothening out the high k modes and get v_1. > Restrict > > >>>>> this approximate solution to G_0. Relax on G_0. Correct the > solution > > >>>>> v_1 and use this as an initial guess on an even finer grid G_2 > etc. > > >>>>> etc. In other words it combines "nested iteration" and "coarse > grid > > >>>>> correction". > > >>>> > > >>>> You are correct this is exactly traditional full multigrid. The > > >>>> "PETSc full multigrid" is slightly different. We start with a right > > >>>> hand side (and initial guess) on the finest grid, restrict the > > >>>> residual to the coarsest grid and then start up the grids with > nested > > >>>> iteration AND coarse grid correction. Thus unlike "traditional" > full > > >>>> multigrid you only need to define your problem on the finest grid. > > >>>> > > >>>> We've found that this usually works better than just using regular > V > > >>>> or W cycles. (BTW: PETSc full multigrid can, of course, use either > V > > >>>> or W cycles. > > >>>> > > >>>>> My "algorithm" is as follows: > > >>>>> > > >>>>> 1) apply initial conditions to Density,n, and Temperature,T. > > >>>>> 2) find \phi solving a Poisson like equation using a multigrid > > >>>>> scheme. Use \phi from previous timestep as an initial guess. n and > T > > >>>>> are variables in this equation. 3) Step n and T forward in time > using > > >>>>> the "stiffly stable" time stepping scheme. This is to be done > using a > > >>>>> pre-LU-factorized matrix. 4) goto 2) > > >>>>> > > >>>>> I would like to make a V (or W) cycle starting on the finest grid > > >>>>> instead. On the finest grid I would like to apply boundary > > >>>>> conditions, provide the previous time step as an initial guess and > > >>>>> use "coarse grid correction" only. My own code is (probably) full > of > > >>>>> errors :-) so I have tried running the multigrid examples under > KSP > > >>>>> and SNES with -pc_type richardson and/or, -pc_mg_type additive > and/or > > >>>>> -ksp_type preonly etc.What I can see using -ksp/snes_view is that > the > > >>>>> starting point is always the coarsest grid with dimensions given > by > > >>>>> DACreateNd ? The next MG-Grids are always finer. Can I make DMMG > > >>>>> start on the finest grid with dimensions given in DACreateNd ? > > >>>> > > >>>> You need to create a DA with a coarser size so that after it is > > >>>> refined the number of times it gives you the grid you want. That is > if > > >>>> you want 5 grid points with two levels you would create a DA with 3 > > >>>> grid points and pass that into the DMMG. Sorry there is no way to > > >>>> start with a DA on the finest (but you get the same effect by > starting > > >>>> with a coarser DA. > > >>>> > > >>>> Barry > > >>>> > > >>>>> Cheers and thanks Jens > > >>>>> > > >>>>> ________________________________ > > >>>>> > > >>>>> Fra: Barry Smith [mailto:petsc-maint at mcs.anl.gov] > > >>>>> Sendt: on 29-03-2006 17:20 > > >>>>> Til: jens.madsen at risoe.dk > > >>>>> Cc: petsc-maint at mcs.anl.gov > > >>>>> Emne: Re: [PETSC #14613] DMMG question > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> Jens, > > >>>>> > > >>>>> YOu can access any of the low level PCMG options from > > >>>>> DMMG. For example, -pc_type richardson gives you "multigrid > > >>>>> as a solve". -pc_mg_type additive gives you additive > > >>>>> -pc_mg_type multiplicative gives you standard v or w cycel > > >>>>> -pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2 > > >>>>> gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother > > >>>>> etc etc etc. Run with -help to see all the choices for the parts > > >>>>> of the multigrid process. > > >>>>> > > >>>>> Barry > > >>>>> > > >>>>> As Matt noted, using the PCMG directly requires YOU provide > > >>>>> a mesh infrastructure that manages the meshes, thus it is not > > >>>>> realistic for us to provide this whole infrastructure in an > > >>>>> example. We currently only provide the full infrastructure > > >>>>> for structured grids (in DMMG). > > >>>>> > > >>>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: > > >>>>>> Hi Petsc :-) > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> I am trying to use Petsc for solving plasma fluid equations. Is > it > > >>>>>> possible to use the DMMG with multiplicative or additive > multigrid > > >>>>>> schemes ? Also can I use multigrid as a solver not only as a > > >>>>>> preconditioner in DMMG ? > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> Also I cannot find any examples using the "low-level" PCMG > > >>>>>> multigrid interface ? Only a testprogram in the PC/TEST directory > ? > > >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> Cheers Jens Madsen > > -- "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness -------------- next part -------------- An HTML attachment was scrubbed... URL: From randy at geosystem.us Wed Sep 13 09:51:23 2006 From: randy at geosystem.us (Randall Mackie) Date: Wed, 13 Sep 2006 07:51:23 -0700 Subject: question on static binaries Message-ID: <45081AEB.7030500@geosystem.us> This may be a silly question, but is it possible to compile my PETSc program and build a static binary that will run on another cluster, or is it necessary to recompile my program on each cluster on which I want to run it? Randy -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From balay at mcs.anl.gov Wed Sep 13 10:26:59 2006 From: balay at mcs.anl.gov (Satish Balay) Date: Wed, 13 Sep 2006 10:26:59 -0500 (CDT) Subject: question on static binaries In-Reply-To: <45081AEB.7030500@geosystem.us> References: <45081AEB.7030500@geosystem.us> Message-ID: Its best to install PETSc on each cluster you need to use. However building PETSc binaries as static [and copying over to a different cluster] should be possible. There could be issues depending upon the library dependencies you might have - and the compiler you use. There could also be issues with MPI impls installed on each of these clusters [i.e MPI installed on one cluster might not be appropriate for the other one] If there are no MPI/other portability issues - either of the following should work: 1) With gcc - you can try using the link option '-static' and see if the binary gets created. If not - look at the error messsage and see what libraries are not a available as static. For example - the following works for me [with a bunch of warnings] on linux with gcc/g77 make ex2 LDFLAGS=-static PCC_LINKER_LIBS='-lm -lg2c' 2) If there are missing .a files preventing the above to work - you can make sure the PETSc [and other package libraries] are built static only - and create the executable. The do the following to get the list of sharedlibraries required: ldd executable Copy the executable to the remote machine - and invoke the same command on the remote machine to get a list of 'missing shared libraries'. Now copy these sharedlibs as well to the remote-machine - and add the PATH to LD_LIBRARY_PATH - and then run the binary. Satish On Wed, 13 Sep 2006, Randall Mackie wrote: > This may be a silly question, but is it possible to compile my PETSc program > and build a static > binary that will run on another cluster, or is it necessary to recompile my > program on each > cluster on which I want to run it? > > Randy > > From yaronkretchmer at gmail.com Wed Sep 13 12:32:06 2006 From: yaronkretchmer at gmail.com (Yaron Kretchmer) Date: Wed, 13 Sep 2006 10:32:06 -0700 Subject: question on static binaries In-Reply-To: <45081AEB.7030500@geosystem.us> References: <45081AEB.7030500@geosystem.us> Message-ID: Yes, this is possible. This is how we use PETSc. Yaron On 9/13/06, Randall Mackie wrote: > > This may be a silly question, but is it possible to compile my PETSc > program and build a static > binary that will run on another cluster, or is it necessary to recompile > my program on each > cluster on which I want to run it? > > Randy > > -- > Randall Mackie > GSY-USA, Inc. > PMB# 643 > 2261 Market St., > San Francisco, CA 94114-1600 > Tel (415) 469-8649 > Fax (415) 469-5044 > > California Registered Geophysicist > License No. GP 1034 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mafunk at nmsu.edu Wed Sep 13 18:04:48 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Wed, 13 Sep 2006 17:04:48 -0600 Subject: petsc I/O In-Reply-To: References: <45081AEB.7030500@geosystem.us> Message-ID: <200609131704.56028.mafunk@nmsu.edu> Hi, i need to read in an input file. So to open my file i use PETSCFOpen which works fine. But then my problems begin ... :) I guess i need to tell only the first proc in the communicator to fscan. But is there a PETSC function that returns me the processor id? And when i read the parameters in on the first proc i need to broadcast them to the other procs. Does PETSC have anything for this? thanks mat On Wednesday 13 September 2006 11:32, Yaron Kretchmer wrote: > Yes, this is possible. This is how we use PETSc. > > Yaron > > On 9/13/06, Randall Mackie wrote: > > This may be a silly question, but is it possible to compile my PETSc > > program and build a static > > binary that will run on another cluster, or is it necessary to recompile > > my program on each > > cluster on which I want to run it? > > > > Randy > > > > -- > > Randall Mackie > > GSY-USA, Inc. > > PMB# 643 > > 2261 Market St., > > San Francisco, CA 94114-1600 > > Tel (415) 469-8649 > > Fax (415) 469-5044 > > > > California Registered Geophysicist > > License No. GP 1034 From bsmith at mcs.anl.gov Wed Sep 13 18:11:25 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 13 Sep 2006 18:11:25 -0500 (CDT) Subject: petsc I/O In-Reply-To: <200609131704.56028.mafunk@nmsu.edu> References: <45081AEB.7030500@geosystem.us> <200609131704.56028.mafunk@nmsu.edu> Message-ID: PetscSynchronizedFGets() then all processes use sscanf() Good luck, Barry You won't need any if (rank == 0) code On Wed, 13 Sep 2006, Matt Funk wrote: > Hi, > > i need to read in an input file. So to open my file i use PETSCFOpen which > works fine. But then my problems begin ... :) > > I guess i need to tell only the first proc in the communicator to fscan. But > is there a PETSC function that returns me the processor id? > > And when i read the parameters in on the first proc i need to broadcast them > to the other procs. Does PETSC have anything for this? > > > thanks > mat > > > On Wednesday 13 September 2006 11:32, Yaron Kretchmer wrote: >> Yes, this is possible. This is how we use PETSc. >> >> Yaron >> >> On 9/13/06, Randall Mackie wrote: >>> This may be a silly question, but is it possible to compile my PETSc >>> program and build a static >>> binary that will run on another cluster, or is it necessary to recompile >>> my program on each >>> cluster on which I want to run it? >>> >>> Randy >>> >>> -- >>> Randall Mackie >>> GSY-USA, Inc. >>> PMB# 643 >>> 2261 Market St., >>> San Francisco, CA 94114-1600 >>> Tel (415) 469-8649 >>> Fax (415) 469-5044 >>> >>> California Registered Geophysicist >>> License No. GP 1034 > > From berend at chalmers.se Wed Sep 13 18:13:48 2006 From: berend at chalmers.se (Berend van Wachem) Date: Thu, 14 Sep 2006 01:13:48 +0200 Subject: petsc I/O In-Reply-To: <200609131704.56028.mafunk@nmsu.edu> References: <45081AEB.7030500@geosystem.us> <200609131704.56028.mafunk@nmsu.edu> Message-ID: <450890AC.1030904@chalmers.se> Hi Matt, > i need to read in an input file. So to open my file i use PETSCFOpen which > works fine. But then my problems begin ... :) > > I guess i need to tell only the first proc in the communicator to fscan. But > is there a PETSC function that returns me the processor id? > And when i read the parameters in on the first proc i need to broadcast them > to the other procs. Does PETSC have anything for this? > For both issues you can use standard MPI: to get the processor ID: ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); to broadcast information: ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm ) If possible, I would recommend you to use the PetscViewer interface for your IO handling; it is very easy. Good luck, Berend. From mafunk at nmsu.edu Fri Sep 15 11:21:39 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Fri, 15 Sep 2006 10:21:39 -0600 Subject: petsc I/O In-Reply-To: <450890AC.1030904@chalmers.se> References: <45081AEB.7030500@geosystem.us> <200609131704.56028.mafunk@nmsu.edu> <450890AC.1030904@chalmers.se> Message-ID: <200609151021.47575.mafunk@nmsu.edu> Hi, thanks for the answers first of all. I have another question though ... :) Say, i want to print a specific element from a PETSc global vector. Is there a function (PetscSunchFPrintF does not do this i believe) to which i simply pass the file handle, communicator, the vector and the element and it writes the value to the file? thanks mat On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > Hi Matt, > > > i need to read in an input file. So to open my file i use PETSCFOpen > > which works fine. But then my problems begin ... :) > > > > I guess i need to tell only the first proc in the communicator to fscan. > > But is there a PETSC function that returns me the processor id? > > And when i read the parameters in on the first proc i need to broadcast > > them to the other procs. Does PETSC have anything for this? > > For both issues you can use standard MPI: > > to get the processor ID: > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > to broadcast information: > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > root, MPI_Comm comm ) > > If possible, I would recommend you to use the PetscViewer interface for > your IO handling; it is very easy. > > Good luck, > > Berend. From knepley at gmail.com Fri Sep 15 11:44:01 2006 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 15 Sep 2006 11:44:01 -0500 Subject: petsc I/O In-Reply-To: <200609151021.47575.mafunk@nmsu.edu> References: <45081AEB.7030500@geosystem.us> <200609131704.56028.mafunk@nmsu.edu> <450890AC.1030904@chalmers.se> <200609151021.47575.mafunk@nmsu.edu> Message-ID: On 9/15/06, Matt Funk wrote: > > Hi, > > thanks for the answers first of all. I have another question though ... :) > > Say, i want to print a specific element from a PETSc global vector. Is > there a > function (PetscSunchFPrintF does not do this i believe) to which i simply > pass the file handle, communicator, the vector and the element and it > writes > the value to the file? No, this function does not currently exist. Are these elements local? If not, it would entail communication. If so, you could use VecGetArray() and then just index in. Is that sufficient? thanks, Matt thanks > mat > > On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > > Hi Matt, > > > > > i need to read in an input file. So to open my file i use PETSCFOpen > > > which works fine. But then my problems begin ... :) > > > > > > I guess i need to tell only the first proc in the communicator to > fscan. > > > But is there a PETSC function that returns me the processor id? > > > And when i read the parameters in on the first proc i need to > broadcast > > > them to the other procs. Does PETSC have anything for this? > > > > For both issues you can use standard MPI: > > > > to get the processor ID: > > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > > > to broadcast information: > > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > > root, MPI_Comm comm ) > > > > If possible, I would recommend you to use the PetscViewer interface for > > your IO handling; it is very easy. > > > > Good luck, > > > > Berend. > > -- "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Fri Sep 15 15:15:44 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 15 Sep 2006 15:15:44 -0500 (CDT) Subject: petsc I/O In-Reply-To: <200609151021.47575.mafunk@nmsu.edu> References: <45081AEB.7030500@geosystem.us> <200609131704.56028.mafunk@nmsu.edu> <450890AC.1030904@chalmers.se> <200609151021.47575.mafunk@nmsu.edu> Message-ID: Matt, if the element lives on my process then use VecGetArray() to access the value and call PetscSynchronizedPrintf() Not completely canned but easy to do. Barry On Fri, 15 Sep 2006, Matt Funk wrote: > Hi, > > thanks for the answers first of all. I have another question though ... :) > > Say, i want to print a specific element from a PETSc global vector. Is there a > function (PetscSunchFPrintF does not do this i believe) to which i simply > pass the file handle, communicator, the vector and the element and it writes > the value to the file? > > > thanks > mat > > On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > > Hi Matt, > > > > > i need to read in an input file. So to open my file i use PETSCFOpen > > > which works fine. But then my problems begin ... :) > > > > > > I guess i need to tell only the first proc in the communicator to fscan. > > > But is there a PETSC function that returns me the processor id? > > > And when i read the parameters in on the first proc i need to broadcast > > > them to the other procs. Does PETSC have anything for this? > > > > For both issues you can use standard MPI: > > > > to get the processor ID: > > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > > > to broadcast information: > > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > > root, MPI_Comm comm ) > > > > If possible, I would recommend you to use the PetscViewer interface for > > your IO handling; it is very easy. > > > > Good luck, > > > > Berend. > > From bsmith at mcs.anl.gov Fri Sep 15 15:21:56 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 15 Sep 2006 15:21:56 -0500 (CDT) Subject: petsc I/O In-Reply-To: References: <45081AEB.7030500@geosystem.us> <200609131704.56028.mafunk@nmsu.edu> <450890AC.1030904@chalmers.se> <200609151021.47575.mafunk@nmsu.edu> Message-ID: Sorry it should be PetscSynchronizedFPrintf() ^^^^^^^ Barry On Fri, 15 Sep 2006, Barry Smith wrote: > > Matt, > > if the element lives on my process then use VecGetArray() to access > the value and call > PetscSynchronizedPrintf() > > Not completely canned but easy to do. > > Barry > > On Fri, 15 Sep 2006, Matt Funk wrote: > > > Hi, > > > > thanks for the answers first of all. I have another question though ... :) > > > > Say, i want to print a specific element from a PETSc global vector. Is there a > > function (PetscSunchFPrintF does not do this i believe) to which i simply > > pass the file handle, communicator, the vector and the element and it writes > > the value to the file? > > > > > > thanks > > mat > > > > On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > > > Hi Matt, > > > > > > > i need to read in an input file. So to open my file i use PETSCFOpen > > > > which works fine. But then my problems begin ... :) > > > > > > > > I guess i need to tell only the first proc in the communicator to fscan. > > > > But is there a PETSC function that returns me the processor id? > > > > And when i read the parameters in on the first proc i need to broadcast > > > > them to the other procs. Does PETSC have anything for this? > > > > > > For both issues you can use standard MPI: > > > > > > to get the processor ID: > > > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > > > > > to broadcast information: > > > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > > > root, MPI_Comm comm ) > > > > > > If possible, I would recommend you to use the PetscViewer interface for > > > your IO handling; it is very easy. > > > > > > Good luck, > > > > > > Berend. > > > > > From bsmith at mcs.anl.gov Fri Sep 15 15:27:19 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 15 Sep 2006 15:27:19 -0500 (CDT) Subject: some changes to interface in petsc-dev Message-ID: I have just pushed some changes to the user interface for PETSc dev in the interest of consistency and future extensibility. In particular [KSP/SNES/TS]XXXXMonitor becomes [KSP/SNES/TS]MonitorYYYY -[ksp/ts/snes]_xxxxmonitor becomes -[ksp/ts/snes]_monitor_yyyy where yyy is often the same as XXX but also may be a clearer longer name. I've also been working on the Socket viewer, if you are using that and have problems please let me know. Thanks for your patience, Barry Please send all flames about API changes to /dev/nulll From mafunk at nmsu.edu Fri Sep 15 18:17:16 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Fri, 15 Sep 2006 17:17:16 -0600 Subject: petsc I/O In-Reply-To: References: <45081AEB.7030500@geosystem.us> <200609151021.47575.mafunk@nmsu.edu> Message-ID: <200609151717.18750.mafunk@nmsu.edu> Hi The value are not local in general. So, true, it would entail communication. I just used MPI calls to do what i needed it to do. I was just wondering if PETSc had that functionality, that's all. Also before i wrote the email, i did as Barry suggested by using the PetscSynchronizedPrintf() after getting the array via VecGetArray(). However, for me that hung the program (at least i believe this was the reason the program hung). Because for example, say i want to print (array-wise speaking) element 144,144,144. This element resides on one processor only. I use the DA object and hence use global(!!) indices to access the array. So that means the program looks for element 144,144,144 on all processor (since, as far as i understand it, PetscSynchronizedPrintf() gets the requested value from all processors and then prints it). However, this will mean that it is out of the scope of the local portion of the global vector for all processors except one (that is the processors on which this point lives). So i believe that was the reason it crashed. thanks mat On Friday 15 September 2006 10:44, Matthew Knepley wrote: > On 9/15/06, Matt Funk wrote: > > Hi, > > > > thanks for the answers first of all. I have another question though ... > > :) > > > > Say, i want to print a specific element from a PETSc global vector. Is > > there a > > function (PetscSunchFPrintF does not do this i believe) to which i simply > > pass the file handle, communicator, the vector and the element and it > > writes > > the value to the file? > > No, this function does not currently exist. Are these elements local? If > not, it > would entail communication. If so, you could use VecGetArray() and then > just index in. Is that sufficient? > > thanks, > > Matt > > thanks > > > mat > > > > On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > > > Hi Matt, > > > > > > > i need to read in an input file. So to open my file i use PETSCFOpen > > > > which works fine. But then my problems begin ... :) > > > > > > > > I guess i need to tell only the first proc in the communicator to > > > > fscan. > > > > > > But is there a PETSC function that returns me the processor id? > > > > And when i read the parameters in on the first proc i need to > > > > broadcast > > > > > > them to the other procs. Does PETSC have anything for this? > > > > > > For both issues you can use standard MPI: > > > > > > to get the processor ID: > > > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > > > > > to broadcast information: > > > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > > > root, MPI_Comm comm ) > > > > > > If possible, I would recommend you to use the PetscViewer interface for > > > your IO handling; it is very easy. > > > > > > Good luck, > > > > > > Berend. From bsmith at mcs.anl.gov Fri Sep 15 20:26:17 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 15 Sep 2006 20:26:17 -0500 (CDT) Subject: petsc I/O In-Reply-To: <200609151717.18750.mafunk@nmsu.edu> References: <45081AEB.7030500@geosystem.us> <200609151021.47575.mafunk@nmsu.edu> <200609151717.18750.mafunk@nmsu.edu> Message-ID: Matt, You need to if (I am then correct process) I put in and ONLY access the value on the process that owns it and then have ONLY that one call PetscSynchronizedFPrintf(). Barry On Fri, 15 Sep 2006, Matt Funk wrote: > Hi > > The value are not local in general. So, true, it would entail communication. > > I just used MPI calls to do what i needed it to do. I was just wondering if > PETSc had that functionality, that's all. > > Also before i wrote the email, i did as Barry suggested by using the > PetscSynchronizedPrintf() after getting the array via VecGetArray(). > However, for me that hung the program (at least i believe this was the reason > the program hung). Because for example, say i want to print (array-wise > speaking) element 144,144,144. This element resides on one processor only. I > use the DA object and hence use global(!!) indices to access the array. So > that means the program looks for element 144,144,144 on all processor (since, > as far as i understand it, PetscSynchronizedPrintf() gets the requested value > from all processors and then prints it). However, this will mean that it is > out of the scope of the local portion of the global vector for all processors > except one (that is the processors on which this point lives). So i believe > that was the reason it crashed. > > thanks > mat > > > On Friday 15 September 2006 10:44, Matthew Knepley wrote: > > On 9/15/06, Matt Funk wrote: > > > Hi, > > > > > > thanks for the answers first of all. I have another question though ... > > > :) > > > > > > Say, i want to print a specific element from a PETSc global vector. Is > > > there a > > > function (PetscSunchFPrintF does not do this i believe) to which i simply > > > pass the file handle, communicator, the vector and the element and it > > > writes > > > the value to the file? > > > > No, this function does not currently exist. Are these elements local? If > > not, it > > would entail communication. If so, you could use VecGetArray() and then > > just index in. Is that sufficient? > > > > thanks, > > > > Matt > > > > thanks > > > > > mat > > > > > > On Wednesday 13 September 2006 17:13, Berend van Wachem wrote: > > > > Hi Matt, > > > > > > > > > i need to read in an input file. So to open my file i use PETSCFOpen > > > > > which works fine. But then my problems begin ... :) > > > > > > > > > > I guess i need to tell only the first proc in the communicator to > > > > > > fscan. > > > > > > > > But is there a PETSC function that returns me the processor id? > > > > > And when i read the parameters in on the first proc i need to > > > > > > broadcast > > > > > > > > them to the other procs. Does PETSC have anything for this? > > > > > > > > For both issues you can use standard MPI: > > > > > > > > to get the processor ID: > > > > ierr=MPI_Comm_rank(MPI_Comm Communicator,int *rank); > > > > > > > > to broadcast information: > > > > ierr=MPI_Bcast ( void *buffer, int count, MPI_Datatype datatype, int > > > > root, MPI_Comm comm ) > > > > > > > > If possible, I would recommend you to use the PetscViewer interface for > > > > your IO handling; it is very easy. > > > > > > > > Good luck, > > > > > > > > Berend. > > From griffith at cims.nyu.edu Mon Sep 18 12:40:54 2006 From: griffith at cims.nyu.edu (Boyce Griffith) Date: Mon, 18 Sep 2006 13:40:54 -0400 Subject: suppressing some command line options? Message-ID: <450EDA26.4040907@cims.nyu.edu> Hi, Folks -- I have an application in which, for better or for worse, I generate a huge number of sequential sparse AIJ matrices. I was wondering if it was possible to suppress the command line options affiliated with those objects. (I am using MatCreateSeqAIJ, and I am not using MatSetFromOptions.) The basic issue is that when a user runs the program with the '-help' flag, the options associated with these matrices tend to overwhelm all of the other command line options, e.g., KSP settings. Thanks in advance for any suggestions, -- Boyce Griffith From bsmith at mcs.anl.gov Mon Sep 18 15:19:30 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 18 Sep 2006 15:19:30 -0500 (CDT) Subject: suppressing some command line options? In-Reply-To: <450EDA26.4040907@cims.nyu.edu> References: <450EDA26.4040907@cims.nyu.edu> Message-ID: Boyce, Satish is working on this right now. It is a problem that we never properly resolved in that past and it needs to be solved. Unfortunately we won't be able to get it into the current petsc release, it will have to go in petsc-dev. Thanks for reminding us of this problem, Barry On Mon, 18 Sep 2006, Boyce Griffith wrote: > Hi, Folks -- > > I have an application in which, for better or for worse, I generate a huge > number of sequential sparse AIJ matrices. I was wondering if it was possible > to suppress the command line options affiliated with those objects. (I am > using MatCreateSeqAIJ, and I am not using MatSetFromOptions.) > > The basic issue is that when a user runs the program with the '-help' flag, > the options associated with these matrices tend to overwhelm all of the other > command line options, e.g., KSP settings. > > Thanks in advance for any suggestions, > > -- Boyce Griffith > > From bsmith at mcs.anl.gov Mon Sep 18 16:22:17 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 18 Sep 2006 16:22:17 -0500 (CDT) Subject: DMMG Time dependent matrix In-Reply-To: References: Message-ID: On Mon, 18 Sep 2006, jens.madsen at risoe.dk wrote: > Hi Again > > Really hope that you have an answer :-) My problem is that the MG code gets slower and slower the longer it runs. For example lets say that that it took 10 sec to get from iteration 1000 to iteration 2000. If I use the fields from iteration 1000 as initial condition and start the code it takes only 7 sec to calculate 1000 iterations. Note that the solutions are identical. I do not think that this is caused by a memory leaks; I have logged the memory use and there is no increase in memory use when using "top" or -malloc_info/log. > > I think that the "slowing down" is happening because I am using the MG matrices on the coarser levels from the first iteration for all iterations. More specificly the amat and pmat belonging to mg[i]->smoothd(u) are not being updated ? When I am testing with a time independent matrix the code does not slow down at all. > > I am sure that the coarser level matrices are calculated/restricted for each timestep. I have tested this simply by subtracting the coarser matrices for different timesteps. > > Do you know whether this: ierr = KSPGetPC(dmmg[i]->ksp,&pc); > ierr = PCMGGetSmoother(pc,i,&lksp);CHKERRQ(ierr); > KSPSetOperators(lksp,dmmg[i]->B,dmmg[i]->B,DIFFERENT_NONZERO_PATTERN); > > will do the job ? I don't think so. You need KSPGetPC(dmmg[n-1]->ksp,&pc); for (i=0; i KSPSetOperators(lksp,dmmg[i]->B,dmmg[i]->B,DIFFERENT_NONZERO_PATTERN); Also if the nonzero structure of B is not changing you'll want to use SAME_NONZERO_PATTERN Barry Reason: There are two sets of hierachy: Each level of dmmg[i] has its own KSP that is used for grid sequencing. WITHIN each dmmg[i]->ksp is the hierarchy for multigrid. You are only using dmmg[n-1] so you need to reset the operator for each level of that's multigrid hierarchy. I have tried a lot of different things.. I have noticed that there is a comment in mg.c in PCSetUp_MG. Do not see whether there is a connection ? > > Cheers Jens > > > > -----Original Message----- > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > Sent: Mon 9/11/2006 1:50 AM > To: petsc-users at mcs.anl.gov; jens.madsen at risoe.dk > Subject: Re: DMMG Time dependent matrix > > > Jens, > > You are correct; functionality to do this does not exist in DMMG. So you > have to write it yourself as you have, let us know if you have any trouble > with it. > > Barry > > > On Sun, 10 Sep 2006, jens.madsen at risoe.dk wrote: > > > Hi again > > > > My linear problem Ax = b. In my case the matrix A is timepdependent. In my KSP code I calculate A and call KSPSetOperators() in each timestep. When using DMMG I have not been able to find such a functionallity ? I am using galerkin matrices on all coarser MG levels. Here is the code that I am currently using > > > > /*Matrix is time dependent*/ > > if(para.PolEq==GLOBAL) > > { > > ierr = MGComputePolaMatrix(*dmmg,dmmg[para.MG_levels-1]->J,dmmg[para.MG_levels-1]->B); > > /*ierr = MatView(dmmg[DMMGGetLevels(dmmg)-1]->B,PETSC_VIEWER_STDOUT_WORLD);*/ > > for (i=DMMGGetLevels(dmmg)-2; i>-1; i--) > > { > > if (dmmg[i]->galerkin) > > { > > MatPtAP(dmmg[i+1]->B,dmmg[i+1]->R,MAT_REUSE_MATRIX,1.0,&dmmg[i]->B); > > if (!dmmg[i]->J) > > { > > dmmg[i]->J = dmmg[i]->B; > > } > > } > > /*ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_NONZERO_PATTERN);CHKERRQ(ierr);*/ > dmmg[i]->matricesset = PETSC_TRUE; > > } > for(i=0;inlevels;i++) > { > ierr = KSPGetPC(dmmg[i]->ksp,&pc); > ierr = PCMGGetSmoother(pc,i,&lksp);CHKERRQ(ierr); > KSPSetOperators(lksp,dmmg[i]->B,dmmg[i]->B,DIFFERENT_NONZERO_PATTERN); > } > > } > > else > > { > > ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_PRECONDITIONER);CHKERRQ(ierr); > > } > > > ierr = DMMGSolve(dmmg);CHKERRQ(ierr); > > > > I this the way to do it or have missed some functionallity in DMMG ? > > > > Cheers Jens > > > > -----Original Message----- > > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > > Sent: Thu 8/31/2006 10:12 PM > > To: jens.madsen at risoe.dk > > Subject: Re: SV: SV: SV: [PETSC #14613] DMMG question; more stupid danish questions :-) > > > > > > Yes, one of the arguments to DACreate is which directions you want > > periodicity. > > > > Barry > > > > > > On Thu, 31 Aug 2006, jens.madsen at risoe.dk wrote: > > > >> Ok I had not figured that out. Think I misunderstood a response from you that you mailed in the winter :-) > >> > >> I am now trying to implement DMMG in my code. Just one question: is DMMG able to handle periodic boundary conditions ? I think I have made it work but I have not performed intensive testing .... > >> > >> thx Jens :-) > >> > >> ________________________________ > >> > >> Fra: Barry Smith [mailto:bsmith at mcs.anl.gov] > >> Sendt: on 23-08-2006 00:06 > >> Til: jens.madsen at risoe.dk > >> Cc: petsc-maint at mcs.anl.gov > >> Emne: Re: SV: SV: [PETSC #14613] DMMG question > >> > >> > >> > >> > >> Actually DMMG does not always start at the coarsest level. > >> It will only do that if you pass in the -dmmg_grid_sequence option. > >> You can run with -pc_mg_type multiplicative -pc_mg_cycles 1 for > >> V cycle and -pc_mg_cycles 2 for W cycles. > >> > >> There may be other reasons you might not be able to use DMMG like > >> it only works on logically rectangular grids, etc. > >> > >> The only example for the mg directly is src/ksp/ksp/examples/tests/ex19.c > >> it is terribly ugly. > >> > >> > >> Barry > >> > >> It is a different ex19.c > >> > >> > >> > >> On Tue, 22 Aug 2006 jens.madsen at risoe.dk wrote: > >> > >>> Hi again > >>> > >>> As far as I can see petsc/src/snes/examples/tutorials/ex19.c uses DMMG ? > >>> > >>> I am trying to use the preconditioner itself. I do not want to use DMMG because DMMG always starts at the coarsest grid in order to improve the initial guess. I want to start on the finest grid in each timestep and do a V or W... > >>> > >>> > >>> > >>> Kind regards > >>> > >>> > >>> > >>> JEns > >>> > >>> > >>> > >>> > >>> > >>> > >>> ________________________________ > >>> > >>> Fra: Hong Zhang [mailto:petsc-maint at mcs.anl.gov] > >>> Sendt: l? 19-08-2006 03:04 > >>> Til: jens.madsen at risoe.dk > >>> Cc: petsc-maint at mcs.anl.gov > >>> Emne: RE: SV: [PETSC #14613] DMMG question > >>> > >>> > >>> > >>> > >>> See > >>> ~petsc/src/snes/examples/tutorials/ex19.c > >>> > >>> Hong > >>> > >>> On Fri, 18 Aug 2006 jens.madsen at risoe.dk wrote: > >>> > >>>> Hi again > >>>> > >>>> First I will thank you guys for developing such a great product. Since i wrote the mails below I have developed a code simulating 2D plasmaphysics. At the moment I am using the Krylov subspace methods, KSP. Now that this is runnning I would like to see which improvements a MG precoditioner would give. Before starting doing so I would ask you guys whether you have any examples ? The documentation on the PCMG is a bit sparse (:-)) > >>>> > >>>> cheers Jens > >>>> > >>>> PS. I will not forget to site you @:-) > >>>> > >>>> > >>>> -----Original Message----- > >>>> From: Barry Smith [mailto:petsc-maint at mcs.anl.gov] > >>>> Sent: Thu 3/30/2006 2:35 AM > >>>> To: jens.madsen at risoe.dk > >>>> Cc: petsc-maint at mcs.anl.gov > >>>> Subject: Re: SV: [PETSC #14613] DMMG question > >>>> > >>>> > >>>> > >>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: > >>>> > >>>>> Hi Barry and Matt > >>>>> > >>>>> Thank you for you quick response :-) > >>>>> > >>>>> I have actually tried those command line options that you suggest. It is probably me not using the right terminology; I am not that experienced. I try to rephrase my problem. > >>>>> > >>>>> As far as I understand the full multigrid always starts on the coarsest grid G_0. On the coarsest grid you calculate an approximate solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This approximate solution is interpolated to a fine grid and used as an initial guess on this finer grid G_1. Now you make a few iterative sweeps on G_1 smoothening out the high k modes and get v_1. Restrict this approximate solution to G_0. Relax on G_0. Correct the solution v_1 and use this as an initial guess on an even finer grid G_2 etc. etc. In other words it combines "nested iteration" and "coarse grid correction". > >>>> > >>>> You are correct this is exactly traditional full multigrid. The "PETSc full multigrid" is slightly > >>>> different. We start with a right hand side (and initial guess) on the finest grid, restrict the residual > >>>> to the coarsest grid and then start up the grids with nested iteration AND coarse grid correction. > >>>> Thus unlike "traditional" full multigrid you only need to define your problem on the finest grid. > >>>> > >>>> We've found that this usually works better than just using regular V or W cycles. (BTW: PETSc full multigrid > >>>> can, of course, use either V or W cycles. > >>>> > >>>>> > >>>>> My "algorithm" is as follows: > >>>>> > >>>>> 1) apply initial conditions to Density,n, and Temperature,T. > >>>>> 2) find \phi solving a Poisson like equation using a multigrid scheme. Use \phi from previous timestep as an initial guess. n and T are variables in this equation. > >>>>> 3) Step n and T forward in time using the "stiffly stable" time stepping scheme. This is to be done using a pre-LU-factorized matrix. > >>>>> 4) goto 2) > >>>>> > >>>>> I would like to make a V (or W) cycle starting on the finest grid instead. On the finest grid I would like to apply boundary conditions, provide the previous time step as an initial guess and use "coarse grid correction" only. My own code is (probably) full of errors :-) so I have tried running the multigrid examples under KSP and SNES with -pc_type richardson and/or, -pc_mg_type additive and/or -ksp_type preonly etc.What I can see using -ksp/snes_view is that the starting point is always the coarsest grid with dimensions given by DACreateNd ? The next MG-Grids are always finer. Can I make DMMG start on the finest grid with dimensions given in DACreateNd ? > >>>> > >>>> You need to create a DA with a coarser size so that after it is refined the number of times it gives you > >>>> the grid you want. That is if you want 5 grid points with two levels you would create a DA with 3 grid > >>>> points and pass that into the DMMG. Sorry there is no way to start with a DA on the finest (but you get the > >>>> same effect by starting with a coarser DA. > >>>> > >>>> Barry > >>>>> > >>>>> Cheers and thanks Jens > >>>>> > >>>>> ________________________________ > >>>>> > >>>>> Fra: Barry Smith [mailto:petsc-maint at mcs.anl.gov] > >>>>> Sendt: on 29-03-2006 17:20 > >>>>> Til: jens.madsen at risoe.dk > >>>>> Cc: petsc-maint at mcs.anl.gov > >>>>> Emne: Re: [PETSC #14613] DMMG question > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> Jens, > >>>>> > >>>>> YOu can access any of the low level PCMG options from > >>>>> DMMG. For example, -pc_type richardson gives you "multigrid > >>>>> as a solve". -pc_mg_type additive gives you additive > >>>>> -pc_mg_type multiplicative gives you standard v or w cycel > >>>>> -pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2 > >>>>> gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother > >>>>> etc etc etc. Run with -help to see all the choices for the parts > >>>>> of the multigrid process. > >>>>> > >>>>> Barry > >>>>> > >>>>> As Matt noted, using the PCMG directly requires YOU provide > >>>>> a mesh infrastructure that manages the meshes, thus it is not > >>>>> realistic for us to provide this whole infrastructure in an > >>>>> example. We currently only provide the full infrastructure > >>>>> for structured grids (in DMMG). > >>>>> > >>>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: > >>>>> > >>>>>> Hi Petsc :-) > >>>>>> > >>>>>> > >>>>>> > >>>>>> I am trying to use Petsc for solving plasma fluid equations. Is it > >>>>>> possible to use the DMMG with multiplicative or additive multigrid > >>>>>> schemes ? Also can I use multigrid as a solver not only as a > >>>>>> preconditioner in DMMG ? > >>>>>> > >>>>>> > >>>>>> > >>>>>> Also I cannot find any examples using the "low-level" PCMG multigrid > >>>>>> interface ? Only a testprogram in the PC/TEST directory ? > >>>>>> > >>>>>> > >>>>>> > >>>>>> Cheers Jens Madsen > >>>>>> > >>>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >> > >> > >> > >> > > > > > > From jens.madsen at risoe.dk Mon Sep 18 15:39:33 2006 From: jens.madsen at risoe.dk (jens.madsen at risoe.dk) Date: Mon, 18 Sep 2006 22:39:33 +0200 Subject: DMMG Time dependent matrix References: Message-ID: Jens, You are correct; functionality to do this does not exist in DMMG. So you have to write it yourself as you have, let us know if you have any trouble with it. Barry On Sun, 10 Sep 2006, jens.madsen at risoe.dk wrote: > Hi again > > My linear problem Ax = b. In my case the matrix A is timepdependent. In my KSP code I calculate A and call KSPSetOperators() in each timestep. When using DMMG I have not been able to find such a functionallity ? I am using galerkin matrices on all coarser MG levels. Here is the code that I am currently using > > /*Matrix is time dependent*/ > if(para.PolEq==GLOBAL) > { > ierr = MGComputePolaMatrix(*dmmg,dmmg[para.MG_levels-1]->J,dmmg[para.MG_levels-1]->B); > /*ierr = MatView(dmmg[DMMGGetLevels(dmmg)-1]->B,PETSC_VIEWER_STDOUT_WORLD);*/ > for (i=DMMGGetLevels(dmmg)-2; i>-1; i--) > { > if (dmmg[i]->galerkin) > { > MatPtAP(dmmg[i+1]->B,dmmg[i+1]->R,MAT_REUSE_MATRIX,1.0,&dmmg[i]->B); > if (!dmmg[i]->J) > { > dmmg[i]->J = dmmg[i]->B; > } > } > ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_NONZERO_PATTERN);CHKERRQ(ierr); > } > } > else > { > ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_PRECONDITIONER);CHKERRQ(ierr); > } > ierr = DMMGSolve(dmmg);CHKERRQ(ierr); > > I this the way to do it or have missed some functionallity in DMMG ? > > Cheers Jens > > -----Original Message----- > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > Sent: Thu 8/31/2006 10:12 PM > To: jens.madsen at risoe.dk > Subject: Re: SV: SV: SV: [PETSC #14613] DMMG question; more stupid danish questions :-) > > > Yes, one of the arguments to DACreate is which directions you want > periodicity. > > Barry > > > On Thu, 31 Aug 2006, jens.madsen at risoe.dk wrote: > >> Ok I had not figured that out. Think I misunderstood a response from you that you mailed in the winter :-) >> >> I am now trying to implement DMMG in my code. Just one question: is DMMG able to handle periodic boundary conditions ? I think I have made it work but I have not performed intensive testing .... >> >> thx Jens :-) >> >> ________________________________ >> >> Fra: Barry Smith [mailto:bsmith at mcs.anl.gov] >> Sendt: on 23-08-2006 00:06 >> Til: jens.madsen at risoe.dk >> Cc: petsc-maint at mcs.anl.gov >> Emne: Re: SV: SV: [PETSC #14613] DMMG question >> >> >> >> >> Actually DMMG does not always start at the coarsest level. >> It will only do that if you pass in the -dmmg_grid_sequence option. >> You can run with -pc_mg_type multiplicative -pc_mg_cycles 1 for >> V cycle and -pc_mg_cycles 2 for W cycles. >> >> There may be other reasons you might not be able to use DMMG like >> it only works on logically rectangular grids, etc. >> >> The only example for the mg directly is src/ksp/ksp/examples/tests/ex19.c >> it is terribly ugly. >> >> >> Barry >> >> It is a different ex19.c >> >> >> >> On Tue, 22 Aug 2006 jens.madsen at risoe.dk wrote: >> >>> Hi again >>> >>> As far as I can see petsc/src/snes/examples/tutorials/ex19.c uses DMMG ? >>> >>> I am trying to use the preconditioner itself. I do not want to use DMMG because DMMG always starts at the coarsest grid in order to improve the initial guess. I want to start on the finest grid in each timestep and do a V or W... >>> >>> >>> >>> Kind regards >>> >>> >>> >>> JEns >>> >>> >>> >>> >>> >>> >>> ________________________________ >>> >>> Fra: Hong Zhang [mailto:petsc-maint at mcs.anl.gov] >>> Sendt: l? 19-08-2006 03:04 >>> Til: jens.madsen at risoe.dk >>> Cc: petsc-maint at mcs.anl.gov >>> Emne: RE: SV: [PETSC #14613] DMMG question >>> >>> >>> >>> >>> See >>> ~petsc/src/snes/examples/tutorials/ex19.c >>> >>> Hong >>> >>> On Fri, 18 Aug 2006 jens.madsen at risoe.dk wrote: >>> >>>> Hi again >>>> >>>> First I will thank you guys for developing such a great product. Since i wrote the mails below I have developed a code simulating 2D plasmaphysics. At the moment I am using the Krylov subspace methods, KSP. Now that this is runnning I would like to see which improvements a MG precoditioner would give. Before starting doing so I would ask you guys whether you have any examples ? The documentation on the PCMG is a bit sparse (:-)) >>>> >>>> cheers Jens >>>> >>>> PS. I will not forget to site you @:-) >>>> >>>> >>>> -----Original Message----- >>>> From: Barry Smith [mailto:petsc-maint at mcs.anl.gov] >>>> Sent: Thu 3/30/2006 2:35 AM >>>> To: jens.madsen at risoe.dk >>>> Cc: petsc-maint at mcs.anl.gov >>>> Subject: Re: SV: [PETSC #14613] DMMG question >>>> >>>> >>>> >>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: >>>> >>>>> Hi Barry and Matt >>>>> >>>>> Thank you for you quick response :-) >>>>> >>>>> I have actually tried those command line options that you suggest. It is probably me not using the right terminology; I am not that experienced. I try to rephrase my problem. >>>>> >>>>> As far as I understand the full multigrid always starts on the coarsest grid G_0. On the coarsest grid you calculate an approximate solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This approximate solution is interpolated to a fine grid and used as an initial guess on this finer grid G_1. Now you make a few iterative sweeps on G_1 smoothening out the high k modes and get v_1. Restrict this approximate solution to G_0. Relax on G_0. Correct the solution v_1 and use this as an initial guess on an even finer grid G_2 etc. etc. In other words it combines "nested iteration" and "coarse grid correction". >>>> >>>> You are correct this is exactly traditional full multigrid. The "PETSc full multigrid" is slightly >>>> different. We start with a right hand side (and initial guess) on the finest grid, restrict the residual >>>> to the coarsest grid and then start up the grids with nested iteration AND coarse grid correction. >>>> Thus unlike "traditional" full multigrid you only need to define your problem on the finest grid. >>>> >>>> We've found that this usually works better than just using regular V or W cycles. (BTW: PETSc full multigrid >>>> can, of course, use either V or W cycles. >>>> >>>>> >>>>> My "algorithm" is as follows: >>>>> >>>>> 1) apply initial conditions to Density,n, and Temperature,T. >>>>> 2) find \phi solving a Poisson like equation using a multigrid scheme. Use \phi from previous timestep as an initial guess. n and T are variables in this equation. >>>>> 3) Step n and T forward in time using the "stiffly stable" time stepping scheme. This is to be done using a pre-LU-factorized matrix. >>>>> 4) goto 2) >>>>> >>>>> I would like to make a V (or W) cycle starting on the finest grid instead. On the finest grid I would like to apply boundary conditions, provide the previous time step as an initial guess and use "coarse grid correction" only. My own code is (probably) full of errors :-) so I have tried running the multigrid examples under KSP and SNES with -pc_type richardson and/or, -pc_mg_type additive and/or -ksp_type preonly etc.What I can see using -ksp/snes_view is that the starting point is always the coarsest grid with dimensions given by DACreateNd ? The next MG-Grids are always finer. Can I make DMMG start on the finest grid with dimensions given in DACreateNd ? >>>> >>>> You need to create a DA with a coarser size so that after it is refined the number of times it gives you >>>> the grid you want. That is if you want 5 grid points with two levels you would create a DA with 3 grid >>>> points and pass that into the DMMG. Sorry there is no way to start with a DA on the finest (but you get the >>>> same effect by starting with a coarser DA. >>>> >>>> Barry >>>>> >>>>> Cheers and thanks Jens >>>>> >>>>> ________________________________ >>>>> >>>>> Fra: Barry Smith [mailto:petsc-maint at mcs.anl.gov] >>>>> Sendt: on 29-03-2006 17:20 >>>>> Til: jens.madsen at risoe.dk >>>>> Cc: petsc-maint at mcs.anl.gov >>>>> Emne: Re: [PETSC #14613] DMMG question >>>>> >>>>> >>>>> >>>>> >>>>> Jens, >>>>> >>>>> YOu can access any of the low level PCMG options from >>>>> DMMG. For example, -pc_type richardson gives you "multigrid >>>>> as a solve". -pc_mg_type additive gives you additive >>>>> -pc_mg_type multiplicative gives you standard v or w cycel >>>>> -pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2 >>>>> gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother >>>>> etc etc etc. Run with -help to see all the choices for the parts >>>>> of the multigrid process. >>>>> >>>>> Barry >>>>> >>>>> As Matt noted, using the PCMG directly requires YOU provide >>>>> a mesh infrastructure that manages the meshes, thus it is not >>>>> realistic for us to provide this whole infrastructure in an >>>>> example. We currently only provide the full infrastructure >>>>> for structured grids (in DMMG). >>>>> >>>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: >>>>> >>>>>> Hi Petsc :-) >>>>>> >>>>>> >>>>>> >>>>>> I am trying to use Petsc for solving plasma fluid equations. Is it >>>>>> possible to use the DMMG with multiplicative or additive multigrid >>>>>> schemes ? Also can I use multigrid as a solver not only as a >>>>>> preconditioner in DMMG ? >>>>>> >>>>>> >>>>>> >>>>>> Also I cannot find any examples using the "low-level" PCMG multigrid >>>>>> interface ? Only a testprogram in the PC/TEST directory ? >>>>>> >>>>>> >>>>>> >>>>>> Cheers Jens Madsen >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >> >> >> > > From jens.madsen at risoe.dk Mon Sep 18 15:40:24 2006 From: jens.madsen at risoe.dk (jens.madsen at risoe.dk) Date: Mon, 18 Sep 2006 22:40:24 +0200 Subject: DMMG Time dependent matrix References: Message-ID: Hi Again Really hope that you have an answer :-) My problem is that the MG code gets slower and slower the longer it runs. For example lets say that that it took 10 sec to get from iteration 1000 to iteration 2000. If I use the fields from iteration 1000 as initial condition and start the code it takes only 7 sec to calculate 1000 iterations. Note that the solutions are identical. I do not think that this is caused by a memory leaks; I have logged the memory use and there is no increase in memory use when using "top" or -malloc_info/log. I think that the "slowing down" is happening because I am using the MG matrices on the coarser levels from the first iteration for all iterations. More specificly the amat and pmat belonging to mg[i]->smoothd(u) are not being updated ? When I am testing with a time independent matrix the code does not slow down at all. I am sure that the coarser level matrices are calculated/restricted for each timestep. I have tested this simply by subtracting the coarser matrices for different timesteps. Do you know whether this: ierr = KSPGetPC(dmmg[i]->ksp,&pc); ierr = PCMGGetSmoother(pc,i,&lksp);CHKERRQ(ierr); KSPSetOperators(lksp,dmmg[i]->B,dmmg[i]->B,DIFFERENT_NONZERO_PATTERN); will do the job ? I have tried a lot of different things.. I have noticed that there is a comment in mg.c in PCSetUp_MG. Do not see whether there is a connection ? Cheers Jens -----Original Message----- From: Barry Smith [mailto:bsmith at mcs.anl.gov] Sent: Mon 9/11/2006 1:50 AM To: petsc-users at mcs.anl.gov; jens.madsen at risoe.dk Subject: Re: DMMG Time dependent matrix Jens, You are correct; functionality to do this does not exist in DMMG. So you have to write it yourself as you have, let us know if you have any trouble with it. Barry On Sun, 10 Sep 2006, jens.madsen at risoe.dk wrote: > Hi again > > My linear problem Ax = b. In my case the matrix A is timepdependent. In my KSP code I calculate A and call KSPSetOperators() in each timestep. When using DMMG I have not been able to find such a functionallity ? I am using galerkin matrices on all coarser MG levels. Here is the code that I am currently using > > /*Matrix is time dependent*/ > if(para.PolEq==GLOBAL) > { > ierr = MGComputePolaMatrix(*dmmg,dmmg[para.MG_levels-1]->J,dmmg[para.MG_levels-1]->B); > /*ierr = MatView(dmmg[DMMGGetLevels(dmmg)-1]->B,PETSC_VIEWER_STDOUT_WORLD);*/ > for (i=DMMGGetLevels(dmmg)-2; i>-1; i--) > { > if (dmmg[i]->galerkin) > { > MatPtAP(dmmg[i+1]->B,dmmg[i+1]->R,MAT_REUSE_MATRIX,1.0,&dmmg[i]->B); > if (!dmmg[i]->J) > { > dmmg[i]->J = dmmg[i]->B; > } > } > /*ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_NONZERO_PATTERN);CHKERRQ(ierr);*/ dmmg[i]->matricesset = PETSC_TRUE; > } for(i=0;inlevels;i++) { ierr = KSPGetPC(dmmg[i]->ksp,&pc); ierr = PCMGGetSmoother(pc,i,&lksp);CHKERRQ(ierr); KSPSetOperators(lksp,dmmg[i]->B,dmmg[i]->B,DIFFERENT_NONZERO_PATTERN); } > } > else > { > ierr = KSPSetOperators(dmmg[i]->ksp,dmmg[i]->B,dmmg[i]->B,SAME_PRECONDITIONER);CHKERRQ(ierr); > } > ierr = DMMGSolve(dmmg);CHKERRQ(ierr); > > I this the way to do it or have missed some functionallity in DMMG ? > > Cheers Jens > > -----Original Message----- > From: Barry Smith [mailto:bsmith at mcs.anl.gov] > Sent: Thu 8/31/2006 10:12 PM > To: jens.madsen at risoe.dk > Subject: Re: SV: SV: SV: [PETSC #14613] DMMG question; more stupid danish questions :-) > > > Yes, one of the arguments to DACreate is which directions you want > periodicity. > > Barry > > > On Thu, 31 Aug 2006, jens.madsen at risoe.dk wrote: > >> Ok I had not figured that out. Think I misunderstood a response from you that you mailed in the winter :-) >> >> I am now trying to implement DMMG in my code. Just one question: is DMMG able to handle periodic boundary conditions ? I think I have made it work but I have not performed intensive testing .... >> >> thx Jens :-) >> >> ________________________________ >> >> Fra: Barry Smith [mailto:bsmith at mcs.anl.gov] >> Sendt: on 23-08-2006 00:06 >> Til: jens.madsen at risoe.dk >> Cc: petsc-maint at mcs.anl.gov >> Emne: Re: SV: SV: [PETSC #14613] DMMG question >> >> >> >> >> Actually DMMG does not always start at the coarsest level. >> It will only do that if you pass in the -dmmg_grid_sequence option. >> You can run with -pc_mg_type multiplicative -pc_mg_cycles 1 for >> V cycle and -pc_mg_cycles 2 for W cycles. >> >> There may be other reasons you might not be able to use DMMG like >> it only works on logically rectangular grids, etc. >> >> The only example for the mg directly is src/ksp/ksp/examples/tests/ex19.c >> it is terribly ugly. >> >> >> Barry >> >> It is a different ex19.c >> >> >> >> On Tue, 22 Aug 2006 jens.madsen at risoe.dk wrote: >> >>> Hi again >>> >>> As far as I can see petsc/src/snes/examples/tutorials/ex19.c uses DMMG ? >>> >>> I am trying to use the preconditioner itself. I do not want to use DMMG because DMMG always starts at the coarsest grid in order to improve the initial guess. I want to start on the finest grid in each timestep and do a V or W... >>> >>> >>> >>> Kind regards >>> >>> >>> >>> JEns >>> >>> >>> >>> >>> >>> >>> ________________________________ >>> >>> Fra: Hong Zhang [mailto:petsc-maint at mcs.anl.gov] >>> Sendt: l? 19-08-2006 03:04 >>> Til: jens.madsen at risoe.dk >>> Cc: petsc-maint at mcs.anl.gov >>> Emne: RE: SV: [PETSC #14613] DMMG question >>> >>> >>> >>> >>> See >>> ~petsc/src/snes/examples/tutorials/ex19.c >>> >>> Hong >>> >>> On Fri, 18 Aug 2006 jens.madsen at risoe.dk wrote: >>> >>>> Hi again >>>> >>>> First I will thank you guys for developing such a great product. Since i wrote the mails below I have developed a code simulating 2D plasmaphysics. At the moment I am using the Krylov subspace methods, KSP. Now that this is runnning I would like to see which improvements a MG precoditioner would give. Before starting doing so I would ask you guys whether you have any examples ? The documentation on the PCMG is a bit sparse (:-)) >>>> >>>> cheers Jens >>>> >>>> PS. I will not forget to site you @:-) >>>> >>>> >>>> -----Original Message----- >>>> From: Barry Smith [mailto:petsc-maint at mcs.anl.gov] >>>> Sent: Thu 3/30/2006 2:35 AM >>>> To: jens.madsen at risoe.dk >>>> Cc: petsc-maint at mcs.anl.gov >>>> Subject: Re: SV: [PETSC #14613] DMMG question >>>> >>>> >>>> >>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: >>>> >>>>> Hi Barry and Matt >>>>> >>>>> Thank you for you quick response :-) >>>>> >>>>> I have actually tried those command line options that you suggest. It is probably me not using the right terminology; I am not that experienced. I try to rephrase my problem. >>>>> >>>>> As far as I understand the full multigrid always starts on the coarsest grid G_0. On the coarsest grid you calculate an approximate solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This approximate solution is interpolated to a fine grid and used as an initial guess on this finer grid G_1. Now you make a few iterative sweeps on G_1 smoothening out the high k modes and get v_1. Restrict this approximate solution to G_0. Relax on G_0. Correct the solution v_1 and use this as an initial guess on an even finer grid G_2 etc. etc. In other words it combines "nested iteration" and "coarse grid correction". >>>> >>>> You are correct this is exactly traditional full multigrid. The "PETSc full multigrid" is slightly >>>> different. We start with a right hand side (and initial guess) on the finest grid, restrict the residual >>>> to the coarsest grid and then start up the grids with nested iteration AND coarse grid correction. >>>> Thus unlike "traditional" full multigrid you only need to define your problem on the finest grid. >>>> >>>> We've found that this usually works better than just using regular V or W cycles. (BTW: PETSc full multigrid >>>> can, of course, use either V or W cycles. >>>> >>>>> >>>>> My "algorithm" is as follows: >>>>> >>>>> 1) apply initial conditions to Density,n, and Temperature,T. >>>>> 2) find \phi solving a Poisson like equation using a multigrid scheme. Use \phi from previous timestep as an initial guess. n and T are variables in this equation. >>>>> 3) Step n and T forward in time using the "stiffly stable" time stepping scheme. This is to be done using a pre-LU-factorized matrix. >>>>> 4) goto 2) >>>>> >>>>> I would like to make a V (or W) cycle starting on the finest grid instead. On the finest grid I would like to apply boundary conditions, provide the previous time step as an initial guess and use "coarse grid correction" only. My own code is (probably) full of errors :-) so I have tried running the multigrid examples under KSP and SNES with -pc_type richardson and/or, -pc_mg_type additive and/or -ksp_type preonly etc.What I can see using -ksp/snes_view is that the starting point is always the coarsest grid with dimensions given by DACreateNd ? The next MG-Grids are always finer. Can I make DMMG start on the finest grid with dimensions given in DACreateNd ? >>>> >>>> You need to create a DA with a coarser size so that after it is refined the number of times it gives you >>>> the grid you want. That is if you want 5 grid points with two levels you would create a DA with 3 grid >>>> points and pass that into the DMMG. Sorry there is no way to start with a DA on the finest (but you get the >>>> same effect by starting with a coarser DA. >>>> >>>> Barry >>>>> >>>>> Cheers and thanks Jens >>>>> >>>>> ________________________________ >>>>> >>>>> Fra: Barry Smith [mailto:petsc-maint at mcs.anl.gov] >>>>> Sendt: on 29-03-2006 17:20 >>>>> Til: jens.madsen at risoe.dk >>>>> Cc: petsc-maint at mcs.anl.gov >>>>> Emne: Re: [PETSC #14613] DMMG question >>>>> >>>>> >>>>> >>>>> >>>>> Jens, >>>>> >>>>> YOu can access any of the low level PCMG options from >>>>> DMMG. For example, -pc_type richardson gives you "multigrid >>>>> as a solve". -pc_mg_type additive gives you additive >>>>> -pc_mg_type multiplicative gives you standard v or w cycel >>>>> -pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2 >>>>> gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother >>>>> etc etc etc. Run with -help to see all the choices for the parts >>>>> of the multigrid process. >>>>> >>>>> Barry >>>>> >>>>> As Matt noted, using the PCMG directly requires YOU provide >>>>> a mesh infrastructure that manages the meshes, thus it is not >>>>> realistic for us to provide this whole infrastructure in an >>>>> example. We currently only provide the full infrastructure >>>>> for structured grids (in DMMG). >>>>> >>>>> On Wed, 29 Mar 2006, jens.madsen at risoe.dk wrote: >>>>> >>>>>> Hi Petsc :-) >>>>>> >>>>>> >>>>>> >>>>>> I am trying to use Petsc for solving plasma fluid equations. Is it >>>>>> possible to use the DMMG with multiplicative or additive multigrid >>>>>> schemes ? Also can I use multigrid as a solver not only as a >>>>>> preconditioner in DMMG ? >>>>>> >>>>>> >>>>>> >>>>>> Also I cannot find any examples using the "low-level" PCMG multigrid >>>>>> interface ? Only a testprogram in the PC/TEST directory ? >>>>>> >>>>>> >>>>>> >>>>>> Cheers Jens Madsen >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >>> >> >> >> >> > > From mappol at gmail.com Tue Sep 19 05:30:43 2006 From: mappol at gmail.com (Patrick Lechner) Date: Tue, 19 Sep 2006 11:30:43 +0100 Subject: Compiling problems using -DPETSC_USE_FORTRAN_KERNELS Message-ID: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> Dear all, I have some problems compiling PETSc correctly when using the flag "-DPETSC_USE_FORTRAN_KERNELS" (to increase the performance of my code). My compiling options are: ./config/configure.py --prefix=/usr/local/compiler/pg-6.1--with-scalar-type=complex --with-cc=/usr/pgi/linux86-64/6.1/bin/pgcc --with-cxx=/usr/pgi/linux86-64/6.1/bin/pgCC --with-fc=/usr/pgi/linux86-64/6.1/bin/pgf90 --with-mpi=0 --with-blas-lapack-lib=-lacml --LDFLAGS=-pgf90libs --CPPFLAGS=-DPETSC_USE_FORTRAN_KERNELS When trying to run the PETSc test examples, I get error messages like: /projects/301/petsc-2.3.1-p15b /lib/linux-gnu-fortran-complex-nodebug/libpetscvec.a(dvec2.o)(.text+0x7581): In function `VecPointwiseMult_Seq': /projects/301/petsc-2.3.1-p15b/src/vec/vec/impls/seq/dvec2.c:848: undefined reference to `fortranxtimesy_' make[2]: [ex19] Error 2 (ignored) /bin/rm -f ex19.o --------------Error detected during compile or link!----------------------- There are basically undefined references to all "fortran*" functions. My questions now are: Am I using the "-DPETSC_USE_FORTRAN_KERNELS"-flag in the correct way? How can I get rid of these errors? I'm very much looking forward to your ideas. Best wishes! Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Tue Sep 19 08:43:21 2006 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 19 Sep 2006 08:43:21 -0500 Subject: Compiling problems using -DPETSC_USE_FORTRAN_KERNELS In-Reply-To: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> Message-ID: On 9/19/06, Patrick Lechner wrote: > > Dear all, > > I have some problems compiling PETSc correctly when using the flag > "-DPETSC_USE_FORTRAN_KERNELS" (to increase the performance of my code). > > My compiling options are: > ./config/configure.py --prefix=/usr/local/compiler/pg-6.1--with-scalar-type=complex --with-cc=/usr/pgi/linux86-64/6.1/bin/pgcc > --with-cxx=/usr/pgi/linux86-64/6.1/bin/pgCC > --with-fc=/usr/pgi/linux86-64/6.1/bin/pgf90 --with-mpi=0 > --with-blas-lapack-lib=-lacml --LDFLAGS=-pgf90libs > --CPPFLAGS=-DPETSC_USE_FORTRAN_KERNELS > You really want to use --with-fortran-kernels=generic. You can find this using --help. Thanks, Matt When trying to run the PETSc test examples, I get error messages like: > /projects/301/petsc-2.3.1-p15b > /lib/linux-gnu-fortran-complex-nodebug/libpetscvec.a(dvec2.o)(.text+0x7581): > In function `VecPointwiseMult_Seq': > /projects/301/petsc-2.3.1-p15b/src/vec/vec/impls/seq/dvec2.c:848: > undefined reference to `fortranxtimesy_' > make[2]: [ex19] Error 2 (ignored) > /bin/rm -f ex19.o > --------------Error detected during compile or > link!----------------------- > > There are basically undefined references to all "fortran*" functions. > My questions now are: > Am I using the "-DPETSC_USE_FORTRAN_KERNELS"-flag in the correct way? > How can I get rid of these errors? > > I'm very much looking forward to your ideas. > Best wishes! > Patrick > > -- "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness -------------- next part -------------- An HTML attachment was scrubbed... URL: From mafunk at nmsu.edu Tue Sep 19 18:02:23 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Tue, 19 Sep 2006 17:02:23 -0600 Subject: using hypre through petsc In-Reply-To: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> Message-ID: <200609191702.25168.mafunk@nmsu.edu> Hi, i am trying to use boomeramg from hypre in petsc. What i am doing right now is simply do: m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) m_ierr = PCHYPRESetType(m_pc,"boomeramg"); then i do my kspsetup etc... i was wondering what other things i need to configure/set to properly use the hypre preconditioner with petsc. This is new to me, so i am not really experienced with this (that is using external packages through petsc). Also, these are the only hypre calls i found in the manual pages. Maybe somebody with more experience can share some of their wisdom ..., or point to a place where i can read up on it? thanks mat From yaronkretchmer at gmail.com Tue Sep 19 18:05:14 2006 From: yaronkretchmer at gmail.com (Yaron Kretchmer) Date: Tue, 19 Sep 2006 16:05:14 -0700 Subject: using hypre through petsc In-Reply-To: <200609191702.25168.mafunk@nmsu.edu> References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> Message-ID: Hi Matt You can start experimenting by using -pc_type hypre -pc_hypre_type boomeramg -help which will give you all the boomeramg options. When I use it I get intermittent segfaults, which I couldn't resolve with the Hypre guys, so good luck. Yaron On 9/19/06, Matt Funk wrote: > > Hi, > > i am trying to use boomeramg from hypre in petsc. What i am doing right > now is > simply do: > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > then i do my kspsetup etc... > > i was wondering what other things i need to configure/set to properly use > the > hypre preconditioner with petsc. This is new to me, so i am not really > experienced with this (that is using external packages through petsc). > Also, > these are the only hypre calls i found in the manual pages. > > Maybe somebody with more experience can share some of their wisdom ..., or > point to a place where i can read up on it? > > > thanks > mat > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mafunk at nmsu.edu Tue Sep 19 18:44:51 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Tue, 19 Sep 2006 17:44:51 -0600 Subject: using hypre through petsc In-Reply-To: References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> Message-ID: <200609191744.53979.mafunk@nmsu.edu> Thanks for the answer. now, when i want to change some of the values, what kind of function do i call to do this? (I cannot seem to find any in the manual pages. And I'd much rather set the option in the code rather than on the command line) mat On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > Hi Matt > You can start experimenting by using > -pc_type hypre -pc_hypre_type boomeramg -help > which will give you all the boomeramg options. > > When I use it I get intermittent segfaults, which I couldn't resolve with > the Hypre guys, so good luck. > > Yaron > > On 9/19/06, Matt Funk wrote: > > Hi, > > > > i am trying to use boomeramg from hypre in petsc. What i am doing right > > now is > > simply do: > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > then i do my kspsetup etc... > > > > i was wondering what other things i need to configure/set to properly use > > the > > hypre preconditioner with petsc. This is new to me, so i am not really > > experienced with this (that is using external packages through petsc). > > Also, > > these are the only hypre calls i found in the manual pages. > > > > Maybe somebody with more experience can share some of their wisdom ..., > > or point to a place where i can read up on it? > > > > > > thanks > > mat From bsmith at mcs.anl.gov Tue Sep 19 21:40:04 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 19 Sep 2006 21:40:04 -0500 (CDT) Subject: using hypre through petsc In-Reply-To: <200609191744.53979.mafunk@nmsu.edu> References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> <200609191744.53979.mafunk@nmsu.edu> Message-ID: Matt, hypre has a big set of options, we have not written a function call interface for all of the options. {humm, could we automate this?} If you wish to do it in the program use the PetscOptionsSetValue() routine to add it to the options database before you set the type to hypre. Barry On Tue, 19 Sep 2006, Matt Funk wrote: > Thanks for the answer. > > now, when i want to change some of the values, what kind of function do i call > to do this? (I cannot seem to find any in the manual pages. And I'd much > rather set the option in the code rather than on the command line) > > mat > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > Hi Matt > > You can start experimenting by using > > -pc_type hypre -pc_hypre_type boomeramg -help > > which will give you all the boomeramg options. > > > > When I use it I get intermittent segfaults, which I couldn't resolve with > > the Hypre guys, so good luck. > > > > Yaron > > > > On 9/19/06, Matt Funk wrote: > > > Hi, > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing right > > > now is > > > simply do: > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > then i do my kspsetup etc... > > > > > > i was wondering what other things i need to configure/set to properly use > > > the > > > hypre preconditioner with petsc. This is new to me, so i am not really > > > experienced with this (that is using external packages through petsc). > > > Also, > > > these are the only hypre calls i found in the manual pages. > > > > > > Maybe somebody with more experience can share some of their wisdom ..., > > > or point to a place where i can read up on it? > > > > > > > > > thanks > > > mat > > From jens.madsen at risoe.dk Thu Sep 21 04:42:59 2006 From: jens.madsen at risoe.dk (jens.madsen at risoe.dk) Date: Thu, 21 Sep 2006 11:42:59 +0200 Subject: TOPSPIN mpich Message-ID: Hi Do you have any experience with TOPSPIN mpich implementation ? I am trying to compile petsc using -with-mpi-include and -with-mpi-lib. First of all I think that I am parsing a wrong argument to -with-mpi-lib= ..... Am I supposed to type the library name, library file name etc. I have tried a lot of things :-) I just need an example on how to compile petsc with "--with-mpi-include" and "--with-mpi-lib" instead of "-with-mpi-dir" Cheers Jens Also thank you Barry. My MG is working now :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Sep 21 07:42:10 2006 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 21 Sep 2006 07:42:10 -0500 Subject: TOPSPIN mpich In-Reply-To: References: Message-ID: On 9/21/06, jens.madsen at risoe.dk wrote: > > Hi > > > Do you have any experience with TOPSPIN mpich implementation ? I am trying > to compile petsc using ?with-mpi-include and ?with-mpi-lib. > > > > First of all I think that I am parsing a wrong argument to ?with-mpi-lib= > ?.. Am I supposed to type the library name, library file name etc. I have > tried a lot of things J I just need an example on how to compile petsc > with "--with-mpi-include" and "--with-mpi-lib" instead of "?with-mpi-dir" > --with-mpi-lib= or --with-mpi-lib=[,,] --with-mpi-include= Matt > Cheers Jens > > > > Also thank you Barry. My MG is working now J > -- "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Thu Sep 21 09:37:46 2006 From: balay at mcs.anl.gov (Satish Balay) Date: Thu, 21 Sep 2006 09:37:46 -0500 (CDT) Subject: TOPSPIN mpich In-Reply-To: References: Message-ID: Does this MPI have mpicc/mpif77 etc? If so - just use: --with-cc=mpicc --with-fc=mpif77 This is less error prone then specifying --with-mpi-include --with-mpi-lib etc.. Satish On Thu, 21 Sep 2006, jens.madsen at risoe.dk wrote: > Hi > > > > Do you have any experience with TOPSPIN mpich implementation ? I am > trying to compile petsc using -with-mpi-include and -with-mpi-lib. > > > > First of all I think that I am parsing a wrong argument to > -with-mpi-lib= ..... Am I supposed to type the library name, library > file name etc. I have tried a lot of things :-) I just need an example > on how to compile petsc with "--with-mpi-include" and "--with-mpi-lib" > instead of "-with-mpi-dir" > > > > Cheers Jens > > > > Also thank you Barry. My MG is working now :-) > > From gdiso at ustc.edu Sun Sep 24 01:21:21 2006 From: gdiso at ustc.edu (Gong Ding) Date: Sun, 24 Sep 2006 14:21:21 +0800 Subject: =?gb2312?B?SG93IGNhbiBJIGNvbXB1dGUgY29uZGl0aW9uIG51bWJlcg==?= Message-ID: <1208d52625c528bc77d70ff8fa5fc6b5@> Hi, I meet some convergince problem with my semiconductor simulation code. I 'd like to check the condition number of Jacobian matrix. How can I do with PETSC? -- USTC Alumni Email System From knepley at gmail.com Sun Sep 24 11:10:45 2006 From: knepley at gmail.com (Matthew Knepley) Date: Sun, 24 Sep 2006 11:10:45 -0500 Subject: How can I compute condition number In-Reply-To: <4488782112437466337@unknownmsgid> References: <4488782112437466337@unknownmsgid> Message-ID: On 9/24/06, Gong Ding wrote: > > Hi, > I meet some convergince problem with my > semiconductor simulation code. I 'd like to check > the condition number of Jacobian matrix. How can I > do with PETSC? The true L_2 condition number would involve a very large SVD calculation, and thus is rarely computed. We do have the option: -ksp_compute_singularvalues which will give you the condition number of the Krylov matrix, a low-dimensional approximation of your matrix. A very convenient form of this is: -ksp_singmonitor which includes this information in the KSP monitor. Thanks, Matt -- > USTC Alumni Email System > -- "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness -------------- next part -------------- An HTML attachment was scrubbed... URL: From randy at geosystem.us Mon Sep 25 13:59:47 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 11:59:47 -0700 Subject: question on solving the transpose of a system Message-ID: <45182723.4040703@geosystem.us> I have a situation where I have to solve the following problems: 1) Ax=b 2) (A)^T u = c A is not symmetric. After I set up my A matrix and the preconditioner P (which is NOT the same as A), I solve it like so: call set_P(da,P,l,m,n,period,resist,x,y,z) call set_A(da,A,l,m,n,period,resist,x,y,z) call MatSetBlockSize(A,3,ierr) call MatSetBlockSize(P,3,ierr) call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) call KSPSolve(ksp,b,xsol,ierr) call KSPGetIterationNumber(ksp,its,ierr) call KSPGetConvergedReason(ksp,reason,ierr) Now, if I want to solve (2) above, do I simply make a call to KSPSolveTranspose(ksp,b,xsol), where I've set b to the right hand side of (2), or do I have to create the transposes of both A and the preconditioner and just use KSPSolve? When I've tried just using KSPSolveTranspose, the preconditioned residual norm falls, but not as rapidly as when doing (1), and the true residual norm seems not to change much at all. Thanks, Randy -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From bsmith at mcs.anl.gov Mon Sep 25 14:16:30 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 25 Sep 2006 14:16:30 -0500 (CDT) Subject: question on solving the transpose of a system In-Reply-To: <45182723.4040703@geosystem.us> References: <45182723.4040703@geosystem.us> Message-ID: Randy, > Now, if I want to solve (2) above, do I simply make a call to > KSPSolveTranspose(ksp,b,xsol), where I've set b to the right > hand side of (2) Yes, this is the way we intend it to be used. You should not have to construct the transposed matrices. Questions: Are you using KSPSetNullSpace()? Are you using right or left preconditioning? Or not setting it? What KSP method are you using? What preconditioner are you using? Barry On Mon, 25 Sep 2006, Randall Mackie wrote: > I have a situation where I have to solve the following problems: > > 1) Ax=b > > 2) (A)^T u = c > > A is not symmetric. > > > After I set up my A matrix and the preconditioner P (which is NOT the same as > A), > I solve it like so: > > > call set_P(da,P,l,m,n,period,resist,x,y,z) > call set_A(da,A,l,m,n,period,resist,x,y,z) > > call MatSetBlockSize(A,3,ierr) > call MatSetBlockSize(P,3,ierr) > > call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) > call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) > > call KSPSolve(ksp,b,xsol,ierr) > call KSPGetIterationNumber(ksp,its,ierr) > call KSPGetConvergedReason(ksp,reason,ierr) > > > Now, if I want to solve (2) above, do I simply make a call to > KSPSolveTranspose(ksp,b,xsol), where I've set b to the right > hand side of (2), or do I have to create the transposes of both > A and the preconditioner and just use KSPSolve? > > > When I've tried just using KSPSolveTranspose, the preconditioned residual > norm falls, but not as rapidly as when doing (1), and the true residual norm > seems not to change much at all. > > > Thanks, Randy > > > From randy at geosystem.us Mon Sep 25 14:18:49 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 12:18:49 -0700 Subject: question on solving the transpose of a system In-Reply-To: References: <45182723.4040703@geosystem.us> Message-ID: <45182B99.5090600@geosystem.us> Barry Smith wrote: > Randy, > >> Now, if I want to solve (2) above, do I simply make a call to >> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >> hand side of (2) > > Yes, this is the way we intend it to be used. You should not > have to construct the transposed matrices. > > Questions: > > Are you using KSPSetNullSpace()? No > Are you using right or left preconditioning? Or not setting it? I'm not setting it, just using the default > What KSP method are you using? > What preconditioner are you using? -em_ksp_truemonitor \ -em_ksp_type bcgs \ -em_pc_type bjacobi \ -em_sub_pc_type ilu \ -em_sub_pc_factor_levels 3 \ -em_sub_pc_factor_fill 6 \ > > Barry > > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > >> I have a situation where I have to solve the following problems: >> >> 1) Ax=b >> >> 2) (A)^T u = c >> >> A is not symmetric. >> >> >> After I set up my A matrix and the preconditioner P (which is NOT the same as >> A), >> I solve it like so: >> >> >> call set_P(da,P,l,m,n,period,resist,x,y,z) >> call set_A(da,A,l,m,n,period,resist,x,y,z) >> >> call MatSetBlockSize(A,3,ierr) >> call MatSetBlockSize(P,3,ierr) >> >> call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) >> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) >> >> call KSPSolve(ksp,b,xsol,ierr) >> call KSPGetIterationNumber(ksp,its,ierr) >> call KSPGetConvergedReason(ksp,reason,ierr) >> >> >> Now, if I want to solve (2) above, do I simply make a call to >> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >> hand side of (2), or do I have to create the transposes of both >> A and the preconditioner and just use KSPSolve? >> >> >> When I've tried just using KSPSolveTranspose, the preconditioned residual >> norm falls, but not as rapidly as when doing (1), and the true residual norm >> seems not to change much at all. >> >> >> Thanks, Randy >> >> >> > -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From bsmith at mcs.anl.gov Mon Sep 25 14:24:38 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 25 Sep 2006 14:24:38 -0500 (CDT) Subject: question on solving the transpose of a system In-Reply-To: <45182B99.5090600@geosystem.us> References: <45182723.4040703@geosystem.us> <45182B99.5090600@geosystem.us> Message-ID: Randy, Do you have this problem on one process? Barry On Mon, 25 Sep 2006, Randall Mackie wrote: > > > Barry Smith wrote: > > Randy, > > > > > Now, if I want to solve (2) above, do I simply make a call to > > > KSPSolveTranspose(ksp,b,xsol), where I've set b to the right > > > hand side of (2) > > > > Yes, this is the way we intend it to be used. You should not > > have to construct the transposed matrices. > > > > Questions: > > > > Are you using KSPSetNullSpace()? > > No > > > Are you using right or left preconditioning? Or not setting it? > > I'm not setting it, just using the default > > > > What KSP method are you using? > > What preconditioner are you using? > > -em_ksp_truemonitor \ > -em_ksp_type bcgs \ > -em_pc_type bjacobi \ > -em_sub_pc_type ilu \ > -em_sub_pc_factor_levels 3 \ > -em_sub_pc_factor_fill 6 \ > > > > > Barry > > > > > > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > > > > > I have a situation where I have to solve the following problems: > > > > > > 1) Ax=b > > > > > > 2) (A)^T u = c > > > > > > A is not symmetric. > > > > > > > > > After I set up my A matrix and the preconditioner P (which is NOT the same > > > as > > > A), > > > I solve it like so: > > > > > > > > > call set_P(da,P,l,m,n,period,resist,x,y,z) > > > call set_A(da,A,l,m,n,period,resist,x,y,z) > > > > > > call MatSetBlockSize(A,3,ierr) > > > call MatSetBlockSize(P,3,ierr) > > > > > > call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) > > > call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) > > > > > > call KSPSolve(ksp,b,xsol,ierr) > > > call KSPGetIterationNumber(ksp,its,ierr) > > > call KSPGetConvergedReason(ksp,reason,ierr) > > > > > > > > > Now, if I want to solve (2) above, do I simply make a call to > > > KSPSolveTranspose(ksp,b,xsol), where I've set b to the right > > > hand side of (2), or do I have to create the transposes of both > > > A and the preconditioner and just use KSPSolve? > > > > > > > > > When I've tried just using KSPSolveTranspose, the preconditioned residual > > > norm falls, but not as rapidly as when doing (1), and the true residual > > > norm > > > seems not to change much at all. > > > > > > > > > Thanks, Randy > > > > > > > > > > > > > From bsmith at mcs.anl.gov Mon Sep 25 14:35:17 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 25 Sep 2006 14:35:17 -0500 (CDT) Subject: question on solving the transpose of a system In-Reply-To: <45182B99.5090600@geosystem.us> References: <45182723.4040703@geosystem.us> <45182B99.5090600@geosystem.us> Message-ID: Randy, Can you try -ksp_type gmres and see if you still get the affect? Barry On Mon, 25 Sep 2006, Randall Mackie wrote: > > > Barry Smith wrote: > > Randy, > > > > > Now, if I want to solve (2) above, do I simply make a call to > > > KSPSolveTranspose(ksp,b,xsol), where I've set b to the right > > > hand side of (2) > > > > Yes, this is the way we intend it to be used. You should not > > have to construct the transposed matrices. > > > > Questions: > > > > Are you using KSPSetNullSpace()? > > No > > > Are you using right or left preconditioning? Or not setting it? > > I'm not setting it, just using the default > > > > What KSP method are you using? > > What preconditioner are you using? > > -em_ksp_truemonitor \ > -em_ksp_type bcgs \ > -em_pc_type bjacobi \ > -em_sub_pc_type ilu \ > -em_sub_pc_factor_levels 3 \ > -em_sub_pc_factor_fill 6 \ > > > > > Barry > > > > > > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > > > > > I have a situation where I have to solve the following problems: > > > > > > 1) Ax=b > > > > > > 2) (A)^T u = c > > > > > > A is not symmetric. > > > > > > > > > After I set up my A matrix and the preconditioner P (which is NOT the same > > > as > > > A), > > > I solve it like so: > > > > > > > > > call set_P(da,P,l,m,n,period,resist,x,y,z) > > > call set_A(da,A,l,m,n,period,resist,x,y,z) > > > > > > call MatSetBlockSize(A,3,ierr) > > > call MatSetBlockSize(P,3,ierr) > > > > > > call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) > > > call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) > > > > > > call KSPSolve(ksp,b,xsol,ierr) > > > call KSPGetIterationNumber(ksp,its,ierr) > > > call KSPGetConvergedReason(ksp,reason,ierr) > > > > > > > > > Now, if I want to solve (2) above, do I simply make a call to > > > KSPSolveTranspose(ksp,b,xsol), where I've set b to the right > > > hand side of (2), or do I have to create the transposes of both > > > A and the preconditioner and just use KSPSolve? > > > > > > > > > When I've tried just using KSPSolveTranspose, the preconditioned residual > > > norm falls, but not as rapidly as when doing (1), and the true residual > > > norm > > > seems not to change much at all. > > > > > > > > > Thanks, Randy > > > > > > > > > > > > > From randy at geosystem.us Mon Sep 25 14:41:16 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 12:41:16 -0700 Subject: question on solving the transpose of a system In-Reply-To: References: <45182723.4040703@geosystem.us> <45182B99.5090600@geosystem.us> Message-ID: <451830DC.3040201@geosystem.us> I'm only running on one processor at the moment, this is the behavior I'm talking about: (note that KSPSolve on the original matrix works great) 0 KSP preconditioned resid norm 1.390903128574e-04 true resid norm 7.071067811865e-01 1 KSP preconditioned resid norm 4.599763143217e-05 true resid norm 8.322371331683e-01 2 KSP preconditioned resid norm 1.654272381302e-04 true resid norm 8.003440639371e-01 3 KSP preconditioned resid norm 7.136279098867e-02 true resid norm 4.349303771363e+01 4 KSP preconditioned resid norm 5.796284088553e-03 true resid norm 4.955296676945e-01 5 KSP preconditioned resid norm 4.768750713012e-03 true resid norm 3.137347590723e-01 6 KSP preconditioned resid norm 3.408688625913e-03 true resid norm 1.945847883068e-01 7 KSP preconditioned resid norm 2.583172643288e-03 true resid norm 7.634413690787e-01 8 KSP preconditioned resid norm 2.019037806077e-03 true resid norm 2.514111815705e-01 9 KSP preconditioned resid norm 1.000916210470e-03 true resid norm 1.149340854362e-01 10 KSP preconditioned resid norm 6.961789967280e-04 true resid norm 7.473089637106e-02 11 KSP preconditioned resid norm 5.318821017005e-04 true resid norm 6.819674638097e-02 12 KSP preconditioned resid norm 5.102845585294e-04 true resid norm 7.504782304994e-02 13 KSP preconditioned resid norm 4.827530166955e-04 true resid norm 6.961251586046e-02 14 KSP preconditioned resid norm 4.650489781850e-04 true resid norm 7.105110351352e-02 15 KSP preconditioned resid norm 7.554860350168e-04 true resid norm 1.362292692709e-01 16 KSP preconditioned resid norm 3.856120189896e-04 true resid norm 8.611614029207e-02 17 KSP preconditioned resid norm 3.388301062554e-04 true resid norm 7.937086351967e-02 18 KSP preconditioned resid norm 3.941150978725e-04 true resid norm 8.480487700195e-02 19 KSP preconditioned resid norm 2.618186602635e-04 true resid norm 8.182966564123e-02 20 KSP preconditioned resid norm 2.329131506171e-04 true resid norm 8.529721065137e-02 21 KSP preconditioned resid norm 2.290962719325e-04 true resid norm 8.698456707472e-02 22 KSP preconditioned resid norm 2.288880028982e-04 true resid norm 8.540349746618e-02 23 KSP preconditioned resid norm 2.054973204158e-04 true resid norm 8.959104987193e-02 24 KSP preconditioned resid norm 1.959904943582e-04 true resid norm 9.045567512559e-02 25 KSP preconditioned resid norm 1.952418586285e-04 true resid norm 9.007738434662e-02 26 KSP preconditioned resid norm 2.251677392651e-04 true resid norm 9.589901454236e-02 27 KSP preconditioned resid norm 2.333244796735e-04 true resid norm 9.566927017538e-02 28 KSP preconditioned resid norm 2.415316032032e-04 true resid norm 9.646694389042e-02 29 KSP preconditioned resid norm 2.486845824748e-04 true resid norm 9.739660339140e-02 30 KSP preconditioned resid norm 3.496031881750e-04 true resid norm 9.191874052601e-02 31 KSP preconditioned resid norm 2.742098425944e-04 true resid norm 1.036225649385e-01 32 KSP preconditioned resid norm 2.918732801969e-04 true resid norm 1.061810009699e-01 33 KSP preconditioned resid norm 2.911510984457e-04 true resid norm 1.067104526588e-01 34 KSP preconditioned resid norm 2.812031840107e-04 true resid norm 1.060861749923e-01 35 KSP preconditioned resid norm 2.736426511632e-04 true resid norm 1.062681091319e-01 36 KSP preconditioned resid norm 2.452982568345e-04 true resid norm 1.058722690723e-01 37 KSP preconditioned resid norm 2.636619237574e-04 true resid norm 1.045871337618e-01 38 KSP preconditioned resid norm 2.363085860212e-04 true resid norm 1.061122603986e-01 39 KSP preconditioned resid norm 2.307147509961e-04 true resid norm 1.164653200787e-01 40 KSP preconditioned resid norm 2.076585793357e-04 true resid norm 1.036395343938e-01 41 KSP preconditioned resid norm 9.748011400474e-05 true resid norm 1.217755590404e-01 42 KSP preconditioned resid norm 8.044274057205e-05 true resid norm 1.308671247290e-01 43 KSP preconditioned resid norm 3.704513052916e-05 true resid norm 1.418486616816e-01 44 KSP preconditioned resid norm 1.808370336561e-05 true resid norm 1.462866580439e-01 45 KSP preconditioned resid norm 1.007327518499e-05 true resid norm 1.469533395294e-01 46 KSP preconditioned resid norm 7.474203323248e-06 true resid norm 1.471196722197e-01 47 KSP preconditioned resid norm 3.104362804334e-06 true resid norm 1.464133558701e-01 48 KSP preconditioned resid norm 3.916281651035e-06 true resid norm 1.459108432786e-01 49 KSP preconditioned resid norm 2.125266913518e-06 true resid norm 1.459915674565e-01 50 KSP preconditioned resid norm 1.278372472354e-06 true resid norm 1.460058114531e-01 51 KSP preconditioned resid norm 1.154265590044e-06 true resid norm 1.460037010751e-01 52 KSP preconditioned resid norm 8.377365056555e-07 true resid norm 1.461658296202e-01 53 KSP preconditioned resid norm 6.259258415049e-07 true resid norm 1.461829228733e-01 54 KSP preconditioned resid norm 4.864836311168e-07 true resid norm 1.460741388015e-01 55 KSP preconditioned resid norm 3.193814690832e-07 true resid norm 1.461503915286e-01 56 KSP preconditioned resid norm 3.117670096628e-07 true resid norm 1.461442206620e-01 57 KSP preconditioned resid norm 2.794649220494e-08 true resid norm 1.462036860889e-01 58 KSP preconditioned resid norm 5.305003844821e-08 true resid norm 1.461952341641e-01 59 KSP preconditioned resid norm 4.858416309274e-08 true resid norm 1.461955191337e-01 60 KSP preconditioned resid norm 4.961086764514e-08 true resid norm 1.461980523947e-01 61 KSP preconditioned resid norm 3.593919110530e-08 true resid norm 1.462003890061e-01 62 KSP preconditioned resid norm 1.654302376661e-08 true resid norm 1.462081188051e-01 63 KSP preconditioned resid norm 1.616013993598e-08 true resid norm 1.462087103241e-01 64 KSP preconditioned resid norm 1.629058386377e-08 true resid norm 1.462088185303e-01 65 KSP preconditioned resid norm 1.642015568778e-08 true resid norm 1.462086724918e-01 66 KSP preconditioned resid norm 1.702949256327e-08 true resid norm 1.462088581780e-01 67 KSP preconditioned resid norm 1.701842873848e-08 true resid norm 1.462087329483e-01 68 KSP preconditioned resid norm 1.695944590616e-08 true resid norm 1.462087098414e-01 69 KSP preconditioned resid norm 1.696929117551e-08 true resid norm 1.462086881118e-01 70 KSP preconditioned resid norm 1.700242718414e-08 true resid norm 1.462087228929e-01 71 KSP preconditioned resid norm 1.658065137177e-08 true resid norm 1.462086814880e-01 72 KSP preconditioned resid norm 1.662100494981e-08 true resid norm 1.462087581058e-01 73 KSP preconditioned resid norm 1.629897996614e-08 true resid norm 1.462088048567e-01 74 KSP preconditioned resid norm 1.625741596991e-08 true resid norm 1.462088774477e-01 75 KSP preconditioned resid norm 1.624765824983e-08 true resid norm 1.462089036067e-01 76 KSP preconditioned resid norm 1.626897149810e-08 true resid norm 1.462085483495e-01 77 KSP preconditioned resid norm 1.635255659489e-08 true resid norm 1.462065713317e-01 78 KSP preconditioned resid norm 1.628063309886e-08 true resid norm 1.462070325450e-01 79 KSP preconditioned resid norm 1.632101341913e-08 true resid norm 1.462054785290e-01 80 KSP preconditioned resid norm 1.650324175189e-08 true resid norm 1.462015895771e-01 81 KSP preconditioned resid norm 1.648384674574e-08 true resid norm 1.462009093701e-01 82 KSP preconditioned resid norm 1.646363445772e-08 true resid norm 1.462001938088e-01 83 KSP preconditioned resid norm 1.642895250869e-08 true resid norm 1.462001704846e-01 84 KSP preconditioned resid norm 1.696723246615e-08 true resid norm 1.461858749698e-01 85 KSP preconditioned resid norm 1.856665593258e-08 true resid norm 1.462124281091e-01 86 KSP preconditioned resid norm 1.841962116850e-08 true resid norm 1.462148912533e-01 87 KSP preconditioned resid norm 1.698558241454e-08 true resid norm 1.461781897268e-01 88 KSP preconditioned resid norm 1.905123320211e-08 true resid norm 1.466101067430e-01 89 KSP preconditioned resid norm 1.711173152252e-08 true resid norm 1.463386042754e-01 90 KSP preconditioned resid norm 1.784287144041e-08 true resid norm 1.464641485021e-01 91 KSP preconditioned resid norm 1.808297575000e-08 true resid norm 1.464123027903e-01 92 KSP preconditioned resid norm 1.820795767966e-08 true resid norm 1.463642823300e-01 93 KSP preconditioned resid norm 1.811029186150e-08 true resid norm 1.464525930488e-01 94 KSP preconditioned resid norm 1.837449132765e-08 true resid norm 1.467284100358e-01 95 KSP preconditioned resid norm 1.799274687142e-08 true resid norm 1.467334617102e-01 96 KSP preconditioned resid norm 1.780871897998e-08 true resid norm 1.467508060173e-01 97 KSP preconditioned resid norm 1.780933765924e-08 true resid norm 1.466991064681e-01 98 KSP preconditioned resid norm 1.693611578188e-08 true resid norm 1.468053166786e-01 Barry Smith wrote: > Randy, > > Do you have this problem on one process? > > Barry > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > >> >> Barry Smith wrote: >>> Randy, >>> >>>> Now, if I want to solve (2) above, do I simply make a call to >>>> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >>>> hand side of (2) >>> Yes, this is the way we intend it to be used. You should not >>> have to construct the transposed matrices. >>> >>> Questions: >>> >>> Are you using KSPSetNullSpace()? >> No >> >>> Are you using right or left preconditioning? Or not setting it? >> I'm not setting it, just using the default >> >> >>> What KSP method are you using? >>> What preconditioner are you using? >> -em_ksp_truemonitor \ >> -em_ksp_type bcgs \ >> -em_pc_type bjacobi \ >> -em_sub_pc_type ilu \ >> -em_sub_pc_factor_levels 3 \ >> -em_sub_pc_factor_fill 6 \ >> >>> Barry >>> >>> >>> >>> On Mon, 25 Sep 2006, Randall Mackie wrote: >>> >>>> I have a situation where I have to solve the following problems: >>>> >>>> 1) Ax=b >>>> >>>> 2) (A)^T u = c >>>> >>>> A is not symmetric. >>>> >>>> >>>> After I set up my A matrix and the preconditioner P (which is NOT the same >>>> as >>>> A), >>>> I solve it like so: >>>> >>>> >>>> call set_P(da,P,l,m,n,period,resist,x,y,z) >>>> call set_A(da,A,l,m,n,period,resist,x,y,z) >>>> >>>> call MatSetBlockSize(A,3,ierr) >>>> call MatSetBlockSize(P,3,ierr) >>>> >>>> call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) >>>> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) >>>> >>>> call KSPSolve(ksp,b,xsol,ierr) >>>> call KSPGetIterationNumber(ksp,its,ierr) >>>> call KSPGetConvergedReason(ksp,reason,ierr) >>>> >>>> >>>> Now, if I want to solve (2) above, do I simply make a call to >>>> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >>>> hand side of (2), or do I have to create the transposes of both >>>> A and the preconditioner and just use KSPSolve? >>>> >>>> >>>> When I've tried just using KSPSolveTranspose, the preconditioned residual >>>> norm falls, but not as rapidly as when doing (1), and the true residual >>>> norm >>>> seems not to change much at all. >>>> >>>> >>>> Thanks, Randy >>>> >>>> >>>> >> > -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From randy at geosystem.us Mon Sep 25 14:43:41 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 12:43:41 -0700 Subject: question on solving the transpose of a system In-Reply-To: References: <45182723.4040703@geosystem.us> <45182B99.5090600@geosystem.us> Message-ID: <4518316D.1050202@geosystem.us> Barry, Same effect with gmres. I'm going to try using MatTranspose and transpose both A and P, and use KSPSolve and see what happens. Randy Barry Smith wrote: > Randy, > > Can you try -ksp_type gmres and see if you still get the > affect? > > Barry > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > >> >> Barry Smith wrote: >>> Randy, >>> >>>> Now, if I want to solve (2) above, do I simply make a call to >>>> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >>>> hand side of (2) >>> Yes, this is the way we intend it to be used. You should not >>> have to construct the transposed matrices. >>> >>> Questions: >>> >>> Are you using KSPSetNullSpace()? >> No >> >>> Are you using right or left preconditioning? Or not setting it? >> I'm not setting it, just using the default >> >> >>> What KSP method are you using? >>> What preconditioner are you using? >> -em_ksp_truemonitor \ >> -em_ksp_type bcgs \ >> -em_pc_type bjacobi \ >> -em_sub_pc_type ilu \ >> -em_sub_pc_factor_levels 3 \ >> -em_sub_pc_factor_fill 6 \ >> >>> Barry >>> >>> >>> >>> On Mon, 25 Sep 2006, Randall Mackie wrote: >>> >>>> I have a situation where I have to solve the following problems: >>>> >>>> 1) Ax=b >>>> >>>> 2) (A)^T u = c >>>> >>>> A is not symmetric. >>>> >>>> >>>> After I set up my A matrix and the preconditioner P (which is NOT the same >>>> as >>>> A), >>>> I solve it like so: >>>> >>>> >>>> call set_P(da,P,l,m,n,period,resist,x,y,z) >>>> call set_A(da,A,l,m,n,period,resist,x,y,z) >>>> >>>> call MatSetBlockSize(A,3,ierr) >>>> call MatSetBlockSize(P,3,ierr) >>>> >>>> call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) >>>> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) >>>> >>>> call KSPSolve(ksp,b,xsol,ierr) >>>> call KSPGetIterationNumber(ksp,its,ierr) >>>> call KSPGetConvergedReason(ksp,reason,ierr) >>>> >>>> >>>> Now, if I want to solve (2) above, do I simply make a call to >>>> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >>>> hand side of (2), or do I have to create the transposes of both >>>> A and the preconditioner and just use KSPSolve? >>>> >>>> >>>> When I've tried just using KSPSolveTranspose, the preconditioned residual >>>> norm falls, but not as rapidly as when doing (1), and the true residual >>>> norm >>>> seems not to change much at all. >>>> >>>> >>>> Thanks, Randy >>>> >>>> >>>> >> > -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From randy at geosystem.us Mon Sep 25 16:10:51 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 14:10:51 -0700 Subject: question on solving the transpose of a system In-Reply-To: References: <45182723.4040703@geosystem.us> Message-ID: <451845DB.2060206@geosystem.us> Barry, I tried in my program simply doing an in-place transpose: Call MatTranspose (A, PETSC_NULL, ierr) and it returns an error code of 0, but the KSPSolve still seems to be on the untransposed system. Not sure how to actually get the transpose inside my code. Randy Barry Smith wrote: > Randy, > >> Now, if I want to solve (2) above, do I simply make a call to >> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >> hand side of (2) > > Yes, this is the way we intend it to be used. You should not > have to construct the transposed matrices. > > Questions: > > Are you using KSPSetNullSpace()? > Are you using right or left preconditioning? Or not setting it? > What KSP method are you using? > What preconditioner are you using? > > Barry > > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > >> I have a situation where I have to solve the following problems: >> >> 1) Ax=b >> >> 2) (A)^T u = c >> >> A is not symmetric. >> >> >> After I set up my A matrix and the preconditioner P (which is NOT the same as >> A), >> I solve it like so: >> >> >> call set_P(da,P,l,m,n,period,resist,x,y,z) >> call set_A(da,A,l,m,n,period,resist,x,y,z) >> >> call MatSetBlockSize(A,3,ierr) >> call MatSetBlockSize(P,3,ierr) >> >> call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr) >> call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr) >> >> call KSPSolve(ksp,b,xsol,ierr) >> call KSPGetIterationNumber(ksp,its,ierr) >> call KSPGetConvergedReason(ksp,reason,ierr) >> >> >> Now, if I want to solve (2) above, do I simply make a call to >> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right >> hand side of (2), or do I have to create the transposes of both >> A and the preconditioner and just use KSPSolve? >> >> >> When I've tried just using KSPSolveTranspose, the preconditioned residual >> norm falls, but not as rapidly as when doing (1), and the true residual norm >> seems not to change much at all. >> >> >> Thanks, Randy >> >> >> > -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From randy at geosystem.us Mon Sep 25 19:11:13 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 17:11:13 -0700 Subject: KSPSolveTranspose Message-ID: <45187021.4000309@geosystem.us> If one calls KSPSolveTranspose, how does PETSc actually do the solve? Does it simply use the transpose of the pre-computed preconditioner as the preconditioner for the Transpose solve, or does it recompute the ILU of the transpose matrix? I suspect they are not the same. As posted in earlier emails, the preconditioned and true residual numbers don't seem correct to me, but the results are fine (I have other ways to check the results). I've tried taking the transpose of the matrix within my Fortran code, but I'm not quite sure how to get this to work. It requires passing of a NULL pointer, but it's not clear how to do this in Fortran. What I would like to do is to get the transpose of my matrix within my code, and then do a KSPSolve on that to confirm whether the residual numbers I'm getting from KSPSolveTranspose are correct. Any pointers on doing this would be appreciated. Randy -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From bsmith at mcs.anl.gov Mon Sep 25 19:42:18 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 25 Sep 2006 19:42:18 -0500 (CDT) Subject: KSPSolveTranspose In-Reply-To: <45187021.4000309@geosystem.us> References: <45187021.4000309@geosystem.us> Message-ID: Randy, Why not just call MatTranspose(A,A2,ierr) call MatTranspose(P,P2,ierr) KSPSetOperators(ksp,A2,P2... etc? On Mon, 25 Sep 2006, Randall Mackie wrote: > If one calls KSPSolveTranspose, how does PETSc actually do the solve? > Does it simply use the transpose of the pre-computed preconditioner > as the preconditioner for the Transpose solve, or does it recompute > the ILU of the transpose matrix? I suspect they are not the same. It uses MatMultTranspose() and PCApplyTranspose(). So, no it does not refactor the matrix. Barry > > As posted in earlier emails, the preconditioned and true residual numbers > don't seem correct to me, but the results are fine (I have other ways > to check the results). > > I've tried taking the transpose of the matrix within my Fortran > code, but I'm not quite sure how to get this to work. It requires > passing of a NULL pointer, but it's not clear how to do this > in Fortran. > > What I would like to do is to get the transpose of my matrix within > my code, and then do a KSPSolve on that to confirm whether the > residual numbers I'm getting from KSPSolveTranspose are correct. > > Any pointers on doing this would be appreciated. > > Randy > > From randy at geosystem.us Mon Sep 25 19:54:50 2006 From: randy at geosystem.us (Randall Mackie) Date: Mon, 25 Sep 2006 17:54:50 -0700 Subject: KSPSolveTranspose In-Reply-To: References: <45187021.4000309@geosystem.us> Message-ID: <45187A5A.5070305@geosystem.us> Barry, Do I have to create A2 (or duplicate it or something) before calling MatTranspose, or is it automatically created? The documentation is unclear about this. Randy Barry Smith wrote: > Randy, > > Why not just call MatTranspose(A,A2,ierr) > call MatTranspose(P,P2,ierr) > KSPSetOperators(ksp,A2,P2... etc? > > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > >> If one calls KSPSolveTranspose, how does PETSc actually do the solve? >> Does it simply use the transpose of the pre-computed preconditioner >> as the preconditioner for the Transpose solve, or does it recompute >> the ILU of the transpose matrix? I suspect they are not the same. > > It uses MatMultTranspose() and PCApplyTranspose(). So, no it does not > refactor the matrix. > > Barry > >> As posted in earlier emails, the preconditioned and true residual numbers >> don't seem correct to me, but the results are fine (I have other ways >> to check the results). >> >> I've tried taking the transpose of the matrix within my Fortran >> code, but I'm not quite sure how to get this to work. It requires >> passing of a NULL pointer, but it's not clear how to do this >> in Fortran. >> >> What I would like to do is to get the transpose of my matrix within >> my code, and then do a KSPSolve on that to confirm whether the >> residual numbers I'm getting from KSPSolveTranspose are correct. >> >> Any pointers on doing this would be appreciated. >> >> Randy >> >> > -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From bsmith at mcs.anl.gov Mon Sep 25 19:58:42 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 25 Sep 2006 19:58:42 -0500 (CDT) Subject: KSPSolveTranspose In-Reply-To: <45187A5A.5070305@geosystem.us> References: <45187021.4000309@geosystem.us> <45187A5A.5070305@geosystem.us> Message-ID: It is created. On Mon, 25 Sep 2006, Randall Mackie wrote: > Barry, > > Do I have to create A2 (or duplicate it or something) > before calling MatTranspose, or is it automatically created? > The documentation is unclear about this. > > Randy > > > Barry Smith wrote: > > Randy, > > > > Why not just call MatTranspose(A,A2,ierr) > > call MatTranspose(P,P2,ierr) > > KSPSetOperators(ksp,A2,P2... etc? > > > > > > > > On Mon, 25 Sep 2006, Randall Mackie wrote: > > > > > If one calls KSPSolveTranspose, how does PETSc actually do the solve? > > > Does it simply use the transpose of the pre-computed preconditioner > > > as the preconditioner for the Transpose solve, or does it recompute > > > the ILU of the transpose matrix? I suspect they are not the same. > > > > It uses MatMultTranspose() and PCApplyTranspose(). So, no it does not > > refactor the matrix. > > > > Barry > > > > > As posted in earlier emails, the preconditioned and true residual numbers > > > don't seem correct to me, but the results are fine (I have other ways > > > to check the results). > > > > > > I've tried taking the transpose of the matrix within my Fortran > > > code, but I'm not quite sure how to get this to work. It requires > > > passing of a NULL pointer, but it's not clear how to do this > > > in Fortran. > > > > > > What I would like to do is to get the transpose of my matrix within > > > my code, and then do a KSPSolve on that to confirm whether the > > > residual numbers I'm getting from KSPSolveTranspose are correct. > > > > > > Any pointers on doing this would be appreciated. > > > > > > Randy > > > > > > > > > > From randy at geosystem.us Tue Sep 26 18:59:29 2006 From: randy at geosystem.us (Randall Mackie) Date: Tue, 26 Sep 2006 16:59:29 -0700 Subject: KSPSolveTranspose and PCFieldSplit Message-ID: <4519BEE1.4050200@geosystem.us> When I try to use KSPSolveTranspose with PCFieldSplit, I get the following errors: [0]PETSC ERROR: PCApplyTranspose() line 483 in src/ksp/pc/interface/precon.c [0]PETSC ERROR: No support for this operation for this object type! [0]PETSC ERROR: ! [0]PETSC ERROR: KSPInitialResidual() line 56 in src/ksp/ksp/interface/itres.c [0]PETSC ERROR: KSPSolve_BCGS() line 41 in src/ksp/ksp/impls/bcgs/bcgs.c [0]PETSC ERROR: KSPSolveTranspose() line 562 in src/ksp/ksp/interface/itfunc.c So then I thought in my code I would just take the transpose of A and call KSPSolve, but then I get the following errors: [0]PETSC ERROR: MatGetSubMatrix_SeqAIJ() line 1686 in src/mat/impls/aij/seq/aij.c [0]PETSC ERROR: Nonconforming object sizes! [0]PETSC ERROR: Cannot reuse matrix. wrong no of nonzeros! [0]PETSC ERROR: MatGetSubMatrices_SeqAIJ() line 1799 in src/mat/impls/aij/seq/aij.c [0]PETSC ERROR: MatGetSubMatrices() line 4828 in src/mat/interface/matrix.c [0]PETSC ERROR: MatGetSubMatrix() line 5438 in src/mat/interface/matrix.c [0]PETSC ERROR: PCSetUp_FieldSplit() line 162 in src/ksp/pc/impls/fieldsplit/fieldsplit.c [0]PETSC ERROR: PCSetUp() line 798 in src/ksp/pc/interface/precon.c [0]PETSC ERROR: KSPSetUp() line 234 in src/ksp/ksp/interface/itfunc.c [0]PETSC ERROR: KSPSolve() line 334 in src/ksp/ksp/interface/itfunc.c Is there some reason why the PCFIeildSplit is not compatible with KSPSolveTranspose? I'm solving with the following options: -em_ksp_truemonitor \ -em_ksp_type bcgs \ -em_pc_type fieldsplit \ -em_pc_fieldsplit_default \ -em_pc_fieldsplit_type multiplicative \ -em_fieldsplit_pc_type bjacobi \ -em_fieldsplit_sub_pc_type ilu \ -em_fieldsplit_sub_pc_factor_levels 4 \ -em_fieldsplit_sub_pc_factor_fill 10 \ Randy -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From bsmith at mcs.anl.gov Tue Sep 26 19:56:00 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 26 Sep 2006 19:56:00 -0500 (CDT) Subject: KSPSolveTranspose and PCFieldSplit In-Reply-To: <4519BEE1.4050200@geosystem.us> References: <4519BEE1.4050200@geosystem.us> Message-ID: On Tue, 26 Sep 2006, Randall Mackie wrote: > When I try to use KSPSolveTranspose with PCFieldSplit, I get the following > errors: > > [0]PETSC ERROR: PCApplyTranspose() line 483 in src/ksp/pc/interface/precon.c > [0]PETSC ERROR: No support for this operation for this object type! > [0]PETSC ERROR: ! > [0]PETSC ERROR: KSPInitialResidual() line 56 in src/ksp/ksp/interface/itres.c > [0]PETSC ERROR: KSPSolve_BCGS() line 41 in src/ksp/ksp/impls/bcgs/bcgs.c > [0]PETSC ERROR: KSPSolveTranspose() line 562 in src/ksp/ksp/interface/itfunc.c > This is just "lazyness", I hadn't implemented the apply transpose. I've added it now to PETSc-dev; the problem is it cannot be made into an easy patch since it involves several nontrivial changes. > > So then I thought in my code I would just take the transpose of A and call > KSPSolve, but then I get the following errors: > > [0]PETSC ERROR: MatGetSubMatrix_SeqAIJ() line 1686 in > src/mat/impls/aij/seq/aij.c > [0]PETSC ERROR: Nonconforming object sizes! > [0]PETSC ERROR: Cannot reuse matrix. wrong no of nonzeros! > [0]PETSC ERROR: MatGetSubMatrices_SeqAIJ() line 1799 in > src/mat/impls/aij/seq/aij.c > [0]PETSC ERROR: MatGetSubMatrices() line 4828 in src/mat/interface/matrix.c > [0]PETSC ERROR: MatGetSubMatrix() line 5438 in src/mat/interface/matrix.c > [0]PETSC ERROR: PCSetUp_FieldSplit() line 162 in > src/ksp/pc/impls/fieldsplit/fieldsplit.c > [0]PETSC ERROR: PCSetUp() line 798 in src/ksp/pc/interface/precon.c > [0]PETSC ERROR: KSPSetUp() line 234 in src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: KSPSolve() line 334 in src/ksp/ksp/interface/itfunc.c > > I'm guessing you used MAT_SAME_NONZERO_PATTERN? But the transpose won't have the same nonzero pattern? BTW: Did you find explicitly forming the transposes and solving worked better than just using KSPSolveTranspose()? Barry > Is there some reason why the PCFIeildSplit is not compatible with > KSPSolveTranspose? > > I'm solving with the following options: > > > -em_ksp_truemonitor \ > -em_ksp_type bcgs \ > -em_pc_type fieldsplit \ > -em_pc_fieldsplit_default \ > -em_pc_fieldsplit_type multiplicative \ > -em_fieldsplit_pc_type bjacobi \ > -em_fieldsplit_sub_pc_type ilu \ > -em_fieldsplit_sub_pc_factor_levels 4 \ > -em_fieldsplit_sub_pc_factor_fill 10 \ > > Randy > > From randy at geosystem.us Tue Sep 26 20:06:55 2006 From: randy at geosystem.us (Randall Mackie) Date: Tue, 26 Sep 2006 18:06:55 -0700 Subject: KSPSolveTranspose and PCFieldSplit In-Reply-To: References: <4519BEE1.4050200@geosystem.us> Message-ID: <4519CEAF.2050307@geosystem.us> Barry, Okay, I assume this means it will be done at some point in the near future? I tried taking the transpose in my code, and then using KSPSolve, but then I was getting error messages about zero pivots. I then added -pc_shift_positive_definite and it ran, but it didn't seem to do any better than KSPSolveTranspose, although I haven't been able to spend a lot of time on that. I'll just add another KSP in my code, one to use the fieldsplit PC for the first problem, and then another one to just use ILU for the transpose problem, at least until you get the patch for fieldsplit PC. Thanks, Randy Barry Smith wrote: > > On Tue, 26 Sep 2006, Randall Mackie wrote: > >> When I try to use KSPSolveTranspose with PCFieldSplit, I get the following >> errors: >> >> [0]PETSC ERROR: PCApplyTranspose() line 483 in src/ksp/pc/interface/precon.c >> [0]PETSC ERROR: No support for this operation for this object type! >> [0]PETSC ERROR: ! >> [0]PETSC ERROR: KSPInitialResidual() line 56 in src/ksp/ksp/interface/itres.c >> [0]PETSC ERROR: KSPSolve_BCGS() line 41 in src/ksp/ksp/impls/bcgs/bcgs.c >> [0]PETSC ERROR: KSPSolveTranspose() line 562 in src/ksp/ksp/interface/itfunc.c >> > > This is just "lazyness", I hadn't implemented the apply transpose. > I've added it now to PETSc-dev; the problem is it cannot be made into an > easy patch since it involves several nontrivial changes. > > >> So then I thought in my code I would just take the transpose of A and call >> KSPSolve, but then I get the following errors: >> >> [0]PETSC ERROR: MatGetSubMatrix_SeqAIJ() line 1686 in >> src/mat/impls/aij/seq/aij.c >> [0]PETSC ERROR: Nonconforming object sizes! >> [0]PETSC ERROR: Cannot reuse matrix. wrong no of nonzeros! >> [0]PETSC ERROR: MatGetSubMatrices_SeqAIJ() line 1799 in >> src/mat/impls/aij/seq/aij.c >> [0]PETSC ERROR: MatGetSubMatrices() line 4828 in src/mat/interface/matrix.c >> [0]PETSC ERROR: MatGetSubMatrix() line 5438 in src/mat/interface/matrix.c >> [0]PETSC ERROR: PCSetUp_FieldSplit() line 162 in >> src/ksp/pc/impls/fieldsplit/fieldsplit.c >> [0]PETSC ERROR: PCSetUp() line 798 in src/ksp/pc/interface/precon.c >> [0]PETSC ERROR: KSPSetUp() line 234 in src/ksp/ksp/interface/itfunc.c >> [0]PETSC ERROR: KSPSolve() line 334 in src/ksp/ksp/interface/itfunc.c >> >> > I'm guessing you used MAT_SAME_NONZERO_PATTERN? But the transpose won't have > the same nonzero pattern? > > BTW: Did you find explicitly forming the transposes and solving worked better > than just using KSPSolveTranspose()? > > Barry > >> Is there some reason why the PCFIeildSplit is not compatible with >> KSPSolveTranspose? >> >> I'm solving with the following options: >> >> >> -em_ksp_truemonitor \ >> -em_ksp_type bcgs \ >> -em_pc_type fieldsplit \ >> -em_pc_fieldsplit_default \ >> -em_pc_fieldsplit_type multiplicative \ >> -em_fieldsplit_pc_type bjacobi \ >> -em_fieldsplit_sub_pc_type ilu \ >> -em_fieldsplit_sub_pc_factor_levels 4 \ >> -em_fieldsplit_sub_pc_factor_fill 10 \ >> >> Randy >> >> > -- Randall Mackie GSY-USA, Inc. PMB# 643 2261 Market St., San Francisco, CA 94114-1600 Tel (415) 469-8649 Fax (415) 469-5044 California Registered Geophysicist License No. GP 1034 From bsmith at mcs.anl.gov Tue Sep 26 20:11:41 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 26 Sep 2006 20:11:41 -0500 (CDT) Subject: KSPSolveTranspose and PCFieldSplit In-Reply-To: <4519CEAF.2050307@geosystem.us> References: <4519BEE1.4050200@geosystem.us> <4519CEAF.2050307@geosystem.us> Message-ID: On Tue, 26 Sep 2006, Randall Mackie wrote: > Barry, > > Okay, I assume this means it will be done at some point in the near future? > > I tried taking the transpose in my code, and then using KSPSolve, but then > I was getting error messages about zero pivots. I then added > -pc_shift_positive_definite and it ran, but it didn't seem to do any better > than KSPSolveTranspose, although I haven't been able to spend a lot of time > on that. > > I'll just add another KSP in my code, one to use the fieldsplit PC for > the first problem, and then another one to just use ILU for the transpose > problem, at least until you get the patch for fieldsplit PC. To use it you'll have to use the development copy of PETSc http://www-unix.mcs.anl.gov/petsc/petsc-as/developers/index.html or wait for our next release which is a few months away. Sorry, Barry In general there is nothing that says if B is a good preconditioner for A that B' is a good preconditioner for A', though usually you would think it would be. > > Thanks, Randy > > > Barry Smith wrote: > > > > On Tue, 26 Sep 2006, Randall Mackie wrote: > > > > > When I try to use KSPSolveTranspose with PCFieldSplit, I get the following > > > errors: > > > > > > [0]PETSC ERROR: PCApplyTranspose() line 483 in > > > src/ksp/pc/interface/precon.c > > > [0]PETSC ERROR: No support for this operation for this object type! > > > [0]PETSC ERROR: ! > > > [0]PETSC ERROR: KSPInitialResidual() line 56 in > > > src/ksp/ksp/interface/itres.c > > > [0]PETSC ERROR: KSPSolve_BCGS() line 41 in src/ksp/ksp/impls/bcgs/bcgs.c > > > [0]PETSC ERROR: KSPSolveTranspose() line 562 in > > > src/ksp/ksp/interface/itfunc.c > > > > > > > This is just "lazyness", I hadn't implemented the apply transpose. I've > > added it now to PETSc-dev; the problem is it cannot be made into an > > easy patch since it involves several nontrivial changes. > > > > > > > So then I thought in my code I would just take the transpose of A and call > > > KSPSolve, but then I get the following errors: > > > > > > [0]PETSC ERROR: MatGetSubMatrix_SeqAIJ() line 1686 in > > > src/mat/impls/aij/seq/aij.c > > > [0]PETSC ERROR: Nonconforming object sizes! > > > [0]PETSC ERROR: Cannot reuse matrix. wrong no of nonzeros! > > > [0]PETSC ERROR: MatGetSubMatrices_SeqAIJ() line 1799 in > > > src/mat/impls/aij/seq/aij.c > > > [0]PETSC ERROR: MatGetSubMatrices() line 4828 in > > > src/mat/interface/matrix.c > > > [0]PETSC ERROR: MatGetSubMatrix() line 5438 in src/mat/interface/matrix.c > > > [0]PETSC ERROR: PCSetUp_FieldSplit() line 162 in > > > src/ksp/pc/impls/fieldsplit/fieldsplit.c > > > [0]PETSC ERROR: PCSetUp() line 798 in src/ksp/pc/interface/precon.c > > > [0]PETSC ERROR: KSPSetUp() line 234 in src/ksp/ksp/interface/itfunc.c > > > [0]PETSC ERROR: KSPSolve() line 334 in src/ksp/ksp/interface/itfunc.c > > > > > > > > I'm guessing you used MAT_SAME_NONZERO_PATTERN? But the transpose won't > > have the same nonzero pattern? > > > > BTW: Did you find explicitly forming the transposes and solving worked > > better > > than just using KSPSolveTranspose()? > > > > Barry > > > > > Is there some reason why the PCFIeildSplit is not compatible with > > > KSPSolveTranspose? > > > > > > I'm solving with the following options: > > > > > > > > > -em_ksp_truemonitor \ > > > -em_ksp_type bcgs \ > > > -em_pc_type fieldsplit \ > > > -em_pc_fieldsplit_default \ > > > -em_pc_fieldsplit_type multiplicative \ > > > -em_fieldsplit_pc_type bjacobi \ > > > -em_fieldsplit_sub_pc_type ilu \ > > > -em_fieldsplit_sub_pc_factor_levels 4 \ > > > -em_fieldsplit_sub_pc_factor_fill 10 \ > > > > > > Randy > > > > > > > > > > From mafunk at nmsu.edu Fri Sep 29 15:45:11 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Fri, 29 Sep 2006 14:45:11 -0600 Subject: using hypre through petsc In-Reply-To: References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> Message-ID: <200609291445.12183.mafunk@nmsu.edu> This might be a pretty stupid question, especially since i did this a while back and it worked. However, how do i specify thsis? Do i run my executable do and then simply append -pc_type hypre -pc_hypre_type boomeramg -help and it will print out the options? Because when i do that i get: Options for all PETSc programs: -on_error_abort: cause an abort when an error is detected. Useful only when run in the debugger -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] start the debugger in new xterm unless noxterm is given -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] start all processes in the debugger -on_error_emacs emacs jumps to error file -debugger_nodes [n1,n2,..] Nodes to start in debugger -debugger_pause [m] : delay (in seconds) to attach debugger -stop_for_debugger : prints message on how to attach debugger manually waits the delay for you to attach -display display: Location where graphics and debuggers are displayed -no_signal_handler: do not trap error signals -mpi_return_on_error: MPI returns error code, rather than abort on internal error -fp_trap: stop on floating point exceptions note on IBM RS6000 this slows run greatly -malloc_dump : dump list of unfreed memory at conclusion -malloc: use our error checking malloc -malloc no: don't use error checking malloc -mallocinfo: prints total memory usage -malloc_debug: enables extended checking for memory corruption -options_table: dump list of options inputted -options_left: dump list of unused options -options_left no: don't dump list of unused options -tmp tmpdir: alternative /tmp directory -shared_tmp: tmp directory is shared by all processors -not_shared_tmp: each processor has separate tmp directory -memory_info: print memory usage at end of run -get_total_flops: total flops over all processors -log[_all _summary]: logging objects and events -log_trace [filename]: prints trace of all PETSc calls -info : print informative messages about the calculations -v: prints PETSc version number and release date -options_file : reads options from file -petsc_sleep n: sleeps n seconds before running program but nothing about hypre .... ? mat On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > Hi Matt > You can start experimenting by using > -pc_type hypre -pc_hypre_type boomeramg -help > which will give you all the boomeramg options. > > When I use it I get intermittent segfaults, which I couldn't resolve with > the Hypre guys, so good luck. > > Yaron > > On 9/19/06, Matt Funk wrote: > > Hi, > > > > i am trying to use boomeramg from hypre in petsc. What i am doing right > > now is > > simply do: > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > then i do my kspsetup etc... > > > > i was wondering what other things i need to configure/set to properly use > > the > > hypre preconditioner with petsc. This is new to me, so i am not really > > experienced with this (that is using external packages through petsc). > > Also, > > these are the only hypre calls i found in the manual pages. > > > > Maybe somebody with more experience can share some of their wisdom ..., > > or point to a place where i can read up on it? > > > > > > thanks > > mat From bsmith at mcs.anl.gov Fri Sep 29 16:11:32 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 29 Sep 2006 16:11:32 -0500 (CDT) Subject: using hypre through petsc In-Reply-To: <200609291445.12183.mafunk@nmsu.edu> References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> <200609291445.12183.mafunk@nmsu.edu> Message-ID: Either you are not calling KSPSetFromOptions() in your code (or SNESSetFromOptions() OR PETSc was not configured to use hypre. To configure PETSc to use hypre you must use the additional config/configure.py option --download-hypre Good luck, Barry On Fri, 29 Sep 2006, Matt Funk wrote: > This might be a pretty stupid question, especially since i did this a while > back and it worked. > > However, how do i specify thsis? Do i run my executable do and then simply > append -pc_type hypre -pc_hypre_type boomeramg -help and it will print out > the options? > > > Because when i do that i get: > Options for all PETSc programs: > -on_error_abort: cause an abort when an error is detected. Useful > only when run in the debugger > -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] > start the debugger in new xterm > unless noxterm is given > -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] > start all processes in the debugger > -on_error_emacs > emacs jumps to error file > -debugger_nodes [n1,n2,..] Nodes to start in debugger > -debugger_pause [m] : delay (in seconds) to attach debugger > -stop_for_debugger : prints message on how to attach debugger manually > waits the delay for you to attach > -display display: Location where graphics and debuggers are displayed > -no_signal_handler: do not trap error signals > -mpi_return_on_error: MPI returns error code, rather than abort on internal > error > -fp_trap: stop on floating point exceptions > note on IBM RS6000 this slows run greatly > -malloc_dump : dump list of unfreed memory at conclusion > -malloc: use our error checking malloc > -malloc no: don't use error checking malloc > -mallocinfo: prints total memory usage > -malloc_debug: enables extended checking for memory corruption > -options_table: dump list of options inputted > -options_left: dump list of unused options > -options_left no: don't dump list of unused options > -tmp tmpdir: alternative /tmp directory > -shared_tmp: tmp directory is shared by all processors > -not_shared_tmp: each processor has separate tmp directory > -memory_info: print memory usage at end of run > -get_total_flops: total flops over all processors > -log[_all _summary]: logging objects and events > -log_trace [filename]: prints trace of all PETSc calls > -info : print informative messages about the calculations > -v: prints PETSc version number and release date > -options_file : reads options from file > -petsc_sleep n: sleeps n seconds before running program > > > but nothing about hypre .... ? > > > mat > > > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > Hi Matt > > You can start experimenting by using > > -pc_type hypre -pc_hypre_type boomeramg -help > > which will give you all the boomeramg options. > > > > When I use it I get intermittent segfaults, which I couldn't resolve with > > the Hypre guys, so good luck. > > > > Yaron > > > > On 9/19/06, Matt Funk wrote: > > > Hi, > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing right > > > now is > > > simply do: > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > then i do my kspsetup etc... > > > > > > i was wondering what other things i need to configure/set to properly use > > > the > > > hypre preconditioner with petsc. This is new to me, so i am not really > > > experienced with this (that is using external packages through petsc). > > > Also, > > > these are the only hypre calls i found in the manual pages. > > > > > > Maybe somebody with more experience can share some of their wisdom ..., > > > or point to a place where i can read up on it? > > > > > > > > > thanks > > > mat > > From yaronkretchmer at gmail.com Fri Sep 29 16:14:57 2006 From: yaronkretchmer at gmail.com (Yaron Kretchmer) Date: Fri, 29 Sep 2006 14:14:57 -0700 Subject: using hypre through petsc In-Reply-To: References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> <200609291445.12183.mafunk@nmsu.edu> Message-ID: If the latter (Petsc not configured to use Hypre), wouldn't Matt get an error when specifying hypre as preconditioner? Yaron On 9/29/06, Barry Smith wrote: > > > Either you are not calling KSPSetFromOptions() in your > code (or SNESSetFromOptions() OR PETSc was not configured > to use hypre. To configure PETSc to use hypre you > must use the additional config/configure.py option > --download-hypre > > Good luck, > > Barry > > > On Fri, 29 Sep 2006, Matt Funk wrote: > > > This might be a pretty stupid question, especially since i did this a > while > > back and it worked. > > > > However, how do i specify thsis? Do i run my executable do and then > simply > > append -pc_type hypre -pc_hypre_type boomeramg -help and it will print > out > > the options? > > > > > > Because when i do that i get: > > Options for all PETSc programs: > > -on_error_abort: cause an abort when an error is detected. Useful > > only when run in the debugger > > -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] > > start the debugger in new xterm > > unless noxterm is given > > -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] > > start all processes in the debugger > > -on_error_emacs > > emacs jumps to error file > > -debugger_nodes [n1,n2,..] Nodes to start in debugger > > -debugger_pause [m] : delay (in seconds) to attach debugger > > -stop_for_debugger : prints message on how to attach debugger manually > > waits the delay for you to attach > > -display display: Location where graphics and debuggers are displayed > > -no_signal_handler: do not trap error signals > > -mpi_return_on_error: MPI returns error code, rather than abort on > internal > > error > > -fp_trap: stop on floating point exceptions > > note on IBM RS6000 this slows run greatly > > -malloc_dump : dump list of unfreed memory at > conclusion > > -malloc: use our error checking malloc > > -malloc no: don't use error checking malloc > > -mallocinfo: prints total memory usage > > -malloc_debug: enables extended checking for memory corruption > > -options_table: dump list of options inputted > > -options_left: dump list of unused options > > -options_left no: don't dump list of unused options > > -tmp tmpdir: alternative /tmp directory > > -shared_tmp: tmp directory is shared by all processors > > -not_shared_tmp: each processor has separate tmp directory > > -memory_info: print memory usage at end of run > > -get_total_flops: total flops over all processors > > -log[_all _summary]: logging objects and events > > -log_trace [filename]: prints trace of all PETSc calls > > -info : print informative messages about the > calculations > > -v: prints PETSc version number and release date > > -options_file : reads options from file > > -petsc_sleep n: sleeps n seconds before running program > > > > > > but nothing about hypre .... ? > > > > > > mat > > > > > > > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > > Hi Matt > > > You can start experimenting by using > > > -pc_type hypre -pc_hypre_type boomeramg -help > > > which will give you all the boomeramg options. > > > > > > When I use it I get intermittent segfaults, which I couldn't resolve > with > > > the Hypre guys, so good luck. > > > > > > Yaron > > > > > > On 9/19/06, Matt Funk wrote: > > > > Hi, > > > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing > right > > > > now is > > > > simply do: > > > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > > > then i do my kspsetup etc... > > > > > > > > i was wondering what other things i need to configure/set to > properly use > > > > the > > > > hypre preconditioner with petsc. This is new to me, so i am not > really > > > > experienced with this (that is using external packages through > petsc). > > > > Also, > > > > these are the only hypre calls i found in the manual pages. > > > > > > > > Maybe somebody with more experience can share some of their wisdom > ..., > > > > or point to a place where i can read up on it? > > > > > > > > > > > > thanks > > > > mat > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Fri Sep 29 16:35:40 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 29 Sep 2006 16:35:40 -0500 (CDT) Subject: using hypre through petsc In-Reply-To: References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609191702.25168.mafunk@nmsu.edu> <200609291445.12183.mafunk@nmsu.edu> Message-ID: On Fri, 29 Sep 2006, Yaron Kretchmer wrote: > If the latter (Petsc not configured to use Hypre), wouldn't Matt get an > error when specifying hypre as preconditioner? Yes he would, but it could get lost among all the help messages printed. Barry > > Yaron > > > On 9/29/06, Barry Smith wrote: > > > > > > Either you are not calling KSPSetFromOptions() in your > > code (or SNESSetFromOptions() OR PETSc was not configured > > to use hypre. To configure PETSc to use hypre you > > must use the additional config/configure.py option > > --download-hypre > > > > Good luck, > > > > Barry > > > > > > On Fri, 29 Sep 2006, Matt Funk wrote: > > > > > This might be a pretty stupid question, especially since i did this a > > while > > > back and it worked. > > > > > > However, how do i specify thsis? Do i run my executable do and then > > simply > > > append -pc_type hypre -pc_hypre_type boomeramg -help and it will print > > out > > > the options? > > > > > > > > > Because when i do that i get: > > > Options for all PETSc programs: > > > -on_error_abort: cause an abort when an error is detected. Useful > > > only when run in the debugger > > > -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > start the debugger in new xterm > > > unless noxterm is given > > > -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > start all processes in the debugger > > > -on_error_emacs > > > emacs jumps to error file > > > -debugger_nodes [n1,n2,..] Nodes to start in debugger > > > -debugger_pause [m] : delay (in seconds) to attach debugger > > > -stop_for_debugger : prints message on how to attach debugger manually > > > waits the delay for you to attach > > > -display display: Location where graphics and debuggers are displayed > > > -no_signal_handler: do not trap error signals > > > -mpi_return_on_error: MPI returns error code, rather than abort on > > internal > > > error > > > -fp_trap: stop on floating point exceptions > > > note on IBM RS6000 this slows run greatly > > > -malloc_dump : dump list of unfreed memory at > > conclusion > > > -malloc: use our error checking malloc > > > -malloc no: don't use error checking malloc > > > -mallocinfo: prints total memory usage > > > -malloc_debug: enables extended checking for memory corruption > > > -options_table: dump list of options inputted > > > -options_left: dump list of unused options > > > -options_left no: don't dump list of unused options > > > -tmp tmpdir: alternative /tmp directory > > > -shared_tmp: tmp directory is shared by all processors > > > -not_shared_tmp: each processor has separate tmp directory > > > -memory_info: print memory usage at end of run > > > -get_total_flops: total flops over all processors > > > -log[_all _summary]: logging objects and events > > > -log_trace [filename]: prints trace of all PETSc calls > > > -info : print informative messages about the > > calculations > > > -v: prints PETSc version number and release date > > > -options_file : reads options from file > > > -petsc_sleep n: sleeps n seconds before running program > > > > > > > > > but nothing about hypre .... ? > > > > > > > > > mat > > > > > > > > > > > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > > > Hi Matt > > > > You can start experimenting by using > > > > -pc_type hypre -pc_hypre_type boomeramg -help > > > > which will give you all the boomeramg options. > > > > > > > > When I use it I get intermittent segfaults, which I couldn't resolve > > with > > > > the Hypre guys, so good luck. > > > > > > > > Yaron > > > > > > > > On 9/19/06, Matt Funk wrote: > > > > > Hi, > > > > > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing > > right > > > > > now is > > > > > simply do: > > > > > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > > > > > then i do my kspsetup etc... > > > > > > > > > > i was wondering what other things i need to configure/set to > > properly use > > > > > the > > > > > hypre preconditioner with petsc. This is new to me, so i am not > > really > > > > > experienced with this (that is using external packages through > > petsc). > > > > > Also, > > > > > these are the only hypre calls i found in the manual pages. > > > > > > > > > > Maybe somebody with more experience can share some of their wisdom > > ..., > > > > > or point to a place where i can read up on it? > > > > > > > > > > > > > > > thanks > > > > > mat > > > > > > > > > > > From mafunk at nmsu.edu Fri Sep 29 18:19:21 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Fri, 29 Sep 2006 17:19:21 -0600 Subject: using hypre through petsc In-Reply-To: References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> Message-ID: <200609291719.22969.mafunk@nmsu.edu> Hi, i don't know what i am doing wrong, but it still doesn't give me the any hypre output. So i need to call KSPSetFromOptions? or PCSetFromOptions? Also, at what point in the program should it print those options out? After i call XSetFromOptions? Do i need to set the PCType to hypre first and then PCHYPRESetType(m_pc,"boomeramg") and then it prints it out? mat On Friday 29 September 2006 15:35, Barry Smith wrote: > On Fri, 29 Sep 2006, Yaron Kretchmer wrote: > > If the latter (Petsc not configured to use Hypre), wouldn't Matt get an > > error when specifying hypre as preconditioner? > > Yes he would, but it could get lost among all the help messages > printed. > > Barry > > > Yaron > > > > On 9/29/06, Barry Smith wrote: > > > Either you are not calling KSPSetFromOptions() in your > > > code (or SNESSetFromOptions() OR PETSc was not configured > > > to use hypre. To configure PETSc to use hypre you > > > must use the additional config/configure.py option > > > --download-hypre > > > > > > Good luck, > > > > > > Barry > > > > > > On Fri, 29 Sep 2006, Matt Funk wrote: > > > > This might be a pretty stupid question, especially since i did this a > > > > > > while > > > > > > > back and it worked. > > > > > > > > However, how do i specify thsis? Do i run my executable do and then > > > > > > simply > > > > > > > append -pc_type hypre -pc_hypre_type boomeramg -help and it will > > > > print > > > > > > out > > > > > > > the options? > > > > > > > > > > > > Because when i do that i get: > > > > Options for all PETSc programs: > > > > -on_error_abort: cause an abort when an error is detected. Useful > > > > only when run in the debugger > > > > -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > > start the debugger in new xterm > > > > unless noxterm is given > > > > -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > > start all processes in the debugger > > > > -on_error_emacs > > > > emacs jumps to error file > > > > -debugger_nodes [n1,n2,..] Nodes to start in debugger > > > > -debugger_pause [m] : delay (in seconds) to attach debugger > > > > -stop_for_debugger : prints message on how to attach debugger > > > > manually waits the delay for you to attach > > > > -display display: Location where graphics and debuggers are > > > > displayed -no_signal_handler: do not trap error signals > > > > -mpi_return_on_error: MPI returns error code, rather than abort on > > > > > > internal > > > > > > > error > > > > -fp_trap: stop on floating point exceptions > > > > note on IBM RS6000 this slows run greatly > > > > -malloc_dump : dump list of unfreed memory at > > > > > > conclusion > > > > > > > -malloc: use our error checking malloc > > > > -malloc no: don't use error checking malloc > > > > -mallocinfo: prints total memory usage > > > > -malloc_debug: enables extended checking for memory corruption > > > > -options_table: dump list of options inputted > > > > -options_left: dump list of unused options > > > > -options_left no: don't dump list of unused options > > > > -tmp tmpdir: alternative /tmp directory > > > > -shared_tmp: tmp directory is shared by all processors > > > > -not_shared_tmp: each processor has separate tmp directory > > > > -memory_info: print memory usage at end of run > > > > -get_total_flops: total flops over all processors > > > > -log[_all _summary]: logging objects and events > > > > -log_trace [filename]: prints trace of all PETSc calls > > > > -info : print informative messages about the > > > > > > calculations > > > > > > > -v: prints PETSc version number and release date > > > > -options_file : reads options from file > > > > -petsc_sleep n: sleeps n seconds before running program > > > > > > > > > > > > but nothing about hypre .... ? > > > > > > > > > > > > mat > > > > > > > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > > > > Hi Matt > > > > > You can start experimenting by using > > > > > -pc_type hypre -pc_hypre_type boomeramg -help > > > > > which will give you all the boomeramg options. > > > > > > > > > > When I use it I get intermittent segfaults, which I couldn't > > > > > resolve > > > > > > with > > > > > > > > the Hypre guys, so good luck. > > > > > > > > > > Yaron > > > > > > > > > > On 9/19/06, Matt Funk wrote: > > > > > > Hi, > > > > > > > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing > > > > > > right > > > > > > > > > now is > > > > > > simply do: > > > > > > > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > > > > > > > then i do my kspsetup etc... > > > > > > > > > > > > i was wondering what other things i need to configure/set to > > > > > > properly use > > > > > > > > > the > > > > > > hypre preconditioner with petsc. This is new to me, so i am not > > > > > > really > > > > > > > > > experienced with this (that is using external packages through > > > > > > petsc). > > > > > > > > > Also, > > > > > > these are the only hypre calls i found in the manual pages. > > > > > > > > > > > > Maybe somebody with more experience can share some of their > > > > > > wisdom > > > > > > ..., > > > > > > > > > or point to a place where i can read up on it? > > > > > > > > > > > > > > > > > > thanks > > > > > > mat From mafunk at nmsu.edu Fri Sep 29 18:20:28 2006 From: mafunk at nmsu.edu (Matt Funk) Date: Fri, 29 Sep 2006 17:20:28 -0600 Subject: using hypre through petsc In-Reply-To: References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> Message-ID: <200609291720.28735.mafunk@nmsu.edu> I do have hypre in there. I configured it with the hypre-download=1 option mat On Friday 29 September 2006 15:35, Barry Smith wrote: > On Fri, 29 Sep 2006, Yaron Kretchmer wrote: > > If the latter (Petsc not configured to use Hypre), wouldn't Matt get an > > error when specifying hypre as preconditioner? > > Yes he would, but it could get lost among all the help messages > printed. > > Barry > > > Yaron > > > > On 9/29/06, Barry Smith wrote: > > > Either you are not calling KSPSetFromOptions() in your > > > code (or SNESSetFromOptions() OR PETSc was not configured > > > to use hypre. To configure PETSc to use hypre you > > > must use the additional config/configure.py option > > > --download-hypre > > > > > > Good luck, > > > > > > Barry > > > > > > On Fri, 29 Sep 2006, Matt Funk wrote: > > > > This might be a pretty stupid question, especially since i did this a > > > > > > while > > > > > > > back and it worked. > > > > > > > > However, how do i specify thsis? Do i run my executable do and then > > > > > > simply > > > > > > > append -pc_type hypre -pc_hypre_type boomeramg -help and it will > > > > print > > > > > > out > > > > > > > the options? > > > > > > > > > > > > Because when i do that i get: > > > > Options for all PETSc programs: > > > > -on_error_abort: cause an abort when an error is detected. Useful > > > > only when run in the debugger > > > > -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > > start the debugger in new xterm > > > > unless noxterm is given > > > > -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > > start all processes in the debugger > > > > -on_error_emacs > > > > emacs jumps to error file > > > > -debugger_nodes [n1,n2,..] Nodes to start in debugger > > > > -debugger_pause [m] : delay (in seconds) to attach debugger > > > > -stop_for_debugger : prints message on how to attach debugger > > > > manually waits the delay for you to attach > > > > -display display: Location where graphics and debuggers are > > > > displayed -no_signal_handler: do not trap error signals > > > > -mpi_return_on_error: MPI returns error code, rather than abort on > > > > > > internal > > > > > > > error > > > > -fp_trap: stop on floating point exceptions > > > > note on IBM RS6000 this slows run greatly > > > > -malloc_dump : dump list of unfreed memory at > > > > > > conclusion > > > > > > > -malloc: use our error checking malloc > > > > -malloc no: don't use error checking malloc > > > > -mallocinfo: prints total memory usage > > > > -malloc_debug: enables extended checking for memory corruption > > > > -options_table: dump list of options inputted > > > > -options_left: dump list of unused options > > > > -options_left no: don't dump list of unused options > > > > -tmp tmpdir: alternative /tmp directory > > > > -shared_tmp: tmp directory is shared by all processors > > > > -not_shared_tmp: each processor has separate tmp directory > > > > -memory_info: print memory usage at end of run > > > > -get_total_flops: total flops over all processors > > > > -log[_all _summary]: logging objects and events > > > > -log_trace [filename]: prints trace of all PETSc calls > > > > -info : print informative messages about the > > > > > > calculations > > > > > > > -v: prints PETSc version number and release date > > > > -options_file : reads options from file > > > > -petsc_sleep n: sleeps n seconds before running program > > > > > > > > > > > > but nothing about hypre .... ? > > > > > > > > > > > > mat > > > > > > > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > > > > Hi Matt > > > > > You can start experimenting by using > > > > > -pc_type hypre -pc_hypre_type boomeramg -help > > > > > which will give you all the boomeramg options. > > > > > > > > > > When I use it I get intermittent segfaults, which I couldn't > > > > > resolve > > > > > > with > > > > > > > > the Hypre guys, so good luck. > > > > > > > > > > Yaron > > > > > > > > > > On 9/19/06, Matt Funk wrote: > > > > > > Hi, > > > > > > > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing > > > > > > right > > > > > > > > > now is > > > > > > simply do: > > > > > > > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > > > > > > > then i do my kspsetup etc... > > > > > > > > > > > > i was wondering what other things i need to configure/set to > > > > > > properly use > > > > > > > > > the > > > > > > hypre preconditioner with petsc. This is new to me, so i am not > > > > > > really > > > > > > > > > experienced with this (that is using external packages through > > > > > > petsc). > > > > > > > > > Also, > > > > > > these are the only hypre calls i found in the manual pages. > > > > > > > > > > > > Maybe somebody with more experience can share some of their > > > > > > wisdom > > > > > > ..., > > > > > > > > > or point to a place where i can read up on it? > > > > > > > > > > > > > > > > > > thanks > > > > > > mat From bsmith at mcs.anl.gov Fri Sep 29 20:56:52 2006 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 29 Sep 2006 20:56:52 -0500 (CDT) Subject: using hypre through petsc In-Reply-To: <200609291719.22969.mafunk@nmsu.edu> References: <215294220609190330n630747f7p9c1996c4d38f23ae@mail.gmail.com> <200609291719.22969.mafunk@nmsu.edu> Message-ID: Yes, you must call SNESSetFromOptions, KSPSetFromOptions or PCSetFromOptions. It is at this point in the code that it checks the provided options and prints the help messages (as it checks them). You do not need to hardwire the options in the code to have the proper help printed. Barry On Fri, 29 Sep 2006, Matt Funk wrote: > Hi, > > i don't know what i am doing wrong, but it still doesn't give me the any hypre > output. > > So i need to call KSPSetFromOptions? or PCSetFromOptions? > > Also, at what point in the program should it print those options out? After i > call XSetFromOptions? > > Do i need to set the PCType to hypre first and then > PCHYPRESetType(m_pc,"boomeramg") and then it prints it out? > > mat > > > On Friday 29 September 2006 15:35, Barry Smith wrote: > > On Fri, 29 Sep 2006, Yaron Kretchmer wrote: > > > If the latter (Petsc not configured to use Hypre), wouldn't Matt get an > > > error when specifying hypre as preconditioner? > > > > Yes he would, but it could get lost among all the help messages > > printed. > > > > Barry > > > > > Yaron > > > > > > On 9/29/06, Barry Smith wrote: > > > > Either you are not calling KSPSetFromOptions() in your > > > > code (or SNESSetFromOptions() OR PETSc was not configured > > > > to use hypre. To configure PETSc to use hypre you > > > > must use the additional config/configure.py option > > > > --download-hypre > > > > > > > > Good luck, > > > > > > > > Barry > > > > > > > > On Fri, 29 Sep 2006, Matt Funk wrote: > > > > > This might be a pretty stupid question, especially since i did this a > > > > > > > > while > > > > > > > > > back and it worked. > > > > > > > > > > However, how do i specify thsis? Do i run my executable do and then > > > > > > > > simply > > > > > > > > > append -pc_type hypre -pc_hypre_type boomeramg -help and it will > > > > > print > > > > > > > > out > > > > > > > > > the options? > > > > > > > > > > > > > > > Because when i do that i get: > > > > > Options for all PETSc programs: > > > > > -on_error_abort: cause an abort when an error is detected. Useful > > > > > only when run in the debugger > > > > > -on_error_attach_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > > > start the debugger in new xterm > > > > > unless noxterm is given > > > > > -start_in_debugger [gdb,dbx,xxgdb,ups,noxterm] > > > > > start all processes in the debugger > > > > > -on_error_emacs > > > > > emacs jumps to error file > > > > > -debugger_nodes [n1,n2,..] Nodes to start in debugger > > > > > -debugger_pause [m] : delay (in seconds) to attach debugger > > > > > -stop_for_debugger : prints message on how to attach debugger > > > > > manually waits the delay for you to attach > > > > > -display display: Location where graphics and debuggers are > > > > > displayed -no_signal_handler: do not trap error signals > > > > > -mpi_return_on_error: MPI returns error code, rather than abort on > > > > > > > > internal > > > > > > > > > error > > > > > -fp_trap: stop on floating point exceptions > > > > > note on IBM RS6000 this slows run greatly > > > > > -malloc_dump : dump list of unfreed memory at > > > > > > > > conclusion > > > > > > > > > -malloc: use our error checking malloc > > > > > -malloc no: don't use error checking malloc > > > > > -mallocinfo: prints total memory usage > > > > > -malloc_debug: enables extended checking for memory corruption > > > > > -options_table: dump list of options inputted > > > > > -options_left: dump list of unused options > > > > > -options_left no: don't dump list of unused options > > > > > -tmp tmpdir: alternative /tmp directory > > > > > -shared_tmp: tmp directory is shared by all processors > > > > > -not_shared_tmp: each processor has separate tmp directory > > > > > -memory_info: print memory usage at end of run > > > > > -get_total_flops: total flops over all processors > > > > > -log[_all _summary]: logging objects and events > > > > > -log_trace [filename]: prints trace of all PETSc calls > > > > > -info : print informative messages about the > > > > > > > > calculations > > > > > > > > > -v: prints PETSc version number and release date > > > > > -options_file : reads options from file > > > > > -petsc_sleep n: sleeps n seconds before running program > > > > > > > > > > > > > > > but nothing about hypre .... ? > > > > > > > > > > > > > > > mat > > > > > > > > > > On Tuesday 19 September 2006 17:05, Yaron Kretchmer wrote: > > > > > > Hi Matt > > > > > > You can start experimenting by using > > > > > > -pc_type hypre -pc_hypre_type boomeramg -help > > > > > > which will give you all the boomeramg options. > > > > > > > > > > > > When I use it I get intermittent segfaults, which I couldn't > > > > > > resolve > > > > > > > > with > > > > > > > > > > the Hypre guys, so good luck. > > > > > > > > > > > > Yaron > > > > > > > > > > > > On 9/19/06, Matt Funk wrote: > > > > > > > Hi, > > > > > > > > > > > > > > i am trying to use boomeramg from hypre in petsc. What i am doing > > > > > > > > right > > > > > > > > > > > now is > > > > > > > simply do: > > > > > > > > > > > > > > m_ierr = PCSetType(m_pc,PCHYPRE);//CHKERRQ(ierr) > > > > > > > m_ierr = PCHYPRESetType(m_pc,"boomeramg"); > > > > > > > > > > > > > > then i do my kspsetup etc... > > > > > > > > > > > > > > i was wondering what other things i need to configure/set to > > > > > > > > properly use > > > > > > > > > > > the > > > > > > > hypre preconditioner with petsc. This is new to me, so i am not > > > > > > > > really > > > > > > > > > > > experienced with this (that is using external packages through > > > > > > > > petsc). > > > > > > > > > > > Also, > > > > > > > these are the only hypre calls i found in the manual pages. > > > > > > > > > > > > > > Maybe somebody with more experience can share some of their > > > > > > > wisdom > > > > > > > > ..., > > > > > > > > > > > or point to a place where i can read up on it? > > > > > > > > > > > > > > > > > > > > > thanks > > > > > > > mat > >