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

Adds a parallel manager, allowing parallel execution of reaktoro blocks. #11

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

avdudchenko
Copy link
Contributor

@avdudchenko avdudchenko commented Oct 24, 2024

Realted to 9 this adds ability for reaktoro to run in parallel using multiprocessing.

This PR added a a new ReaktoroBlockManager class, that can be passed into a ReaktoroBlock allowing its aggregation and solving in parallel.

Most functionality remains the same. Typical usage is shown below :

m.reaktoro_manager = ReaktoroBlockManager()
m.property_block_1 = ReaktoroBlock(reaktoro_block_manager=m.reaktoro_manager, other options...)
m.property_block_2 = ReaktoroBlock(reaktoro_block_manager=m.reaktoro_manager, other options...)
m.property_block_3 = ReaktoroBlock(reaktoro_block_manager=m.reaktoro_manager, other options...)
m.reaktoro_manager.build_reaktoro_blocks()

Proceed to use as normal in flowsheet e.g.

init model 
m.property_block_1.initialize()
m.property_block_2.initialize()
m.property_block_3.initialize()
solve model 

once completed working with flowsheet ensure to kill all workers with
m.reaktoro_manager.terminate_workers()

Left to add:

  • async for when there are more blocks than the maximum allowed processors - currently, no checks or limits are enforced.

  • Currently, there is no clean way to interact directly with reaktoro_block.reaktoro_model.outputs.

  • Fix display for reaktoro state.

@avdudchenko avdudchenko self-assigned this Oct 24, 2024
@avdudchenko avdudchenko changed the title This addes a parallel manager, allowing paral execution of reaktoro blocks. Adds a parallel manager, allowing parallel execution of reaktoro blocks. Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant