Skip to content

2D Navie-Stokes example code produces an error #2

Open
@valentinslepukhin

Description

@valentinslepukhin

TypingError Traceback (most recent call last)
Cell In [12], line 6
2 from numpy import linspace
4 from pypde import pde_solver
----> 6 out = pde_solver(u,
7 tf,
8 L,
9 F=F,
10 cfl=0.9,
11 order=2,
12 boundaryTypes='periodic')
14 x = linspace(0, L[0], nx)
15 y = linspace(0, L[1], ny)

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/pypde/solvers.py:200, in pde_solver(Q0, tf, L, F, B, S, boundaryTypes, cfl, order, ndt, flux, stiff, nThreads)
196 secondOrder = nargs(F) == 3
198 print('compiling functions...')
--> 200 _F, _B, _S = generate_cfuncs(F, B, S, ndim, V)
202 solver = create_solver()
204 ret = zeros(ndt * Q0.size)

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/pypde/cfuncs.py:37, in generate_cfuncs(F, B, S, ndim, V)
33 nBargs = nargs(B)
35 Fsig, Bsig, Ssig = generate_signatures(nFargs, nBargs)
---> 37 Fjit = njit(Fsig)(F)
38 Bjit = njit(Bsig)(B)
39 Sjit = njit(Ssig)(S)

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/decorators.py:219, in _jit..wrapper(func)
217 with typeinfer.register_dispatcher(disp):
218 for sig in sigs:
--> 219 disp.compile(sig)
220 disp.disable_compile()
221 return disp

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/dispatcher.py:965, in Dispatcher.compile(self, sig)
963 with ev.trigger_event("numba:compile", data=ev_details):
964 try:
--> 965 cres = self._compiler.compile(args, return_type)
966 except errors.ForceLiteralArg as e:
967 def folded(args, kws):

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/dispatcher.py:129, in _FunctionCompiler.compile(self, args, return_type)
127 return retval
128 else:
--> 129 raise retval

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/dispatcher.py:139, in _FunctionCompiler._compile_cached(self, args, return_type)
136 pass
138 try:
--> 139 retval = self._compile_core(args, return_type)
140 except errors.TypingError as e:
141 self._failed_cache[key] = e

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/dispatcher.py:152, in _FunctionCompiler._compile_core(self, args, return_type)
149 flags = self._customize_flags(flags)
151 impl = self._get_implementation(args, {})
--> 152 cres = compiler.compile_extra(self.targetdescr.typing_context,
153 self.targetdescr.target_context,
154 impl,
155 args=args, return_type=return_type,
156 flags=flags, locals=self.locals,
157 pipeline_class=self.pipeline_class)
158 # Check typing error if object mode is used
159 if cres.typing_error is not None and not flags.enable_pyobject:

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler.py:716, in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
692 """Compiler entry point
693
694 Parameter
(...)
712 compiler pipeline
713 """
714 pipeline = pipeline_class(typingctx, targetctx, library,
715 args, return_type, flags, locals)
--> 716 return pipeline.compile_extra(func)

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler.py:452, in CompilerBase.compile_extra(self, func)
450 self.state.lifted = ()
451 self.state.lifted_from = None
--> 452 return self._compile_bytecode()

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler.py:520, in CompilerBase._compile_bytecode(self)
516 """
517 Populate and run pipeline for bytecode input
518 """
519 assert self.state.func_ir is None
--> 520 return self._compile_core()

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler.py:499, in CompilerBase._compile_core(self)
497 self.state.status.fail_reason = e
498 if is_final_pipeline:
--> 499 raise e
500 else:
501 raise CompilerError("All available pipelines exhausted")

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler.py:486, in CompilerBase._compile_core(self)
484 res = None
485 try:
--> 486 pm.run(self.state)
487 if self.state.cr is not None:
488 break

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler_machinery.py:368, in PassManager.run(self, state)
365 msg = "Failed in %s mode pipeline (step: %s)" %
366 (self.pipeline_name, pass_desc)
367 patched_exception = self._patch_error(msg, e)
--> 368 raise patched_exception

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler_machinery.py:356, in PassManager.run(self, state)
354 pass_inst = _pass_registry.get(pss).pass_inst
355 if isinstance(pass_inst, CompilerPass):
--> 356 self._runPass(idx, pass_inst, state)
357 else:
358 raise BaseException("Legacy pass in use")

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler_lock.py:35, in _CompilerLock.call.._acquire_compile_lock(*args, **kwargs)
32 @functools.wraps(func)
33 def _acquire_compile_lock(*args, **kwargs):
34 with self:
---> 35 return func(*args, **kwargs)

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler_machinery.py:311, in PassManager._runPass(self, index, pss, internal_state)
309 mutated |= check(pss.run_initialization, internal_state)
310 with SimpleTimer() as pass_time:
--> 311 mutated |= check(pss.run_pass, internal_state)
312 with SimpleTimer() as finalize_time:
313 mutated |= check(pss.run_finalizer, internal_state)

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/compiler_machinery.py:273, in PassManager._runPass..check(func, compiler_state)
272 def check(func, compiler_state):
--> 273 mangled = func(compiler_state)
274 if mangled not in (True, False):
275 msg = ("CompilerPass implementations should return True/False. "
276 "CompilerPass with name '%s' did not.")

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/typed_passes.py:105, in BaseTypeInference.run_pass(self, state)
99 """
100 Type inference and legalization
101 """
102 with fallback_context(state, 'Function "%s" failed type inference'
103 % (state.func_id.func_name,)):
104 # Type inference
--> 105 typemap, return_type, calltypes, errs = type_inference_stage(
106 state.typingctx,
107 state.targetctx,
108 state.func_ir,
109 state.args,
110 state.return_type,
111 state.locals,
112 raise_errors=self._raise_errors)
113 state.typemap = typemap
114 # save errors in case of partial typing

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/typed_passes.py:83, in type_inference_stage(typingctx, targetctx, interp, args, return_type, locals, raise_errors)
81 infer.build_constraint()
82 # return errors in case of partial typing
---> 83 errs = infer.propagate(raise_errors=raise_errors)
84 typemap, restype, calltypes = infer.unify(raise_errors=raise_errors)
86 # Output all Numba warnings

File ~/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/typeinfer.py:1086, in TypeInferer.propagate(self, raise_errors)
1083 force_lit_args = [e for e in errors
1084 if isinstance(e, ForceLiteralArg)]
1085 if not force_lit_args:
-> 1086 raise errors[0]
1087 else:
1088 raise reduce(operator.or_, force_lit_args)

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<function dot at 0x7faf3c155940>) found for signature:

dot(array(float64, 1d, C), array(float64, 1d, C))

There are 4 candidate implementations:

  • Of which 4 did not match due to:
    Overload in function '_OverloadWrapper._build..ol_generated': File: numba/core/overload_glue.py: Line 129.
    With argument(s): '(array(float64, 1d, C), array(float64, 1d, C))':
    Rejected as the implementation raised a specific error:
    LoweringError: Failed in nopython mode pipeline (step: native lowering)
    scipy 0.16+ is required for linear algebra

File "", line 3:

During: lowering "$8call_function.3 = call $2load_global.0(a, b, func=$2load_global.0, args=[Var(a, :3), Var(b, :3)], kws=(), vararg=None, varkwarg=None, target=None)" at (3)
raised from /home/valentin/anaconda3/envs/pdesolve/lib/python3.8/site-packages/numba/core/errors.py:837

During: resolving callee type: Function(<function dot at 0x7faf3c155940>)
During: typing of call at /tmp/ipykernel_14609/274012429.py (16)

File "../../tmp/ipykernel_14609/274012429.py", line 16:

During: resolving callee type: type(CPUDispatcher(<function pressure at 0x7faf13aac670>))
During: typing of call at /tmp/ipykernel_14609/274012429.py (34)

During: resolving callee type: type(CPUDispatcher(<function pressure at 0x7faf13aac670>))
During: typing of call at /tmp/ipykernel_14609/274012429.py (34)

File "../../tmp/ipykernel_14609/274012429.py", line 34:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions