exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
15.17k stars 520 forks source link

codon.codon_jit.JITError: <jit>:3:5: name 'a' is not defined #450

Open manjiler opened 1 year ago

manjiler commented 1 year ago

I am trying to make use codon to speed up few python functions.

Stuck with this error.

  File "/anaconda3/lib/python3.9/site-packages/codon/decorator.py", line 218, in wrapped
    return _jit.run_wrapper(
  File "codon/jit.pyx", line 42, in codon.codon_jit.JITWrapper.run_wrapper
codon.codon_jit.JITError: <jit>:3:5: name 'a' is not defined

Function that has

@codon.jit
def scale_test(z, x_min, x_max):
     return x_min + (z + 1) * (x_max - x_min) / 2

type z is list.

Is there a way to get past this error or am I doing something wrong here?

arshajii commented 1 year ago

Hi @manjiler -- this should actually cause an error because z + 1 is a type error, right? Or am I missing something? Of course, the error message should be better :)

phcapde commented 10 months ago

I have the exact same error with an empty function with just pass. In the end the error was due to an external import (import tf , ROS noetic). It worked fine when removed.