This simulation uses Hamiltonian mechanics to calculate the dynamics of the solar system:
To just build & run to check if it works, execute
dac/Examples/SolarSystem$ ./makeRun.shReminder from DAC-Readme: The Generator-binary generates the computational graph and from that the C-code which will perform the actual simulation. The Executor-binary runs this code and registers a callback function, which receives the state of the simulation at each time step.
Consequently, if you want to change any simulation parameters (time-increment step size, number of iterations, ...), you have to compile & run the Generator and then compile & run the Executor again.
Use
dac/Examples/SolarSystem$ Executor/build/main.out -hfor an overview of provided options. Run the simulation with
dac/Examples/SolarSystem$ Executor/build/main.out -p ./State.csv -i 1000After running the simulation, open Gnuplot and
dac/Examples/SolarSystem$ gnuplot
gnuplot> load "gnuplot.p"To change the number of simulation steps or the stepsize, use
dac/Examples/SolarSystem$ Generator/build/main.out -hfor an overview of provided options and run it afterwards to generate the code with new stepsize/runtime.
You may use gcc's feedback directed optimization feature to optimize the code:
- Choose some reasonably large number of iterations that doesn't take too long (e.g. 1000)
- compile and run the simulation with special gcc options (see below)
- GCC will create a run profile helping it to unroll loops and decide which branches are more or less likely
- Change the number of iterations to the large value you are actually interested in
- Recompile with gcc using the profile information
- It yields another ~5% speed increase.
dac/Examples/SolarSystem/Executor$ make clean
dac/Examples/SolarSystem/Executor$ make BCONFIG=PROFILE_GENERATE
dac/Examples/SolarSystem/Executor$ /build/main.out
dac/Examples/SolarSystem/Executor$ make clean
dac/Examples/SolarSystem/Executor$ make BCONFIG=PROFILE_USE # This will create the faster binary, so change iteration number before this stepIf the binary is executed privilidged or the binary itself is granted sufficient rights
dac/Examples/SolarSystem/Executor$ sudo setcap 'cap_sys_nice=eip' build/main.outall threads will be run at highest priority using SCHED_FIFO.

