Parallel computing for OpenSim Matlab code

10 Ansichten (letzte 30 Tage)
Shivangi Giri
Shivangi Giri am 21 Dez. 2022
Beantwortet: Infinite_king am 14 Dez. 2023
Hello,
I was to speed up my MATLAB code which uses OpenSim libraryies and model. The time of execution is most for the integration part. I was thinking if I can speed it up using parallel computing or maybe by assigning it to the GPU.
The sample code is
import org.opensim.modeling.*
main_model = Model('DAS_to_arm26.osim');
state = main_model.initSystem();
for i=initial:final
manager = Manager(main_model); % Manager will be the forward dynamics integrator
state.setTime((i)*timed);
manager.initialize(state); % State of the model is given to the manager, so that this state can be updated once the integration is done
state = manager.integrate((i+1)*timed); ----->This line takes most time to execution for each iteration
end
Has anyone ever tried such a thing. Kindly help.
I posted the same question on OpenSim forum, but it has been days since I got an answer.
Regards,
Shivangi

Antworten (1)

Infinite_king
Infinite_king am 14 Dez. 2023
Hi Shivangi Giri,
I understand that you are seeking to speed up the script using the "Parallel Computing Toolbox" (PCT) or by shifting calculations to the GPU.
It depends upon the specific operations that you are performing.
  1. When dealing with a for loop where each iteration's calculations are independent of others, leverage the 'parfor' (parallel for) functionality.
  2. ‘parfor' enables parallelization of the loop, allowing independent calculations to be performed concurrently, thereby reducing overall execution time. Refer the following MATLAB document for more info,
  1. If you are performing operations on large set of data, then you can transfer the data to GPU and then proceed to perform the operation. This will improve runtime if the operation is supported on GPU. Refer the following MATLAB documentations for more info.
Hope this is helpful.

Kategorien

Mehr zu GPU Computing finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by