- edited description
potential memory leak with small emittance
Running bdsim (develop) on the lhc model with a very small emittance (~1e-12 m) produces memory leak - running even 1 event requires more than 14 GB of memory. If running with the correct emittance (~1e-10 m), everything works fine.
To run:
bdsim --file=lhc_shift.gmad --batch --ngenerate=1 --circular
Comments (3)
-
reporter -
This isn't in fact related to the emittance. Reducing the emittance merely induces fewer losses and you don't see the real problem. The ring in this model overlaps by around 0.6m at the end in 3D Cartesian coordinates. BDSIM actually prints out:
Calculating Teleporter delta Last item end position: (0.0784335,0,400.111) mm First item start position: (0,0,0) mm Teleport delta: (0.0784335,0,400.111) mm Insufficient space between the first and last elements in the beam line to fit the terminator and teleporter - these will not be built. BDSDetectorConstruction::BuildBeamline> Minimum space for circular mechanics is 0.011 um
That explains this. The z component should be negative if there's a gap and the beam line was built in the default +ve Z direction (i.e. no beam line starting transform specified in options).
Removing the last two components resolves this and it completes 1 turn in 2s for me with around the model usage of 1.1GB of RAM.
Usually the LHC doesn't close completely in 3D Cartesian coordinates due to the different treatment of the separation dipoles as sbends / rbends and their slight offset. The current LHC optics have a 75um X offset and 150um gap in Z.
The excessive memory usage is because the primary particle proceeds unhindered by the terminator (despite the geometry overlaps!) and loops the ring indefinitely. For the primary, the trajectory information is accumulated and this takes up more and more memory.
I will change it to exit when it can't build the circular mechanics (teleporter and terminator) correctly to prevent this.
Aside from that, @stewartboogert will say when we can remove the post step trajectory information that will reduce the trajectory memory usage by a factor of 2.
-
- changed status to resolved
I've changed BDSIM in the develop branch to exit now if the circular mechanics bits can't be built. This will be in the next version of BDSIM.
- Log in to comment