Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update prof #229

Merged
merged 1 commit into from
Aug 29, 2024
Merged
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
32 changes: 11 additions & 21 deletions benchmark/prof.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using JET

precompile = true

test_time = true
test_solve = true
#test = :objective
test = :constraints
test_code_warntype = false
Expand All @@ -23,28 +23,18 @@ grid_size = 100
docp, nlp = direct_transcription(ocp, grid_size = grid_size)
println("Load problem ", prob[:name])

# full solve
if test_time
if precompile
println("Precompilation")
direct_solve(ocp, grid_size = grid_size, display = false, max_iter = 2)
end
println("Timed solve")
@timev sol = direct_solve(ocp, grid_size = grid_size, display = false)
@btime sol = direct_solve(ocp, grid_size = grid_size, display = false)
end

if precompile
println("Precompilation")
if test == :objective
CTDirect.DOCP_objective(CTDirect.DOCP_initial_guess(docp), docp)
else
CTDirect.DOCP_constraints!(
zeros(docp.dim_NLP_constraints),
CTDirect.DOCP_initial_guess(docp),
docp,
)
end
direct_solve(ocp, grid_size = grid_size, display = false, max_iter = 2)
CTDirect.DOCP_objective(CTDirect.DOCP_initial_guess(docp), docp)
CTDirect.DOCP_constraints!(zeros(docp.dim_NLP_constraints), CTDirect.DOCP_initial_guess(docp), docp)
end

# full solve
if test_solve
println("Timed solve")
@timev sol = direct_solve(ocp, grid_size = grid_size, display=false)
@btime sol = direct_solve(ocp, grid_size = grid_size, display=false)
end

if test_code_warntype
Expand Down
Loading