Just made sympy-llvm public ( https://github.com/yuemingl/sympy-llvm ). The core is the file jit_compile.py. I think it is very simple to integrate into SymPy subject to some modifications. I think there are still some work to be done, for example the support of basic math functions is not complete but it is trivial to add them. The JIT part is based on LLVMPY (http://www.llvmpy.org/). I can migrate it to llvmlite since llvmpy is deprecated. I also looked the code that using llvmlite in SymPy. There are some overlap of the functions but my work provides more functions and very suitable for numerical computations like vectorized function (Compile one or a list of expressions and the list of expressions can be evaluated N times by passing array parameters in the call of the compiled function).
On Wednesday, April 20, 2016 at 2:44:41 PM UTC-7, Ondřej Čertík wrote: > > Hi Yueming, > > On Wed, Apr 20, 2016 at 12:29 PM, yueming liu <[email protected] > <javascript:>> wrote: > > I am not sure if it is too late to contribute to SymPy and the paper. > I've > > been developing a private project called sympy-llvm which uses > just-in-time > > (JIT) compilation technique to compile SymPy expressions to native > machine > > code in order to speedup the numerical evaluation of the expressions for > > numerical computation purpose. This is similar to the existing functions > in > > SymPy like subs/evalf, lambdify, ufuncify and Theano (see > > http://docs.sympy.org/latest/modules/numeric-computation.html). The > > advantage of sympy-llvm is that it is faster than all the existing > methods > > in the sense of compilation time and numerical evaluation time. Another > > advantage is that no FORTRAN or C/C++ source code generation involved. > > Runnable machine code is generated in memory using LLVM (Attached > figures > > show some comparison benchmarks. SMC_py stands for sympy-llvm > > implementation). Example applications are implemented such as the > numerical > > computation for modals in PyDy. I'd like to make sympy-llvm public and > > integrate into SymPy as an optional component for numerical computation > if > > possible. > > > > As you all may know that the projects like Google TensorFlow and Theano > are > > both using symbolic-numerical way to provide human friendly language > > interface and fast numerical computation. The CASs projects developed a > > couple of decades ago like Maple, Maxima, Mathematica, Reduce etc > > (https://en.wikipedia.org/wiki/List_of_computer_algebra_systems) none > of > > them have 'in-memory' JIT complication functions to bridge the gap > between > > symbolic and numeric computations. I believe sympy-llvm as a component > of > > SymPy will be a great enhancement of SymPy in numerical computation > field. > > That sounds very interesting. Jason and I were in fact discussing how > to speedup the compilation phase when the expression is large, as it > can take a long time (like 1 day to compile a single file C file). > Using LLVM was one the ideas. > > If you are interested in contributing this to SymPy, you can share the > code somewhere and we can have a look how to best integrate it. > > Ondrej > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/c4fcf2c1-306b-4b89-9396-06e9ae556221%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
