-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1403 from CliMA/ali/flesh-out-vs-grid
- Loading branch information
Showing
19 changed files
with
518 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using BenchmarkTools | ||
using CUDA | ||
using Oceananigans | ||
using Benchmarks | ||
|
||
using Oceananigans.Solvers | ||
|
||
# Benchmark function | ||
|
||
function benchmark_fourier_tridiagonal_poisson_solver(Arch, N, topo) | ||
grid = VerticallyStretchedRectilinearGrid(architecture=Arch(), topology=topo, size=(N, N, N), x=(0, 1), y=(0, 1), zF=collect(0:N)) | ||
solver = FourierTridiagonalPoissonSolver(Arch(), grid) | ||
|
||
solve_poisson_equation!(solver) # warmup | ||
|
||
trial = @benchmark begin | ||
@sync_gpu solve_poisson_equation!($solver) | ||
end samples=10 | ||
|
||
return trial | ||
end | ||
|
||
# Benchmark parameters | ||
|
||
Architectures = has_cuda() ? [CPU, GPU] : [CPU] | ||
Ns = [256] | ||
PB = (Periodic, Bounded) | ||
Topologies = collect(Iterators.product(PB, PB, (Bounded,)))[:] | ||
|
||
# Run and summarize benchmarks | ||
|
||
suite = run_benchmarks(benchmark_fourier_tridiagonal_poisson_solver; Architectures, Ns, Topologies) | ||
|
||
df = benchmarks_dataframe(suite) | ||
sort!(df, [:Architectures, :Topologies, :Ns], by=(string, string, identity)) | ||
benchmarks_pretty_table(df, title="Fourier-tridiagonal Poisson solver benchmarks") | ||
|
||
if GPU in Architectures | ||
df = gpu_speedups_suite(suite) |> speedups_dataframe | ||
sort!(df, [:Topologies, :Ns], by=(string, identity)) | ||
benchmarks_pretty_table(df, title="Fourier-tridiagonal Poisson solver CPU -> GPU speedup") | ||
end | ||
|
||
for Arch in Architectures | ||
suite_arch = speedups_suite(suite[@tagged Arch], base_case=(Arch, Ns[1], (Periodic, Periodic, Bounded))) | ||
df_arch = speedups_dataframe(suite_arch, slowdown=true) | ||
sort!(df_arch, [:Topologies, :Ns], by=string) | ||
benchmarks_pretty_table(df_arch, title="Fourier-tridiagonal Poisson solver relative performance ($Arch)") | ||
end |
40 changes: 40 additions & 0 deletions
40
benchmark/benchmark_vertically_stretched_incompressible_model.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using BenchmarkTools | ||
using CUDA | ||
using Oceananigans | ||
using Benchmarks | ||
|
||
# Benchmark function | ||
|
||
function benchmark_vertically_stretched_incompressible_model(Arch, FT, N) | ||
grid = VerticallyStretchedRectilinearGrid(architecture=Arch(), size=(N, N, N), x=(0, 1), y=(0, 1), zF=collect(0:N)) | ||
model = IncompressibleModel(architecture=Arch(), float_type=FT, grid=grid) | ||
|
||
time_step!(model, 1) # warmup | ||
|
||
trial = @benchmark begin | ||
@sync_gpu time_step!($model, 1) | ||
end samples=10 | ||
|
||
return trial | ||
end | ||
|
||
# Benchmark parameters | ||
|
||
Architectures = has_cuda() ? [CPU, GPU] : [CPU] | ||
Float_types = [Float32, Float64] | ||
Ns = [32, 64, 128, 256] | ||
|
||
# Run and summarize benchmarks | ||
|
||
print_system_info() | ||
suite = run_benchmarks(benchmark_vertically_stretched_incompressible_model; Architectures, Float_types, Ns) | ||
|
||
df = benchmarks_dataframe(suite) | ||
sort!(df, [:Architectures, :Float_types, :Ns], by=(string, string, identity)) | ||
benchmarks_pretty_table(df, title="Vertically-stretched incompressible model benchmarks") | ||
|
||
if GPU in Architectures | ||
df_Δ = gpu_speedups_suite(suite) |> speedups_dataframe | ||
sort!(df_Δ, [:Float_types, :Ns], by=(string, identity)) | ||
benchmarks_pretty_table(df_Δ, title="Vertically-stretched incompressible model CPU -> GPU speedup") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
0da4ca7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
Release notes:
Major features:
HydrostaticFreeSurfaceModel
onRegularLatitudeLongitudeGrid
!VerticallyStretchedRectilinearGrid
now works for all topologies on the CPU and GPU!IncompressibleModel
with(Periodic, Periodic, Bounded)
topologies are actually faster with aVerticallyStretchedRectilinearGrid
.cleanup
keyword argument forCheckpointer
to delete old checkpoint files.DateTime
s andTimeDate
s.0da4ca7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/30894
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: