Is using multicore always possible?

3 vues (au cours des 30 derniers jours)
Elham Kashani
Elham Kashani le 10 Juil 2021
Commenté : Elham Kashani le 10 Juil 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?

Réponses (1)

Walter Roberson
Walter Roberson le 10 Juil 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 commentaire
Elham Kashani
Elham Kashani le 10 Juil 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Spline Postprocessing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by