Skip to content
Snippets Groups Projects
Peter W. Draper's avatar
Peter W. Draper authored
Clean up allocations and deallocations

Two improvements to the code:

 - Replaced all calls to `alloca()` by `malloc()` and `posix_memalign()` depending on use case.
 - Added cleaning up code to free up all the allocated memory. 

The second change is there to make sure we don't have memory leaks by easing the read of the memory sanitizer output. There is only one allocation that cannot be easily freed at the end of a run. In space.c (line 1327) we allocate cells in batches and then use them as a linked list. No memory leak there, just a hard unnecessary work to clean up at the end of a run.

That allows to run the EAGLE_50 example for hundreds of steps. 

See merge request !211
be9e0e49
History
 Welcome to the cosmological hydrodynamical code
    ______       _________________
   / ___/ |     / /  _/ ___/_  __/
   \__ \| | /| / // // /_   / /   
  ___/ /| |/ |/ // // __/  / /    
 /____/ |__/|__/___/_/    /_/     
 SPH With Inter-dependent Fine-grained Tasking

 Website: www.swiftsim.com
 Twitter: @SwiftSimulation

See INSTALL.swift for install instructions.

Usage: swift [OPTION]... PARAMFILE
       swift_mpi [OPTION]... PARAMFILE
       swift_fixdt [OPTION]... PARAMFILE
       swift_fixdt_mpi [OPTION]... PARAMFILE

Valid options are:
  -a          Pin runners using processor affinity
  -c          Run with cosmological time integration
  -d          Dry run. Read the parameter file, allocate memory but does not read 
              the particles from ICs and exit before the start of time integration.
              Allows user to check validy of parameter and IC files as well as memory limits.
  -e          Enable floating-point exceptions (debugging mode)
  -f    {int} Overwrite the CPU frequency (Hz) to be used for time measurements
  -g          Run with an external gravitational potential
  -G          Run with self-gravity
  -n    {int} Execute a fixed number of time steps. When unset use the time_end
              parameter to stop. 
  -s          Run with SPH
  -t    {int} The number of threads to use on each MPI rank. Defaults to 1 if not specified.
  -v     [12] Increase the level of verbosity 1: MPI-rank 0 writes 
              2: All MPI-ranks write
  -y    {int} Time-step frequency at which task graphs are dumped
  -h          Print this help message and exit

See the file examples/parameter_example.yml for an example of parameter file.