devito icon indicating copy to clipboard operation
devito copied to clipboard

aarch64 : CompileError

Open gfkdliucheng opened this issue 5 months ago • 5 comments

from devito import * import matplotlib.pyplot as plt

def solver(I, dt, T, eqs):

```Nt = int(round(T/dt))
```t = TimeDimension('t', spacing=Constant('h_t'))
```u = TimeFunction(name='u', dimensions=(t,),
                     shape=(Nt+1,), space_order=2, time_order=1)
```u.data[:] = I
```eqn = eval(eqs)
```stencil = Eq(u.forward, solve(eqn, u.forward))
```print(stencil)
```op = Operator(stencil)
```op.apply(h_t=dt, t_M=Nt-1)
```return u.data, np.linspace(0.0001, Nt*dt, Nt+1),op.ccode

u,t,ccode = solver(1, 0.001,2, r'u.dt-u ') 

print(u[-1])


CompileError :
undefined reference to `main'
---------------------------------------------------------------------------
CompileError                              Traceback (most recent call last)
Cell In[11], line 18
     15     op.apply(h_t=dt, t_M=Nt-1)
     16     return u.data, np.linspace(0.0001, Nt*dt, Nt+1),op.ccode
---> 18 u,t,ccode = solver(1, 0.001,2, r'u.dt-u ') # a=0.01
     20 print(u[-1])

Cell In[11], line 15, in solver(I, dt, T, eqs)
     13 print(stencil)
     14 op = Operator(stencil)
---> 15 op.apply(h_t=dt, t_M=Nt-1)
     16 return u.data, np.linspace(0.0001, Nt*dt, Nt+1),op.ccode

File ~/miniconda3/lib/python3.11/site-packages/devito/operator/operator.py:832, in Operator.apply(self, **kwargs)
    830 arg_values = [args[p.name] for p in self.parameters]
    831 try:
--> 832     cfunction = self.cfunction
    833     with self._profiler.timer_on('apply', comm=args.comm):
    834         cfunction(*arg_values)

File ~/miniconda3/lib/python3.11/site-packages/devito/operator/operator.py:714, in Operator.cfunction(self)
    712 """The JIT-compiled C function as a ctypes.FuncPtr object."""
    713 if self._lib is None:
--> 714     self._jit_compile()
    715     self._lib = self._compiler.load(self._soname)
    716     self._lib.name = self._soname

File ~/miniconda3/lib/python3.11/site-packages/devito/operator/operator.py:699, in Operator._jit_compile(self)
    697 if self._lib is None:
    698     with self._profiler.timer_on('jit-compile'):
--> 699         recompiled, src_file = self._compiler.jit_compile(self._soname,
    700                                                           str(self.ccode))
    702     elapsed = self._profiler.py_timers['jit-compile']
    703     if recompiled:

File ~/miniconda3/lib/python3.11/site-packages/devito/arch/compiler.py:360, in Compiler.jit_compile(self, soname, code)
    358 with warnings.catch_warnings():
    359     warnings.simplefilter('ignore')
--> 360     _, _, _, recompiled = compile_from_string(self, target, code, src_file,
    361                                               cache_dir=cache_dir, debug=debug,
    362                                               sleep_delay=sleep_delay)
    364 return recompiled, src_file

File ~/miniconda3/lib/python3.11/site-packages/codepy/jit.py:439, in compile_from_string(toolchain, name, source_string, source_name, cache_dir, debug, wait_on_error, debug_recompile, object, source_is_binary, sleep_delay)
    437     toolchain.build_object(ext_file, source_paths, debug=debug)
    438 else:
--> 439     toolchain.build_extension(ext_file, source_paths, debug=debug)
    441 if info_path is not None:
    442     import pickle

File ~/miniconda3/lib/python3.11/site-packages/codepy/toolchain.py:211, in GCCLikeToolchain.build_extension(self, ext_file, source_files, debug)
    208 import sys
    209 print("FAILED compiler invocation: {}".format(" ".join(cc_cmdline)),
    210       file=sys.stderr)
--> 211 raise CompileError("module compilation failed")

CompileError: module compilation failed

gfkdliucheng avatar Jan 09 '24 05:01 gfkdliucheng