Skip to content

Commit

Permalink
remarks on trixi-framework#18
Browse files Browse the repository at this point in the history
  • Loading branch information
LasNikas committed Jun 25, 2024
1 parent 927120c commit 6e3ee75
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
9 changes: 9 additions & 0 deletions benchmarks/count_neighbors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ Due to the minimal computational cost, differences between neighborhood search
implementations are highlighted. On the other hand, this is the least realistic benchmark.
For a computationally heavier benchmark, see [`benchmark_n_body`](@ref).
# Example
```julia
nhs_trivial = TrivialNeighborhoodSearch .......
...
nhs_grid = GridNeighborhoodSearch ....
```
"""
function benchmark_count_neighbors(neighborhood_search, coordinates; parallel = true)
n_neighbors = zeros(Int, size(coordinates, 2))
Expand Down
9 changes: 9 additions & 0 deletions benchmarks/n_body.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ This is a more realistic benchmark for particle-based simulations than
[`benchmark_count_neighbors`](@ref).
However, due to the higher computational cost, differences between neighborhood search
implementations are less pronounced.
# Example
```julia
nhs_trivial = TrivialNeighborhoodSearch .......
...
nhs_grid = GridNeighborhoodSearch ....
```
"""
function benchmark_n_body(neighborhood_search, coordinates; parallel = true)
mass = 1e10 * (rand(size(coordinates, 2)) .+ 1)
Expand Down
8 changes: 7 additions & 1 deletion benchmarks/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include("../test/point_cloud.jl")
seed = 1, perturbation_factor_position = 1.0,
parallel = true, title = "")
Run a benchmark for with several neighborhood searches multiple times for increasing numbers
Run a benchmark with several neighborhood searches multiple times for increasing numbers
of points and plot the results.
# Arguments
Expand All @@ -28,10 +28,16 @@ of points and plot the results.
- `perturbation_factor_position = 1.0`: Perturb point positions by this factor. A factor of
`1.0` corresponds to points being moved by
a maximum distance of `0.5` along each axis.
# Example
also an example?
"""
function plot_benchmarks(benchmark, n_points_per_dimension, iterations;
parallel = true, title = "",
seed = 1, perturbation_factor_position = 1.0)
# Is there a reason why this is hard coded? Why not passing custom nhs like `custom_nhs...`?
# And then `nameof(typeof(nhs))`
neighborhood_searches_names = ["TrivialNeighborhoodSearch";;
"GridNeighborhoodSearch";;
"PrecomputedNeighborhoodSearch"]
Expand Down

0 comments on commit 6e3ee75

Please sign in to comment.