[Trilinos-Users] Tpetra::Vector: elementwise operations

Heroux, Michael A maherou at sandia.gov
Wed Feb 17 08:31:26 MST 2010


Direct assignment (x[k] = val) will always be faster than the method call in Epetra.  Even if the compiler successfully inlines all of the code, there is overhead due to error checking the return code and extra dereferences.  The direct assignment can also often be vectorized if it is within a loop and memory prefetch can be triggered on modern processors.


On 2/17/10 7:32 AM, "Nico Schlömer" <nico.schloemer at ua.ac.be> wrote:

On 01/25/2010 05:21 PM, Baker, Christopher G. wrote:
> Furthermore, and I keep meaning to add a note about this, the method replaceLocalValue() is not an efficient method anymore. On GPU platforms, the performance will be horrible. On CPU platforms, there will be some overhead to pay. The reason is because each call to replaceLocalValue() will call get1dViewNonConst(); therefore, it is better to call get1dViewNonConst() up front and use a view of the out vector, as you are currently doing with the in vector.
Is that true for Epetra_Vectors as well? Is there any substantial
difference between the next two lines (with x being an Epetra_Vector)?

    x.ReplaceMyValue( k  , 0,  val );
    x[k] = val;


Trilinos-Users mailing list
Trilinos-Users at software.sandia.gov

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

More information about the Trilinos-Users mailing list