[petsc-users] Simple question regarding dense matrix algebra using elemental

Hong hzhang at mcs.anl.gov
Mon Apr 13 13:42:15 CDT 2015


Preyas,
I tested your code (renamed as src/ksp/ksp/examples/tests/ex46.cpp) and got
mpiexec -n 1 ./ex46
...
1
1
1
1
1
Norm of error 3.58644e-10 iterations 1

mpiexec -n 3 ./ex46
...
1
1
1
1
1
Norm of error 5.81285e-11 iterations 1

option '-ksp_view' gives
KSP Object: 3 MPI processes
  type: preonly
  maximum iterations=10000, initial guess is zero
  tolerances:  relative=1e-05, absolute=1e-16, divergence=10000
  left preconditioning
  using NONE norm type for convergence test
PC Object: 3 MPI processes
  type: lu
    LU: out-of-place factorization
    tolerance for zero pivot 2.22045e-14
    matrix ordering: natural
    factor fill ratio given 0, needed 0
      Factored matrix follows:
        Mat Object:         3 MPI processes
          type: elemental
          rows=1000, cols=1000
          package used to perform factorization: elemental
          total: nonzeros=334000, allocated nonzeros=334000
          total number of mallocs used during MatSetValues calls =0
            Elemental run parameters:
              allocated entries=334000
              grid height=1, grid width=3
  linear system matrix = precond matrix:
...

Everything looks correct.

Hong




On Mon, Apr 13, 2015 at 12:26 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Mon, Apr 13, 2015 at 12:20 PM, Preyas Shah <shah.preyas at gmail.com>
> wrote:
>
>> Another beginner's querry:
>>
>> ​I worked out an example that "combines"
>> mat/examples/tests/ex145.c
>>  /ksp/ksp/examples/tutorials/ex2.c
>> /ksp/ksp/examples/tutorials/ex30.c
>>
>> Please see attached code sample. The code compiles but does not solve the
>> system correctly. I would like to know what changes I would need to
>> ​implement to get it working right. Thanks!
>>
>
> Check the residual as well (rhs - MM sol). This should be small. Its
> possible you have not set
> the exact solution correctly, or the discretization error is large, or the
> condition number is large.
>
>   Thanks,
>
>      Matt
>
>
>> P.S.  Feel free to include the (corrected) code sample in the
>> test/tutorial folders of the development version.
>>
>> On Sun, Apr 12, 2015 at 7:47 PM, Hong <hzhang at mcs.anl.gov> wrote:
>>
>>> You can either use elemental directly, or use petsc-elemental interface.
>>> An example can be found at
>>> ~petsc/src/mat/examples/tests/ex145.c
>>>
>>> You may use petsc KSP interface instead. I just modified
>>> ~petsc/src/ksp/ksp/examples/tutorials/ex2.c
>>> so this example can be run with elemental with runtime options
>>> mpiexec -n 3 ./ex2 -pc_type lu -pc_factor_mat_solver_package elemental
>>> -mat_type elemental
>>> Norm of error 2.81086e-15 iterations 1
>>>
>>> Please using petsc-dev (master branch) for petsc-elemental interface.
>>>
>>> Hong
>>>
>>> On Sun, Apr 12, 2015 at 6:57 PM, Preyas Shah <shah.preyas at gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have been recently investigating the use of Petsc for solving a PDE
>>>> related to my research and web search suggests that I should use petsc with
>>>> elemental.
>>>>
>>>> So far, I was required to solve a matrix equation Ax=b where A was
>>>> dense (with number of non zeros =0) but the size of the matrix was order
>>>> 5000x5000. I employed the standard serial LU solver from Gnu Scientific
>>>> Library and obtained a decent runtime that served my needs.
>>>>
>>>> Now I am investigating the same problem in a particularly singular
>>>> limit of one parameters in my PDE. As a result, to obtain grid convergence
>>>> on the physical domain, I am forced to go to sizes of A beyond 30000x30000.
>>>> I am trying to find a good library that can solve such dense systems in
>>>> **parallel**. Petsc says its capable of doing dense linear algebra but my
>>>> web search hasn't shown me any examples where dense equations are solved in
>>>> **parallel**. A webpage showing a minimum working example would be enough.
>>>> Or any other advice :)
>>>>
>>>> Thanks for your time!
>>>> ​~Preyas
>>>>
>>>>
>>>
>>
>>
>> --
>> ~
>> Preyas
>>
>> Doctoral Researcher, MechE, Stanford Univ.
>>
>> *"Can a man still be brave if he's afraid?".**"That is the only time he
>> can be brave."-- George R R Martin*
>> *"To learn who rules over you, simply find out who you are not allowed to
>> criticize." -- Voltaire*
>> *"First they ignore you, then they laugh at you, then they fight you,
>> then you win" -- Gandhi*
>>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150413/79c376ff/attachment.html>


More information about the petsc-users mailing list