Parallel coding in matlab

조회 수: 1 (최근 30일)
Mitra Taghizadeh
Mitra Taghizadeh 2023년 1월 13일
댓글: Mitra Taghizadeh 2023년 1월 13일
Hello everyone,
I am writting a code that In this code I have 8 independant equations which each equation is a second order equation that should be solved using Runge-Kutta 4th order method. But I need to solve them paralerly.
Do you know how can I do this work?
  댓글 수: 2
Bjorn Gustavsson
Bjorn Gustavsson 2023년 1월 13일
Why do you need to solve them parallely if they are independent? If they are independent shouldn't their solutions be possible to calculate one after the other, and then you can put them together without any-one knowing the difference?
Mitra Taghizadeh
Mitra Taghizadeh 2023년 1월 13일
Becuse the computation time ia too much if I solve each equation after the athor. In fact this solution is in a for-loop, and this 8 equation should be solved in each time.
In a paper, it was mentioned that if you use the parallel algorithem it will have a less computational time.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 1월 13일
In your r2019b release you would need the Parallel Computing Toolbox and use parfor or parfeval or spmd
With sufficiently new MATLAB versions there is a new built-in background pool that can execute parfeval without needing any additional toolbox.
Note that depending on the details of what is being calculated and on the memory patterns, there are cases where calculations in parallel will be slower than calculating sequentially.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by