Skip to content

Commit

Permalink
Python Examples: Finalize Sim (#519)
Browse files Browse the repository at this point in the history
As in the Python tests, run explicitly `sim.finalize()` for a
controlled and clean shutdown. This also stops and prints
the tiny profiler table.
  • Loading branch information
ax3l authored Feb 3, 2024
1 parent 84226b1 commit e326fb8
Show file tree
Hide file tree
Showing 40 changed files with 120 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/alignment/run_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/aperture/run_aperture.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/apochromatic/run_apochromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/apochromatic/run_apochromatic_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/cfbend/run_cfbend.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/cfbend/run_cfbend_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/cfchannel/run_cfchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/cfchannel/run_cfchannel_10nC.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/chicane/run_chicane.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/chicane/run_chicane_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/compression/run_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/cyclotron/run_cyclotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/epac2004_benchmarks/run_bithermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/epac2004_benchmarks/run_fodo_rf_SC.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/epac2004_benchmarks/run_thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/expanding_beam/run_expanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/fodo/run_fodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/fodo/run_fodo_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/fodo/run_fodo_programmable.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,6 @@ def my_ref_drift(pge, refpart):

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/fodo_chromatic/run_fodo_chr.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/fodo_rf/run_fodo_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/iota_lattice/run_iotalattice.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/iota_lattice/run_iotalattice_sdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/iota_lens/run_iotalens.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/iota_lens/run_iotalens_sdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/kicker/run_hvkicker_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/kicker/run_kicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/kicker/run_kicker_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/kurth/run_kurth_10nC_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/kurth/run_kurth_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/multipole/run_multipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/positron_channel/run_positron.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/pytorch_surrogate_model/run_ml_surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,6 @@ def surrogate_push(self, pc, step):
sim.lattice.extend([monitor])

sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/quadrupole_softedge/run_quadrupole_softedge.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/rfcavity/run_rfcavity.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/rotation/run_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/solenoid/run_solenoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/solenoid/run_solenoid_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/solenoid_softedge/run_solenoid_softedge.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()
3 changes: 3 additions & 0 deletions examples/thin_dipole/run_thin_dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@

# run simulation
sim.evolve()

# clean shutdown
sim.finalize()

0 comments on commit e326fb8

Please sign in to comment.