Skip to content
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ jobs:
joinpath(output_directory, "machines_tlsph.png"))
savefig(plot!(plot_machines_tlsph_deformation_grad(); title = ""),
joinpath(output_directory, "machines_tlsph_deformation_gradient.png"))
savefig(plot!(plot_implementations_wcsph(); title = ""),
joinpath(output_directory, "implementations_wcsph.png"))
savefig(plot!(plot_update_strategies(); title = ""),
joinpath(output_directory, "update_strategies.png"))
'
- name: Build and deploy
env:
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
- Designed as a "playground" to easily switch between different implementations and data
structures
- Common API over all implementations
- Extensive benchmark suite to study different implementations (work in progress)
- GPU compatibility (work in progress)
- Extensive benchmark suite to study different implementations
- GPU compatibility

| Implementation | Description | Features | Query | Update | GPU-compatible |
| ------------- | ------------- | --- | :--: | :--: | :--: |
Expand All @@ -32,16 +32,17 @@

## Benchmarks by Implementation

The following benchmarks were conducted on an AMD Ryzen Threadripper 3990X using 128 threads.
The following benchmarks were conducted on an Intel Xeon W9-3475X using 36 threads.

Benchmark of a single force computation step of a Weakly Compressible SPH (WCSPH) simulation:
![wcsph](https://github.com/trixi-framework/PointNeighbors.jl/assets/44124897/ad5c378b-9ce2-4e6f-91dc-1e0da379b91f)

Benchmark of an incremental update similar to a WCSPH simulation (note the log scale):
![update](https://github.com/trixi-framework/PointNeighbors.jl/assets/44124897/71eac5c9-6aa5-4267-bc0b-4057c89f8b12)

Benchmark of a full right-hand side evaluation of a WCSPH simulation (note the log scale):
![rhs](https://github.com/trixi-framework/PointNeighbors.jl/assets/44124897/ac328a96-1b9f-4319-a785-dce9d862fd70)
![WCSPH benchmark by implementation](https://trixi-framework.org/PointNeighbors.jl/dev/assets/benchmarks/implementations_wcsph.png)

Benchmark of different neighborhood search update strategies. The benchmark alternates
Comment thread
efaulhaber marked this conversation as resolved.
between two perturbed point clouds. In 3D, only about 0.7% of the particles change cells
between updates, which is similar to a dam break simulation.
This is not relevant for `ParallelUpdate`, which reinitializes all particles
in every update step.
![Benchmark by update strategy](https://trixi-framework.org/PointNeighbors.jl/dev/assets/benchmarks/update_strategies.png)


## Benchmarks by Machine
Expand Down
55 changes: 52 additions & 3 deletions benchmarks/plot_benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ Keyword arguments are passed to `Plots.plot`. For example, use `title = "My titl

# Examples
```julia
include("benchmarks/benchmarks.jl")
include("benchmarks/plot_benchmarks.jl")
using PointNeighbors
include(joinpath(pkgdir(PointNeighbors), "benchmarks", "benchmarks.jl"));
include(joinpath(pkgdir(PointNeighbors), "benchmarks", "plot_benchmarks.jl"));

n_particles_vec, times = run_benchmark_default(benchmark_count_neighbors, (10, 10), 3)
plot_benchmark(n_particles_vec, times; title = "Count neighbors benchmark")
Expand All @@ -41,6 +42,8 @@ function plot_benchmark!(p, n_particles_vec, times; kwargs...)

plot!(p, n_particles_vec, n_particles_vec ./ times .* 1e-6;
xaxis = :log, xticks = (n_particles_vec, xticks), linewidth = 2,
# Make sure the plot starts at y = 0.
ylimits = (0, Inf), widen = true,
xlabel = "#particles", ylabel = "million particles processed per second",
legend = :outerright, size = (700, 350), dpi = 600, margin = 4 * Plots.mm,
palette = palette(:tab10), kwargs...)
Expand All @@ -50,6 +53,7 @@ end
# Run these benchmarks like this. The type of `search_radius_factor` determines
# if the benchmark is run in Float32 or Float64.
#
# using PointNeighbors
# include(joinpath(pkgdir(PointNeighbors), "benchmarks", "benchmarks.jl"));
# _, times = run_benchmark_full_grid(benchmark_wcsph, (10, 10, 10), 9,
# search_radius_factor=3.0f0,
Expand Down Expand Up @@ -86,7 +90,22 @@ benchmark_runtimes = (n_particles = [
n_particles_tlsph_deformation_grad_5090 = [
1000, 4096, 15625, 64000, 250047, 1030301, 4096000, 16387064,
42875000],
tlsph_deformation_grad_5090_fp32 = [5.6569e-5; 6.894e-5; 7.6672e-5; 8.3602e-5; 0.000313116; 0.00099187; 0.003671176; 0.015459844; 0.041021319;;])
tlsph_deformation_grad_5090_fp32 = [5.6569e-5; 6.894e-5; 7.6672e-5; 8.3602e-5; 0.000313116; 0.00099187; 0.003671176; 0.015459844; 0.041021319;;],
# Benchmarking the difference between implementations on an
# Intel Xeon W9-3475X (x36).
# _, times = run_benchmark_default(benchmark_wcsph, ...)
wcsph_w9_3475x_dictionary = [9.539e-5; 0.000507708; 0.001999838; 0.008442291; 0.034369512; 0.145935124; 0.581081578; 2.341472385; 9.445755411;;],
wcsph_w9_3475x_fullgrid = [6.0765e-5; 0.000402875; 0.001569317; 0.006578832; 0.026040483; 0.108027132; 0.434874618; 1.755279267; 7.07428452;;],
wcsph_w9_3475x_precomputed = [3.7762e-5; 0.000148563; 0.00054964; 0.002274807; 0.00899912; 0.037950566; 0.151298558; 0.607103175; 2.440462785;;],
# NaN values are just placeholders because the benchmark took too long.
wcsph_w9_3475x_trivial = [6.3518e-5; 0.000669186; 0.008641863; 0.135930064; 2.468379663; 43.607518925; NaN; NaN; NaN;;],
# Benchmarking the difference between update strategies on an
# Intel Xeon W9-3475X (x36).
# _, times = run_benchmark_updates((10, 10, 10), 9)
update_w9_3475x_parallel = [1.42395e-5; 1.9205e-5; 3.3569e-5; 7.6216e-5; 0.0001972665; 0.000657154; 0.002366056; 0.008558718; 0.0328478125;;],
update_w9_3475x_parallel_incremental = [1.05465e-5; 1.41955e-5; 2.36415e-5; 6.3423e-5; 0.000185218; 0.0007833225; 0.0052182165; 0.025595217; 0.103340834;;],
update_w9_3475x_semi_parallel = [1.00805e-5; 1.78505e-5; 4.28215e-5; 0.000153458; 0.0006931965; 0.0026806445; 0.0158252845; 0.079710013; 0.329653309;;],
update_w9_3475x_precomputed = [0.000156829; 0.0005617385; 0.0021646195; 0.009024255; 0.0354495175; 0.1443668715; 0.5821228515; 2.341333004; 9.381562997;;])

function plot_machines_wcsph()
times = hcat(benchmark_runtimes.wcsph_5090_fp32,
Expand Down Expand Up @@ -132,3 +151,33 @@ function plot_machines_tlsph_deformation_grad()

plot_benchmark!(p, benchmark_runtimes.n_particles, times; label = names)
end

function plot_implementations_wcsph()
times = hcat(benchmark_runtimes.wcsph_w9_3475x_precomputed,
benchmark_runtimes.wcsph_w9_3475x_fullgrid,
benchmark_runtimes.wcsph_w9_3475x_dictionary,
benchmark_runtimes.wcsph_w9_3475x_trivial)

names = ["PrecomputedNeighborhoodSearch";;
Comment thread
efaulhaber marked this conversation as resolved.
"GNHS & FullGridCellList";;
"GridNeighborhoodSearch";;
"TrivialNeighborhoodSearch";;]

plot_benchmark(benchmark_runtimes.n_particles, times; label = names,
title = "WCSPH on Intel Xeon W9-3475X (x36)")
end

function plot_update_strategies()
times = hcat(benchmark_runtimes.update_w9_3475x_parallel,
benchmark_runtimes.update_w9_3475x_parallel_incremental,
benchmark_runtimes.update_w9_3475x_semi_parallel,
benchmark_runtimes.update_w9_3475x_precomputed)

names = ["GNHS & ParallelUpdate";;
"GNHS & ParallelIncrementalUpdate";;
"GNHS & SemiParallelUpdate";;
"PrecomputedNeighborhoodSearch";;]

plot_benchmark(benchmark_runtimes.n_particles, times; label = names,
title = "Update strategies on Intel Xeon W9-3475X (x36)")
end
Loading
Loading