Raspberry Pi parallel computing and cluster computing experiment

We are going to use 4 Raspberry Pis to build a parallel computing cluster based on MPI protocol. As usual, we are going to install Raspbian OS for every RPi machine:

Building programming environment

Raspbian Installation

1
2
7za x 2019-09-26-raspbian-buster.zip
dd bs=4M if=2019-07-10-raspbian-buster.img of=/dev/sdX status=progress conv=fsync

To enable SSH, placing a file name ssh without any extension on the boot partition(rather than /boot/ on rootfs partition) of SD card.

Network Proxy

Edit ~/.bashrc

1
2
export http_proxy="http://USER:PASS@IP_ADDRESS:PORT_NUM"
export https_proxy="http://USER:PASS@IP_ADDRESS:PORT_NUM"
1
2
3
su
visudo /etc/sudoers
Defaults env_keep += "all_proxy ftp_proxy http_proxy https_proxy no_proxy"

Time syncronizing

1
sudo date -s "$(wget -S  "http://www.ustb.edu.cn/" 2>&1 | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2,  $5 ,"GMT", $4 }' | sed 's/,//')"

Or replace wget -S with curl -I.

install proxy tool from network

1
2
curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh --proxy "http://ip:port"
sudo bash install-release.sh --proxy "http://ip:port"

or copy the arm32-v7a install-pkg

Tsinghua mirrors

https://mirrors.tuna.tsinghua.edu.cn/help/raspbian/

/etc/apt/sources.list

1
2
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib

/etc/apt/sources.list.d/raspi.list

1
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

Upgrade system

1
2
sudo apt update
sudo apt upgrade # It may take a long time

ssh config for non-interactive shell

1
2
rpi0:~ $ ssh-keygen -t rsa
rpi0:~ $ cat .ssh/id_rsa.pub

Copy the content into rpi1:~/.ssh/authorized_keys

Experiments

Openmpi

1
sudo apt install build-essentials openmpi-bin openmpi-common openssh-server openssh-client libopenmpi3 libopenmpi-dev libopenmpi-dbg

Python mpi4py

1
sudo apt install python-numpy python-mpi4py

Obtain project

1
2
3
4
5
6
7
sudo apt install git
git config --global user.name "YourUserName"
git config --global user.email "YourEmail"
git config --global http.proxy "Your proxy"
git config --global https.proxy "Your proxy"
git config --global http.proxyAuthMethod 'basic'
git clone https://github.com/BillyStudio/openmpi-demo.git
Serving Web Content with Spring MVC Creating virtual machiness on Linux --- the hard way

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×