HI,
I am currently using acados on a large-scale problem but found a interesting problem. The “time_tot” can be less than “time_sim”, Is this caused by parallelization in acados by openmp? Can I trust time_tot?
Hi,
yes, I also saw inconsistent timings when using acados with openmp.
I just played around with it a bit more and found that inconsistent timings are occurring for me when using 8 threads on my machine, which has only 4 physical cores.
I think one should not use more threads than physical cores with openmp.
You can specify the option in CMake using e.g. -DACADOS_NUM_THREADS=4
.
Maybe, this should be used for timing when using acados with openmp:
https://www.openmp.org/spec-html/5.0/openmpsu160.html
Hola,
I set the thread num to 6, as my CPU is 8750H with 6 cores, there still exists longer sim timing than total one. Is the total one truly trusted? If so, I think longer sim timing is acceptable.
I just thought again about this.
-
time_sim
is the sum of the CPU time of all dynamic modules (for each shooting interval).
If the dynamics modules are called in parallel fashion, multiple timers are running in parallel and count CPU time of each thread. -
time_tot
corresponds a single timer in the acados OCP solver.
Thus, it makes sense that time_sim
can be larger than time_tot
.
I suggest to look at time_lin
instead for parallelized timing.
This is measured with a single timer and contains all the linearization (i.e. also constraints and cost).