Skip to content

Leaner gparts and cell structure

Matthieu Schaller requested to merge lean_gparts into master

A bunch of updates to help with the memory foot-print, especially in cases with relatively simple physics:

  • Remove the padding of the gpart structure. (We were not taking advantage of it anyway)
  • Add a compile-time option to not compute (and hence store in RAM) potentials as they are not always needed.
  • Split the cell structure into sub-structures for each particle type.
  • Hide all the non-strictly necessary fields of these sub-structures into an anonymous union when compiling without star/BH/sink.
  • Add an empty hydro scheme to use the same trick as above also for the gas so that we have the leanest possible cell structure in gravity-only runs.

The 4th item in the list is quite a dirty trick I would think. Alternatives require massive code restructuring and probably runtime costs. This allows the code to compile as all the variables are defined. Though if one attempts to use them (e.g. because you have stars but compiled without) then you are in for a treat.

Merge request reports