[Aldor-l] bug in setpartition - well, not quite -- ALDOR compiler bug
Ralf Hemmecke
ralf at hemmecke.de
Wed Oct 25 18:55:23 EDT 2006
Hi Martin,
I just wanted to tell you that the 12 seconds are probably due to the
fact that
1) you are timing in the interpreter (not really realistic)
2) I have deliberately set the variable
VARIANTSTOBUILD=debug
in Makefile.def.nw that compiles with -q1 against a non-optimized
libalgebrad and libaldord. So you should not expect good timings here.
So I changed to
VARIANTSTOBUILD=ordinary
which then uses the flags "-q3 -qinline-all" (among others)
and started "make check".
Result... No result. Segmentation fault!!!
In order to repreducuce the behaviour, we speak here of
svn://svn.risc.uni-linz.ac.at/hemmecke/combinat/trunk/
in revision 83.
I traced it down a bit and found out that in
testStream5 the loop
for i in 0..9 repeat {
x := s.i;
import from Pointer;
TRACE("Stream5 i=", i);
TRACE("Stream5 p=", x pretend Pointer);
TRACE("Stream5 x=", x);
v := v + x;
TRACE("Stream5 v=", v);
}
works fine while the more or less original loop
for i in 0..9 for x in s repeat {
import from Pointer;
TRACE("Stream5 i=", i);
TRACE("Stream5 p=", x pretend Pointer);
TRACE("Stream5 x=", x);
v := v + x;
TRACE("Stream5 v=", v);
}
gives
Stream5
Stream5 k=0
Stream5 p=0x83a9578
Stream5 x=Hello
Stream5 v=Hello
Stream5 k=1
Stream5 p=0x83a957e
Stream5 x=
Stream5 v=Hello
Stream5 k=2
Stream5 p=0x83a9580
Stream5 x=World
Stream5 v=Hello World
Stream5 k=3
Stream5 p=0x83a9586
Stream5 x=!
Stream5 v=Hello World!
Stream5 k=4
Stream5 p=0x0
Stream5 x=Segmentation fault
I have no idea where this NIL pointer comes from, but seemingly the
Aldor compiler must have done something wrong.
Note that in DataStream I have defined
generator(x: %): Generator T == generate for i in 0.. repeat yield x.i;
so if you look closer than the two code chunks above are equivalent only
that in the first the "apply" is explicit (and it really does wild
things) and the other one is implicitly given through this generator
function.
The optimizer in the compiler is seriously broken.
I don't want to invest more time to file a proper bugreport. I don't
think that there is anybody who is going to read it anyway.
I really feel sorry for Aldor, but if bugs get not fixed, it makes no
sense to support Aldor any longer.
On 10/25/2006 11:07 PM, Martin Rubey wrote:
> Dear Ralf,
>
> Can you explain the following weird behaviour? Note that calculating
> coefficient 17 takes already 12 seconds!
>
> (Version is trunk, 79)
>
> aldor -gloop -y lib -i include
> #assert DEBUG
> #include "combinat"
> #include "aldorinterp"
> import from ExponentialGeneratingSeries, Integer, Fraction Integer, DataStream(Integer), DataStream(Fraction Integer), MachineInteger
>
> s := stream(inv(fn) for fn in factorialStream);
> s.10
> s.15
> s.17
> #quit
>
>
> aldor -gloop -y lib -i include
>
> AA L DDDD OOO RRRR
> A A L D D O O R R
> A A L D D O O R R
> AAAAA L D D O O RRRR
> A A L D D O O R R
> A A LLLLL DDDD OOO R R
>
> (c) Numerical Algorithms Group Ltd 1995-2001
> Release: Aldor(C) version 1.0.3 for LINUX(glibc2.3)
> Type "#int help" for more details.
> %1 >> #assert DEBUG
> %2 >> #include "combinat"
>
> Comp: 810 msec, Interp: 10 msec
> %3 >> #include "aldorinterp"
>
> Comp: 70 msec, Interp: 0 msec
> %4 >> import from ExponentialGeneratingSeries, Integer, Fraction Integer, DataStream(Integer), DataStream(Fraction Integer), MachineInteger
> Comp: 420 msec, Interp: 0 msec
> %5 >> s := stream(inv(fn) for fn in factorialStream);
> () @ DataStream(Fraction(AldorInteger))
> Comp: 10 msec, Interp: 1280 msec
> %6 >> s.10
> 1 / 3628800 @ Fraction(AldorInteger)
> Comp: 90 msec, Interp: 480 msec
> %7 >> s.15
> 1 / 1307674368000 @ Fraction(AldorInteger)
> Comp: 0 msec, Interp: 4140 msec
> %8 >> s.17
> 1 / 355687428096000 @ Fraction(AldorInteger)
> Comp: 10 msec, Interp: 11910 msec
>
> factorialStream itself seems to work OK, although not especially fast. However,
> one has to keep in mind that it is creating and resizing arrays all the
> time. Maybe more than necessary are created when one nests streams as above?
>
> Martin
More information about the Aldor-l
mailing list