svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
54 stars 27 forks source link

Reducing memory consumption of simulations that use harmonic upconversion 2 #76

Closed ZeugAusHH closed 1 year ago

ZeugAusHH commented 1 year ago

(This is updated resubmission of pull request https://github.com/svenreiche/Genesis-1.3-Version4/pull/72 )

Improvements to harmonic upconversion code, reducing memory consumption of simulations using harmonic upconversion.

So far the memory holding the beam data in the std::vector objects used to store the slices is not returned to the system, for instance when the particles are sorted. This results in an amount of no longer used (but still allocated) physical RAM that is on the order of the total amount of electron beam data. When there are multiple sequential harmonic conversions, additional physical RAM is spent every time.

To compare the effect of the patch, the attached images show the memory consumption of "GENESIS 1.3" v4 processes (total mpisize=60, output of top is on the first simulation node) in two simulations on identical hardware at approximately the same progress (after a first harmonic upconversion). The left image shows the version in this pull request, the right image shows a version without this patch (commit id 37fe01b). The memory footprint of the processes with the patched code is significantly smaller.

These simulations were done in one4one mode with a Gaussian current envelope (120 slices, with 2500A peak current) and the initial wavelength of the photon field is 1um.

top