Im using Python37 through Jupyter Notebook with the netgen/ngsolve packages to do finite elements, this part is working but I want to be able to approximate the memory usage of my code. If you are aware of a way to have python profile it please let me know but I couldn’t find a way that would work with my set up. If not I would like to know how ngsolve stores its sparse matrices, and how to calculate that?
some classes have implemented a memory profiling interface (BilinearForm, LinearForm, GridFunction,…)
You can get it by calling the memory property of them for example:
a = BilinearForm(fes)
gives something like
[('SparseMatrix bf biform_from_py low-order', 1352, 1), ('SparseMatrix bf biform_from_py', 24200, 1)]
meaning that the sparse matrix uses 24200 bytes in 1 block and the low order matrix (used in some preconditioners,…) needs 1352 bytes in 1 block.
Hi, thanks for replying so quick. When I tried your suggestion I got the following error:
AttributeError: ‘ngsolve.comp.BilinearForm’ object has no attribute ‘memory’
my ‘a’ is defined as:
on a unit square. Did this memory tool get added recently?
Yes, git says 2018-09-18. So it should be in the latest version v6.2.1809