When I run the following command at the end of my program list_timings(), I get the following error.
TypeError: list_timings(): incompatible function arguments. The following argument types are supported:
1. (arg0: dolfin.cpp.common.TimingClear, arg1: List[dolfin.cpp.common.TimingType]) -> None
What is the right way to use list_timings()? Thanks!
Minimal example:
from dolfin import *
import numpy as np
import matplotlib.pyplot as plt
mesh = UnitSquareMesh(8, 8)
V = FunctionSpace(mesh, 'P', 1)
# Define boundary condition
u_D = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree=2)
def boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(V, u_D, boundary)
# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(-6.0)
a = dot(grad(u), grad(v))*dx
L = f*v*dx
# Compute solution
u = Function(V)
solve(a == L, u, bc)
# Plot solution and mesh
plot(u)
list_timings()
The problem was that I used list_timings(), rather than just timings() as in your example. The former method prints to the terminal, but returns time_table=None. Thanks for the help!
The main reason for not having a convenience function list all tasks is that the timing system is used internally in the code for developers to make sure the code is scalable, and a lot of the output is not meaningful for the general user.