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

SparseTimeFunction incompatibility with injection of functions with non-grid dimensions #2206

Closed
deckerla opened this issue Sep 13, 2023 · 1 comment · Fixed by #2205
Closed

Comments

@deckerla
Copy link
Contributor

MFE:

import devito

nt = 11

grid = devito.Grid(shape=(25,25))
u = devito.TimeFunction(name="u", grid=grid, time_order=2)
src = devito.SparseTimeFunction(name="src", grid=grid, nt=nt, npoint=1)

nfreq = 5
freq_dim = devito.DefaultDimension(name="freq", default_value=nfreq)
omega = devito.Function(name="omega", dimensions=(freq_dim,), shape=(nfreq,), grid=grid)

inj = src.inject(field=u.forward, expr=omega)

op = devito.Operator([inj])

op.apply(time_M=nt)

Results in:

python mfe.py 
/tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c: In function ‘Kernel’:
/tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c:90:25: error: ‘posx’ undeclared (first use in this function)
   90 |             if (rsrcx + posx >= x_m - 1 && rsrcy + posy >= y_m - 1 && rsrcx + posx <= x_M + 1 && rsrcy + posy <= y_M + 1)
      |                         ^~~~
/tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c:90:25: note: each undeclared identifier is reported only once for each function it appears in
/tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c:90:52: error: ‘posy’ undeclared (first use in this function)
   90 |    if (rsrcx + posx >= x_m - 1 && rsrcy + posy >= y_m - 1 && rsrcx + posx <= x_M + 1 && rsrcy + posy <= y_M + 1)
      |                                           ^~~~

/tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c:92:33: error: ‘px’ undeclared (first use in this function)
   92 |               float r0 = (rsrcx*px + (1 - rsrcx)*(1 - px))*(rsrcy*py + (1 - rsrcy)*(1 - py))*omega[freq];
      |                                 ^~
/tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c:92:67: error: ‘py’ undeclared (first use in this function)
   92 |  (rsrcx*px + (1 - rsrcx)*(1 - px))*(rsrcy*py + (1 - rsrcy)*(1 - py))*omega[freq];
      |                                           ^~

FAILED compiler invocation: gcc -march=native -O3 -g -fPIC -Wall -std=c99 -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -fopenmp /tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.c -lm -o /tmp/devito-jitcache-uid1000/ac560dfe7ab691cf08841ec029562c7a3479ad38.so
Traceback (most recent call last):
  File "/home/cvx/.julia/dev/JetPackDevitoPSD/test/mfe.py", line 17, in <module>
    op.apply(time_M=nt)
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/operator/operator.py", line 825, in apply
    cfunction = self.cfunction
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/operator/operator.py", line 707, in cfunction
    self._jit_compile()
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/operator/operator.py", line 692, in _jit_compile
    recompiled, src_file = self._compiler.jit_compile(self._soname,
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/arch/compiler.py", line 360, in jit_compile
    _, _, _, recompiled = compile_from_string(self, target, code, src_file,
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/codepy/jit.py", line 439, in compile_from_string
    toolchain.build_extension(ext_file, source_paths, debug=debug)
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/codepy/toolchain.py", line 211, in build_extension
    raise CompileError("module compilation failed")
codepy.CompileError: module compilation failed
@deckerla
Copy link
Contributor Author

@mloubout @FabioLuporini

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

Successfully merging a pull request may close this issue.

1 participant