- edited description
Repeatedly creating a PETSc matrix fills up memory and kills process
Issue #272
resolved
Hello,
I must solve repeatedly a system arising from two matrices from a fem formulation. The system matrix is just a linear combination of both matrices. However, when I use the 'PETSc' backend I find that my process gets killed after a few iterations in my for loop. I run top and I see python is filling all my memory (up to 4 GB). This does not happen when I use 'uBLAS', for example. It behaves as if the matrix created inside the loop is not destroyed when the new assignment is made in the following iteration of the loop. I have tried to destroy it manually, but I have no clue.
Thank you very much for your help.
MINIMAL CODE SCRIPT:
from dolfin import *
parameters["linear_algebra_backend"] = 'PETSc' #'PETSc', 'uBLAS', 'Epetra', or 'STL'
Element = "Nedelec 2nd kind H(curl)"
Order = 2
mesh = UnitCubeMesh(15,15,15)
V = FunctionSpace(mesh, Element, Order)
v = TestFunction(V)
u = TrialFunction(V)
a = dot(v, u)*dx
b = dot(v, u)*dx
A=assemble(a)
B=assemble(b)
ka=1.0
kb=1.0
print "Number of dofs: ", A.size(0)
for i in range(0,100):
#C=A #this is assignment!-->not valid
#C=A.copy() #another option if G is constructed outside loop
C=Matrix(A)
C*=ka
C.axpy(kb,B,True)
print "Iteration n. ", i
Comments (7)
-
reporter -
reporter - edited description
-
Not present in 1.3.0.
-
-
assigned issue to
-
assigned issue to
-
The leak is in copy constructor.
-
- changed status to resolved
-
- removed milestone
Removing milestone: 1.4 (automated comment)
- Log in to comment