Using memory_profiler
(memory-profiler · PyPI) I ran the following code on my laptop (in serial one process using python3 -m memory_profiler 3D_prob.py
from dolfin import *
parameters["form_compiler"]["optimize"] = True
parameters["form_compiler"]["cpp_optimize"] = True
parameters["form_compiler"]["representation"] = "uflacs"
@profile
def create_space(N):
mesh = BoxMesh(Point(0.0,0.0,0.0),Point(5.0e-2,5.0e-2,5.0e-2), N, N, N)
a = FiniteElement("CG", mesh.ufl_cell(), 4)
b = VectorElement("Lagrange", mesh.ufl_cell(), 2)
c = MixedElement([a, b])
d = FunctionSpace(mesh, c)
if __name__ == "__main__":
create_space(22)
and got the following results:
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Filename: 3D_prob.py
Line # Mem usage Increment Occurences Line Contents
============================================================
6 97.082 MiB 97.082 MiB 1 @profile
7 def create_space(N):
8 99.758 MiB 2.676 MiB 1 mesh = BoxMesh(Point(0.0,0.0,0.0),Point(5.0e-2,5.0e-2,5.0e-2), N, N, N)
9
10 99.980 MiB 0.223 MiB 1 a = FiniteElement("CG", mesh.ufl_cell(), 4)
11
12 99.980 MiB 0.000 MiB 1 b = VectorElement("Lagrange", mesh.ufl_cell(), 2)
13
14 99.980 MiB 0.000 MiB 1 c = MixedElement([a, b])
15
16 994.715 MiB 894.734 MiB 1 d = FunctionSpace(mesh, c)
I.e. the memory usage should be about 1 GB.
This indicates that something else might be wrong with your installation.
What system are you using, and how have you installed dolfin?