Re: [sympy] ODE code generation

2013-12-19 Thread Frédéric Bastien
Hi, ok, if cython is a wrapper to manually done c code, then Theano is the faster automatic code regenrator at run time :) Under linux, mac, the easiest way to change theano flags is via the command line under bash: THEANO_FLAGS=linker=c python benchmark.py would do the trick. This only work w

Re: [sympy] ODE code generation

2013-12-19 Thread Frédéric Bastien
Hi, This is just to note that I did some optimization in Theano related to this. I did "easy" stuff, like adding c code to some "trivial" op that where bottleneck in our cases. It is still slower then your cython example. Is it manually done cython or generated cython? Also, I fixed a crash due

Re: [sympy] ODE code generation

2013-11-05 Thread Jason Moore
Sure, I'll do some benchmarks on that soon. Jason moorepants.info +01 530-601-9791 On Tue, Nov 5, 2013 at 9:27 PM, Aaron S. Meurer wrote: > Assumedly if it doesn't, then you would be able to tell just by applying > the sympy cse and seeing if it makes a significant difference in the run > tim

Re: [sympy] ODE code generation

2013-11-05 Thread Aaron S. Meurer
Assumedly if it doesn't, then you would be able to tell just by applying the sympy cse and seeing if it makes a significant difference in the run time. Aaron Meurer > On Nov 5, 2013, at 6:45 PM, Matthew Rocklin wrote: > > Sadly I'm not an expert in C compilers and I no longer have an awesome

Re: [sympy] ODE code generation

2013-11-05 Thread Matthew Rocklin
Sadly I'm not an expert in C compilers and I no longer have an awesome compilers-post-doc-office-mate. I don't know what they'll do in this situation. His no-CSE statement would still hold if the input pointers point to dynamically allocated memory. I don't recall what he said if they point to s

Re: [sympy] ODE code generation

2013-11-05 Thread Jason Moore
Got it. SymPy's code generators in codegen and autowrap don't support evaluating a SymPy matrix as the expression. I'd like to improve those so that you can pass in a sequences of Matrices and it returns a function that evaluates all of the matrices in a single C/Fortran/etc file. Here is a simpl

Re: [sympy] ODE code generation

2013-11-05 Thread Matthew Rocklin
My previous statement was that Theano won over autowrap.ufuncify because theano did CSE internally (theano's basic data structure is a DAG). My understanding is that your C friend is correct IF the code is written in the standard way, declaring each variable individually. I remember looking at ol

Re: [sympy] ODE code generation

2013-11-05 Thread Aaron Meurer
I would still benchmark running cse and not. If cse() is fast enough, it might out-balance the overhead of the code generation, especially if it significantly reduces the resulting code size. Aaron Meurer On Tue, Nov 5, 2013 at 11:36 AM, Jason Moore wrote: > My roommate who's a C guy suggested t

Re: [sympy] ODE code generation

2013-11-05 Thread Jason Moore
My roommate who's a C guy suggested that CSE was a waste of time if you have a good compiler. He claimed that the compiler will do CSE anyways, so doing it in the C code was not useful. I need to compare my Cython code output with and without CSE (it currently uses CSE). How would I use CSE with t

Re: [sympy] ODE code generation

2013-11-05 Thread Matthew Rocklin
In my experiments with sympy-theano earlier this year I found that it was competitive with our Fortran code generation (autowrap.ufuncify) on single array outputs and outperformed it when CSE were involved. I don't have anything recorded that profiles scalar operations. Frederic might have some i

Re: [sympy] ODE code generation

2013-11-05 Thread Jason Moore
Ok, so I think I'm comparing things correctly then. It is surprising that the compiled Theano code doesn't seem to execute that fast. The functions I'm generating are essentially evaluating very long sympy expressions, maybe Theano isn't great at that... Jason moorepants.info +01 530-601-9791 O

Re: [sympy] ODE code generation

2013-11-05 Thread Matthew Rocklin
`sympy.printing.theanocode.theano_function` calls `theano.function` The result of `theano_function` is a compiled theano function. On Tue, Nov 5, 2013 at 9:27 AM, Jason Moore wrote: > > > > Jason > moorepants.info > +01 530-601-9791 > > > On Tue, Nov 5, 2013 at 8:46 AM, Frédéric Bastien wrot

Re: [sympy] ODE code generation

2013-11-05 Thread Jason Moore
Jason moorepants.info +01 530-601-9791 On Tue, Nov 5, 2013 at 8:46 AM, Frédéric Bastien wrote: > Hi, > > Just to know, witch version of Theano did you used? I have speed up a > little the optimization phase of the compilation and I have a PR that > will optimize this more. > I'm using the mast

Re: [sympy] ODE code generation

2013-11-05 Thread Frédéric Bastien
Hi, Just to know, witch version of Theano did you used? I have speed up a little the optimization phase of the compilation and I have a PR that will optimize this more. Also, Theano cache the compilation of the c code. Where this timming done with a empty theano cache or a filled Theano cache? If

Re: [sympy] ODE code generation

2013-11-03 Thread Ronan Lamy
Le 03/11/13 14:19, Jason Moore a écrit : Ronan, Thanks for looking at the derivation code. We haven't ever really had any review of it outside of our mechanical engineer group, so this very helpful. I'll review your PR and look into the second two items. Why do you think the dictionary represe

Re: [sympy] ODE code generation

2013-11-03 Thread Jason Moore
Ronan, Thanks for looking at the derivation code. We haven't ever really had any review of it outside of our mechanical engineer group, so this very helpful. I'll review your PR and look into the second two items. Why do you think the dictionary representation will be so much faster? Jason moo

Re: [sympy] ODE code generation

2013-11-02 Thread Ronan Lamy
Le 01/11/13 11:54, Jason Moore a écrit : I've been tinkering with code generation for ODE's that sympy.physics.mechanics spits out and have some results: http://www.moorepants.info/blog/pydy-code-gen.html Several people have posted topics on this recently. We need to build in a code generator f

[sympy] ODE code generation

2013-11-01 Thread Jason Moore
I've been tinkering with code generation for ODE's that sympy.physics.mechanics spits out and have some results: http://www.moorepants.info/blog/pydy-code-gen.html Several people have posted topics on this recently. We need to build in a code generator for solving ODE's into SymPy that would play