Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FJGEODEV opened this issue Apr 6, 2023 · 2 comments
Open

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

FJGEODEV opened this issue Apr 6, 2023 · 2 comments

Comments

@FJGEODEV
Copy link

FJGEODEV commented Apr 6, 2023

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.

@georgebisbas
Copy link
Contributor

Hi @FJGEODEV , did you try some problem that indeed will allocate more memory on your device?
What was the size of the problem you tried?

@FJGEODEV
Copy link
Author

FJGEODEV commented Apr 13, 2023

Hi, the system memory is good enough. I tried to

define this first:
op_imaging = ImagingOperator(geometry, image, space_order, save=False)

then import those:

    from devito import DevitoCheckpoint, CheckpointOperator
    from devito import ConditionalDimension

In this way, it works good. This is kind of workaround, but I am still not sure what's going on with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants