Is using multicore always possible?
조회 수: 3 (최근 30일)
이전 댓글 표시
I have about 90 matrix with [7000,7000]. simulation is too slow, I need 60M iteration which will take about 6 years!!!
I tried vectorizing and it makes simulation faster but not enough. In my code there is just one for loop which is deependent to previous step, so parfor can not be implement. Inside this for loop there are some math operations between matrixes, which should be done step by step, for example:
for i=1:1000
C=A+B
D=C.*A
B=B+D
A=A.*B
end
(It is just an example!)
Is there any suggestion, how could I use multicor?
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 7월 10일
MATLAB automatically uses multiple cores for the primary operations such as addition and multiplication and matrix multiplication, provided that the arrays are "large enough" to make it worth doing (and provided that the number of threads has not been set to 1)
There is nothing to configure for this behavior.
You mentioned 90 matrices. If they do not depend on each other then in some cases you might be able to store them together in a 3d array and then let vectorized operations work on all of them at the same time.
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!