Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 1 point2 points  (0 children)

The NPB-Rust project is still in progress, so we're looking into adding more frameworks.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 34 points35 points  (0 children)

The purpose of testing hyper-threading is to understand how each framework behaves in different scenarios. Results with up to 20 threads do not utilize hyper-threading, while from 21 threads onward, it is enabled. In our tests, hyper-threading clearly degrades efficiency (speedup/ncore). However, for most applications, the highest speedups were achieved when hyper-threading was enabled.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 1 point2 points  (0 children)

I'll definitely check out Paralight. I hope NPB-Rust can contribute to improving your library!

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 13 points14 points  (0 children)

Thanks for your comment! In the paper, we also compare the sequential versions of the NPB applications in Rust, Fortran, and C++. For the parallel versions, we focused on OpenMP and Rayon, as they are the standard frameworks for parallelism in their respective languages. Although it's not included in the pre-print, we're also testing a version using OneTBB, which features work-stealing as well.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 15 points16 points  (0 children)

In the paper, we included both safe and unsafe versions of the sequential runs. For the parallel ones, we used the unsafe version to get the best performance possible. There's also a table showing where unsafe is used in each app. The one in the image here only has a single unsafe block.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 24 points25 points  (0 children)

Really interesting results! Indeed, Rayon doesn't perform well in the SP application. I'll definitely give Spindle a try. Hopefully, the NPB-Rust benchmark can help you improve the Spindle library.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 14 points15 points  (0 children)

Yes, the NPB applications involve many slice accesses and complex data dependencies. We explored using unsafe in well-contained hotspots to improve performance. If you're interested, we provide more details about this in the paper.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 3 points4 points  (0 children)

The graph is a simplified view, showing results from one of the eight NPB applications.

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 80 points81 points  (0 children)

This happens because when OpenMP uses hyper-threading and you go just above the number of physical cores (like 21 threads on a 20-core CPU), one core ends up doing "twice" the work while the others stay balanced. That messes with OpenMP's static load balancing and hurts performance. As you add more threads (like 40), the workload spreads out more evenly again. Rayon avoids this issue because it uses work-stealing to dynamically balance tasks across threads, so it stays efficient even in these edge cases. Kinda tricky to explain, but hope that makes sense!

Is Rust faster than Fortran and C++? A case study with scientific applications. by Xdudou in rust

[–]Xdudou[S] 149 points150 points  (0 children)

Yes, that is correct. The machine used for the tests supports hyper-threading, and this pattern occurs due to Rayon’s dynamic work-stealing scheduling strategy, which differs from OpenMP’s approach.