Skip to content

Commit

Permalink
Merge pull request #1791 from certik/lpython_dec
Browse files Browse the repository at this point in the history
Rename the @jit decorator to @lpython
  • Loading branch information
certik authored May 12, 2023
2 parents 144a50d + 6728f50 commit 86fde94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -543,4 +543,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

0 comments on commit 86fde94

Please sign in to comment.