Beruflich Dokumente
Kultur Dokumente
Table of Contents
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Intro: How To Make A Raspberry Pi SuperComputer!
By itself the Raspberry Pi doesn't boast impressive specs. But with the dirt cheap price, buying several of these and connecting them to use they're combined processing
power could potentially make a decent low cost computer. There have been several impressive rigs built connecting dozen's of Pi's together. So in this instructable, let's
explore how the technology behind cluster computing and make our own Bramble Pi!
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Step 3: Installing and Configuring Raspbian
Once you have all the parts, the next step is to download and configure Raspbian OS on one of the Raspberry Pi's. This will be your master Pi. Here's the steps:
mkdir mpich2
cd ~/mpich2
wget http://www.mpich.org/static/downloads/3.1/mpich-3.1.tar.gz
mkdir /home/pi/mpi-build
cd /home/pi/mpi-build
sudo make
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
sudo make install
nano .bashrc
PATH=$PATH:/home/rpimpi/mpi-install/bin
sudo reboot
mpiexec -n 1 hostname
These commands will download and install MPICH, as well as add it as a path to your BASHRC boot file. The last command runs a test to see if it works. If the last
command returns “Pi01”, then you did everything successfully.
wget https://mpi4py.googlecode.com/files/mpi4py-1.3.1.tar.gztar
tar-zxf mpi4py-1.3.1
cd mpi4py-1.3.1
export PYTHONPATH=/home/pi/mpi4py-1.3.1
That last command should return five responses. Each one is a different process on Pi01 running the python program "Hello World" that we just made.
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Step 6: Copying The Image
Now that we've successfully configured our master Pi, we need to copy that Pi's SD card image to all the other Pi's. Here's how you can do that on Windows:
1. Take the master SD Card out of the Pi and insert it into your computer.
2. Using Win32DiskImager, use the "Read" button to save the contents of the SD card to your computer.
3. Eject the master SD Card and insert an SD card for one of the other Pi's. Then use the Win32DiskImager "Write" option to write the image we saved to the new
SD Card.
4. Repeat step 3 until you have the master image written to all of the SD cards.
Once all of the Pi's are powered on, using our Master Pi, we should be able to get the IP addresses of each Pi on the network. Here's how:
Copy down all of the IP addresses that pertain to the other Raspberry Pi's on the network. We will then be able to use those IP's to connect into each of the other Pi's
using SSH. What we need to do first is rename each of the secondary Pi's to a unique network name. Right now they're all set to Pi01. Assuming that one of the
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
secondary Pi's IP addresses is 192.168.0.3, here's how you can connect to it and change it's name:
You want to repeat those steps for each of the other Pi's on the network renaming them to Pi03, Pi04, etc.
On your master Pi, you want to create a new textfile called "machinefile"
nano machinefile
And in it, you want to type in each of the Pi's IP addresses (including the Master IP address) on a new line and then save the file.
At this point, we could run a test file using mpiexec -f machinefile -n 4 hostname, but it will error out saying that there was a "host key verification failure". So in
the next step, let's fix that.
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Step 8: Verifying Host Keys
To fix it so that communicating with each Pi doesn't result in a host key verification failure, we need to create and swap keys for each of our Raspberry Pi's. This part may
get slightly complicated, but hopefully you can stay with me.
1. On the Master Pi, in the default home folder, create a new key.
cd~
ssh-keygen
2. Navigate to the ssh folder and copy the key file to a new file called "pi01"
cd .ssh
cp id_rsa.pub pi01
3. Next you want to connect via SSH into Pi02 and repeat those same steps to create a Pi02 keyfile
ssh pi@192.168.1.3
ssh-keygen
cd .ssh
cp id_rsa.pub pi02
4. Before exiting out of Pi02, we need to copy the Pi01 keyfile over to it and authorize it.
scp 192.168.1.2:/home/pi/.ssh/pi01 .
cat pi01 >> authorized_keys
exit
5. With Pi02 done, repeat all of those steps for Pi03
ssh pi@192.168.1.4
ssh-keygen
cd .ssh
cp id_rsa.pub pi03
scp 192.168.1.2:/home/pi/.ssh/pi01 .
cat pi01 >> authorized_keys
exit
6. Repeat the last step for the remaining Pi's that you have on your network.
7. After generating keys for each of the Pi's, exit back to your Master Pi and copy over all of the keys generated on each of the Pi's.
cp 192.168.1.3:/home/pi/.ssh/pi02
cat pi02 >> authorized_keys
cp 192.168.1.4:/home/pi/.ssh/pi03
cat pi03 >> authorized_keys
cp 192.168.1.5:/home/pi/.ssh/pi02
cat pi04 >> authorized_keys
(repeat for as many Pi's are on your network)
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Step 9: Running A Program On Your Supercomputer
Now everything should be set up. While still on your Master Pi, try running this machinefile again:
cd ~
mpiexec -f machinefile -n 4 hostname
If everything was done correctly, it should return the IP addresses of all your Raspberry Pi's. Now that we've successfully tested out our supercomputer, lets run a python
program on it:
The script will run using the processing power of all of the Pi's on your network! Feel free to test it out using your own python script!
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Related Instructables
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/
Advertisements
Comments
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-SuperComputer/