Skip to content
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
15 changes: 11 additions & 4 deletions ring_of_CPUs_multiturn.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def __init__(self, sim_content, N_pieces_per_transfer=1, force_serial = False, c

if hasattr(sim_content, 'N_parellel_rings'):
self.N_parellel_rings = sim_content.N_parellel_rings

if int(np.mod(self.N_turns, self.N_parellel_rings)) != 0.:
raise ValueError('Sorry! N_turns needs to be a multiple of N_parellel_rings!')

if hasattr(sim_content, 'verbose'):
self.verbose = sim_content.verbose
Expand Down Expand Up @@ -222,11 +225,15 @@ def run(self):

self.sim_content.perform_bunch_operations_at_start_ring(next_bunch)

if next_bunch.slice_info['i_bunch'] == next_bunch.slice_info['N_bunches_tot_beam']-1:
if int(next_bunch.slice_info['i_turn']) >= self.N_turns:
orders_from_master.append('stop')
if self.I_am_a_worker:
raise ValueError('I cannot give orders to anybody :-(')

next_bunch.slice_info['i_turn']+=1
self.slices_to_be_treated = self.sim_content.slice_bunch_at_start_ring(next_bunch)

if next_bunch.slice_info['i_turn'] > self.N_turns:
orders_from_master.append('stop')
if next_bunch.slice_info['i_turn'] <= self.N_turns:
self.slices_to_be_treated = self.sim_content.slice_bunch_at_start_ring(next_bunch)

# Pop slices
slice_group = []
Expand Down