在使用matlab parallel server工具箱做​并行计算时,怎么计算​一个程序使用的内存峰​值?(不是使用mem​ory得到的累计内存​)

1 view (last 30 days)
诗杰
诗杰 on 23 Jun 2025
Answered: Govind KM on 23 Jul 2025
我要对比两个方法求解一个问题的内存,如果使用memory来计算的话,得到的内存是一样的,这肯定不对,我要的是计算一个程序时,这个程序的内存峰值。

Answers (1)

Govind KM
Govind KM on 23 Jul 2025
Using Google Translate, I gather that you wish to calculate the peak memory usage of a program, without the use of the "memory" function.
Kindly refer to the following MATLAB Answers post, which provides a function to help monitor memory usage: https://www.mathworks.com/matlabcentral/answers/97560-how-can-i-monitor-how-much-memory-matlab-is-using. The program uses the "whos" command, but automatically does it for variables in the base workspace. This can be adjusted to be evaluated in the function work space, which might be of use to you when trying to evaluate peak memory usage.
The parallel profiler could also be of use to you. More details can be found in the documentation page: https://www.mathworks.com/help/parallel-computing/profiling-parallel-code.html
Hope this helps!

Categories

Find more on 性能和内存 in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!