Sunday, September 30, 2012

Assembly complete ...

Everything is connected, and after some tweaks, it looks like this:



Even though this setup is only 8 nodes, the amount of hardware involved is pretty significant when you put it all together.  I expected that there would be at least one or two things that didn't work, and that came to be.  As it turns out, one of the power supplies (cell phone chargers) was DOA, and Pi card number 7 would never fully boot.  I tried replacing the SD card and the network cable, but the system either hangs, or goes into an infinite loop on first boot.  Sometimes I could get into the raspi-config tool, but it would never complete before a problem occurred, and it never failed at the same place every time.  I don't know why this happens, I could have damaged the card as I was mounting it, who knows.  It's just the way things go, and I'll have to replace it as I move forward.

Once the physical configuration was complete, I went to my router, and assigned fixed IP addresses for all of the nodes.  This involved finding the MAC address of each card (see the HWAddr field):

pi@raspberrypi ~ $ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:1e:12:7d 
          inet addr:192.168.1.151  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1664 errors:0 dropped:0 overruns:0 frame:0
          TX packets:281 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:154134 (150.5 KiB)  TX bytes:27682 (27.0 KiB)


There should be a section of the admin interface on your router where you can choose an IP address and assign it to each of these MAC addresses.  Once the IP addresses are fixed, it's a relatively easy task to build a few tools to do housekeeping things like ping all of the nodes, or tell them all to shut down.  I've been able to reach all of these nodes using SSH, and expect that I'll build my tools around this.  There is probably someone out there who has done this before, but I'll do my own version, just to make it work the way I want.  I plan to enlist the aid of my able sidekick and son Neil to put a web interface on these tools once I have them working from the command line.

The next step is to move forward with the configuration as professor Cox describes - building the Message Passage Interface (MPI) for distributing work throughout the network.  This will be interesting to see work.


Tuesday, September 25, 2012

Building a Parallel Pi (physical assembly)

After laying out all of the Pi boards, I came to the conclusion that this will all comfortably fit on a single 12X18 cutting board.  I chose a nylon cutting board because of (1) weight - having 8 cables and 8 power cords attached to all of the Pi boards won't cause everything to want to fly away, (2) it won't conduct electricity and interfere with the operating of the boards, and (3) a cutting board is relatively cheap.

The next question is how to attach the boards.  Ideally, they could be clamped into place using a mechanism so that we don't have to worry about them falling out, regardless of the orientation of the cutting board.  The solution I thought of is to use plastic coax cable staples:

These can be placed under the boards to give some air space between the Pi board and the cutting board, and on top of the board to clamp things in place.  The idea here is to remove the little nails from the staples, drill some holes to run a screw through them, and attach to the cutting board.


There are a couple of points to keep in mind.  First, a nylon cutting board is remarkably hard.  Pilot holes are needed to get a screw to tap into it.  Second, the arrangement of the Pi boards on the cutting board is important.  I decided to keep the CAT5 cables in the middle, with the SD cards and the power lines running around the outside.  This gives good access to the ports and slots in the event that I need to change or update them.  It's important that the master Pi board (board 1 below) has all ports reachable.  This is the machine that the monitor will attach to, so the HDMI port also needs to be accessible.

Here is the completed assembly:

Assembled board, sans cabling
This is a big step for the hardware configuration.  There is still work to do to cable everything up.  After that, we'll be ready to build and configure the parallel code to form a bramble.

Monday, September 24, 2012

Building a Parallel Pi (2)

I've been spending a good deal of time lately thinking about an optimal physical configuration for an 8 slice Pi bramble.  Professor Cox's Lego setup is a very good one, but my concern is the way the cables tend to twist and lift the card  up in the air.  Whatever platform I mount the Pi cards to has to have enough weight to keep everything in place.

Professor Cox has 64 nodes arranged into 16 planes/blades, grouped into 2 sets of 8.  I think stacking things this high gives these configurations enough heft to stay put.  However, I'm only going to have 2 planes of 4 Pis each, and with 2 cables (CAT5, power) per card, I think a Lego board underneath will be a little too light for things to be stable.

I think I'm going to use an 18' X 12' nylon cutting board to mount each Pi, 4 to a board.  I'll then stack 2 of these, and probably put a plexiglass top over it all to make things easy to see.  I've been collecting all of the parts for this, but before I can get serious about assembling things, I need a work space.  The living room isn't a good place to do this.

Here is what things look like now:
The wire frame shelves make a good Pi rack, because it's easy to thread cables and cords between the shelves.
I went with a wireless keyboard to eliminate a USB cord, and make the configuration a little less cluttered.


The next step is to begin mounting and cabling everything up.  That is going to be an interesting challenge.




Friday, September 21, 2012

Building a Parallel Pi (1)


So far things are progressing according to plan.  The instructions that professor Cox has provided are nicely accurate, and to the point.  There is not a lot of wasted motion here.  There are a few observations about the construction process that I have:
  • The Pi doesn't boot sometimes if you put the SD card in before giving it power.  Pulling the card and re-inserting with the power already on seems to make things work.
  • Mounting the Pis on a board is a practical thing to do early in the process.  Right now, the one Pi that I'm working from just hangs in mid-air between the CAT5 and HDMI cables - a sub-optimal configuration.




  • The stuff that you find in regular retail stores varies a lot in price and capability.  Since the total cost will be a multiple of the per-node cost in this configuration, things can add up quickly.  My full configuration will be 8 nodes, and although I ordered all 8 Pis at once, I've decided to buy the rest of the parts as-needed, until I'm sure that I'm getting the right stuff.  
  • For each node you're going to need an SD card and a power cord.  So far I've chosen 16 GB cards, and this seems like a good size to give a reasonable amount of local storage at each node.  I've bought 2 cards so far - one for $14.99, and one for $19.99.  The cheaper one claims to be fast, and the more expensive one claims to be faster.  I do notice that the apparently faster one seems to allow the Pi to boot and run faster, but that's just a subjective impression.  Most common 16 GB SD cards out there seem to cost between $29.00 and $39.00, which seems pretty high.  I'm going to buy the other 6 cards that I need online, and get something that is a good balance between speed and cost.  The power cords are a similar mixed bag.  I've paid $19.99 for each of the 2 USB/micro USB cords, and $9.99 for a 2 port charger to plug them into.  The charger price seems ok, but I really think I can do better than $20 for a 3 ft. long USB cord from an online source.
From an actual configuration standpoint, I've installed the Fortran compiler, and am ready to build MPi to provide the message passing interface that we need for the parallel part of this project.  So far, so good.

Tuesday, September 18, 2012

Time for some Pi

I ran across a great article in Ars Technica about Professor Simon Cox at the University of Southampton, and his 6 year old son, who built a 64-node parallel machine out of Raspberry Pi devices and a rack made of Legos.  He gives step-by-step instructions on how to set things up, and this seemed like a perfect opportunity to do something cool.  If you aren't familiar with the philosophy behind Raspberry Pi, it's worth the read, and is a noble cause.

Professor Cox's 64-node configuration costs a little more than I care to spend, but I figure an 8-node environment would be a good balance between reasonable parallelism and cost.  I started with the instructions above, and here is what I found ...

I ordered 8 Raspberry PI model B boards from MCM Electronics at $35 apiece.  2 days later (today), they arrived.









We (me and my son Neil) picked up a wireless keyboard, cell phone mini-USB power supply, and 16 GB SD card for another $81, and began an installation.

I downloaded the wheezy-raspian distribution, dropped it on my new SD card, and everything worked per the instructions.  The first-boot was magical - everything came up as intended, and I got into the initial config tool.  Make the following config changes:

  • Expand the root file system to use the whole SD card
  • Set the user password
  • Enable SSH
  • Boot to the user shell
  • Install updates

Being able to reach the web from this little machine and see it all on my TV in the living room was great.

After re-booting, the system came up to a point, and then did an online config of the root file system.  This took a relatively long time - several minutes, so we had to be patient.  Eventually everything came up, and we saw the desktop:



We could surf the web, or do anything that a regular machine can do.  It looks like the system takes about 1.6 GB of space, since a check of the root file system showed about 90% free.  None of this was blazing fast.  You never forget that this is a configuration with an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU, and 256 Megabytes of RAM.  One thing that may be affecting the performance of this setup is the speed of the SD card.  We used a PNY card with no particular claims for speed, so who knows.

The performance of the individual nodes won't be a big deal if we can get a parallel configuration right, and apply it to some task that lends itself to parallel solutions.

This was a successful and satisfying first day.  It was fun to see one of these little machines take it's first step.  Next we'll start getting the parallel environment in place.


Hello, World

I've been thinking for some time about taking advantage of some of the Massively Open Online Courses (MOOCs) that are now available from several different sites on the web.  My goal is refresh or re-learn several of the subjects I covered when I worked on my Master's degree.  Most of these subjects had to do with machine vision, parallel programming, or AI in general.  These were great areas of study, but when I went back to work, there just wasn't much chance to apply what I had learned.

Fast forward several years (more than I care to admit), and the time has arrived for an intellectual re-boot.  This blog is intended to be journal of my adventures in assorted areas of computing.  I hope everyone finds this stuff as interesting as I do.