Running the examples on the SD card - P*/p*

A forum for documenting the Parallella and Epiphany . (Not Q&A!)

Running the examples on the SD card - P*/p*

Postby Dr.BeauWebber » Tue May 20, 2014 4:07 pm

Here I am discussing the examples that come on the default SD card image :
Firstly just those in :
~/Parallella/parallella-examples

What I am saying applies to the following Parallella SD card image at :
ftp://ftp.parallella.org/sd_images
ubuntu-14.01-lxde.14.03.06.img
(still current as of 2014-05-18)

At first whwn running these examples, I met with problems, but this was because the Ubuntu system and the examples need to be updated to the latest versions, and I have now re-writen this post to include that.

First update the files etc. on the SD card, and instal tightvncserver for remote graphical login, as described at :
A Beginners Guide to getting started with the Parallella.
http://forums.parallella.org/viewtopic.php?f=23&t=1236

This is a default Ubuntu Linux system, and needs to be tweaked to be better suited to the Parallella board and an HDMI monitor.
Beginners Guide - 2 - Tweaking the Linux system
http://forums.parallella.org/viewtopic.php?f=23&t=1277

The first example I am going to consider is an x-window program, that can be run either at the Parallella workstation, or in a window from a remote PC, as described in the previous 2 posts.

If you are working at the parallella desktop :
Go to the bottom left icon on the bottom taskbar, and you should get an on-screen menu.
Select : Other => tcsh - right near the bottom of the list
- this is a shell window where you can type commands
If you are working remotely, also open a Vnc graphical window, as described in :
A Beginners Guide to getting started with the Parallella.
Also open a text login window via Putty, (which is what I am using toi cut and paste these text strings), as described in :
Beginners Guide - 2 - Tweaking the Linux system

A next thing we will prepare, is to use the graphical file viewer :
Go to the bottom left icon on the bottom taskbar,
Select : Accessories => File Manager

In this posting I am going to look at :
~/Parallella/parallella-examples
Code: Select all
linaro-nano:~> ls
      Desktop/  Downloads/  Parallella/  examples.desktop
linaro-nano:~> ls P*
      bdt_install/  epiphany-examples/  parallella-examples/
linaro-nano:~> ls P*/p*
      BSD  GPLv3  README.md  aobench/  blobubska/  mandelbrot/  xtemp/

Now the first example we are going to run will be an X program, so we have to use the parallella desktop or the vnc window (yes it is possible for a program to open X windows on a remote computer, but I am not going into that here and now)

The other three programs : aobench blobubska mandelbrot
are different in two respects :
a) they have to be run in natve full-screen mode, not in X-windows
b) we have to update them first from git hub.

So first we will move the existing examples directory :
Code: Select all
linaro-nano: cd ~/P*
linaro-nano:~/Parallella> ls
    bdt_install/  epiphany-examples/  parallella-examples/
linaro-nano:~/Parallella> mv  parallella-examples parallella-examples-old
linaro-nano:~/Parallella> ls
    bdt_install/  epiphany-examples/  parallella-examples-old/


Now xtemp has been moved to a new location, we will clone that first :
Code: Select all
linaro-nano:~> git clone  https://github.com/parallella/parallella-utils Parallella/parallella-utils
    Cloning into 'Parallella/parallella-utils'...
    remote: Reusing existing pack: 18, done.
    remote: Total 18 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (18/18), done.
    Checking connectivity... done


Then get the fresh examples directory :
Code: Select all
linaro-nano:~> git clone https://github.com/parallella/parallella-examples Parallella/parallella-examples
    Cloning into 'Parallella/parallella-examples'...
    remote: Reusing existing pack: 152, done.
    remote: Total 152 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (152/152), 174.68 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (73/73), done.
    Checking connectivity... done


Code: Select all
linaro-nano:~> cd P*
linaro-nano:~/Parallella> ls
    bdt_install/  epiphany-examples/  parallella-examples/  parallella-examples-old/  parallella-utils/
linaro-nano:~/Parallella> ls p*
    parallella-examples:
    BSD  GPLv2  GPLv3  README.md  aobench/  blobubska/  mandelbrot/  r-opencl/

    parallella-examples-old:
    BSD  GPLv2  GPLv3  README.md  aobench/  blobubska/  mandelbrot/  xtemp/

    parallella-utils:
    BSD  GPLv3  README.md  xtemp/


1) Run the example (pre-compiled) program to measure the temperature of the FPGA core :
1a) Run from a shell :
Code: Select all
linaro-nano:~> pushd ~/Parallella/parallella-utils/xtemp
linaro-nano:~/Parallella/parallella-utils/xtemp> ls
    README.md  makefile  xtemp  xtemp.c

To run xtemp, type :
./xtemp

After a moment a window should open, temperatures display on the left, and a graph start drawing from the right.
When you are done, close the window
xtemp.png
Running the xtemp program from a remote computer.
xtemp.png (79.57 KiB) Viewed 32770 times

Now (1b), do the same using the graphical file viewer
Keep changing directories until you are in : ~/Parallella/parallella-examples-x/xtemp
Double click on the xterm icon, and select “Execute” – xterm should then run as above.

2) Compile and run the Mandlebrot drawing example :
Code: Select all
pushd ~/Parallella/parallella-examples/mandelbrot
    ~/Parallella/parallella-examples/mandelbrot ~/Parallella/parallella-utils/xtemp ~/Parallella ~/Parallella
linaro-nano:~/Parallella/parallella-examples/mandelbrot> ls
    Makefile  README.md  epiphany.c  host.c  run.sh  shared_data.h
linaro-nano:~/Parallella/parallella-examples/mandelbrot> make
    gcc -O3 host.c -o main -I /opt/adapteva/esdk/tools/host/include -L /opt/adapteva/esdk/tools/host/lib -le-hal -lrt
    e-gcc -O3 -funroll-loops -ffast-math -T /opt/adapteva/esdk/bsps/current/internal.ldf epiphany.c -o epiphany.elf -le-lib
    e-objcopy --srec-forceS3 --output-target srec epiphany.elf epiphany.srec
linaro-nano:~/Parallella/parallella-examples/mandelbrot> ls
    Makefile  README.md  epiphany.c  epiphany.elf  epiphany.srec  host.c  main  run.sh  shared_data.h


Mandlebrot expects the raw native hdmi screen :
Go to the actual Parallella keyboard
<Cntrl><Alt><F2>
and then re-login, then :
Code: Select all
pushd ~/Parallella/parallella-examples/mandelbrot
./run.sh

And you should get a colourfull, fast changing, wholescreen Mandlebrot pattern :
mandlebrot 1.JPG
Mandlebrot -1
mandlebrot 1.JPG (118.92 KiB) Viewed 32770 times


To stop it, use <cntrl> C

3) Run Blobubska :
Readme says : A Realtime Raytracing Visual Music Generator
Need various packages :
Code: Select all
sudo apt-get install libfluidsynth-dev fluidsynth fluid-soundfont-gm alsa-base alsa-utils libasound2-plugins
linaro-nano:~/Parallella/parallella-examples/mandelbrot> cd ../b*
linaro-nano:~/Parallella/parallella-examples/blobubska> ls
    README.md  src/
linaro-nano:~/Parallella/parallella-examples/blobubska> cd src
linaro-nano:~/Parallella/parallella-examples/blobubska/src> ls
    Makefile  common.h  epiphany.c  host.c  hostonly.c  hostonlyrun.sh  keymap.h  run.sh
linaro-nano:~/Parallella/parallella-examples/blobubska/src> make
    gcc -Ofast -funroll-loops -ffast-math host.c -o main -I /opt/adapteva/esdk/tools/host/include -L       /opt/adapteva/esdk/tools/host/lib -le-hal -lrt -lfluidsynth
    e-gcc -Ofast -funroll-loops -ffast-math -T /opt/adapteva/esdk/bsps/current/internal.ldf epiphany.c -o epiphany.elf -le-lib
    e-objcopy --srec-forceS3 --output-target srec epiphany.elf epiphany.srec
    gcc -Ofast -funroll-loops -ffast-math hostonly.c -o hostonly -lrt -lfluidsynth
linaro-nano:~/Parallella/parallella-examples/blobubska/src> ls
    Makefile  epiphany.c    epiphany.srec  hostonly    hostonlyrun.sh  main
    common.h  epiphany.elf  host.c         hostonly.c  keymap.h        run.sh


Blobubska again expects the raw native hdmi screen :
Go to the actual Parallella keyboard
Code: Select all
pushd  ../blobubska/src
./run.sh

And you should get a colourfull set of ray-traced silvery balls, moving slowly :
balls.JPG
Ray-Traced Silver Balls
balls.JPG (86.46 KiB) Viewed 32770 times

Note the hdmi monitor I am borrowing does not appear to support sound.
Also the keyboard control command do not currently seem to work.
To stop it, use <cntrl> C (does work)

4) aobench :
Code: Select all
linaro-nano:~/Parallella/parallella-examples/blobubska/src> cd ../../a*
linaro-nano:~/Parallella/parallella-examples/aobench> ls
    Makefile  README.md  epiphany.c  host.c  img/  run.sh  shared_data.h
linaro-nano:~/Parallella/parallella-examples/aobench> make
    gcc -O3 host.c -o ao -I /opt/adapteva/esdk/tools/host/include -L /opt/adapteva/esdk/tools/host/lib -le-hal -lrt
    e-gcc -O2 -funroll-loops -ffast-math -fsingle-precision-constant -T /opt/adapteva/esdk/bsps/current/fast.ldf epiphany.c -o      epiphany.elf -lm -le-lib
    e-objcopy --srec-forceS3 --output-target srec epiphany.elf epiphany.srec
linaro-nano:~/Parallella/parallella-examples/aobench> ls
    Makefile  README.md  ao  epiphany.c  epiphany.elf  epiphany.srec  host.c  img/  run.sh  shared_data.h

Aobench again expects the raw native hdmi screen :
Go to the actual Parallella keyboard
Code: Select all
pushd  ../../a*
./run.sh

And you should get 3 monochrome balls rotating round and through each other.

To stop it, use <cntrl> C

The final example is R-opencl :
"This example demonstrates how to do a simple parallel vector addition from within the R programming language."
Code: Select all
linaro-nano:~/Parallella/parallella-examples/aobench> cd ..
linaro-nano:~/Parallella/parallella-examples> ls
BSD  GPLv2  GPLv3  README.md  aobench/  blobubska/  mandelbrot/  r-opencl/

but this is hardly beginners' stuff, so I will leave it for the moment - see the Readme if you want to have a go at it.
Last edited by Dr.BeauWebber on Tue May 27, 2014 12:38 pm, edited 7 times in total.
User avatar
Dr.BeauWebber
 
Posts: 114
Joined: Mon Dec 17, 2012 4:01 am
Location: England

Re: Running the examples on the SD card - P*/p*

Postby aolofsson » Tue May 20, 2014 4:20 pm

I thought this was fixed in the repo? Can you try downloading again and checking?

Code: Select all
git clone https://github.com/parallella/parallella-examples
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: Running the examples on the SD card - P*/p*

Postby 9600 » Tue May 20, 2014 4:31 pm

aolofsson wrote:I thought this was fixed in the repo? Can you try downloading again and checking?


There was an outstanding pull request for this, which I have just merged, and so a git pull in parallella-examples may be required before rebuilding (make clean; make).

Cheers,

Andrew
Andrew Back (a.k.a. 9600 / carrierdetect)
User avatar
9600
 
Posts: 997
Joined: Mon Dec 17, 2012 3:25 am

Re: Running the examples on the SD card - P*/p*

Postby Dr.BeauWebber » Tue May 20, 2014 4:33 pm

Oh thanks for the quick reply.
Hmm, I am flat on my back with back problems and theoretically have to fly on a business trip tomorrow.
Will do my best.
User avatar
Dr.BeauWebber
 
Posts: 114
Joined: Mon Dec 17, 2012 4:01 am
Location: England

Re: Running the examples on the SD card - P*/p*

Postby Dr.BeauWebber » Tue May 20, 2014 4:47 pm

Not sure what to do about the following error :

linaro-nano:~/Parallella/parallella-examples> git pull
Updating 138a344..aab5584
error: Your local changes to the following files would be overwritten by merge:
xtemp/xtemp
Please, commit your changes or stash them before you can merge.
Aborting
User avatar
Dr.BeauWebber
 
Posts: 114
Joined: Mon Dec 17, 2012 4:01 am
Location: England

Re: Running the examples on the SD card - P*/p*

Postby aolofsson » Tue May 20, 2014 5:01 pm

You could try deleting the directory and do a 'git clone' of parallella-examples' again.
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: Running the examples on the SD card - P*/p*

Postby Dr.BeauWebber » Tue May 20, 2014 5:10 pm

Thanks !
I have mandlebrot running and it is pretty stunning ! Speed !
I will write a new version of the original how-to.
User avatar
Dr.BeauWebber
 
Posts: 114
Joined: Mon Dec 17, 2012 4:01 am
Location: England

Re: Running the examples on the SD card - P*/p*

Postby shodruk » Tue May 20, 2014 5:29 pm

The official Ubuntu image ubuntu-lxde-14.03.06-p16g1.img has several issues e.g. no sound, no device node creation, poor desktop performance, instability on boot up...
So we have to apply these tips first.

http://elinux.org/Parallella_Speed_Up_Ubuntu

Because Mandelbrot, Blobubska and aobench use native framebuffer, you have to connect HDMI monitor/TV and keyboard to the Parallella, and run them natively. (They won't run on a X Window or a VNC)
Shodruky
shodruk
 
Posts: 464
Joined: Mon Apr 08, 2013 7:03 pm

Re: Running the examples on the SD card - P*/p*

Postby Dr.BeauWebber » Tue May 20, 2014 5:35 pm

Yes I have aobench running fine as well.
As you say, I need to do further updates for the blobuska example, to sort the sound issue.
User avatar
Dr.BeauWebber
 
Posts: 114
Joined: Mon Dec 17, 2012 4:01 am
Location: England

Re: Running the examples on the SD card - P*/p*

Postby Dr.BeauWebber » Tue May 20, 2014 6:56 pm

shodruk wrote:The official Ubuntu image ubuntu-lxde-14.03.06-p16g1.img has several issues e.g. no sound, no device node creation, poor desktop performance, instability on boot up...
So we have to apply these tips first.
http://elinux.org/Parallella_Speed_Up_Ubuntu


Two simple questions to do with forcing screen res in these "tips"
1) does forcing screen res interact with a vnc screen (which I set small to not clutter up my laptop screen) NO
2) suppose you don't know the screen res (I am currently using a borrowed screen) - just omit this tip entirely ? which also omits the devtmpfs fix. SEE BELOW

ADDED
OK, that seems to work, but be warned, after login there may be a delay of some minutes, then an all white task bar, then a delay of minutes, then eventually a desktop and all working well. It is of course possible that these delays are because I have set the wrong screen res. YES THAT IS SO, SEE BELOW

MORE
On a reboot the scroling text has 2 items that fail (not yet sure what). NOW NONE
Yes the delay is still present on a re-boot. From login to desktop, 4 1/4 minutes.SEE BELOW
A small (750x500) vnc screen still works fine.

YET MORE
OK, it is essential to know the screen resolution before inserting these "tips".
For Ubuntu :
in a terminal (Ctrl + Alt + T) or shell window, do :
xrandr -q | grep -w Screen
for my screen this reports : 1920x1080
(the monitor itself now confirms this)

This has to be inserted into two positions in the "tips" :

(note the "nano" referred to below is a text editor, use any you prefer)

sudo dtc -I dtb -O dts -o devicetree.dts devicetree.dtb
sudo nano devicetree.dts
(Search(Ctrl-W) and Edit the "bootargs" line then save)
bootargs = "root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait devtmpfs.mount=1 video=HDMI-A-1:1920x1080@60";
sudo dtc -I dts devicetree.dts -O dtb -o devicetree.dtb

and :
sudo nano /etc/X11/xorg.conf

(copy & paste and save)

Section "Device"
Identifier "Card0"
Driver "modesetting"
Option "ShadowFB" "True"
Option "SWCursor" "True"
Option "HWCursor" "False"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
SubSection "Display"
#---- Uncomment your preferred mode ----
#Modes "1920x1200"
Modes "1920x1080"
#Modes "1280x720"

#Modes "640x480"
EndSubSection
EndSection

Booting is then reasonably quick, to the desktop.
Last edited by Dr.BeauWebber on Tue May 20, 2014 10:41 pm, edited 1 time in total.
User avatar
Dr.BeauWebber
 
Posts: 114
Joined: Mon Dec 17, 2012 4:01 am
Location: England

Next

Return to Quick Start Guides , Documentation, Examples (Start Here!)

Who is online

Users browsing this forum: No registered users and 1 guest