I am currently trying to quantify the performance/ scaling of the VML functions as added via VML.jl,
and ran into a curious problem.
Running this script, my RAM steadily increases until julia consumes 12-14Gb at the end.
This is especially curious because
medianandtest only return a single number and
computesizedep consequently returns only a 15-element array. Ran over the 31 functions contained in
base_unary_real, this results in a Dict with ~500 Floats64 (and Dict overhead).
Everything else, including the large arrays that get generated in
medianandtest and interpolated into
@benchmark should frequently go out of scope and free up.
However, what I found is the following, when printing the free system memory in Mb before and after benchmarking a given function for a number of array sizes:
cbrt 9632.1953125 11747.6328125 sqrt 11747.6328125 8581.375 exp 8581.375 8248.140625 expm1 8248.140625 11711.32421875 log 11711.32421875 8172.6640625 log10 8172.6640625 7615.99609375 log1p 7615.99609375 7231.12890625 abs 7231.12890625 8724.1796875 abs2 8724.1796875 8916.37109375 ceil 8916.37109375 4671.90625 floor 4671.90625 4040.67578125 round 4040.67578125 3286.375 trunc 3286.375 2255.203125 cis 2255.203125 2547.5234375 erf 2547.5234375 1600.7578125 erfc 1600.7578125 1575.23828125 erfinv 1575.23828125 1358.9375 erfcinv 1358.9375 1330.16015625 gamma 1330.16015625 1333.8125
Clearly something gets freed, but the RAM still increases overall. In addition, even though the same sizes of arrays are created for each function, and each function is virtually the same apart from the symbol for the MKL shared library function being called, the change in RAM is very different.
Lastly, the memory does not get freed even after the top function saves the results and returns, requiring a REPL restart.
“Manually” freeing the results of
@benchmark as in lines 25/26 helped a little bit, as previously julia got terminated by the OS (Manjaro Linux) for filling every bit of RAM (and swap).
baseBench = nothing vmlBench = nothing
But even with this we get the results shown above.
If anyone knows why this happens or what to do about it I would be very grateful.