필터 지우기
필터 지우기

Parallel computing for OpenSim Matlab code

조회 수: 20 (최근 30일)
Shivangi Giri
Shivangi Giri 2022년 12월 21일
답변: Infinite_king 2023년 12월 14일
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

답변 (1개)

Infinite_king
Infinite_king 2023년 12월 14일
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.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by