Is using multicore always possible?

조회 수: 3 (최근 30일)
Elham Kashani
Elham Kashani 2021년 7월 10일
댓글: Elham Kashani 2021년 7월 10일
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?

답변 (1개)

Walter Roberson
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.
  댓글 수: 1
Elham Kashani
Elham Kashani 2021년 7월 10일
Thank you for the response. Actually matrixes are dependent. The work station that I use have 16 core but CPU usage is fluctuate and mostly it is around 6%. it seems that mostly one core is involved.

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

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by