Is using multicore always possible?

3 Ansichten (letzte 30 Tage)
Elham Kashani
Elham Kashani am 10 Jul. 2021
Kommentiert: Elham Kashani am 10 Jul. 2021
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?

Antworten (1)

Walter Roberson
Walter Roberson am 10 Jul. 2021
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 Kommentar
Elham Kashani
Elham Kashani am 10 Jul. 2021
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by