[Trilinos-Users] Tpetra efficiency

Williams, Alan B william at sandia.gov
Thu Jul 21 06:43:02 MDT 2011

If want a dense matrix, you could keep using Teuchos::serialdensematrix.
I wouldn't recommend using VbrMatrix with one block.

From: Einar Otnes [mailto:eotnes at gmail.com]
Sent: Thursday, July 21, 2011 05:47 AM
To: Holger Brandsmeier <holger.brandsmeier at sam.math.ethz.ch>; trilinos-users at software.sandia.gov <trilinos-users at software.sandia.gov>
Subject: Re: [Trilinos-Users] Tpetra efficiency

Thank you for the prompt response. I didn't think about the dense vs sparse matrix considerations. Thank you for pointing that out. Do you know whether there is a dense matrix class in Tpetra?
I was thinking of trying out VbrMatrix using a single block, but I haven't been able to make that work, yet. Is that a possible path ?

Thanks again,

On Thu, Jul 21, 2011 at 12:34 PM, Holger Brandsmeier <holger.brandsmeier at sam.math.ethz.ch<mailto:holger.brandsmeier at sam.math.ethz.ch>> wrote:
Dear Einar,

Tpetra::CrsMatrix is a sparse Matrix class, Teuchos::SerialDenseMatrix
is a dense matrix as the name implies. I assume that the matrix you
actually test this with is also dense, then the difference you observe
is certainly to be expected.

Note that sparse matrices are matrices where many entries are zero.
When there are many zero entries Tpetra::CrsMatrix is fast. But when
all entries are different than zero, then Tpetra::CrsMatrix is slower,
as it has not been desinged for it. The factor of 2 is quite low,
considering that you are using Tpetra::CrsMatrix for something it has
not been designed for.


On Thu, Jul 21, 2011 at 13:08, Einar Otnes <eotnes at gmail.com<mailto:eotnes at gmail.com>> wrote:
> Dear experts,
> I have been testing the performance of a simple matrix multiplication using
> 2 different Matrix/Vector classes on a single node and using a single
> thread, i.e. Teuchos::SerialDenseMatrix/Vector and Tpetra::CrsMatrix and
> Tpetra::Vector, and I have seen that the run time for evaluating the same
> product differs by a factor ~2  between the SerialDenseMatrix and CrsMatrix.
> Is this  behaviour expected when running on a single node/single thread? Or
> is the way I'm the Tpetra matrices making my code inefficient? Below follows
> the output from my code showing the time it takes to run 200 evaluations of
> Ax=b where the size of the matrix A is 5000x5000.
> I have attached the code I wrote to produce the results below.
> All the best,
> Einar Otnes
> ==========================================================================
> Teuchos in Trilinos 10.6.4
> Tpetra in Trilinos 10.6.4
> Evaluate Ax=b.
> Problem size: numRows m= 5000 numCols n= 5000
> Ax=b will be evaluated 200 time(s).
> Initialize the Matrices and Vectors with random numbers
> Start the Calculations!!
> Done Ax=b using Teuchos::SerialDenseMatrix
> Done Ax=b using Tpetra::CrsMatrix
> Done Ax=b using Thyra/Tpetra adapter
> Calculate norm(b) for each of the three methods applied.
> bNorm= 1671.55
> dNorm= 1671.55
> b2Norm= 1671.55
> Tpetra Vector
>  Tpetra::Vector<double, int, int, Kokkos::TPINode>{length=5000}
>  node    0: local length=5000
> Thyra wrapped Tpetra Vector
>  Thyra::TpetraVector<double, int, int,
> Kokkos::TPINode>{spmdSpace=Thyra::TpetraVectorSpace<double, int, int,
> Kokkos::TPINode>{globalDim=5000,localSubDim=5000,localOffset=0,comm=Teuchos::SerialComm<long
> int>}}
> ================================================================================
>                               TimeMonitor Results
> Timer Name                      Local time (num calls)
> --------------------------------------------------------------------------------
> SerialDenseMatrix apply Time    3.69 (200)
> CrsMatrix apply Time            7.53 (200)
> Thyra CrsMatrix apply Time      7.43 (200)
> ================================================================================
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov<mailto:Trilinos-Users at software.sandia.gov>
> http://software.sandia.gov/mailman/listinfo/trilinos-users

Holger Brandsmeier, SAM, ETH Zürich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20110721/cb5a8aca/attachment.html 

More information about the Trilinos-Users mailing list