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

Rename the @jit decorator to @lpython #1791

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -542,4 +542,4 @@ RUN(NAME intrinsics_01 LABELS cpython llvm) # any
COMPILE(NAME import_order_01 LABELS cpython llvm c) # any

# Jit
RUN(NAME test_jit_01 LABELS cpython)
RUN(NAME test_lpython_decorator LABELS cpython)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from numpy import array
from lpython import i32, f64, jit
from lpython import i32, f64, lpython

@jit
@lpython
def fast_sum(n: i32, x: f64[:]) -> f64:
s: f64 = 0.0
i: i32
Expand Down
11 changes: 10 additions & 1 deletion src/runtime/lpython/lpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,16 @@ def ccallable(f):
def ccallback(f):
return f

class jit:
class lpython:
"""
The @lpython decorator compiles a given function using LPython.

The decorator should be used from CPython mode, i.e., when the module is
being run using CPython. When possible, it is recommended to use LPython
for the main program, and use the @cpython decorator from the LPython mode
to access CPython features that are not supported by LPython.
"""

def __init__(self, function):
def get_rtlib_dir():
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand Down