Is using multicore always possible?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
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.
Siehe auch
Kategorien
Mehr zu Particle Swarm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!