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

Multithreading parallelism #599

Closed
odow opened this issue May 1, 2023 · 3 comments · Fixed by #758
Closed

Multithreading parallelism #599

odow opened this issue May 1, 2023 · 3 comments · Fixed by #758

Comments

@odow
Copy link
Owner

odow commented May 1, 2023

The asynchronous solver currently uses multiprocessing. This causes a lot of excess RAM usage because we need N copies of the full problem.

If we introduced a lock to every subproblem, then we could have the asynchronous threads operating in parallel over a single PolicyGraph. We'd just need to be careful to always obtain a lock whenever we modified data inside a node. And potentially avoid some of the plugins that have state, like PSRSamplingScheme.

I don't have plans to implement this, just noting so that I can come back to this in future.

@odow
Copy link
Owner Author

odow commented May 2, 2023

This will be easier to test and benchmark on some of the upcoming MSPFormat problems, in which SDDP.jl performs poorly compared with QUASAR. (A Markovian graph with 22,000+ nodes.)

@odow odow mentioned this issue May 13, 2023
3 tasks
@odow
Copy link
Owner Author

odow commented May 14, 2023

One blocker is

function prepare_backward_pass(
model::PolicyGraph,
duality_handler::AbstractDualityHandler,
options::Options,
)
undo = Function[]
for (_, node) in model.nodes
push!(undo, prepare_backward_pass(node, duality_handler, options))
end
function undo_relax()
for f in undo
f()
end
return
end
return undo_relax
end
. We'd need to change this so that we did it node-by-node, instead of all in one go.

@odow
Copy link
Owner Author

odow commented Jul 24, 2024

I have something in #758 that seems to work well.

@odow odow closed this as completed in #758 Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant