[Trilinos-Users] Performance comparison between native C++ and Julia wrappers

Bart Janssens bart at bartjanssens.org
Wed Apr 26 16:06:37 EDT 2017


Hi Andrey,

That would be this constructor then, I guess:
https://trilinos.org/docs/dev/packages/tpetra/doc/html/classTpetra_1_1CrsMatrix.html#af3aa543f0cf73601be0b87f2249492bf

It seems that in that case, it is possible to construct the three arrays as
native Julia arrays and pass a pointer to them to Trilinos, so it wouldn't
really measure bottlenecks in the Julia <-> Trilinos interface since only a
single C++ function would be called during assembly.

Maybe I should elaborate a bit on the case I'm trying to simulate using
this simplified example: the idea is to mimic a finite element assembly
loop, where the structure (i.e. the graph) remains constant during the
simulation, but the matrix coefficients can change (e.g. stabilization
coefficients and turbulent viscosity in a stabilized Navier-Stokes
simulation), so that is why I did a separate graph and matrix construction,
where the graph is constructed in the beginning and the values can be
updated each time step. One thing I do wonder about is if it would be
better to use replaceLocalValues for that?

Cheers,

Bart

On Wed, Apr 26, 2017 at 5:34 PM Prokopenko, Andrey V. <prokopenkoav at ornl.gov>
wrote:

> Hi Bart,
>
> First of all, it's awesome that you are working on a Julia wrapper for
> Trilinos. I am quite interested in that too, and will take a look at it.
>
> Second, looking at your laplace2d.cpp, I see that you are using
> insertGlobalIndices and replaceGlobalValues in a loop to fill the
> laplacian. I don't think this is the fastest way to fill. Instead, you
> could construct an array of values the same way you construct the list of
> indices, and then call a constructor of a matrix which takes in 3 arrays:
> row offsets, row indices and values. This should be the fastest serial way
> to construct the matrix given that you know it's structure a priori.
>
> -Andrey
>
>
> On 04/26/2017 11:17 AM, Bart Janssens wrote:
>
> Hi all,
>
> To check the performance of my Julia wrappers for Trilinos, I have added
> an example that assembles a linear system for the 2D Poisson problem, with
> analytical solution (1-x^2)*(1-y^2). Results seem to indicate that the
> performance is on the same level, so at this point I would like to
> double-check that the comparison is fair, i.e. does my example follow best
> practices for a Tpetra-based linear system assembly and not distort results
> somehow?
>
> The C++ code:
>
> https://github.com/barche/Trilinos.jl/blob/master/deps/src/upstream_examples/laplace2d.cpp
>
> The Julia version:
> https://github.com/barche/Trilinos.jl/blob/master/examples/laplace2d.jl
>
> In case someone wants to test the Julia version, the installation
> instructions are here:
> https://github.com/barche/Trilinos.jl
> and Julia can be downloaded from:
> https://julialang.org/downloads/
>
> For the solution itself I still use Thyra here, but I intend to rewrite
> that part to use Belos directly and of course add preconditioner options.
> The comparison for the solution time is not really important, since the
> function call overhead will always be negligible compared to the solution
> time. So for now I'm mostly interested in making sure the method for the
> system assembly is sane.
>
> Kind regards,
>
> Bart
>
>
> _______________________________________________
> Trilinos-Users mailing listTrilinos-Users at trilinos.orghttps://trilinos.org/mailman/listinfo/trilinos-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170426/620d9773/attachment.html>


More information about the Trilinos-Users mailing list