Matlab - memory usage after solving a large system -
i'm trying calculate memory used matlab process before , after solving large sparse matrix. i'm using memory
, direct solver a\b
.
what want mesaure monitoring in way memory used matlab , calculate difference between memory used after loading file containing sparse matrix , memory used after solving sparse system.
here code i'm using
% load , store sparse matrix a = load('very_large_sparse_matrix.mat'); % store memory used after loading usr = memory; memory_after_load = usr.memusedmatlab; % solve system % no matter b comes x = a\b % store memory used after solving usr = memory; memory_after_solve = usr.memusedmatlab; % print difference disp(memory_after_solve - memory_after_load);
but difference 0
or negative integer. think because matlab pre-allocates memory before running code (am wrong?) , doesn't change allocation dinamically if not emergency.
i expect increase of memory used, because through direct solvers fill-in increase number of non-zero elements.
how can calculate it? have seen whos
gives size in bytes of variable, i'm looking memory used process.
thank you.
edit
i've found matlab pre-allocates resources. equivalent question is there method disable pre-allocating system?
thanks @horchler, i've found solution.
even if matlab pre-allocates memory needs before execution, spparams('spunomi', 3)
shows peaks inside allocation.
also doing [l,u,p,q,r] = lu(a)
, calculating difference between number of nonzero elements in l
, number of nonzero elements in a
, function whos
leads same results!
Comments
Post a Comment