Hi everyone, I have some (what I think are) pretty simple questions that I would like answered: 1) How do you print out the global size of the matrix? 2) When FFC/pyop2 is compiling the forms, it says "Skipping optimizations, add -O to optimize", how can I tell my program to add this optimization? 3) Is there a way to simply output the number of KSP iterations? I am guessing it involves getIterationNumber() but I am still kind of new to petsc4py, so how would I invoke this call in the context of firedrake? Thanks! Justin
On 24 Jul 2015, at 11:06, Justin Chang <jychang48@gmail.com> wrote:
Hi everyone,
I have some (what I think are) pretty simple questions that I would like answered:
1) How do you print out the global size of the matrix?
So PyOP2 (and hence firedrake) don't expose global sizes of objects. However, you can ask PETSc: A = assemble(a) print A.M.handle.getSizes() This returns the same as MatGetSizes. You can get the /local/ sizes with: A.M.nrows, A.M.ncols We should probably just expose the global sizes as well.
2) When FFC/pyop2 is compiling the forms, it says "Skipping optimizations, add -O to optimize", how can I tell my program to add this optimization?
I believe that many of these optimisations conflict with those that the COFFEE kernel compiler subsequently applies, so I /think/ that you can't add this optimisation right now. Maybe Fabio can comment more clearly on this point.
3) Is there a way to simply output the number of KSP iterations? I am guessing it involves getIterationNumber() but I am still kind of new to petsc4py, so how would I invoke this call in the context of firedrake?
Do you want to access this number programmatically, or print to a screen? If the latter, you can run with 'ksp_converged_reason': True in your solver_parameters dict and PETSc will print the converged reason (along with the number of iterations). If programmatically: solver = XXXVariationalSolver(...) solver.solve() print solver.snes.ksp.getIterationNumber() If you're using preassembled operators and a LinearSolver: solver = LinearSolver(...) solver.solve(...) print solver.ksp.getIterationNumber() Again, we should expose this programmatically in the public interface. Lawrence
participants (2)
- 
                
                Justin Chang
- 
                
                Lawrence Mitchell