- This topic has 5 replies, 2 voices, and was last updated 4 years, 3 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › Timer for specific part of code
Tagged: 64_bits, AdvancedTimer, Computation Time, Execution time, Linux_ubuntu, SOFA_1912, Speed, Timer
Hi, I am new to SOFA and have a question about using the PythonAdvancedTimer.
I was wondering if it’s possible to extract the computation time of specific part of my code (i.e., the calculation of the forces acting on the mechanical object) and compare it with the overall computation time of one simulation time step.
Thanks in advance for any help!
Best,
Derick
Hi @sderick
I am not familiar with this PythonAdvancedTimer.py
It does not seem to be able to be tuned for extraction of a specific part of the simulation. However, this can be achieved using the “Log Time” option in the Stats widget of runSofa (or the Display Advanced Timer).
are you using the GUI or running SOFA in batch?
Best,
Hugo
Hi Hugo
Thanks for your reply!
I am running SOFA in batch. However, I switched to GUI mode to check out the stats, as you described. This looks very useful. I am curious how to select the substep of my python code so that the computation time can be displayed.
Best
Derick
Hi @sderick
I just would like to confirm my understanding: you would like to measure the time spent in your python script. Is that correct?
Which function(s) are of interest in your script?
Hugo
Hi,
I am calculating forces acting on a MechanicalObject. These forces come from a magnetic manipulation system and there are custom classes which compute these forces. In the end, I need to check how much time is spent calculating the force versus the time needed for the simulation.
Derick
Hi @sderick
Sorry for the delay of the reply.
Ok I better understand.
I think you can get inspired from what appears in CGLinearSolver (l.114). This ScopedAdvancedTimer will compute the time spent into this function. The value of the timer will be returned when you activate the options: “Log Time” or “Display AdvanceTimer profiler” in the Stats Widget (as shown above).
Hope this helps.
Best
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.