Set up master
Last modified: 22 April 2024Install new OS
For this tutorial Noobs was used and a 64 bit version of Raspian lite (no GUI) was installed. During the installation there will be prompts for username and password.




Enable SSH
Execute:
sudo raspi-config
Enable SSH




Set static IP
sudo nano /etc/network/interfaces
Add the following
auto eth0
iface eth0 inet static
address 192.168.0.51
netmask 255.255.255.0
routers 192.168.0.1
donamin-name-servers 192.168.0.1
Reboot. From this point everything is done over SSH. Disconnect HDMI cable, keyboard and mouse. Using a desktop device log in to the Pi,
ssh username@192.158.0.51
Enter password for username.
and upgrade the OS.
sudo apt update
sudo apt full-upgrade
Change the hostname to master
sudo nano /etc/hostname
Add
master
Save and exit Modify the hosts file and comment out the local loopback address. Just keep the static address. While we are here add an entry for the first node. If you plan to have more nodes then add them under node 1.
sudo nano /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
#127.0.1.1 master
192.168.0.51 master
192.168.0.52 node1
Reboot confirm Host name change.
Install MPICH
sudo apt install mpich
Test MPICH
Create machinefile
nano machinefile
add one entry for master
master
Test:
andrew@master:~ $ mpiexec -hostfile machinefile -n 4 hostname
master
master
master
master
andrew@master:~ $
Generate SSH keys
andrew@master:/ $ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/andrew/.ssh/id_rsa):
Created directory '/home/andrew/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/andrew/.ssh/id_rsa
Your public key has been saved in /home/andrew/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:HRw29BTB7P4+ZpYTv/4cvTqNc3jPqz305lm0h7twtos andrew@master
The key's randomart image is:
+---[RSA 3072]----+
| .=o+o |
| o =o |
| o.. |
| . .. |
| S .. .|
| . .+o|
| ..O*=|
| XXXX|
| EB##%|
+----[SHA256]-----+
Install pip
Pip is required to install Python libraries.
sudo apt install pip
You will probably receive a message referring to python-pip or python3-pip. Ignore these as the OS knows what it's doing.
Once pip is installed, mpi4py can be installed.
Install mpi4py
sudo pip install mpi4py
This will take a while. The action:
Building wheel for mpi4py (PEP 517)
will take several minutes to run during which time there will be no visible activity. The spinning "| / - \ |" sequence will stop as well. Just wait.
Done
Now it is time to set up the node(s).