Memory used by Julia process

I'm working on a project on sparse linear systems resolution (using the UMFPACK library and testing all FEMLAB matrices) and I have to check how much RAM is required for this resolution (for each matrix).

I need to test UMFPACK in different programming languages, so I already wrote the code in MATLAB where I found the following commands:

[user, sys] = memory

in particular user.MemUsedMATLAB

.

Now I need to write the same software using the Julia programming language, but it seems difficult to find some similar commands; I am very new to Julia and I just tried the command @time

, but I cannot store the number of memory bytes allocated in a variable. This is very important because in the end I need to plot the graphics with the values ​​of the allocated memory bytes for each matrix.

Does anyone know a solution to my problem? How can I get the RAM used by my code in a variable? Is there an equivalent command for MemUsedMATLAB

Julia?

+3


source to share


1 answer


The macro @time

shows how much memory (total) is allocated when you call the given code. This includes temporary - things that Matlab won't tell you. You can access the values ​​using a macro @timed

; see its description for a description of each return value:

julia> @timed rand(100000)'*rand(100000)
(25069.751546076346, 0.002270112, 1600336, 0.0, Base.GC_Diff(1600336, 2, 0, 7, 0, 0, 0, 0, 0))

help?> @timed
  @timed

  A macro to execute an expression, and return the value of the expression,
  elapsed time, total bytes allocated, garbage collection time, and an object
  with various memory allocation counters.

      



But this is not memory alone. This is the total amount of memory that was allocated while evaluating the expression. This can be significantly higher than the memory available on your system if there are many time series.

You can also use the function Base.summarysize

to get an estimate of the size of individual objects, but the calculation is approximate.

+1


source







All Articles