I just did 'first' and 'third' right now, because they were the ones I
could do quickly right now. 'Fifth' does look promising, except that
when I looked at the install script earlier I was under the impression
that those patches were only applied if the processor was either a core
2 or an amd64. I could be wrong though.

I hope to look more at this tomorrow.

See below for results of tests. (No useful information, I believe.)

On Mon, 2007-07-30 at 21:50 -0700, David Harvey wrote:
> hmmmm okay there's a few pedantic things I'd like to check.
> 
> First, in some of the samples below you had the include directory 
> wrong, e.g.
> 
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 
> > -L/home/bober/sage-2.7.1/sage-2.7.1/local/lib 
> > -I/home/bober/sage-2.7.1/sage-2.7.1/local/lib -lmpfr -lgmp
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 150003 2007-07-30 20:14 a.out
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m46.675s
> > user    0m46.515s
> > sys     0m0.116s
> 
> Just to check nothing funny is coming from the gmp.h files maybe should 
> just run those ones again.
> 

Oops. I just recompiled these properly and got the same results.

> Second: you're using various standard C++ library things, but in sage's 
> setup.py script, the entry for sage.combinat.partitions doesn't mention 
> "stdc++", whereas there are plenty of others that do. I don't 
> understand why those other ones have "stdc++" whereas partitions gets 
> away without it. Seems a bit fishy to me, but probably not the bug 
> we're looking for.
> 
> Third: can we get the program to printf("%s", gmp_version) to check the 
> GMP version that's getting linked in.
> 

I just tried this, but they all say version 4.2.1, which seems odd
because the name of the Ubuntu package is libgmp3-dev, so I assumed it
was version 3.something. On the other hand, now that I think about it,
version 3 might be really old (but I really don't know). Maybe it is
just a poorly named package.

> Fourth: is there some way to tell exactly which shared library is being 
> used when booting up the shared versions? I'd like to check that it's 
> really using the library we think it is. I used to know how to do this. 
> There's some unix command which will print out the libraries that are 
> loaded when the program starts, but I can't remember how to do it.
> 
> Fifth: The sage install log mentions a few patches, namely the 
> "gmp-4.2.1-core2-port" patch, the "gmp_add_nc.patch" patch, and 
> "mpn_amd64.42" patch. I assume sage patches these in before building 
> GMP, and that your build doesn't include these patches. Try either (a) 
> building sage without those patches, or (b) apply them to your separate 
> GMP build, and see whether that makes any difference.
> 
> Actually the last one seems most promising, maybe try that first.
> 
> david
> 
> On Jul 30, 2007, at 5:36 PM, Jonathan Bober wrote:
> 
> > Here are some examples of timings with different compilation options.
> > (I'm using 3*10^8) here because it takes long enough to see the
> > difference, but short enough to conveniently run lots of tests.
> >
> > After running hg_sage.pull() to get the newest version, of the code, I
> > get:
> >
> > sage: time a = number_of_partitions(300000000, algorithm='bober')
> > CPU times: user 46.81 s, sys: 0.04 s, total: 46.85 s
> > Wall time: 47.19
> >
> > Now I copy the code somewhere else and compile it, linking it to the
> > Ubuntu-installed libraries:
> >
> > [EMAIL PROTECTED]:~/sage-2.7.1/sage-2.7.1/devel/sage-bober/sage/combinat$ 
> > cp 
> > partitions_c.cc ~/temp/
> > [EMAIL PROTECTED]:~/sage-2.7.1/sage-2.7.1/devel/sage-bober/sage/combinat$ 
> > cd 
> > ~/temp
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 -lgmp -lmpfr
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 27529 2007-07-30 20:01 a.out       <-- Look at 
> > size 
> > of file to make sure we aren't linking statically
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m36.171s
> > user    0m36.110s
> > sys     0m0.016s
> >
> > Now do the same thing, but link statically:
> >
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 -lmpfr -lgmp -static
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 1452497 2007-07-30 20:08 a.out    <-- Much 
> > bigger binary
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m34.240s
> > user    0m34.146s
> > sys     0m0.020s
> >
> > Now we build with the libraries included in sage. (Note that
> > sage does not build a shared library version of mprf, so
> > this binary is bigger than first we build.) The time this
> > takes to run is comparable to the time it took to run from
> > within sage, so we know the overhead isn't from sage.
> >
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 
> > -L/home/bober/sage-2.7.1/sage-2.7.1/local/lib 
> > -I/home/bober/sage-2.7.1/sage-2.7.1/local/lib -lmpfr -lgmp
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 150003 2007-07-30 20:14 a.out
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m46.675s
> > user    0m46.515s
> > sys     0m0.116s
> >
> > Now build a static version of the library. (It looks like sage
> > only builds a shared library version of gmp, so I'm not sure if
> > this really works the way it is supposed to, but it runs at a
> > similar speed.)
> >
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 
> > -L/home/bober/sage-2.7.1/sage-2.7.1/local/lib 
> > -I/home/bober/sage-2.7.1/sage-2.7.1/local/lib -lmpfr -lgmp -static
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 1479519 2007-07-30 20:19 a.out
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m43.592s
> > user    0m43.443s
> > sys     0m0.012s
> >
> > Now we build using the gmp 4.2.1 and mfpr 2.2.1 that I just built.
> >
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 -L/home/bober/local/lib/ 
> > -I/home/bober/local/include/ -lmpfr -lgmp
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 114849 2007-07-30 20:26 a.out
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m35.630s
> > user    0m35.206s
> > sys     0m0.060s
> >
> > And one more time, linking statically to those libraries
> >
> > [EMAIL PROTECTED]:~/temp$ g++ partitions_c.cc -O3 -L/home/bober/local/lib/ 
> > -I/home/bober/local/include/ -lmpfr -lgmp -static
> > [EMAIL PROTECTED]:~/temp$ ls -l a.out
> > -rwxr-xr-x 1 bober bober 1401979 2007-07-30 20:29 a.out
> > [EMAIL PROTECTED]:~/temp$ time ./a.out 300000000
> > [...]
> > real    0m33.924s
> > user    0m33.354s
> > sys     0m0.052s
> >
> >
> 
> 
> > 
> 
> 


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to