Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
23 changes: 9 additions & 14 deletions benchmarks/core-midpoint-trapeze.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Modeler: :exa

function run()
results = CTBenchmarks.benchmark(
results = CTBenchmarks.benchmark(;
problems=[
:beam,
:chain,
Expand All @@ -20,19 +20,14 @@ function run()
],

# solver × modeler
solver_models = [
:madnlp => [:exa],
:ipopt => [:exa],
],

disc_methods = [:trapeze, :midpoint],

grid_sizes = [200],
tol = 1e-8,
ipopt_mu_strategy = "adaptive",
print_trace = false,
max_iter = 2000,
max_wall_time = 600.0,
solver_models=[:madnlp => [:exa], :ipopt => [:exa]],
disc_methods=[:trapeze, :midpoint],
grid_sizes=[200],
tol=1e-8,
ipopt_mu_strategy="adaptive",
print_trace=false,
max_iter=2000,
max_wall_time=600.0,
)
println("✅ Benchmark midpoint vs trapeze completed successfully!")
return results
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/core-moonshot-gpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ function run()
# :ducted_fan,
:electric_vehicle,
:glider,
## :insurance, # to be re-added (unstable / sincos issue)
## :insurance, # to be re-added (unstable / sincos issue)
:jackson,
:robbins,
## :robot, # to be re-added (unstable / sincos issue)
## :robot, # to be re-added (unstable / sincos issue)
:rocket,
## :space_shuttle, # to be re-added (unstable / sincos issue)
## :steering, # to be re-added (unstable / sincos issue)
## :space_shuttle, # to be re-added (unstable / sincos issue)
## :steering, # to be re-added (unstable / sincos issue)
:vanderpol,
],
solver_models=[:madnlp => [:exa, :exa_gpu]],
Expand Down
3 changes: 2 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ with_processed_template_problems(
"Developers Guidelines" => [
"Add a New Benchmark" => "add_benchmark.md",
"Add a Custom Profile" => "add_performance_profile.md",
"DocUtils Template System" => joinpath("developers", "docutils_templates.md"),
"DocUtils Template System" =>
joinpath("developers", "docutils_templates.md"),
"Documentation Process" => "documentation_process.md",
],
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Modeler: :exa

function run()
results = CTBenchmarks.benchmark(
results = CTBenchmarks.benchmark(;
problems=[
:beam,
:chain,
Expand All @@ -20,19 +20,14 @@ function run()
],

# solver × modeler
solver_models = [
:madnlp => [:exa],
:ipopt => [:exa],
],

disc_methods = [:trapeze, :midpoint],

grid_sizes = [200],
tol = 1e-8,
ipopt_mu_strategy = "adaptive",
print_trace = false,
max_iter = 2000,
max_wall_time = 600.0,
solver_models=[:madnlp => [:exa], :ipopt => [:exa]],
disc_methods=[:trapeze, :midpoint],
grid_sizes=[200],
tol=1e-8,
ipopt_mu_strategy="adaptive",
print_trace=false,
max_iter=2000,
max_wall_time=600.0,
)
println("✅ Benchmark midpoint vs trapeze completed successfully!")
return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ function run()
# :ducted_fan,
:electric_vehicle,
:glider,
## :insurance, # to be re-added (unstable / sincos issue)
## :insurance, # to be re-added (unstable / sincos issue)
:jackson,
:robbins,
## :robot, # to be re-added (unstable / sincos issue)
## :robot, # to be re-added (unstable / sincos issue)
:rocket,
## :space_shuttle, # to be re-added (unstable / sincos issue)
## :steering, # to be re-added (unstable / sincos issue)
## :space_shuttle, # to be re-added (unstable / sincos issue)
## :steering, # to be re-added (unstable / sincos issue)
:vanderpol,
],
solver_models=[:madnlp => [:exa, :exa_gpu]],
Expand Down
1 change: 0 additions & 1 deletion docs/src/docutils/CTBenchmarksDocUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ using .DocumenterReference
# Wrapper Functions (no src_dir parameter needed in templates)
# ═══════════════════════════════════════════════════════════════════════════════


# ═══════════════════════════════════════════════════════════════════════════════
# Exports
# ═══════════════════════════════════════════════════════════════════════════════
Expand Down
4 changes: 1 addition & 3 deletions docs/src/docutils/Core/FigureEngine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ plt = call_figure_function("_plot_profile_default_cpu", ["core-ubuntu-latest"])
```
"""
function call_figure_function(
function_name::AbstractString,
args::Vector{<:AbstractString},
extra_args::Tuple=()
function_name::AbstractString, args::Vector{<:AbstractString}, extra_args::Tuple=()
)
if !haskey(FIGURE_FUNCTIONS, function_name)
available = join(sort(collect(keys(FIGURE_FUNCTIONS))), ", ")
Expand Down
4 changes: 2 additions & 2 deletions docs/src/docutils/Core/ProfileEngine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function plot_profile_from_registry(
name::String,
bench_id::AbstractString,
src_dir::AbstractString;
combos::Union{Nothing,Vector{<:Tuple}}=nothing
combos::Union{Nothing,Vector{<:Tuple}}=nothing,
)
config = CTBenchmarks.get_config(PROFILE_REGISTRY, name)
json_path = joinpath(src_dir, "assets", "benchmarks", bench_id, bench_id * ".json")
Expand Down Expand Up @@ -67,7 +67,7 @@ function analyze_profile_from_registry(
name::String,
bench_id::AbstractString,
src_dir::AbstractString;
combos::Union{Nothing,Vector{<:Tuple}}=nothing
combos::Union{Nothing,Vector{<:Tuple}}=nothing,
)
config = CTBenchmarks.get_config(PROFILE_REGISTRY, name)
json_path = joinpath(src_dir, "assets", "benchmarks", bench_id, bench_id * ".json")
Expand Down
25 changes: 20 additions & 5 deletions docs/src/docutils/Core/TemplateEngine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,17 @@ function replace_profile_plot_blocks(
plt = plot_profile_from_registry(profile_name, bench_id, SRC_DIR; combos=combos)

# Generate unique basename for the figure
args_str = bench_id * (isnothing(combos) ? "" : "_" * join(["$(m)_$(s)" for (m, s) in combos], "_"))
basename = generate_figure_basename(template_filename, "profile_plot_$(profile_name)", args_str)
args_str =
bench_id * (
if isnothing(combos)
""
else
"_" * join(["$(m)_$(s)" for (m, s) in combos], "_")
end
)
basename = generate_figure_basename(
template_filename, "profile_plot_$(profile_name)", args_str
)

# Create output directory if it doesn't exist
mkpath(figures_output_dir)
Expand Down Expand Up @@ -442,7 +451,9 @@ function replace_profile_plot_blocks(

catch e
if DOC_DEBUG[]
@error " ✗ Failed to generate profile plot" exception = (e, catch_backtrace())
@error " ✗ Failed to generate profile plot" exception = (
e, catch_backtrace()
)
else
@error " ✗ Failed to generate profile plot: $(e)"
end
Expand Down Expand Up @@ -528,13 +539,17 @@ function replace_profile_analysis_blocks(content::String)
end

try
text_md = analyze_profile_from_registry(profile_name, bench_id, SRC_DIR; combos=combos)
text_md = analyze_profile_from_registry(
profile_name, bench_id, SRC_DIR; combos=combos
)
DOC_DEBUG[] &&
@info " ✓ Replaced PROFILE_ANALYSIS block #$block_count: $profile_name for $bench_id"
return text_md
catch e
if DOC_DEBUG[]
@error " ✗ Failed to generate profile analysis" exception = (e, catch_backtrace())
@error " ✗ Failed to generate profile analysis" exception = (
e, catch_backtrace()
)
else
@error " ✗ Failed to generate profile analysis: $(e)"
end
Expand Down
5 changes: 1 addition & 4 deletions docs/src/docutils/Core/TextEngine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ string that will be inlined directly into the generated documentation.

const TEXT_FUNCTIONS = Dict{String,Function}()


"""
register_text_handler!(name::String, func::Function)

Expand Down Expand Up @@ -43,9 +42,7 @@ Arguments are passed as: `func(extra_args..., args...)` so that injected
dependencies (like `src_dir`) come first, following the Dependency Inversion Principle.
"""
function call_text_function(
function_name::AbstractString,
args::Vector{<:AbstractString},
extra_args::Tuple=()
function_name::AbstractString, args::Vector{<:AbstractString}, extra_args::Tuple=()
)
if !haskey(TEXT_FUNCTIONS, function_name)
available = join(sort(collect(keys(TEXT_FUNCTIONS))), ", ")
Expand Down
21 changes: 11 additions & 10 deletions docs/src/docutils/Handlers/DefaultProfiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const IS_SUCCESS_WITH_BENCHMARK =
Filter function: accepts rows where success is true and iterations data is available.
"""
const IS_SUCCESS_WITH_ITERATIONS =
row -> row.success == true && hasproperty(row, :iterations) && !ismissing(row.iterations)
row ->
row.success == true && hasproperty(row, :iterations) && !ismissing(row.iterations)

"""
Filter function: accepts all rows (no additional filtering).
Expand All @@ -41,17 +42,15 @@ Extracts the `:time` field from the benchmark object and uses "smaller is better
comparison (a <= b). Returns NaN if benchmark data is missing or malformed.
"""
const CPU_TIME_CRITERION = CTBenchmarks.ProfileCriterion{Float64}(
"CPU time",
row -> begin
"CPU time", row -> begin
bench = get(row, :benchmark, nothing)
if bench === nothing || ismissing(bench)
return NaN
end
time_raw = get(bench, "time", nothing)
time_raw === nothing && return NaN
return Float64(time_raw)
end,
(a, b) -> a <= b
end, (a, b) -> a <= b
)

"""
Expand All @@ -68,7 +67,7 @@ const ITERATIONS_CRITERION = CTBenchmarks.ProfileCriterion{Float64}(
end
return Float64(row.iterations)
end,
(a, b) -> a <= b
(a, b) -> a <= b,
)

# ───────────────────────────────────────────────────────────────────────────────
Expand All @@ -95,7 +94,7 @@ function init_default_profiles!()
CPU_TIME_CRITERION,
IS_SUCCESS_WITH_BENCHMARK,
NO_ADDITIONAL_FILTER,
AGGREGATE_MEAN
AGGREGATE_MEAN,
)
CTBenchmarks.register!(PROFILE_REGISTRY, "default_cpu", cpu_config)

Expand All @@ -106,7 +105,7 @@ function init_default_profiles!()
ITERATIONS_CRITERION,
IS_SUCCESS_WITH_ITERATIONS,
NO_ADDITIONAL_FILTER,
AGGREGATE_MEAN
AGGREGATE_MEAN,
)
CTBenchmarks.register!(PROFILE_REGISTRY, "default_iter", iter_config)

Expand All @@ -118,9 +117,11 @@ function init_default_profiles!()
CPU_TIME_CRITERION,
IS_SUCCESS_WITH_BENCHMARK,
NO_ADDITIONAL_FILTER,
AGGREGATE_MEAN
AGGREGATE_MEAN,
)
CTBenchmarks.register!(
PROFILE_REGISTRY, "midpoint_trapeze_cpu", midpoint_trapeze_config
)
CTBenchmarks.register!(PROFILE_REGISTRY, "midpoint_trapeze_cpu", midpoint_trapeze_config)

return nothing
end
3 changes: 2 additions & 1 deletion src/CTBenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ include(joinpath(@__DIR__, "plot_solutions.jl"))
include(joinpath(@__DIR__, "performance_profile.jl"))

export run, benchmark, plot_solutions
export analyze_performance_profile, build_profile_from_df, plot_performance_profile, load_benchmark_df
export analyze_performance_profile,
build_profile_from_df, plot_performance_profile, load_benchmark_df
export PerformanceProfileRegistry, PerformanceProfileConfig, ProfileCriterion

end # module
Loading