trilinos sparse matrix creation problem

114 views
Skip to first unread message

Pai Liu

unread,
Oct 28, 2019, 8:03:50 PM10/28/19
to deal.II User Group

Hi all,

I need to manually create a trilinos sparse matrix (which a rectangular matrix here) and setup the entries of this matrix.

When I do this with the following codes on one MPI rank:


TrilinosWrappers::SparseMatrix T_mat(
            locally_owned_dofs_DG, locally_owned_dofs_NdRho, MPI_COMM_WORLD, 8);


TrilinosScalar val = 2.;
T_mat.add(0, 0, val);


I got the follow error:

An error occurred in line <1824> of file </home/pai/deal.ii-candi/tmp/unpack/deal.II-v9.1.1/source/lac/trilinos_sparse_matrix.cc> in function
    void dealii::TrilinosWrappers::SparseMatrix::add(dealii::TrilinosWrappers::SparseMatrix::size_type, dealii::TrilinosWrappers::SparseMatrix::size_type, const size_type*, const TrilinosScalar*, bool, bool)
The violated condition was:
    ierr == 0
Additional information:
    An error with error number 2 occurred while calling a Trilinos function


As on one MPI rank, this matrix should have all the entries stroed. I dont understand this error, and any help will be appreciated.

Thank you.


Wolfgang Bangerth

unread,
Nov 13, 2019, 11:30:40 PM11/13/19
to dea...@googlegroups.com

Pai,
can you come up with a small, self-contained testcase? This indeed looks like
a bug somewhere.

I looked at the code you are calling, but it seems correct to me -- it may be
that the error is in Trilinos, but it's hard to tell without a code we can
play with.

Best
W.


On 10/28/19 6:03 PM, Pai Liu wrote:
> Hi all,
>
> I need to manually create a trilinos sparse matrix (which a rectangular matrix
> here) and setup the entries of this matrix.
>
> When I do this with the following codes on one MPI rank:
>
>
> TrilinosWrappers::SparseMatrix T_mat(
>             locally_owned_dofs_DG, locally_owned_dofs_NdRho, MPI_COMM_WORLD, 8);
>
>
> TrilinosScalar val = 2.;
> T_mat.add(0, 0, val);
>
>
> *I got the follow error:*
>
> An error occurred in line <1824> of file
> </home/pai/deal.ii-candi/tmp/unpack/deal.II-v9.1.1/source/lac/trilinos_sparse_matrix.cc>
> in function
>     void
> dealii::TrilinosWrappers::SparseMatrix::add(dealii::TrilinosWrappers::SparseMatrix::size_type,
> dealii::TrilinosWrappers::SparseMatrix::size_type, const size_type*, const
> TrilinosScalar*, bool, bool)
> The violated condition was:
>     ierr == 0
> Additional information:
>     An error with error number 2 occurred while calling a Trilinos function
>
>
> As on one MPI rank, this matrix should have all the entries stroed. I dont
> understand this error, and any help will be appreciated.
>
> Thank you.
>
>
> --
> The deal.II project is located at http://www.dealii.org/
> <https://nam01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dealii.org%2F&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7C9fe76ab7ea1f43caceda08d75c037c9c%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637079042355088604&sdata=xcBbwXMPGI8BSDyzZ3vqDOA5kqHJRtJTgXvHzoF1t6g%3D&reserved=0>
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fforum%2Fdealii%3Fhl%3Den&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7C9fe76ab7ea1f43caceda08d75c037c9c%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637079042355098603&sdata=AlFfjd8AIwvzsKALIVyoaEUhZPoP3ESUYyI7%2FfFkHqE%3D&reserved=0>
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+un...@googlegroups.com
> <mailto:dealii+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/ddbc94dc-b331-4ee8-b457-94542bc82c96%40googlegroups.com
> <https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fdealii%2Fddbc94dc-b331-4ee8-b457-94542bc82c96%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7C9fe76ab7ea1f43caceda08d75c037c9c%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637079042355108594&sdata=iWjFSKQt0pu3GJtxYygpiO7270Ge9%2B0gNr3TmM8djuY%3D&reserved=0>.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages