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

Fixed bug in timeseries plots under MPI. #1116

Merged
merged 2 commits into from
Oct 3, 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
16 changes: 12 additions & 4 deletions dymos/visualization/timeseries/bokeh_timeseries_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,12 @@ def _get_traj_and_phases_from_problem(problem, rank: int = 0):
a subdictionary of phases and their associated options. Under MPI, this dictionary
"""
comm_rank = 0 if MPI is None else MPI.COMM_WORLD.rank
traj_options = _gather_system_options(problem.model, sys_cls=Trajectory, rank=rank)
phase_options = _gather_system_options(problem.model, sys_cls=Phase, rank=rank)
traj_options = _gather_system_options(problem.model, ['parameter_options'],
sys_cls=Trajectory, rank=rank)
phase_options = _gather_system_options(problem.model,
['time_options', 'parameter_options',
'state_options', 'control_options'],
sys_cls=Phase, rank=rank)

trajs = {}

Expand Down Expand Up @@ -344,13 +348,16 @@ def _load_data_sources(traj_and_phase_meta=None, solution_record_file=None, simu
return data_dict


def _gather_system_options(model, sys_cls=None, rank=0):
def _gather_system_options(model, options, sys_cls=None, rank=0,):
"""Retreive system options for systems of the given class and/or pathname.

Parameters
----------
model : System
The root system from which model options are being gathered.
options : Sequence of str
The names of the options to be gathered from systems.
Should be one of Trajectory or Phase.
sys_cls : class, optional
The class of system for which we want to retrieve options, or None if we
should look for all systems regardless of class.
Expand All @@ -363,7 +370,8 @@ def _gather_system_options(model, sys_cls=None, rank=0):

system_options = {}
for subsys in model.system_iter(include_self=True, recurse=True, typ=sys_cls):
system_options[subsys.pathname] = subsys.options
system_options[subsys.pathname] = {k: v['val'] for k, v in subsys.options._dict.items()
if k in options}

if comm_size > 1:
gathered = MPI.COMM_WORLD.gather(system_options, rank)
Expand Down
Loading