[Trilinos-Users] Tpetra efficiency

Einar Otnes eotnes at gmail.com
Thu Jul 21 05:08:11 MDT 2011

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,

                              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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20110721/761fb5ca/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp.gz
Type: application/x-gzip
Size: 1867 bytes
Desc: not available
Url : https://software.sandia.gov/pipermail/trilinos-users/attachments/20110721/761fb5ca/attachment.gz 

More information about the Trilinos-Users mailing list