Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 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
15 changes: 6 additions & 9 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,13 @@

## 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)
![WCSPH benchmark by implementation](https://trixi-framework.org/PointNeighbors.jl/dev/assets/benchmarks/implementations_wcsph.png)

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)
Benchmark of different neighborhood search update strategies:
Comment thread
efaulhaber marked this conversation as resolved.
Outdated
![Benchmark by update strategy](https://trixi-framework.org/PointNeighbors.jl/dev/assets/benchmarks/update_strategies.png)


## Benchmarks by Machine
Expand Down
49 changes: 48 additions & 1 deletion benchmarks/plot_benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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 Down Expand Up @@ -86,7 +88,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 +149,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
26 changes: 24 additions & 2 deletions benchmarks/run_benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,36 @@ function run_benchmark_precomputed(benchmark, n_points_per_dimension, iterations
neighborhood_searches; names, parallelization_backend, kwargs...)
end

function create_full_grid_neighborhood_search(n_points_per_dimension)
function run_benchmark_updates(n_points_per_dimension, iterations;
Comment thread
efaulhaber marked this conversation as resolved.
Comment thread
efaulhaber marked this conversation as resolved.
parallelization_backend = PolyesterBackend(), kwargs...)
parallel = create_full_grid_neighborhood_search(n_points_per_dimension;
update_strategy = ParallelUpdate())
parallel_incremental = create_full_grid_neighborhood_search(n_points_per_dimension;
update_strategy = ParallelIncrementalUpdate())
semi_parallel = create_full_grid_neighborhood_search(n_points_per_dimension;
update_strategy = SemiParallelUpdate())
precomputed_nhs = create_precomputed_neighborhood_search(parallel,
Comment thread
efaulhaber marked this conversation as resolved.
parallelization_backend)
neighborhood_searches = (parallel, parallel_incremental, semi_parallel, precomputed_nhs)

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

run_benchmark(benchmark_update_alternating, n_points_per_dimension, iterations,
Comment thread
efaulhaber marked this conversation as resolved.
neighborhood_searches; names, parallelization_backend, kwargs...)
end

function create_full_grid_neighborhood_search(n_points_per_dimension;
update_strategy = ParallelUpdate())
NDIMS = length(n_points_per_dimension)

min_corner = 0.0f0 .* n_points_per_dimension
max_corner = Float32.(n_points_per_dimension ./ maximum(n_points_per_dimension))
cell_list = FullGridCellList(; search_radius = 0.0f0, min_corner, max_corner)
return GridNeighborhoodSearch{NDIMS}(; search_radius = 0.0f0, cell_list,
update_strategy = ParallelUpdate())
update_strategy)
end

function create_precomputed_neighborhood_search(grid_nhs, parallelization_backend)
Expand Down