Dear Magnus, This memory used is not because of mf.basic_dof_nodes() but of the enumeration of dof it calls (the enumeration of dof is done only once after the definition of a mesh_fem object or when it changes itself or its linked mesh changes).
This enumeration of dof has been recently adpated to be more robust for situtations where some elements share some nodes with the same location but assumed to be different (in order to represent cracks betweens some elements for instance). The consequence of this modification is that some information is stored locally on each element during the enumeration of dof, which is more costly than before in term of memory. However, the memory used during the enumeration of dof is released after the enumeration is completed but, since there is no garbage collector in C++, the resulting memory may be fragmented and not released to python. So, this memory is not lost because it will be used by Getfem in the sequel but it may be not usable in python. I commited a small fix which limitates a bit the necessary memory during enumeration of dof. May be, I will think for the modification of the algorithm in order to reduce even more the necessary memory. Best regards, Yves. ----- Original Message ----- From: "Magnus Paulsson" <[email protected]> To: "getfem-users" <[email protected]> Sent: Friday, May 6, 2016 3:31:01 PM Subject: [Getfem-users] Python interface memory use ... It seems that mf.basic_dof_nodes() takes huge amount of memory and is running very slowly. In the example below the size of the DOF array should be ~ 3MB which is returned but it takes considerable time uses up approx. 1 GB. To make things more complicated I do not get consistent results. I.e., getfem-5.0 on one machine it’s not too bad … while getfem-5321 (new svn) on with slightly different numpy etc uses 1 GB. I’m sorry I have not been able to nail it down better. -Magnus import getfem as GF import numpy as N import resource, gc NN=50 print "Mem use before mesh generation %i kb"%(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss) mesh = GF.Mesh('regular simplices', N.arange(NN), N.arange(NN),N.arange(NN)) mf = GF.MeshFem(mesh,1) mf.set_fem(GF.Fem('FEM_PK(3,1)')) print "Mem use after mesh generation %i kb"%(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss) dof=mf.basic_dof_nodes() print "DOF size %i kb"%(dof.size*8.0/1024.0) print "Mem use after DOF %i kb"%(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss) del mesh, mf, dof gc.collect() print "Mem use after deleting objects %i kb"%(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss) ----------------------------------------------- Magnus Paulsson Associate Professor Dept. of Physics and Electrical Engineering Linnaeus University Phone: +46-480-446308 Mobile: +46-70-6942987 _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users _______________________________________________ Getfem-users mailing list [email protected] https://mail.gna.org/listinfo/getfem-users
