Cythonize and other issues

101 views
Skip to first unread message

pallab

unread,
Jul 14, 2012, 10:15:36 PM7/14/12
to sy...@googlegroups.com
Hi,

What is the current status of the initiatives like cythonize sympy.core or write it in some other fast statically typed language?, I have seen various info internet, however it is unclear what is the present status.

best.
Pallab

Aaron Meurer

unread,
Jul 14, 2012, 10:35:11 PM7/14/12
to sy...@googlegroups.com, Ondřej Čertík
It's present status is mostly stalled. You can see some stuff at
https://github.com/certik/sympyx.

The problem is that the core is currently (and has been for some time)
a mess, mostly due to the old assumptions, making it hard to do things
with.

Ondrej might be able to comment more on any progress or planned progress.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/pN0sMoy3dbwJ.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.

Ondřej Čertík

unread,
Jul 16, 2012, 9:16:46 AM7/16/12
to Aaron Meurer, sy...@googlegroups.com
Pallab,

On Sun, Jul 15, 2012 at 4:35 AM, Aaron Meurer <asme...@gmail.com> wrote:
> It's present status is mostly stalled. You can see some stuff at
> https://github.com/certik/sympyx.

Yes, that's a Cythonized core, the speed is decent (e.g. sometimes faster
than Sage, sometimes slower depending on the benchmark).

>
> The problem is that the core is currently (and has been for some time)
> a mess, mostly due to the old assumptions, making it hard to do things
> with.

Yes, we need to eventually fix that.

>
> Ondrej might be able to comment more on any progress or planned progress.

The work below is very preliminary:

My nearest plan is to figure out whether one can write a faster (than sympyx)
core in C++, my latest code is here (in the "w" branch)

https://github.com/certik/csympy/tree/w

I am using better data structures and quite simple/maintainable model,
I am quite close to actually be able to run some benchmarks.
Then depending on those, I will think about the overall strategy,
and we'll see how to proceed from there. But as I said,
this is really just preliminary -- it might, or might not be a viable
option.

Let me know if you (or anyone) want to help out.

Ondrej

pallab

unread,
Jul 16, 2012, 9:40:06 PM7/16/12
to sy...@googlegroups.com, Aaron Meurer

Hi,

I would like to help. Please let me know how I can help. Although my help may not be very effective :)
best,
Pallab

Ondřej Čertík

unread,
Jul 17, 2012, 11:09:17 AM7/17/12
to sy...@googlegroups.com, Aaron Meurer
On Tue, Jul 17, 2012 at 3:40 AM, pallab <palla...@gmail.com> wrote:
>
> Hi,
>
> I would like to help. Please let me know how I can help. Although my help
> may not be very effective :)

Right now you can help by sending pull requests against:

https://github.com/certik/csympy/tree/w

(i.e. the "w" branch) that improve the code so that we can run
benchmarks from here:

https://github.com/certik/sympyx/blob/master/benchmarks.py

we'll stay on the C++ level, so that we don't have to bother with
Python wrappers (for now).
It might be too difficult to help out with this at this stage, I don't
know. I wanted to ask for help
later, but since you asked, I figured out why not to let you know early.

Ondrej

pallab

unread,
Jul 24, 2012, 2:08:20 PM7/24/12
to sy...@googlegroups.com, Aaron Meurer
This gives error message when I try to make,

[  6%] Building CXX object src/CMakeFiles/csympy.dir/basic.cpp.o
[ 13%] Building CXX object src/CMakeFiles/csympy.dir/dict.cpp.o
/home/pallab/csympy/src/dict.cpp: In function ‘std::ostream& operator<<(std::ostream&, const CSymPy::Dict_int&)’:
/home/pallab/csympy/src/dict.cpp:6:17: error: expected initializer before ‘:’ token
/home/pallab/csympy/src/dict.cpp:9:5: error: expected primary-expression before ‘return’
/home/pallab/csympy/src/dict.cpp:9:5: error: expected ‘)’ before ‘return’
make[2]: *** [src/CMakeFiles/csympy.dir/dict.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/csympy.dir/all] Error 2
make: *** [all] Error 2

Ondřej Čertík

unread,
Jul 24, 2012, 2:53:47 PM7/24/12
to sy...@googlegroups.com
On Tue, Jul 24, 2012 at 11:08 AM, pallab <palla...@gmail.com> wrote:
> This gives error message when I try to make,
>
> [ 6%] Building CXX object src/CMakeFiles/csympy.dir/basic.cpp.o
> [ 13%] Building CXX object src/CMakeFiles/csympy.dir/dict.cpp.o
> /home/pallab/csympy/src/dict.cpp: In function ‘std::ostream&
> operator<<(std::ostream&, const CSymPy::Dict_int&)’:
> /home/pallab/csympy/src/dict.cpp:6:17: error: expected initializer before
> ‘:’ token
> /home/pallab/csympy/src/dict.cpp:9:5: error: expected primary-expression
> before ‘return’
> /home/pallab/csympy/src/dict.cpp:9:5: error: expected ‘)’ before ‘return’
> make[2]: *** [src/CMakeFiles/csympy.dir/dict.cpp.o] Error 1
> make[1]: *** [src/CMakeFiles/csympy.dir/all] Error 2
> make: *** [all] Error 2

Which git hash did you build and which gcc do you use? I have:

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.1-9ubuntu3'
--with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin
--enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)




Ondrej

pallab

unread,
Jul 24, 2012, 3:26:58 PM7/24/12
to sy...@googlegroups.com
I am using 4.5.2


g++ -v

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

pallab

unread,
Jul 24, 2012, 3:29:22 PM7/24/12
to sy...@googlegroups.com

also I did follwoing:

git clone  https://github.com/certik/csympy
cd csympy
git checkout w
git pull

cmake CMakeLists.txt
make

Ondřej Čertík

unread,
Jul 24, 2012, 6:27:38 PM7/24/12
to sy...@googlegroups.com
I think that your gcc is too old --- I am using some new features from C++11,
so that's probably the reason. Right now I just want to get something out there,
see if it does the job and only later start bothering about portability etc.

Ondrej
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sympy/-/tP89jTGiw_AJ.

Tom Bachmann

unread,
Jul 25, 2012, 2:28:06 PM7/25/12
to sy...@googlegroups.com
> The work below is very preliminary:
>
> My nearest plan is to figure out whether one can write a faster (than sympyx)
> core in C++, my latest code is here (in the "w" branch)
>
> https://github.com/certik/csympy/tree/w
>
> I am using better data structures and quite simple/maintainable model,
> I am quite close to actually be able to run some benchmarks.
> Then depending on those, I will think about the overall strategy,
> and we'll see how to proceed from there. But as I said,
> this is really just preliminary -- it might, or might not be a viable
> option.
>
> Let me know if you (or anyone) want to help out.
>

Hi,

this looks really interesting, please keep us posted! I am (right now,
and for at least one more month) very busy, but after that I would be
very happy to help out where I can.

Tom

pallab

unread,
Jul 26, 2012, 12:12:15 AM7/26/12
to sy...@googlegroups.com
This is working fine with g++-4.6.3
> sympy+unsubscribe@googlegroups.com.

Vinzent Steinberg

unread,
Jul 28, 2012, 9:01:51 AM7/28/12
to sy...@googlegroups.com, Aaron Meurer
On Tuesday, July 17, 2012 5:09:17 PM UTC+2, Ondřej Čertík wrote:
How does this compare to GiNaC? [1]

Vinzent

Ondřej Čertík

unread,
Jul 28, 2012, 10:37:11 AM7/28/12
to sy...@googlegroups.com
It's very similar. The difference is that I use RCP from Trilinos and C++11
datastructures (unordered_map), and I want to see how
fast one can get. GiNaC will be one obvious library to compare against.

There is also PyNaC [2], which Sage uses,
but for some reason, it's a bit slower in Sage. So
my first benchmarks will be against GiNaC in C++. That's pretty
much the fastest that I know of, in open source.

Ondrej

[2] https://bitbucket.org/burcin/pynac
Reply all
Reply to author
Forward
0 new messages