필터 지우기
필터 지우기

How much Mac memory can Matlab utilize?

조회 수: 20 (최근 30일)
Michael
Michael 2024년 1월 16일
댓글: Walter Roberson 2024년 1월 17일
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
John D'Errico
John D'Errico 2024년 1월 16일
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.

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

답변 (2개)

Walter Roberson
Walter Roberson 2024년 1월 16일
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 2024년 1월 16일
Try this:
>> memory
in the command window.

카테고리

Help CenterFile Exchange에서 Just for fun에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by