Effacer les filtres
Effacer les filtres

How much Mac memory can Matlab utilize?

21 vues (au cours des 30 derniers jours)
Michael
Michael le 16 Jan 2024
Commenté : Walter Roberson le 17 Jan 2024
I have a MacBookPro, with the M2 Max chip, and 96GB of RAM.
I have been shocked that some large memory-intensive computations I have been performing for years do not run much faster on this laptop than on a 10 year old intel iMac with far less memory.
Will Matlab R2023b utilize all free memory on the laptop, or does it adopt some upper limit of the memory it attempts to access?
I also tried testing the iMac versus the M2 Max laptop with a much simpler 'toy' number-crunching code that repeatedly takes the inverse of a 1,000 by 1,000 matrix.
Here is the M2 Max run using R2023B, supposedly a native Apple silicon version of Matlab
>> m=1000; n=1000; tic; for i=1:m, A=randn(n,n); B=inv(A); end, toc
Elapsed time is 36.986920 seconds.
Almost the same as running the same command on a Late 2012 iMac (intel)
>> m=1000; n=1000; tic; for i=1:m, A=randn(n,n); B=inv(A); end, toc
Elapsed time is 38.338430 seconds.
I get a similar lack of speed-up if I set n=2000, and repeatedly invert 2,000 by 2,000 matrices, or even larger matrices. I find this lack of performance increase rather strange.
MB
  1 commentaire
John D'Errico
John D'Errico le 16 Jan 2024
Note that 2K by 2K matrices are literally tiny, not stressing the memory you have on that computer in the least.
2000*2000*8/1024^3
ans = 0.0298
so 0.03 gigabytes per matrix. Your computer is laughing at you.

Connectez-vous pour commenter.

Réponses (2)

Walter Roberson
Walter Roberson le 16 Jan 2024
Will Matlab R2023b utilize all free memory on the laptop, or does it adopt some upper limit of the memory it attempts to access?
Preferences -> Workspace -> MATLAB Workspace Preferences -> MATLAB array size limit -> [ ] Limit the maximum array size to a percentage of RAM
Untick that so that MATLAB will be willing to request more memory than there is physical memory, which could cause swapping to disk.

Image Analyst
Image Analyst le 16 Jan 2024
Try this:
>> memory
in the command window.
  1 commentaire
Walter Roberson
Walter Roberson le 17 Jan 2024
memory() is not available on Mac.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Just for fun 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