devito icon indicating copy to clipboard operation
devito copied to clipboard

Exception: TypeError('Operator() takes no arguments')

Open FJGEODEV opened this issue 1 year ago • 2 comments

Hi, I had some issue to run devito, please see below codes: (Looks like once I added from devito.checkpointing import *, the error will come out. Error:

` Trying to allocate more memory for symbol u than available on physical device, this will start swapping

TypeError Traceback (most recent call last) /tmp/ipykernel_82665/464761434.py in 43 44 # For illustrative purposes, assuming that there is enough memory ---> 45 op_imaging = ImagingOperator(model, geometry, image, space_order) 46 47 vv = TimeFunction(name='vv', grid=model.grid, staggered=None, time_order=2, space_order=space_order)

/tmp/ipykernel_82665/2604718868.py in ImagingOperator(model, geometry, image, space_order, save) 23 image_update = Eq(image, image - u * v) 24 ---> 25 op = Operator(([stencil] + res_term + [image_update]), subs=model.spacing_map) 26 return op 27

TypeError: Operator() takes no arguments ​` Here are all codes related to this:

`def ImagingOperator(model, geometry, image, space_order, save=True):

v = TimeFunction(name='v', grid=model.grid, time_order=2, space_order=8)

u = TimeFunction(name='u', grid=model.grid, time_order=2, space_order=8,
                 save=geometry.nt)

eqn = model.m * v.dt2 - v.laplace - model.damp * v.dt

stencil = Eq(v.backward, solve(eqn, v.backward))

dt = model.critical_dt
residual = PointSource(name='residual', grid=model.grid,
                       time_range=geometry.time_axis,
                       coordinates=geometry.rec_positions)    
res_term = residual.inject(field=v, expr=residual * dt**2 / model.m)

image_update = Eq(image, image - u * v)

op = Operator(([stencil] + res_term + [image_update]), subs=model.spacing_map)
return op

`

then

op_imaging = ImagingOperator(model, geometry, image, space_order, save=False)

Thanks.

FJGEODEV avatar Apr 06 '23 18:04 FJGEODEV