c++ function in the mex (S) function is much faster than linux terminal
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
seongjoo thunder
el 18 de Nov. de 2022
Comentada: seongjoo thunder
el 29 de Nov. de 2022
Hi guys. I am testing my c++ code using software in the loop (SIL) test.
When i compare computation time of c++ code execution in the S-function and c++ code execution in the linux terminal,
Former is much faster than latter.
Both used the same compiler (g++) and c++ libraries ( eigen and CLP)
It is hard to figure out how it works and there is no info about this.
0 comentarios
Respuesta aceptada
Gaurav Vinay
el 28 de Nov. de 2022
The execution in linux terminal tends to be slower when compared to a S-function since S-functions are already in the binary form of the model, however in SIL the binary gets generated on execution.
Although the SIL simulation happens on the binary generated, the code is generated for the entire model blocks when run on a Linux terminal. This is generally the main cause for the additional execution time.
For a model with S-function, mex files are used, which is already in binary form. Hence there is no generation of blocks into binary again during execution which speeds up the compilation time.
For more information on SIL Simulations, go through the following link:-
Although there is a difference in execution time, the time gap will reduce on subsequent runs of the test in a Linux Terminal as the Binary generated will be cached.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!