-<!doctype html> <html lang=en > <meta charset=UTF-8 > <meta name=viewport content="width=device-width, initial-scale=1"> <link rel=stylesheet href="/css/franklin.css"> <link rel=stylesheet href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic|Source+Code+Pro:400,700" type="text/css"> <link rel=stylesheet href="/css/font-awesome.min.css"> <link rel=stylesheet href="/css/celeste.min.css"> <link rel=icon type="image/png" sizes=192x192 href="/assets/favicon.png"> <link rel="shortcut icon" href="/assets/favicon.ico"> <link rel=apple-touch-icon-precomposed sizes=152x152 href="/assets/apple-touch-icon.png"> <title>Comparison of <code>rhs!</code> Performance: CPU vs. GPU</title> <header> <nav class=nav-main > <ul> <a class=hvr-underline-reveal href="/" style="margin-top: 15px; margin-right: 15px"> <img src="/assets/favicon.png" alt=Logo style="height: 45px; width: 45px"> </a> <li class=hvr-underline-reveal ><a href="/">Home</a> <li class=hvr-underline-reveal ><a href="/doc/">Doc</a> <li class=hvr-underline-reveal ><a href="/tutorial/">Tutorial</a> <li class=hvr-underline-reveal ><a href="/blog/">Blog</a> </ul> </nav> </header> <div class=franklin-content ><h1 id=comparison_of_rhs_performance_cpu_vs_gpu ><a href="#comparison_of_rhs_performance_cpu_vs_gpu" class=header-anchor >Comparison of <code>rhs!</code> Performance: CPU vs. GPU</a></h1> <blockquote> <p>This documentation serves as a supplementary material for JuliaCon 2025. <br /></p> </blockquote> <p>See the benchmarking file at <a href="https://github.com/trixi-gpu/TrixiCUDA.jl/blob/v0.11.17/benchmark/plot.ipynb">plot.ipynb</a>, and all results are compared between <a href="">TrixiCUDA.jl v0.1.0-rc.2</a> and <a href="https://github.com/trixi-framework/Trixi.jl/tree/v0.11.17">Trixi.jl v0.11.17</a>.</p> <p>We provide the link to each example in Trixi.jl as it is a more mature and stable package compared to TrixiCUDA.jl. Note that performance varies with different inputs; these benchmark results are provided for reference only.</p> <h2 id=linear_advection_equation ><a href="#linear_advection_equation" class=header-anchor >Linear Advection Equation</a></h2> <p>Left: Basic linear advection equation (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_advection_basic.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_advection_basic.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_advection_basic.jl">3D</a>) <br />Right: Linear advection equation with mortar method (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_advection_mortar.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_advection_mortar.jl">3D</a>)</p> <table style="background: transparent; border: none;"> <tr> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench1.png" style="width: 300px;"> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench2.png" style="width: 300px;"> </table> <h2 id=compressible_euler_equations ><a href="#compressible_euler_equations" class=header-anchor >Compressible Euler Equations</a></h2> <p>Left: Compressible Euler equations with entropy-conservative flux (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_euler_ec.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_euler_ec.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_euler_ec.jl">3D</a>) Right: Compressible Euler equations with shock capturing (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_euler_shockcapturing.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_euler_shockcapturing.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl">3D</a>)</p> <table style="background: transparent; border: none;"> <tr> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench3.png" style="width: 300px;"> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench4.png" style="width: 300px;"> </table> <h2 id=hyperbolic_diffusion_equations ><a href="#hyperbolic_diffusion_equations" class=header-anchor >Hyperbolic Diffusion Equations</a></h2> <p>Hyperbolic diffusion equations with non-periodic boundary conditions (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_hypdiff_nonperiodic.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_hypdiff_nonperiodic.jl">3D</a>)</p> <div align=center > <img src="/assets/benchmark/bench8.png" style="width: 300px;"> </div> <h2 id=ideal_glm-mhd_equations ><a href="#ideal_glm-mhd_equations" class=header-anchor >Ideal GLM-MHD Equations</a></h2> <p>Upper: Ideal GLM-MHD equations with entropy-conservative flux (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_mhd_ec.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_mhd_ec.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_mhd_ec.jl">3D</a>) <br />Lower left: Ideal GLM-MHD Alfven wave (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_mhd_alfven_wave.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_mhd_alfven_wave.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_mhd_alfven_wave.jl">3D</a>) <br />Lower right: Ideal GLM-MHD Alfven wave with mortar method (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl">2D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl">3D</a>)</p> <p> <div align=center > <img src="/assets/benchmark/bench5.png" style="width: 300px;"> </div> <table style="background: transparent; border: none;"> <tr> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench6.png" style="width: 300px;"> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench7.png" style="width: 300px;"> </table> </p> <h2 id=shallow_water_equations ><a href="#shallow_water_equations" class=header-anchor >Shallow Water Equations</a></h2> <p>Left: Shallow water equations with entropy conservative flux (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_shallowwater_ec.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_shallowwater_ec.jl">2D</a>) <br />Right: Shallow water equations with source terms (<a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_1d_dgsem/elixir_shallowwater_source_terms.jl">1D</a>, <a href="https://github.com/trixi-framework/Trixi.jl/blob/v0.11.17/examples/tree_2d_dgsem/elixir_shallowwater_source_terms.jl">2D</a>)</p> <table style="background: transparent; border: none;"> <tr> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench9.png" style="width: 300px;"> <td style="background: transparent; border: none;"> <img src="/assets/benchmark/bench10.png" style="width: 300px;"> </table> <h2 id=takeaway ><a href="#takeaway" class=header-anchor >Takeaway</a></h2> <p>For simple cases (for example, if the CPU performance is less than 100 μs), it is not advantageous to run on the GPU, since the overhead of using the GPU outweighs any performance gain. However, for more complex cases (such as when execution time on the CPU exceeds 1,000 μs), running on the GPU can provide significant benefits.</p> <div class=page-foot > <p> © <a href="https://github.com/trixi-gpu" target=_blank >Trixi-GPU</a> developers. Powered by <a href="https://github.com/tlienart/Franklin.jl" target=_blank >Franklin.jl</a> and the <a href="https://julialang.org" target=_blank >Julia programming language</a>. </p> </div></div>
0 commit comments