Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73163 > unrolled thread

基于cython的即时编译器cyjit,欢迎大家提建议

Started by1989lzhh <1989lzhh@gmail.com>
First post2014-06-11 17:37 +0800
Last post2014-06-12 07:50 +0800
Articles 5 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  基于cython的即时编译器cyjit,欢迎大家提建议 1989lzhh <1989lzhh@gmail.com> - 2014-06-11 17:37 +0800
    Re: 基于cython的即时编译器cyjit,欢迎大家提建议 mm0fmf <none@mailinator.com> - 2014-06-11 17:16 +0100
      Re: 基于cython的即时编译器cyjit,欢迎大家提建议 Skip Montanaro <skip@pobox.com> - 2014-06-11 12:16 -0500
      Re: 基于cython的即时编译器cyjit,欢迎大家提建议 1989lzhh <1989lzhh@gmail.com> - 2014-06-12 00:50 +0800
      Re: 基于cython的即时编译器cyjit,欢迎大家提建议 1989lzhh <1989lzhh@gmail.com> - 2014-06-12 07:50 +0800

#73163 — 基于cython的即时编译器cyjit,欢迎大家提建议

From1989lzhh <1989lzhh@gmail.com>
Date2014-06-11 17:37 +0800
Subject基于cython的即时编译器cyjit,欢迎大家提建议
Message-ID<mailman.11006.1402484547.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

我正在写一个使用cython code作为后端的即时编译器名为cyjit,将python code 转换为cython code再编译为c extension导入.设计上主要参考numba.jit的思路,使用decorate来指定要编译的function,例如:
from cyjit import jit
@jit('int(int,int)')
def add(a,b):
    return a+b
add(1,2)#compiled

@jit('int(int,int)',
    locals='''
    int c
    ''')
def add1(a,b):
    c=add(a,b)# fast invoked
    return c
add1(1,2)

目前还不支持类型推导,需要手动使用c的语法对局部变量进行定义。
编译过程是在jit函数中完成的,后续计划将编译过程移到函数运行时完成,实现重载。
目前支持编译cache,第一次运行需要编译,时间稍慢,再次运行直接导入编译好的extension,速度就很快了。

欢迎大家fork,pull,提建议。
https://github.com/liuzhenhai/cyjit



[toc] | [next] | [standalone]


#73179

Frommm0fmf <none@mailinator.com>
Date2014-06-11 17:16 +0100
Message-ID<Xh%lv.308109$Ch2.69303@fx13.am4>
In reply to#73163
On 11/06/2014 10:37, 1989lzhh wrote:
> 我正在写一个使用cython code作为后端的即时编译器名为cyjit,将python code
> 转换为cython code再编译为c extension导入.设计上主要参考numba.jit的思路,
> 使用decorate来指定要编译的function,例如:
> from cyjit import jit
> @jit('int(int,int)')
> def add(a,b):
>      return a+b
> add(1,2)#compiled
>
> @jit('int(int,int)',
>      locals='''
>      int c
>      ''')
> def add1(a,b):
>      c=add(a,b)# fast invoked
>      return c
> add1(1,2)
>
> 目前还不支持类型推导,需要手动使用c的语法对局部变量进行定义。
> 编译过程是在jit函数中完成的,后续计划将编译过程移到函数运行时完成,实现
> 重载。
> 目前支持编译cache,第一次运行需要编译,时间稍慢,再次运行直接导入编译好
> 的extension,速度就很快了。
>
> 欢迎大家fork,pull,提建议。
>
> https://github.com/liuzhenhai/cyjit
>

You might say that but I couldn't possibly comment.


[toc] | [prev] | [next] | [standalone]


#73181

FromSkip Montanaro <skip@pobox.com>
Date2014-06-11 12:16 -0500
Message-ID<mailman.11015.1402507023.18130.python-list@python.org>
In reply to#73179
> You might say that but I couldn't possibly comment.

You could run the message through Google Translate. It's not
publication quality translation, but serves the needs in this
instance. (Gmail offers to translate the OP's message for me.)

Here's what GT produced (successfully translates the Chinese, but
destroys the code structure in the process - what's wrong with those
people at Google? <wink>):

> I'm writing a cython code using the compiler as a backend instant named cyjit, the python code
> Convert cython code is then compiled c extension import. Designed primarily reference numba. jit ideas,
> Use decorate to specify compile function, for example:
> from cyjit import jit
> @ Jit ('int (int, int)')
> def add (a, b):
> return a + b
> add (1,2) # compiled
>
> @ Jit ('int (int, int)',
> locals ='' '
> int c
> '' ')
> def add1 (a, b):
> c = add (a, b) # fast invoked
> return c
> add1 (1,2)
>
> Currently does not support the type of derivation, C syntax to use local variables defined manually.
> Jit compilation process is done in the function of Follow-up plans to move to complete the compilation process runtime functions to achieve overloading.
> Currently supports compilation cache, you need to compile the first run, slower time, Run again compiled directly into the extension, the speed very quickly.
>
> Welcome to fork, pull, and suggestions.
>
> https://github.com/liuzhenhai/ cyjit

The concept looks like of interesting.

Skip

[toc] | [prev] | [next] | [standalone]


#73182

From1989lzhh <1989lzhh@gmail.com>
Date2014-06-12 00:50 +0800
Message-ID<mailman.11016.1402507984.18130.python-list@python.org>
In reply to#73179
sorry,wrong version post

发自我的 iPhone

> 在 Jun 12, 2014,0:16,mm0fmf <none@mailinator.com> 写道:
> 
>> On 11/06/2014 10:37, 1989lzhh wrote:
>> 我正在写一个使用cython code作为后端的即时编译器名为cyjit,将python code
>> 转换为cython code再编译为c extension导入.设计上主要参考numba.jit的思路,
>> 使用decorate来指定要编译的function,例如:
>> from cyjit import jit
>> @jit('int(int,int)')
>> def add(a,b):
>>     return a+b
>> add(1,2)#compiled
>> 
>> @jit('int(int,int)',
>>     locals='''
>>     int c
>>     ''')
>> def add1(a,b):
>>     c=add(a,b)# fast invoked
>>     return c
>> add1(1,2)
>> 
>> 目前还不支持类型推导,需要手动使用c的语法对局部变量进行定义。
>> 编译过程是在jit函数中完成的,后续计划将编译过程移到函数运行时完成,实现
>> 重载。
>> 目前支持编译cache,第一次运行需要编译,时间稍慢,再次运行直接导入编译好
>> 的extension,速度就很快了。
>> 
>> 欢迎大家fork,pull,提建议。
>> 
>> https://github.com/liuzhenhai/cyjit
> 
> You might say that but I couldn't possibly comment.
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#73190

From1989lzhh <1989lzhh@gmail.com>
Date2014-06-12 07:50 +0800
Message-ID<mailman.11021.1402530644.18130.python-list@python.org>
In reply to#73179

在 Jun 12, 2014,1:16,Skip Montanaro <skip@pobox.com> 写道:

>> You might say that but I couldn't possibly comment.
> 
> You could run the message through Google Translate. It's not
> publication quality translation, but serves the needs in this
> instance. (Gmail offers to translate the OP's message for me.)
> 
> Here's what GT produced (successfully translates the Chinese, but
> destroys the code structure in the process - what's wrong with those
> people at Google? <wink>):
Thanks skip, I post the email into wrong mail list, I will rewrite it into English. :)
> 
>> I'm writing a cython code using the compiler as a backend instant named cyjit, the python code
>> Convert cython code is then compiled c extension import. Designed primarily reference numba. jit ideas,
>> Use decorate to specify compile function, for example:
>> from cyjit import jit
>> @ Jit ('int (int, int)')
>> def add (a, b):
>> return a + b
>> add (1,2) # compiled
>> 
>> @ Jit ('int (int, int)',
>> locals ='' '
>> int c
>> '' ')
>> def add1 (a, b):
>> c = add (a, b) # fast invoked
>> return c
>> add1 (1,2)
>> 
>> Currently does not support the type of derivation, C syntax to use local variables defined manually.
>> Jit compilation process is done in the function of Follow-up plans to move to complete the compilation process runtime functions to achieve overloading.
>> Currently supports compilation cache, you need to compile the first run, slower time, Run again compiled directly into the extension, the speed very quickly.
>> 
>> Welcome to fork, pull, and suggestions.
>> 
>> https://github.com/liuzhenhai/ cyjit

The translation's quality is quite good, I will edit it and post here again. Thanks
> 
> The concept looks like of interesting.
> 
> Skip
> -- 
> https://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web