Skip to content

Commit

Permalink
tested seh non-timed and the example script for getting ancestors
Browse files Browse the repository at this point in the history
  • Loading branch information
salotz committed Apr 17, 2018
1 parent c1025ee commit 9f6f5cf
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
12 changes: 6 additions & 6 deletions examples/seh_tppu_unbinding/analysis/walker_lineage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
if sys.argv[1] == '-h' or sys.argv[1] == '--help':
print("walker_lineage.py run_index walker_index output_DCD_path")
else:
run_idx = sys.argv[1]
walker_idx = sys.argv[2]
run_idx = int(sys.argv[1])
walker_idx = int(sys.argv[2])
dcd_path = sys.argv[3]

outputs_dir = osp.realpath('../outputs')
Expand All @@ -22,15 +22,15 @@

wepy_h5.open()

cycle_idx = wepy_h5.traj(run_idx, walker_idx)['positions'].shape[0]
cycle_idx = wepy_h5.traj(run_idx, walker_idx)['positions'].shape[0] - 1

resampling_panel = wepy_h5.run_resampling_panel(run_idx)

parent_panel = WExplore1.DECISION.parent_panel(resampling_panel)
parent_table = WExplore1.DECISION.net_parent_panel(parent_panel)
parent_panel = WExplore1Resampler.DECISION.parent_panel(resampling_panel)
parent_table = WExplore1Resampler.DECISION.net_parent_table(parent_panel)

lineage = ancestors(parent_table, cycle_idx, walker_idx)

mdj_traj = wepy_h5.trace_to_mdtraj(lineage)
mdj_traj = wepy_h5.run_trace_to_mdtraj(run_idx, lineage)

mdj_traj.save_dcd(dcd_path)
14 changes: 13 additions & 1 deletion examples/seh_tppu_unbinding/we.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
# standard reporters
from wepy.reporter.hdf5 import WepyHDF5Reporter

# a reporter to show a dashboard in plaintext of current summarized
# results of the simulation
from wepy.reporter.dashboard import WExploreDashboardReporter

## PARAMETERS

# OpenMM simulation parameters
Expand Down Expand Up @@ -367,6 +371,14 @@ def main(n_runs, n_cycles, steps, n_walkers, n_workers=1, debug_prints=False, se
all_atoms_rep_freq=ALL_ATOMS_SAVE_FREQ
)

dashboard_reporter = WExploreDashboardReporter('./outputs/wepy.dash.txt', mode='w',
step_time=STEP_SIZE.value_in_unit(unit.second),
max_n_regions=resampler.max_n_regions,
max_region_sizes=resampler.max_region_sizes,
bc_cutoff_distance=ubc.cutoff_distance)

reporters = [hdf5_reporter, dashboard_reporter]

## The work mapper

# we use a mapper that uses GPUs
Expand All @@ -388,7 +400,7 @@ def main(n_runs, n_cycles, steps, n_walkers, n_workers=1, debug_prints=False, se
resampler=resampler,
boundary_conditions=ubc,
work_mapper=work_mapper,
reporters=[hdf5_reporter])
reporters=reporters)


### RUN the simulation
Expand Down
6 changes: 3 additions & 3 deletions wepy/analysis/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def ancestors(parent_matrix, cycle_idx, walker_idx, ancestor_cycle=0):

previous_walker = walker_idx

for cycle_idx in range(cycle_idx, ancestor_cycle, -1):
previous_walker = parent_matrix[cycle_idx][previous_walker]
previous_point = (cycle_idx - 1, previous_walker)
for curr_cycle_idx in range(cycle_idx, ancestor_cycle, -1):
previous_walker = parent_matrix[curr_cycle_idx][previous_walker]
previous_point = (curr_cycle_idx - 1, previous_walker)
ancestors.insert(0, previous_point)

return ancestors
Expand Down
11 changes: 7 additions & 4 deletions wepy/reporter/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class WExploreDashboardReporter(FileReporter):
Average Resampling Time: {avg_resampling_time}
Average Cycle Time: {avg_cycle_time}
Worker Avg. Segment Times:
{worker_avg_segment_time}
Warping Log:
Expand Down Expand Up @@ -350,6 +351,8 @@ def update_performance_values(self, cycle_idx, n_steps, worker_segment_times,
'worker_idx', 'segment_time'))
# the aggregated table for the workers
self.worker_agg_table = worker_df.groupby('worker_idx')[['segment_time']].aggregate(np.mean)
self.worker_agg_table.rename(columns={'segment_time' : 'avg_segment_time (s)'},
inplace=True)

# log of the components times
self.cycle_runner_times.append(cycle_runner_time)
Expand Down Expand Up @@ -419,13 +422,13 @@ def dashboard_string(self):
branching_table_str = branching_table_df.to_string()

# log of warp events
warp_table_colnames = ('walker_idx', 'weight', 'time')
warp_table_colnames = ('walker_idx', 'weight', 'time (s)')
warp_table_df = pd.DataFrame(self.warp_records, columns=warp_table_colnames)
warp_table_str = warp_table_df.to_string()

# log of cycle times
cycle_table_colnames = ('cycle_time', 'runner_time', 'boundary_conditions_time',
'resampling_time')
cycle_table_colnames = ('cycle_time (s)', 'runner_time (s)', 'boundary_conditions_time (s)',
'resampling_time (s)')
cycle_table_df = pd.DataFrame({'cycle_times' : self.cycle_compute_times,
'runner_time' : self.cycle_runner_times,
'boundary_conditions_time' : self.cycle_bc_times,
Expand All @@ -435,7 +438,7 @@ def dashboard_string(self):


# log of workers performance
worker_table_colnames = ('cycle_idx', 'n_steps', 'worker_idx', 'segment_time',)
worker_table_colnames = ('cycle_idx', 'n_steps', 'worker_idx', 'segment_time (s)',)
worker_table_df = pd.DataFrame(self.worker_records, columns=worker_table_colnames)
worker_table_str = worker_table_df.to_string()

Expand Down
4 changes: 2 additions & 2 deletions wepy/work_mapper/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, num_workers=None, worker_type=None,
debug_prints=False):

self.num_workers = num_workers
self.worker_segment_times = {worker_idx : [] for i in range(num_workers)}
self.worker_segment_times = {i : [] for i in range(self.num_workers)}

# choose the type of the worker
if worker_type is None:
Expand Down Expand Up @@ -161,7 +161,7 @@ def map(self, *args, debug_prints=False):

# save the task run times, so they can be accessed if desired,
# after clearing the task times from the last mapping
self.worker_segment_times = {worker_idx : [] for i in range(num_workers)}
self.worker_segment_times = {i : [] for i in range(self.num_workers)}
for task_idx, worker_idx, task_time, result in results:
self.worker_segment_times[worker_idx].append(task_time)

Expand Down

0 comments on commit 9f6f5cf

Please sign in to comment.