Skip to content

Adds Beam.init_bunch_list_mpi

MR to answer to #10 (closed)

Previously, to initialize a beam with a bunch list and mpi, it was needed to do (some expert know-how needed):

ring = demo()

filling_pattern = np.zeros((ring.h, 1), dtype=bool)

filling_pattern[0] = True
filling_pattern[2] = True
filling_pattern[10] = True
filling_pattern[11] = True

bunch_list = [Bunch(ring, mp_number=1, alive=filling_pattern[i]) for i in range(ring.h)]

# for i in range(size):
#     bunch_list[i] = Bunch(ring, mp_number=1)

idx_non_empty = np.where(filling_pattern)[0]

mybunch = Bunch(ring, mp_number=1e3, current=(rank+1)*1e-3)
mybunch.init_gaussian()

bunch_list[idx_non_empty[rank]] = mybunch

beam = Beam(ring, bunch_list=bunch_list)
beam.mpi_init()

New it's simpler with the new method:

ring = demo()

filling_pattern = np.zeros((ring.h, 1), dtype=bool)

filling_pattern[0] = True
filling_pattern[2] = True
filling_pattern[10] = True
filling_pattern[11] = True

mybunch = Bunch(ring, mp_number=1e3, current=(rank+1)*1e-3)
mybunch.init_gaussian()

beam = Beam(ring)
beam.init_bunch_list_mpi(mybunch, filling_pattern)

Contents:

  • Beam.update_filling_pattern and Beam.update_distance_between_bunches are now called directly in the init when a bunch_list is given.
  • Beam.init_bunch_list_mpi is a convenience method to initialize a beam using MPI parallelisation with a Bunch per core.
  • Add tests for Beam.init_bunch_list_mpi

Merge request reports

Loading