1. OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 11, 2013
- 3271 views
I finally made some time this weekend to mess around with OpenEuphoria on the raspberry pi. Thanks to Ira's hardfloat binaries I was able to build my own newer dev version, although i'm getting a lot of cast & incompatable types warnings in newer changesets & i have to modify line 66 so the grep is for arm rather than ARM and iirc I had to remove a -m32 as well but I think that was one of the earlier changesets before I ended up with one from 28th of November that works, the few changesets i tried from 2013 seemed to bomb out building so i'm going through all of the changesets until i find where the change that stops it from building occured. For some reason my self-built version is taking 10seconds longer than Ira's binaries to complete the sieve8k benchmark
Prime Sieve Benchmark Count: 1028, Largest: 8191 time: 33.07
compared to
Prime Sieve Benchmark Count: 1028, Largest: 8191 time: 23.6
I've ported another interesting benchmark program from a BASIClike interpreter called RTB which is for the raspberry pi and quite slow but usable and I thought others might like to try it on different ARM devices and x86 computers, the code is rubbish but it works as it should, i use the diff() function so it's only got a second granularity but it's good enough.
without type_check include std/datetime.e atom z sequence start function ackermann(atom m, atom n) if m = 0 then return n + 1 end if if n = 0 then return ackermann( m -1, 1) end if return ackermann(m - 1, ackermann(m, n - 1)) end function puts(1, "The Ackermann Test\n") puts(1, "Start\n") start = now() for y = 0 to 3 do for x = 0 to 9 do printf(1, "%d ",ackermann(y, x)) end for puts(1,"\n") end for printf(1, "Done in %d seconds\n", diff( start, now()))
on my 1000MHz on-demand overclocked raspberry pi running raspbian the results are
eui ackermann.ex The Ackermann Test Start 1 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 11 3 5 7 9 11 13 15 17 19 21 5 13 29 61 125 253 509 1021 2045 4093 Done in 30 seconds
and
eub ackermann.il The Ackermann Test Start 1 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 11 3 5 7 9 11 13 15 17 19 21 5 13 29 61 125 253 509 1021 2045 4093 Done in 29 seconds[that was a slow run as ackermann.il normally runs in 27 seconds]
bst rgrds Russell
2. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 11, 2013
- 3238 views
I finally made some time this weekend to mess around with OpenEuphoria on the raspberry pi. Thanks to Ira's hardfloat binaries I was able to build my own newer dev version, although i'm getting a lot of cast & incompatable types warnings in newer changesets & i have to modify line 66 so the grep is for arm rather than ARM and iirc I had to remove a -m32 as well but I think that was one of the earlier changesets before I ended up with one from 28th of November that works, the few changesets i tried from 2013 seemed to bomb out building so i'm going through all of the changesets until i find where the change that stops it from building occured.
If you haven't already, check out the "hg bisect" command. It implements a binary search based on you telling it whether a changeset is good or bad to help you zero in on the problem.
Matt
3. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 11, 2013
- 3247 views
will do, i know squat about mercurial as i use fossil so i'll read up on bisect.
the warnings about unused variables i'm not too bothered about but getting a few like the following that i'm a tad "worried" about
be_alloc.c: In function ‘new_dbl_block’: be_alloc.c:994:2: warning: passing argument 1 of ‘ERealloc’ from incompatible pointer type [enabled by default] be_alloc.h:164:14: note: expected ‘char *’ but argument is of type ‘struct free_block **’ be_alloc.c:994:16: warning: assignment from incompatible pointer type [enabled by default]
you get similar when building on x86?
4. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 11, 2013
- 3213 views
will do, i know squat about mercurial as i use fossil so i'll read up on bisect.
the warnings about unused variables i'm not too bothered about but getting a few like the following that i'm a tad "worried" about
be_alloc.c: In function ‘new_dbl_block’: be_alloc.c:994:2: warning: passing argument 1 of ‘ERealloc’ from incompatible pointer type [enabled by default] be_alloc.h:164:14: note: expected ‘char *’ but argument is of type ‘struct free_block **’ be_alloc.c:994:16: warning: assignment from incompatible pointer type [enabled by default]
you get similar when building on x86?
I do get those. They aren't terribly important, though we should probably get rid of them, since they add unwanted noise. For the purpose of memory management a pointer is pretty much the same as any other pointer, but a function has to have a definite type for its parameters.
Matt
5. Re: OpenEuphoria on the raspberry pi
- Posted by useless_ Feb 11, 2013
- 3180 views
<snip>
[that was a slow run as ackermann.il normally runs in 27 seconds]
bst rgrds Russell
I just ran the code on a 10 yr old P4 2.6Ghz desktop box running winxp (and it was doing other things), and the code ran in 8 seconds, repeatedly. I expected the Pi to execute this much faster than the times you report. It makes sense only if i consider that the speed of *nix OS you are running scales with the cpu clock speed, being your times are 3x and the clock speed is 1/3 of my desktop box.
Maybe i was expecting one could run Eu on the Pi with no preemptive OS, in the same way one can run C (or etc) on the avr in the arduino with no OS. Is that possible on the Pi? Is an OS required? My understanding (and my experience) is if one made no D/OS calls 20 years ago, one didn't need the D/OS to be present.
useless
6. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 11, 2013
- 3214 views
... before I ended up with one from 28th of November that works, the few changesets i tried from 2013 seemed to bomb out building so i'm going through all of the changesets until i find where the change that stops it from building occured. For some reason my self-built version is taking 10seconds longer than Ira's binaries to complete the sieve8k benchmark
Prime Sieve Benchmark Count: 1028, Largest: 8191 time: 33.07
compared to
Prime Sieve Benchmark Count: 1028, Largest: 8191 time: 23.6
I can check after work today, but I think I may have switched/added the optimization level to '-O3' in my Eu source to squeeze at some better performance. I'll confirm and also try your posted code on my Pi for comparison.
Thanks,
Ira
7. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 11, 2013
- 3202 views
With the hard-float version I posted, I had used more aggressive optimization to get better performance! Also, I updated my eui with the lastest version from the default branch. What branch of the code was giving you those errors?
pi@raspberrypi ~/Code/Euphoria $ eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-02-10 21:47:07, Id: 5978:8d834d1a940f
My PI is overclocked to 950 MHz and I get the folliowing with your program:
pi@raspberrypi ~/Code/Euphoria $ eui ackerman.ex The Ackermann Test Start 1 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 11 3 5 7 9 11 13 15 17 19 21 5 13 29 61 125 253 509 1021 2045 4093 Done in 18 seconds
Not too bad!
Thanks,
Ira
8. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 11, 2013
- 3189 views
The latest I have working at the moment is
eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2012-11-18 23:42:44, Id: 5856:3322cfa99960
i'm building on the raspberry pi rather than cross compiling (i have my old raspberry pi scratchbox2 vm but i've not used it in a few months as i've been working on some scripts and xmpp servers) and the newer branches were freezing when building. i'll tweak gpu/arm mem split and see if that helps building newer changesets and i'll use O3. by the way what version of gcc are you using as that has effected speed before on raspbian.
bst rgrds Russell
9. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 12, 2013
- 3136 views
i'm building on the raspberry pi rather than cross compiling (i have my old raspberry pi scratchbox2 vm but i've not used it in a few months as i've been working on some scripts and xmpp servers) and the newer branches were freezing when building. i'll tweak gpu/arm mem split and see if that helps building newer changesets and i'll use O3. by the way what version of gcc are you using as that has effected speed before on raspbian.
Ah, ok! I have the recommended compiler from the raspberry pi foundation setup in my scratchbox:
sb2 -t raspbianhf gcc -v Using built-in specs. Target: arm-linux-gnueabihf .... Thread model: posix gcc version 4.7.2 20120731 (prerelease) (crosstool-NG linaro-1.13.1+bzr2458 - Linaro GCC 2012.08)
For reference, the gcc version on my pi is:
pi@raspberrypi ~/Code/Euphoria $ gcc -v Using built-in specs. Target: arm-linux-gnueabihf .... Thread model: posix gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
While I can compile the latest revision in the default branch in scratchbox, that version seems to not work properly on my pi. Some of the example programs just stall out... I haven't discovered what the issue is yet, but this version seems to be stable on my pi:
sb2 -t raspbianhf ./eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-18 15:52:45, Id: 5957:e9e11b19737a
I'm curious to know what kind of performance you get after switching to -O3 and which revision you get working!
Thanks,
Ira
10. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3109 views
I'm seeing the stalling with some programs as well, that's what stops me from being able to build some versions as the build hangs at the translating code....generating part. if i use the --use-binary-translator it will build but i still get stalled programs, the thing that initially confused me with that was my ackermann.ex runs ok but sieve8k.ex doesn't.
my gcc is
gcc --version gcc (Debian 4.6.3-14+rpi1) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
It is a bit strange that a cross compiled eui works but a natively built one doesn't. it's normally the other way around :)
i guess i'm going to be spending the today's holiday building several versions of euphoria :)
11. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 12, 2013
- 3082 views
I'm seeing the stalling with some programs as well, that's what stops me from being able to build some versions as the build hangs at the translating code....generating part. if i use the --use-binary-translator it will build but i still get stalled programs, the thing that initially confused me with that was my ackermann.ex runs ok but sieve8k.ex doesn't.
You might try adding trace(3) to see where things are getting stuck.
Matt
12. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3081 views
just for yuks and because I already had gcc 4.7 installed on this raspberry pi i thought i'd give it a try. when using gcc 4.6 it stalled at the 1st translating...generating bit, with 4.7 it went passed that bit. it hasn't finished yet (it's about 60 to 90 minutes to build on the rpi iirc) so i won't know if it's completely successful yet but fingers crossed
13. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3076 views
I'm seeing the stalling with some programs as well, that's what stops me from being able to build some versions as the build hangs at the translating code....generating part. if i use the --use-binary-translator it will build but i still get stalled programs, the thing that initially confused me with that was my ackermann.ex runs ok but sieve8k.ex doesn't.
You might try adding trace(3) to see where things are getting stuck.
Matt
i would except it never even gets that far, i put a with trace trace(1) in when i first spotted this and it just sits there blinking it's cursor at me
14. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 12, 2013
- 3039 views
I'm seeing the stalling with some programs as well, that's what stops me from being able to build some versions as the build hangs at the translating code....generating part. if i use the --use-binary-translator it will build but i still get stalled programs, the thing that initially confused me with that was my ackermann.ex runs ok but sieve8k.ex doesn't.
You might try adding trace(3) to see where things are getting stuck.
Matt
i would except it never even gets that far, i put a with trace trace(1) in when i first spotted this and it just sits there blinking it's cursor at me
Ah. Then it's getting stuck somewhere in the front end. In that case, you could do a debug build and run it under gdb and figure out where it is. You might be getting hit by ticket:835.
Matt
15. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3034 views
I'm seeing the stalling with some programs as well, that's what stops me from being able to build some versions as the build hangs at the translating code....generating part. if i use the --use-binary-translator it will build but i still get stalled programs, the thing that initially confused me with that was my ackermann.ex runs ok but sieve8k.ex doesn't.
You might try adding trace(3) to see where things are getting stuck.
Matt
i would except it never even gets that far, i put a with trace trace(1) in when i first spotted this and it just sits there blinking it's cursor at me
actually just tried again and this time it worked (go figure) but it freezes as soon as i press F2 if i follow it manually then it gets further but as soon as i press f2 it freezes, the only consistant thing seems to be after it prints Prime Sieve benchmark & always at an end for line, if not tracing the output line never appears, could be something in the console output? my ackermann.ex doesn't use teh console include and it runs ok
16. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3037 views
YES allsorts.ex with the console.e commented out runs, with it not commented out it doesn't.
17. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 12, 2013
- 3031 views
YES allsorts.ex with the console.e commented out runs, with it not commented out it doesn't.
Interesting. I think trace(3) is the next thing to try.
Matt
18. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 12, 2013
- 3034 views
YES allsorts.ex with the console.e commented out runs, with it not commented out it doesn't.
Interesting. I think trace(3) is the next thing to try.
My guess, BTW, is that there's a problem with the call_c stuff. When you include part of the standard library, that part often uses other parts, and some of those parts do C calls.
Matt
19. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3023 views
ok now i'm really confused
without type_check with trace include std/machine.e include std/math.e include std/console.e include std/error.e
works
without type_check --with trace include std/machine.e include std/math.e include std/console.e include std/error.e
doesn't. i don't need to to use trace(1) just add or remove with trace
commenting out console.e also allows it to run
i'm ssh'ed in to the raspberry pi if that would make a difference but i wouldn't think so
20. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3038 views
YES allsorts.ex with the console.e commented out runs, with it not commented out it doesn't.
Interesting. I think trace(3) is the next thing to try.
My guess, BTW, is that there's a problem with the call_c stuff. When you include part of the standard library, that part often uses other parts, and some of those parts do C calls.
Matt
running allsorts.ex with trace(3) i'll pastebin the ctrace.out when it finishes (10mins so far to get to bubble sort :) )
[edited: the ctrace.out seems to be fubar and not contain the whole run, it was immediatly 39895bytes and never grew. i'll run again and see if it was a glitch]
21. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 12, 2013
- 3030 views
running allsorts.ex with trace(3) i'll pastebin the ctrace.out when it finishes (10mins so far to get to bubble sort :) )
[edited: the ctrace.out seems to be fubar and not contain the whole run, it was immediatly 38895bytes and never grew. i'll run again and see if it was a glitch]
ctrace.out has a fixed number of lines (which is configurable in 4.1), so it wraps around. This is by design to prevent the file from getting too big. There should be a line that says "THE END" shhortly after the last line that was written.
Matt
22. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3055 views
ah ok however not sure if it'll actually tell us anything as the with trace line makes it run anyway so ctrace.out will be of a "working" program. i'm running again though now you've explained how it works.
24. Re: OpenEuphoria on the raspberry pi
- Posted by EUWX Feb 12, 2013
- 3070 views
i guess i'm going to be spending the today's holiday building several versions of euphoria :)
RKD and ira: Are you aware of the new ARM release yesterday at Raspbery site? it is dated yesterday and I think it is a build based on the new 3.7 kernel, which is much more friendly with Hard float?
25. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 3028 views
yeah although i've been on 3.6 & 3.7 kernel for yonks via rpi-update. i was actually going to downgrade back to a older sd card image with 3.2 kernel & older gcc to see if that made a difference
26. Re: OpenEuphoria on the raspberry pi
- Posted by EUWX Feb 12, 2013
- 3013 views
yeah although i've been on 3.6 & 3.7 kernel for yonks via rpi-update. i was actually going to downgrade back to a older sd card image with 3.2 kernel & older gcc to see if that made a difference
There is a sea of difference between kernel 3.6 and 3.7, esp for Arm processors.
Arch Linux for Raspberry Pi is somewhat different from Raspbian version of linux.
27. Re: OpenEuphoria on the raspberry pi
- Posted by EUWX Feb 12, 2013
- 3033 views
yeah although i've been on 3.6 & 3.7 kernel for yonks via rpi-update. i was actually going to downgrade back to a older sd card image with 3.2 kernel & older gcc to see if that made a difference
Tthere is also a Fedora 18 version which was released yesterday and a Bodhi version released a few days ago. Both these specifically address the ARM processor.
http://scotland.proximity.on.ca/raspberrypi/raspberrypi-fedora-remix/18/images/
http://jeffhoogland.blogspot.nl/2012/12/bodhi-linux-armhf-rootfs.html
28. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 2991 views
and on the 9th there was a new raspbian release which is the foundation recommended distro which is effectively what i'm running as i apt-get update/upgrade etc & rpi-update every couple of days [recommended if you don't count RISCOS :) ]
personally i avoid the fedora remix as i was a alpha/beta tester (sort of e.g. i had remote access to their raspberry pi for testing purposes) and it just didn't cut it but others have their own preferences
29. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 2993 views
i'm up to 5892:6a40c057e911 as a changeset that will build and run consistantly & works correctly (no freezing) with both gcc 4.6 & 4.7 although still not found all the places to add -O3 so not the fastest versin there is yet
30. Re: OpenEuphoria on the raspberry pi
- Posted by EUWX Feb 12, 2013
- 2994 views
"raspbian release which is the foundation recommended distro" The wheezy image dated 9th February is NOT built on kernel 3.6
the Arch Linux version is built on 3.7.
You will find the hf integration much easier with 3.7 kernel.
31. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 12, 2013
- 3000 views
Ok, hopefully I can shed some light on the situation! I found that my cross-compiled Euphoria stopped working with revision 5964:ff33ded2f059. According to the changeset, we have:
--- a/include/std/map.e Tue Jan 22 14:26:47 2013 -0500 +++ b/include/std/map.e Tue Jan 22 21:02:33 2013 -0500 @@ -264,7 +264,11 @@ function lookup( object key, integer hashval = hash( key ), sequence slots ) integer mask = length( slots ) - 1 integer index = and_bits( hashval, mask ) + 1 - integer index_hash = index + ifdef BITS64 then + integer index_hash = index + elsedef + atom index_hash = index + end ifdef sequence slot
Based on this, I changed "ifdef BITS64 then" to "ifdef BITS64 or ARM then" and everything works again; the demo programs no longer freeze! Maybe one of the devs can comment on the signifigance here...
i'm up to 5892:6a40c057e911 as a changeset that will build and run consistantly & works correctly (no freezing) with both gcc 4.6 & 4.7 although still not found all the places to add -O3 so not the fastest versin there is yet
To change the optimization levels, I open Makefile.gnu in the source directory with vim. Then you can do a find and replace like so:
:%s/-O2/-O3/g
Also, if you really want optimization appended to all compilation options, you can change the CC reference in Makefile,gnu:
CC=$(CC_PREFIX)$(CC_SUFFIX) to CC=$(CC_PREFIX)$(CC_SUFFIX) -O3
The wheezy image dated 9th February is NOT built on kernel 3.6
the Arch Linux version is built on 3.7.
You will find the hf integration much easier with 3.7 kernel.
I'm a fan of Arch Linux and use it as my primary distro on my x86 system, but the Rapsbian image is based on the 3.6 kernel after the update/upgrade. On my Pi, I get the following:
pi@raspberrypi /tmp $ uname -a Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l GNU/Linux
I've read the 3.7 kernel has some excellent enhancements, but I do think hard float euphoria should work on the older kernels as well.
Thanks,
Ira
32. Re: OpenEuphoria on the raspberry pi
- Posted by EUWX Feb 12, 2013
- 2921 views
"1. Prominent features in Linux 3.7 1.1. ARM multi-platform support
A typical Linux distribution for x86 PC computers can boot and work in hundreds of different PC (different CPU vendor, different GPU models, different motherboards and chipsets, etc) using a single distribution install media. This ability to be able to boot in different hardware configurations is taken as a given in the PC world. However, it didn't exist in the Linux ARM world. The ARM ecosystem has historically been driven by the embedded world, where hardware enumeration isn't even possible in many cases, so each ARM kernel image was targeted for a specific embedded hardware target. It couldn't boot in other ARM systems.
In this release, the Linux ARM implementation has added "multi-platform" support - the ability to build a single ARM kernel image that is able to boot multiple hardware. This will make much easier for distributors to support ARM platforms. "
I would agree that a distro build specifically to address the ARM processor of Rapberry Pi would and should work, but having talked with the "gurus" last summer at the FOSS conference in Toronto, I came away with the impression that the young man (Greene) working on Fedora 17 and Raspberry Pi was "wasting his time". He did come out with a release, and now he has come out with a release based on Fedora 18!
I have very poor knowledge of Linux to actually work doing the type of work Ira is doing, but my grandson might kick me into doing it!
33. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 2930 views
"1. Prominent features in Linux 3.7 1.1. ARM multi-platform support
A typical Linux distribution for x86 PC computers can boot and work in hundreds of different PC (different CPU vendor, different GPU models, different motherboards and chipsets, etc) using a single distribution install media. This ability to be able to boot in different hardware configurations is taken as a given in the PC world. However, it didn't exist in the Linux ARM world. The ARM ecosystem has historically been driven by the embedded world, where hardware enumeration isn't even possible in many cases, so each ARM kernel image was targeted for a specific embedded hardware target. It couldn't boot in other ARM systems.
In this release, the Linux ARM implementation has added "multi-platform" support - the ability to build a single ARM kernel image that is able to boot multiple hardware. This will make much easier for distributors to support ARM platforms. "
I would agree that a distro build specifically to address the ARM processor of Rapberry Pi would and should work, but having talked with the "gurus" last summer at the FOSS conference in Toronto, I came away with the impression that the young man (Greene) working on Fedora 17 and Raspberry Pi was "wasting his time". He did come out with a release, and now he has come out with a release based on Fedora 18!
I have very poor knowledge of Linux to actually work doing the type of work Ira is doing, but my grandson might kick me into doing it!
that is really not really relevant for userspace s/w such as euphoria. i have binaries built on various arm versions and hardware that run fine on others. i've bulit stuff on the raspberry pi that runs on the zipit z2 and vice versa as on the whole (not completely true as iirc some of the newer arm chips break backwards compatability) an armv6 cpu can run armv5/4 binaries, armv7 can run armv6/5/4 and so on all other things being equal e.g. endian, floating point abi, ... and you are not doing stuff to registers and peripherals directly e.g. gpio
34. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 2997 views
Ok, hopefully I can shed some light on the situation! I found that my cross-compiled Euphoria stopped working with revision 5964:ff33ded2f059. According to the changeset, we have:
not having any luck with that changeset
35. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 12, 2013
- 2997 views
not having any luck with that changeset
Ok, thanks for the snippet! I was able to recreate the error you are seeing; essentially your compilation isn't translating the Eu source code which causes the several undefined references. Try this in your source directory:
which eui % Quick check that a working eui is in your path (the original hard float eubins should work) hg revert -a hg update -r 5964 make distclean vi Makefile.gnu % Change optimization switches vi ../include/std/map.e % Add ARM fix ./configure vi config.gnu % Make sure 'EUPHORIA=1' and not 0 make interpreter % Build eui only to save some time
Hope this helps,
Ira
36. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 12, 2013
- 2929 views
thanks, that will probably help. i can see one thing i was doing wrong for a start.
i'd clone then
hg update -r xxxx:yyyyyyyyyyy clean
to switch to a different changeset
i borked my sd card as well just now so i'm building a new one and i'll try the above. it might be easier to track things down with a clean sd card so i'm not too peeved with myself for trashing this one.
37. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2982 views
the map.e change when building on the raspberry pi seems to cause a problem. (but it's a "cleaner" error than before :) )
Translating eui.ex to create rm -f /home/ukscone/euphoria/source/build/intobj/{*.c,*.o} (cd /home/ukscone/euphoria/source/build/intobj;eui -i /home/ukscone/euphoria/include -d E32 /home/ukscone/euphoria/source/euc.ex -nobuild -i /home/ukscone/euphoria/include -gcc \ -arch ARM \ -c /home/ukscone/euphoria/source/eu.cfg /home/ukscone/euphoria/source/eui.ex ) /home/ukscone/euphoria/include/std/map.e:278 in function lookup() type_check failure, index_hash is 3633619608 ... called from /home/ukscone/euphoria/include/std/map.e:568 in procedure put() ... called from /home/ukscone/euphoria/include/std/flags.e:19 --> See ex.err make[1]: *** [/home/ukscone/euphoria/source/build/intobj/main-.c] Error 1 make[1]: Leaving directory `/home/ukscone/euphoria/source' make: *** [interpreter] Error 2
ex.err http://pastebin.com/rQJ9pF9v
38. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 13, 2013
- 2970 views
the map.e change when building on the raspberry pi seems to cause a problem. (but it's a "cleaner" error than before :) )
/home/ukscone/euphoria/include/std/map.e:278 in function lookup() type_check failure, index_hash is 3633619608
ex.err http://pastebin.com/rQJ9pF9v
Yes, that's the error I would expect. The problem here is that the map algorithm uses 32-bit integers. On a 32-bit version of euphoria, that means you need to store it in an atom. However, on a 64-bit version of euphoria, you can use a normal euphoria integer (since those are 63-bit integers), and using an integer is faster than an atom. You can see that same error on an x86 build of euphoria if you use an integer there.
The real question is why it doesn't work on ARM when you have an atom. Here's what I recommend. Build a debug version of euphoria (make interpreter EDEBUG=1), then run a demo program under gdb, and break into in when it's frozen (ctrl-c). It seems likely that the problem is somewhere in side of lookup, but it would be nice to confirm. It sounds like some key is not finding a slot, so it would be interesting to see what was happening there.
FYI, from within gdb, you can easily print out values of euphoria variables with:
(gdb) print StdPrint(1, some_variable_12345, 1 )
That's the equivalent of ? some_variable in your code. I often add stuff like StdPrint() and printf() into translated code and then re-compile to see what code is doing. That might be useful here, too, to try to trace what's going on there.
Matt
39. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 13, 2013
- 2897 views
Yes, that's the error I would expect. The problem here is that the map algorithm uses 32-bit integers. On a 32-bit version of euphoria, that means you need to store it in an atom. However, on a 64-bit version of euphoria, you can use a normal euphoria integer (since those are 63-bit integers), and using an integer is faster than an atom. You can see that same error on an x86 build of euphoria if you use an integer there.
The real question is why it doesn't work on ARM when you have an atom.
Ahh, the danger in making changes without understanding them! So I cross-compile Euphoria for the Pi on my x86-64 system, which means I use 64bit Eu to do the initial translation. I think this explains why I did not get this error, and my compiled binaries do run on the Pi. But does this mean I avoided the bug or just created a more complex one that will crop up later? Also, what does Eu use the lookup routine for? It seems to be called a lot on startup on some of the demo programs.
I'll also try out the gdb debugging today.
Thanks,
Ira
40. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 13, 2013
- 2887 views
Ahh, the danger in making changes without understanding them! So I cross-compile Euphoria for the Pi on my x86-64 system, which means I use 64bit Eu to do the initial translation. I think this explains why I did not get this error, and my compiled binaries do run on the Pi. But does this mean I avoided the bug or just created a more complex one that will crop up later?
That should be fine, assuming you configure with --arch=ARM, it should tell the translator that it's translating in 32-bit mode. 4.1 has gotten a lot of work on cross compiling.
Also, what does Eu use the lookup routine for? It seems to be called a lot on startup on some of the demo programs.
The lookup routine is used to convert a key / hash into a slot index. The basic idea is that it converts a hash value to an index. If that collides with something else, it perturbs the hash in a particular way and then checks again for a collision. Once it finds what it's looking for (or an empty slot) it returns the slot index. I'm guessing that there's a problem somewhere in the implementation of the perturb process on ARM that is getting us stuck in a loop.
Anything that uses maps will end up calling this a lot. There are some places in the std library that create and fill maps on start up.
The algorithm is the same as used by python's dictionary object, FYI.
Matt
41. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2886 views
just woken up (it's 8am here) and not had coffee yet but i'll build a debug version of the one where map.e starts to cause a problem in a few. overnight i got up to
Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-16 13:27:32, Id: 5942:fc67d38623d0
and so far so good
[i've been build a version & if t builds using it to build the next one i choose by moving down the children for a few steps & if i run out of children moving to the next one above]
42. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2890 views
oh & by the way the current build with everything incl. the pcre stuff compiled with -O3 give
build/eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-16 13:27:32, Id: 5942:fc67d38623d0 ukscone@welham ~/euphoria/source $ build/eui ../demo/bench/sieve8k.ex Prime Sieve Benchmark Count: 1028, Largest: 8191 time: 18.53 ukscone@welham ~/euphoria/source $ vi ../demo/ackermann.ex ukscone@welham ~/euphoria/source $ build/eui ../demo/ackermann.ex The Ackermann Test Start 1 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 11 3 5 7 9 11 13 15 17 19 21 5 13 29 61 125 253 509 1021 2045 4093 Done in 15 seconds
43. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2898 views
upto 5958:3b39b88f0ef5 now which is just before some changes to Makefile.gnu that caused it to try to use x86 assembler in parts of the build and the -O3 optimizations changes not to work as the strings don't exist to change :)
44. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 13, 2013
- 2869 views
upto 5958:3b39b88f0ef5 now which is just before some changes to Makefile.gnu that caused it to try to use x86 assembler in parts of the build and the -O3 optimizations changes not to work as the strings don't exist to change :)
Be careful that you stay in the default branch (or whichever branch you are interested in). Revesion 5958 is in the struct branch!
[ ../Euphoria/source/eu-arm]$ hg up -r 5958 53 files updated, 0 files merged, 0 files removed, 0 files unresolved [ ../Euphoria/source/eu-arm]$ hg id 3b39b88f0ef5 (struct)
You can see which changesets are in a particular branch like this:
hg log -b default | more
Thanks,
Ira
45. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2853 views
thanks, i've just been following children from the last working build, that might explain some of the problems i had on a few builds. i told you i know squat about mercurial, i'm a fossil user (for my own stuff) and git user for gthub although only for cloning stuff i want to have not for sending revisions back
46. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 13, 2013
- 2899 views
upto 5958:3b39b88f0ef5 now which is just before some changes to Makefile.gnu that caused it to try to use x86 assembler in parts of the build and the -O3 optimizations changes not to work as the strings don't exist to change :)
Be careful that you stay in the default branch (or whichever branch you are interested in). Revesion 5958 is in the struct branch!
[ ../Euphoria/source/eu-arm]$ hg up -r 5958 53 files updated, 0 files merged, 0 files removed, 0 files unresolved [ ../Euphoria/source/eu-arm]$ hg id 3b39b88f0ef5 (struct)
You can see which changesets are in a particular branch like this:
hg log -b default | more
NO! Seriously, guys, learn to use hg bisect. It will do the hard work for you, and unless you get lucky, you'll probably have to do fewer tests. As I said before, it does a binary search on the revisions.
There were some recent regressions in the C-calling stuff on other architectures, so it wouldn't surprise me to hear there were some on ARM, as well.
Matt
47. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2878 views
[ NO! Seriously, guys, learn to use hg bisect. It will do the hard work for you, and unless you get lucky, you'll probably have to do fewer tests. As I said before, it does a binary search on the revisions.
There were some recent regressions in the C-calling stuff on other architectures, so it wouldn't surprise me to hear there were some on ARM, as well.
Matt
took a look an hour ago and it looks like it is just automating the switch to the next changeset and keeping a list of the ones marked bad (and the instructions i found were for an earlier version to what i have installed as half the stuff doesn't work or has changed.
i'll have another look after lunch and when i finish the next bit of soldering i want to do
48. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2886 views
Ira: have you be building the tests as well with make test? i'm getting a already defined malloc error when i do, not a biggy but i thought i'd choose a rev and do everything for it and that stopped it from building, should be easily fixable but just wondered if you were getting it too
make ../tests/lib818.dll make[2]: Entering directory `/home/ukscone/euphoria/source' gcc -O3 -c -I ../include -c -fsigned-char -DEUNIX -ffast-math -fomit-frame-pointer -I/home/ukscone/euphoria/source -I/home/ukscone/euphoria -DARCH=ARM -Wall -shared ../source/test818.c -o /home/ukscone/euphoria/source/build/test818.o In file included from /usr/include/arm-linux-gnueabihf/bits/string2.h:1298:0, from /usr/include/string.h:637, from ../source/test818.c:12: /usr/include/stdlib.h:471:14: error: conflicting types for ‘malloc’ make[2]: *** [/home/ukscone/euphoria/source/build/test818.o] Error 1 make[2]: Leaving directory `/home/ukscone/euphoria/source' make[1]: *** [lib818] Error 2 make[1]: Leaving directory `/home/ukscone/euphoria/source' make: *** [all] Error 2
49. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 13, 2013
- 2881 views
[ NO! Seriously, guys, learn to use hg bisect. It will do the hard work for you, and unless you get lucky, you'll probably have to do fewer tests. As I said before, it does a binary search on the revisions.
There were some recent regressions in the C-calling stuff on other architectures, so it wouldn't surprise me to hear there were some on ARM, as well.
Matt
took a look an hour ago and it looks like it is just automating the switch to the next changeset and keeping a list of the ones marked bad (and the instructions i found were for an earlier version to what i have installed as half the stuff doesn't work or has changed.
i'll have another look after lunch and when i finish the next bit of soldering i want to do
Yes, that's pretty much what it does. Eventually, it will tell you which was the last good revision. And you don't have to worry about accidentally straying into a different branch or keep track of a list of revisions.
Matt
50. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2887 views
1st occurance of a map.e problem occurs for me on 5963:85ae54f5ae79+
51. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 13, 2013
- 2861 views
1st occurance of a map.e problem occurs for me on 5963:85ae54f5ae79+
Yes, that was the original check in of the updated map stuff. The next changeset fixed the integer / atom declaration.
Matt
52. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 13, 2013
- 2860 views
1st occurance of a map.e problem occurs for me on 5963:85ae54f5ae79+
Yes, that was the original check in of the updated map stuff. The next changeset fixed the integer / atom declaration.
Matt
and that is the one that Ira fixed but didn't work when built on the raspberry pi but did when cross compiled
53. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 13, 2013
- 2830 views
1st occurance of a map.e problem occurs for me on 5963:85ae54f5ae79+
Yes, that was the original check in of the updated map stuff. The next changeset fixed the integer / atom declaration.
and that is the one that Ira fixed but didn't work when built on the raspberry pi but did when cross compiled
Yes. It sounds like somewhere in lookup() something is going wrong. Either the arithmetic or the bitwise operations isn't working correctly.
Matt
54. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 14, 2013
- 2790 views
Yes. It sounds like somewhere in lookup() something is going wrong. Either the arithmetic or the bitwise operations isn't working correctly.
Confirmed! Using gdb and print statements, the variable index in lookup becomes stuck at the length of slots (256 in the case I debugged) and just loops forever. Using a simple sequential search fixes the problem but obviously is not optimal.
Thanks,
Ira
55. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 14, 2013
- 2785 views
Yes. It sounds like somewhere in lookup() something is going wrong. Either the arithmetic or the bitwise operations isn't working correctly.
Confirmed! Using gdb and print statements, the variable index in lookup becomes stuck at the length of slots (256 in the case I debugged) and just loops forever. Using a simple sequential search fixes the problem but obviously is not optimal.
This sounds like a translator bug. If you use an interpreter from before the map change, does t_map.e work with the new map.e? Translated?
Matt
56. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2755 views
Yes. It sounds like somewhere in lookup() something is going wrong. Either the arithmetic or the bitwise operations isn't working correctly.
Confirmed! Using gdb and print statements, the variable index in lookup becomes stuck at the length of slots (256 in the case I debugged) and just loops forever. Using a simple sequential search fixes the problem but obviously is not optimal.
This sounds like a translator bug. If you use an interpreter from before the map change, does t_map.e work with the new map.e? Translated?
Matt
not sure if this has any relevance but building with --use-binary-translator seems to be working (so far, e.g. it is building after generating the files) 5957 euc. the 5957 eui was the one that froze
57. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 14, 2013
- 2761 views
Yes. It sounds like somewhere in lookup() something is going wrong. Either the arithmetic or the bitwise operations isn't working correctly.
Confirmed! Using gdb and print statements, the variable index in lookup becomes stuck at the length of slots (256 in the case I debugged) and just loops forever. Using a simple sequential search fixes the problem but obviously is not optimal.
This sounds like a translator bug. If you use an interpreter from before the map change, does t_map.e work with the new map.e? Translated?
not sure if this has any relevance but building with --use-binary-translator seems to be working (so far, e.g. it is building after generating the files) 5957 euc. the 5957 eui was the one that froze
Assuming that the version of euc on your path is earlier than that, I would expect it to work.
Matt
58. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2752 views
actually, not sure it is, will try again with a clean system
59. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2747 views
doesn't really tell us anything but i thought i'd try it just on the off chance as a way to bypass the bug/failure
use 5957 euc to build 5964 eui -- builds use the resultant 5964 eui to build 5964 eui -- fails (although it does run allsorts.ex, sieve8k.ex, ackermann.ex ok)
looks like i'm stuck on 5957 for a while :)
Ira: which lines did you change in lookup() to get it to work? my euphoria is very rusty esp. as i didn't do much with it after 2.2ish
60. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 14, 2013
- 2749 views
doesn't really tell us anything but i thought i'd try it just on the off chance as a way to bypass the bug/failure
use 5957 euc to build 5964 eui -- builds use the resultant 5964 eui to build 5964 eui -- fails (although it does run allsorts.ex, sieve8k.ex, ackermann.ex ok)
looks like i'm stuck on 5957 for a while :)
Can you try running an up to date t_map.e with an interpreter?
Ira: which lines did you change in lookup() to get it to work? my euphoria is very rusty esp. as i didn't do much with it after 2.2ish
He didn't. It just breaks in a different way.
Matt
61. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2725 views
Can you try running an up to date t_map.e with an interpreter?
eui t_map.e ???
Ira: which lines did you change in lookup() to get it to work? my euphoria is very rusty esp. as i didn't do much with it after 2.2ish
He didn't. It just breaks in a different way.
Matt
62. Re: OpenEuphoria on the raspberry pi
- Posted by jimcbrown (admin) Feb 14, 2013
- 2762 views
does elseifdef even exist?
That's elsifdef IIRC, along with elsedef.
63. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 14, 2013
- 2727 views
Can you try running an up to date t_map.e with an interpreter?
eui t_map.e ???
Yes. We know that the translated version of the new map implementation is broken under ARM. I'm curious if the interpreted version is, too. This might tell us if it's something the translator is doing, or part of the common back end that implements bitwise and double arithmetic.
Ira: which lines did you change in lookup() to get it to work? my euphoria is very rusty esp. as i didn't do much with it after 2.2ish
He didn't. It just breaks in a different way.
Matt
Here's the issue: There's something broken somewhere with doing things with atoms when they are stored as doubles (i.e., not euphoria 31-bit integers). The map algorithm may produce 32 (33?) bit integers, which cannot be stored in a euphoria integer when you're using a 32-bit version of euphoria (which is all we have for ARM right now). You'll either get the current infinite loop or a type check error if you switch the variable to be an integer.
Thinking about it, the commenting out of some includes (and having things work) suggests that the problem isn't with the translator, and perhaps some additional tests should be run. Ideally, all of them, of course. But highest priority right now, to figure out what's wrong with maps are:
- t_map.e
- t_math.e
- t_hash.e
Just go into the tests directory, and execute those with a working version of eui that you've built. Hopefully, something in there will fail and direct us towards an answer. If not, then we should probably try to devise a test based on the lookup() function to see what's going wrong. I know that ARM requires specific alignment of floating point numbers, and I suspect that something there may be amiss, though I would have expected it to crash and burn in that case.
Matt
64. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2763 views
how long should it take? i've been running t_map.e for about 25minutes so far and not sure if it's running or if it's frozen. i added a trace(3) on an earlier run and it was doing something but i got bored and stopped it after about 20minutes
65. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 14, 2013
- 2747 views
how long should it take? i've been running t_map.e for about 25minutes so far and not sure if it's running or if it's frozen. i added a trace(3) on an earlier run and it was doing something but i got bored and stopped it after about 20minutes
It's probably gotten into an infinite loop. You can add -all to the command line:
$ eui t_map.e -all
...and it will print out when a test succeeds or fails. But I wouldn't worry about it in this case, since maps seem pretty broken. Hopefully the problem is covered by something in t_math.e or t_hash.e. More likely, t_math.e, I suspect.
Matt
66. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2740 views
5964 eui t_math.e -all prints nothing at all 5957 fails 11 tests http://openeuphoria.org/pastey/197.wc
67. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2731 views
5957 eui t_map.e -all kills itself
eui t_map.e -all passed: map new #1 passed: map m1 get -5 passed: map m1 get 0 passed: map m1 get 5 passed: map m1 get 6 passed: map m1 get 8 passed: map m1 get -199999999999 passed: map m1 get "XXXXXXXXXX" passed: map m1 size#1 passed: map m1 keys passed: map m1 has #1 passed: map m1 has #2 passed: map m1 has #3 passed: map m1 has #4 passed: map m1 size#2 passed: map m1 get 5#2 passed: map m1 get 1000 Killed5957 eui t_hash.e -all passes all tests
68. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2700 views
and nothing from any of them using 5964 eui, just sit there blinking at me
69. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 14, 2013
- 2694 views
5964 eui t_math.e -all prints nothing at all 5957 fails 11 tests http://openeuphoria.org/pastey/197.wc
Thanks! It looks like we have a problem with bitwise operations. Looking at t_math.e, I notice that we have no and_bits tests, though it is used in all of the tests that failed.
Matt
70. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 14, 2013
- 2704 views
something nagging me that i vaguely recollect is a bug i had in a gpio reading program was the "must align on 4byte boundaries" thing for reading/writing. i think that might no longer be true with new arm processors but as all the failures seem to be with larger numbers it does seem to spark something i sort of remember
71. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 14, 2013
- 2714 views
5964 eui t_math.e -all prints nothing at all 5957 fails 11 tests http://openeuphoria.org/pastey/197.wc
Thanks! It looks like we have a problem with bitwise operations. Looking at t_math.e, I notice that we have no and_bits tests, though it is used in all of the tests that failed.
Matt
Thanks guys for hunting this down! I'm on camping trip this weekend and won't be able to help debug, but I appreciate the effort!
Thanks,
Ira
72. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 15, 2013
- 2663 views
Here's a simple test:
? and_bits( 0xffff_ffff, 1233.5 + 0.5 ) ? and_bits( 0xffff_ffff, 1234 ) ? and_bits( 0xffff, 1234 )
This should print 1234 three times.
Matt
73. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 15, 2013
- 2652 views
Here's a simple test:
? and_bits( 0xffff_ffff, 1233.5 + 0.5 ) ? and_bits( 0xffff_ffff, 1234 ) ? and_bits( 0xffff, 1234 )
This should print 1234 three times.
Matt
yup 5957 does
eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-18 15:52:45, Id: 5957:e9e11b19737a ukscone@welham ~/euphoria/source $ cat test.ex ? and_bits( 0xffff_ffff, 1233.5 + 0.5 ) ? and_bits( 0xffff_ffff, 1234 ) ? and_bits( 0xffff, 1234 ) ukscone@welham ~/euphoria/source $ eui test.ex 1234 1234 1234
74. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 15, 2013
- 2651 views
btw could we possibly change line 66 in configure from
elif echo "$UNAME_MACHINE" | grep ARM > /dev/null; then
to
elif echo "$UNAME_MACHINE" | grep arm > /dev/null; then
it's getting a bit old :) having to change it every time i switch to a different changeset and i've double checked several arm devices and they all respond with it as lowercase
75. Re: OpenEuphoria on the raspberry pi
- Posted by jimcbrown (admin) Feb 15, 2013
- 2672 views
btw could we possibly change line 66 in configure from
elif echo "$UNAME_MACHINE" | grep ARM > /dev/null; then
to
elif echo "$UNAME_MACHINE" | grep arm > /dev/null; then
it's getting a bit old :) having to change it every time i switch to a different changeset and i've double checked several arm devices and they all respond with it as lowercase
Done.
76. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 15, 2013
- 2672 views
btw could we possibly change line 66 in configure from
elif echo "$UNAME_MACHINE" | grep ARM > /dev/null; then
to
elif echo "$UNAME_MACHINE" | grep arm > /dev/null; then
it's getting a bit old :) having to change it every time i switch to a different changeset and i've double checked several arm devices and they all respond with it as lowercase
Done.
thanks, it won't do me any good while on the older revisions but i'll hit it eventually and it gives me something to look forward to :)
77. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 15, 2013
- 2638 views
Does this explain it? I have this test code:
-- andbits.ex atom index_hash = 0xffff_ffff index_hash *= 4 ? index_hash index_hash += 10 ? index_hash ? and_bits( 0xffff_ffff, index_hash )
On x86 I get:
[ /tmp]$ eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-24 14:49:03, Id: 5965:ef579d0f2018 [ /tmp]$ eui andbits.ex 1.717986918e+10 1.717986919e+10 6
On Raspberry Pi:
[ /tmp]$ eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-24 14:49:03, Id: 5965:ef579d0f2018 [ /tmp]$ eui andbits.ex 1.717986918e+10 1.717986919e+10 4294967295
Thanks,
Ira
78. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 15, 2013
- 2640 views
Does this explain it? I have this test code:
On Raspberry Pi:
[ /tmp]$ eui -v Euphoria Interpreter v4.1.0 development 32-bit Linux, Using System Memory Revision Date: 2013-01-24 14:49:03, Id: 5965:ef579d0f2018 [ /tmp]$ eui andbits.ex 1.717986918e+10 1.717986919e+10 4294967295
Thanks,
Ira
confirmed, i get the same results
eui and_bits.ex 1.717986918e+10 1.717986919e+10 4294967295
79. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 16, 2013
- 2528 views
can someone running on x86 check that this change to Dand_bits() in be_runtime.c still works as expected?
object Dand_bits(d_ptr a, d_ptr b) /* double a AND b */ { double maxplus1 = ((double)UINTPTR_MAX) + 1; return and_bits( (uintptr_t)fmod(a->dbl,maxplus1), (uintptr_t)fmod(b->dbl,maxplus1)); }
it seems so far to be working as expected ont eh raspberry pi but i'd like to make sure it isn't mucking up x86
cat and_bits.ex -- andbits.ex atom index_hash = 0xffff_ffff index_hash *= 4 ? index_hash index_hash += 10 ? index_hash ? and_bits( 0xffff_ffff, index_hash ) ukscone@welham ~/euphoria/source $ build/eui and_bits.ex 1.717986918e+10 1.717986919e+10 6
80. Re: OpenEuphoria on the raspberry pi
- Posted by jimcbrown (admin) Feb 16, 2013
- 2488 views
can someone running on x86 check that this change to Dand_bits() in be_runtime.c still works as expected?
object Dand_bits(d_ptr a, d_ptr b) /* double a AND b */ { double maxplus1 = ((double)UINTPTR_MAX) + 1; return and_bits( (uintptr_t)fmod(a->dbl,maxplus1), (uintptr_t)fmod(b->dbl,maxplus1)); }
it seems so far to be working as expected ont eh raspberry pi but i'd like to make sure it isn't mucking up x86
cat and_bits.ex -- andbits.ex atom index_hash = 0xffff_ffff index_hash *= 4 ? index_hash index_hash += 10 ? index_hash ? and_bits( 0xffff_ffff, index_hash ) ukscone@welham ~/euphoria/source $ build/eui and_bits.ex 1.717986918e+10 1.717986919e+10 6
Confirmed. All the tests behave the same with both versions of Dand_bits().
Still, I'd prefer an #ifdef be used here, as the fmod()s aren't necessary on x86 or x86_64 and probably take a speed hit.
81. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 16, 2013
- 2455 views
yes, that was just a quick check to make sure it didn't mess anything up. i'm in the process of putting it inside an #ifdef. i suspect that or_bits, xor_bits, shift_bits etc will need to be changed too.
unfortunaetly the thread where i got help with this is in the raspberry pi mod only forum but as i think it might be interesting to the devs here i'll pastey the relevant posts.
82. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 17, 2013
- 2462 views
i'm still trying to get my head around the various implications of uintptr_t and unsigned long long and a lot of other stuff and thought this might be interestng. although someone needs to run the test program on 32bit x86 as i have just discovered i don't actually have any 32bit x86 machines available :)
83. Re: OpenEuphoria on the raspberry pi
- Posted by jimcbrown (admin) Feb 17, 2013
- 2449 views
i'm still trying to get my head around the various implications of uintptr_t and unsigned long long and a lot of other stuff and thought this might be interestng. although someone needs to run the test program on 32bit x86 as i have just discovered i don't actually have any 32bit x86 machines available :)
You should be able to do this by installing a 32bit cross compiler on your x86_64 box and then installing multi-arch packages or a 32bit chroot environment to run the binary.
The results for 32bit x86:
17179869180.000000 17179869190.000000 400000006 6
84. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 17, 2013
- 2447 views
i'm still trying to get my head around the various implications of uintptr_t and unsigned long long and a lot of other stuff and thought this might be interestng. although someone needs to run the test program on 32bit x86 as i have just discovered i don't actually have any 32bit x86 machines available :)
You should be able to do this by installing a 32bit cross compiler on your x86_64 box and then installing multi-arch packages or a 32bit chroot environment to run the binary.
The results for 32bit x86:
17179869180.000000 17179869190.000000 400000006 6
yeah I could have used a VM but all my vm's are currently workign on long compiles & much easier to ask someone to run it for me :)
looking at the various results i'm thinking that a lot of #ifdef's are going to be required to keep things consistant across platforms and ARM is a right PITA :)
85. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 17, 2013
- 2409 views
quick & dirty patch to fix and_bits() on ARM, not the best way to do it but it seems to work and fixes 6 of the 11 failures of t_math.c on ARM
86. Re: OpenEuphoria on the raspberry pi
- Posted by Jerome Feb 18, 2013
- 2312 views
object Dand_bits(d_ptr a, d_ptr b) /* double a AND b */ { double maxplus1 = ((double)UINTPTR_MAX) + 1; return and_bits( (uintptr_t)fmod(a->dbl,maxplus1), (uintptr_t)fmod(b->dbl,maxplus1)); }
Ahh, very interesting! The solution provided works well, and I also have 5 failed tests with t_math.e which probably have similar issues:
Failed: or_all (0.000000) expected 0 got 3735928549 Failed: shift_bits left #6 (0.010000) expected 4294967240 got 0 Failed: shift_bits right #6 (0.000000) expected 536870911 got 0 Failed: shift_bits seq (0.000000) expected {0,0,1,7695,207,268433297} got {0,0,1,7695,207,0} Failed: rotate bits #B (0.000000) expected {805306368,1342177280,268435457,805314063,2415919311,2684352401} got {805306368,1342177280,268435457,805314063,2415919311,0}
Thanks,
Ira
87. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 18, 2013
- 2323 views
yes i thanks to a friend have a new FIXED & WORKING version, the problem with that patch is it doesn't handle negative numbers correctly.
i'm working up a patch and have only fixed and_bits so far but i'm at 0 failures now
88. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 18, 2013
- 2344 views
here is the current patch
http://openeuphoria.org/pastey/203.wc
it gives me 0 failures in t_math.e
(only and_bits fixed, or,xor,... not yet done
89. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 18, 2013
- 2437 views
Try this patch
http://openeuphoria.org/pastey/204.wc
seems to be fine on my Raspberry Pi but YMMV on other ARM devices.
however it's been suggested to me that the current *_bits() might not follow what is in the docs. i'm seeing spots in front of my eyes at the moment after spending the morning reading ietf rfc's for something else so anyone want to check?
90. Re: OpenEuphoria on the raspberry pi
- Posted by SDPringle Feb 18, 2013
- 2234 views
I remember a long discussion about bitwise operations. The docs say that we only work with 32-bit values. It is not surprising that we have distinct results on ARM and x86 since our inputs are not 32-bit.
Shawn Pringle
91. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 18, 2013
- 2232 views
A lot of discussion has occurred between the people who have been helping me & myself about whether the changes are matching what the docs currently say. My opinion was work to what the 32bit x86 version does rather than what the docs say as i'd prefer at the moment to have a working version rather than a "correct according to the docs" version and let everything work itself out in the wash eventually if it is decided by the powers that be that the ARM version is worth spending time on.
92. Re: OpenEuphoria on the raspberry pi
- Posted by jimcbrown (admin) Feb 19, 2013
- 2190 views
I remember a long discussion about bitwise operations. The docs say that we only work with 32-bit values. It is not surprising that we have distinct results on ARM and x86 since our inputs are not 32-bit.
Shawn Pringle
We need to update these docs as this is no longer the case on 64bit.
93. Re: OpenEuphoria on the raspberry pi
- Posted by jimcbrown (admin) Feb 19, 2013
- 2217 views
A lot of discussion has occurred between the people who have been helping me & myself about whether the changes are matching what the docs currently say. My opinion was work to what the 32bit x86 version does rather than what the docs say as i'd prefer at the moment to have a working version rather than a "correct according to the docs" version and let everything work itself out in the wash eventually if it is decided by the powers that be that the ARM version is worth spending time on.
I think this is a good idea, as the more similiar the ARM version behaves like th x86 32bit version, the fewer differences Euphoria code needs to be aware of, and the more programs that will just work without change on ARM.
Once this effort is finished, I guarantee that these patches will be pushed into 4.1.0
94. Re: OpenEuphoria on the raspberry pi
- Posted by mattlewis (admin) Feb 19, 2013
- 2350 views
A lot of discussion has occurred between the people who have been helping me & myself about whether the changes are matching what the docs currently say. My opinion was work to what the 32bit x86 version does rather than what the docs say as i'd prefer at the moment to have a working version rather than a "correct according to the docs" version and let everything work itself out in the wash eventually if it is decided by the powers that be that the ARM version is worth spending time on.
I think this is a good idea, as the more similiar the ARM version behaves like th x86 32bit version, the fewer differences Euphoria code needs to be aware of, and the more programs that will just work without change on ARM.
Once this effort is finished, I guarantee that these patches will be pushed into 4.1.0
Yes, it looks like we were relying on an implementation detail. Conversion of doubles beyond int range appears to be undefined in the C standard, and x86 and ARM differ on what they do in those cases.
I tried briefly to get a Raspberry Pi image running under qemu, but couldn't get it to log in.
Matt
95. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 19, 2013
- 2205 views
[ I tried briefly to get a Raspberry Pi image running under qemu, but couldn't get it to log in.
Matt
it's been a while since I used a os image for the raspberry pi with qemu, there's some twiddiling required to get it to boot. when i didn't have a raspberry pi and needed to build/test something on arm i'd just grab aboriginal linux and one of the prebuilt images from it as if you don't need to mess with graphics or gpio then it'll do for just testing the arm code and it's a lot less hassle than messing with getting the official raspberry pi images working.
96. Re: OpenEuphoria on the raspberry pi
- Posted by rkdavis Feb 19, 2013
- 2193 views
i've just run through the t_*.e tests in the tests directory, didn't do the t_net*.e or the t_c_*.e ones but only a few failures in
t_convert.e t_de_dep.e t_de_memory.e t_dep.e t_eutest.e t_text.e t_ifdef.e t_include_subdir.e t_locale.e t_memory.e
a couple seem to be the same failure so it's looking good so far
Forked into: Tests on ARM / Raspberry Pi