-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add profiling #36
base: main
Are you sure you want to change the base?
Add profiling #36
Conversation
Percentages of total runtime
|
So if I read that right, lots of room for improvement in GenX and Tulipa? |
Yes, we might improve on the JuMP side on both Tulipa and GenX! Although JuMP is certainly not the main bottleneck. Sienna seems pretty much optimized on the JuMP side. About 50% of the time, it's doing other stuff (probably IO). |
I only see three numbers. Where' the total time? |
In this first pass I only considered relative time, not total time. So, this:
means that Therefore: The remaining 83.17% of the time is spent in other routines that are not from JuMP nor from HiGHS. Does it make sense to you? Open to suggestions on how to report those times. |
Oh I just assumed they were seconds |
is it better? is total time really useful? |
Total time is useful to track over different versions |
|
Not a WIP anymore |
Sienna gets stuck during profile in Linux. The linux fail happens consistently in CI and in my WSL virtual machine. MWE: # necessary sienna stack
import PowerSystems
import PowerSimulations
import HydroPowerSimulations
import PowerSystemCaseBuilder
# solver
import JuMP
import HiGHS
# julia base
import Dates
import Logging
# profile
import Profile
# Profile.init() # default fails
# @show Profile.init(n = 10^6, delay = 0.001) #fails
# @show Profile.init(n = 10^6, delay = 0.1) # works
function build_and_solve(problem)
PowerSimulations.build!(
problem;
output_dir = mktempdir(),
console_level = Logging.Info,
)
PowerSimulations.solve!(problem; console_level = Logging.Info)
return
end
function main()
# case data is downloaded from a julia artifcat
sys = PowerSystemCaseBuilder.build_system(
PowerSystemCaseBuilder.PSISystems,
"modified_RTS_GMLC_DA_sys",
)
template_uc = PowerSimulations.ProblemTemplate()
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.Line,
PowerSimulations.StaticBranch,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.Transformer2W,
PowerSimulations.StaticBranch,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.TapTransformer,
PowerSimulations.StaticBranch,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.ThermalStandard,
PowerSimulations.ThermalStandardUnitCommitment,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.RenewableDispatch,
PowerSimulations.RenewableFullDispatch,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.PowerLoad,
PowerSimulations.StaticPowerLoad,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.HydroDispatch,
HydroPowerSimulations.HydroDispatchRunOfRiver,
)
PowerSimulations.set_device_model!(
template_uc,
PowerSystems.RenewableNonDispatch,
PowerSimulations.FixedOutput,
)
PowerSimulations.set_service_model!(
template_uc,
PowerSystems.VariableReserve{PowerSystems.ReserveUp},
PowerSimulations.RangeReserve,
)
PowerSimulations.set_service_model!(
template_uc,
PowerSystems.VariableReserve{PowerSystems.ReserveDown},
PowerSimulations.RangeReserve,
)
solver =
JuMP.optimizer_with_attributes(HiGHS.Optimizer, "mip_rel_gap" => 0.5)
PowerSimulations.set_network_model!(
template_uc,
PowerSimulations.NetworkModel(PowerSimulations.CopperPlatePowerModel),
)
problem = PowerSimulations.DecisionModel(
template_uc,
sys;
optimizer = solver,
horizon = Dates.Hour(12),
initial_time = Dates.DateTime("2020-01-01T00:00:00") +
Dates.Hour((29 - 1) * 24),
optimizer_solve_log_print = true,
)
@show 1
# precompile
build_and_solve(problem)
@show 2
Profile.@profile build_and_solve(problem) # stuck here
@show 3
return
end
main()
|
cc @jd-lara |
close #7