Hello,
I have a MATLAB code that takes 12 mins to execute. I have to reduce it to less than a minute. However, I am not sure which parallel computing technique is compatible with OpenSim.
Since the integration in the manager takes 80% of the execution time, I was thinking if I can pass this part of code to execute on multiple threads/workers. The part of the code is mentioned below
manager = Manager(main_model); % Manager will be the forward dynamics integrator
state.setTime(0);
manager.initialize(state); % State of the model is given to the manager for update
state = manager.integrate(timed); % Integrate for the time duration of 'timed'
main_model.realizeAcceleration(state);
If anyone has tried a similar problem, kindly help.
Regards,
Shivangi
Speeding up the FD calculations
- Shivangi Giri
- Posts: 50
- Joined: Sun Jul 02, 2017 3:04 am
- Samuele Gould
- Posts: 16
- Joined: Tue Nov 19, 2019 5:53 am
Re: Speeding up the FD calculations
Hi Shivangi,
I had looked to do something similar. From my limited understanding (maybe another community member with a better understand can clarify) the forward dynamic calculations are performed on a single core, and there does not seem to be a way of accessing how the calculations are distributed across cores. So I don't think what you want to do is possible, at least not on the official release of OpenSim.
Maybe this post could help: viewtopicPhpbb.php?f=91&t=15042&p=43684&start=0&view=
However, if you are running many forward dynamic simulations, you can instead parallise the simulations. Each forward dynamic simulation is computed on a different core, this doesn't speed up an individual simulation, but will reduce the total amount of time you spend waiting for results.
Best,
Samuele
I had looked to do something similar. From my limited understanding (maybe another community member with a better understand can clarify) the forward dynamic calculations are performed on a single core, and there does not seem to be a way of accessing how the calculations are distributed across cores. So I don't think what you want to do is possible, at least not on the official release of OpenSim.
Maybe this post could help: viewtopicPhpbb.php?f=91&t=15042&p=43684&start=0&view=
However, if you are running many forward dynamic simulations, you can instead parallise the simulations. Each forward dynamic simulation is computed on a different core, this doesn't speed up an individual simulation, but will reduce the total amount of time you spend waiting for results.
Best,
Samuele
- Ayman Habib
- Posts: 2239
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Speeding up the FD calculations
Thanks Samuele, well said.
I'd just add that forward integration is naturally sequential since it evolves over time so it'd be hard to make a general scheme that integrates in parallel. However in cases of algorithms that run multiple forward integrations (e.g. in an optimization) this becomes an easier problem to tackle.
Best regards,
-Ayman
I'd just add that forward integration is naturally sequential since it evolves over time so it'd be hard to make a general scheme that integrates in parallel. However in cases of algorithms that run multiple forward integrations (e.g. in an optimization) this becomes an easier problem to tackle.
Best regards,
-Ayman
- Shivangi Giri
- Posts: 50
- Joined: Sun Jul 02, 2017 3:04 am
Re: Speeding up the FD calculations
Thank you, Samuele and Ayman for your replies. Much appreciate your help.
Regards,
Shivangi
Regards,
Shivangi