Giter Site home page Giter Site logo

rafathasan / raspi-mpi-cluster Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 61 KB

MPI is a standardized and portable message-passing standard designed to function on parallel computing architectures on Raspberry Pi. The MPI standard defines the syntax and semantics of library routines that are useful to a wide range of users writing portable message-passing programs in C++.

License: GNU General Public License v3.0

raspberrypi cluster mpich mpi

raspi-mpi-cluster's Introduction

Pre-requisite

  • Get yourself a Linux OS. Ubuntu Prefered
  • Download the Pre-build Raspbian, Link

Things are done in pre-build raspbian (no need to run if you download the pre-build raspbian)

MPICH installed.

$ sudo apt-get update && sudo apt-get install mpich

Change Keyboard layout

keyboard layout /etc/default/keyboard -> XKBLAYOUT="us"

Disable onboard WiFi

$ echo "dtoverlay=pi3-disable-wifi" | sudo tee -a /boot/config.txt

Disable Bluetooth

$ echo "dtoverlay=pi3-disable-bt" | sudo tee -a /boot/config.txt

Disable systemd service UART

$ sudo systemctl disable hciuart

Set Autologin CLI

$ sudo raspi-config nonint do_boot_behaviour B2

Set LAN wait on Boot

$ sudo raspi-config nonint do_boot_wait 1

Start SSH on boot

$ sudo raspi-config nonint do_ssh 1

Image Installation after Downloading the pre-build raspbian

$ gzip -d mpi_raspbian_lite.img.gz

$ dd if=clone.img of=/dev/sdX


Setting Up Cluster

Terminology

  • Each Node need to be connected to master Node in order to run the execution command from the master. This will be done via SSH. We are going to override SSH authorization to get rid of human-interaction and make it automate to commnucate seamlessly node to node.
  • In order to run the execution command, the source file must exsist on each nodes. Here comes the shared data, we can use NFS Server which stands for network file system. we need to modifiy some of its configuration to allow outbound connection and auto mount the file system in the slave nodes.

Setting up Master Node

Install NFS Server on Master

$ sudo apt-get install nfs-server

Make shared Folder in Home Directory

$ mkdir shared

Change Directory Permission

$ sudo chmod -R 777 shared

Set shared folder on NFS Server

$ echo "/home/pi/shared nfs 192.168.0.100(rw, sync, no_root_squash,no_subtree_check)" >> /etc/exports

Create a List of IPs of Nodes -> ~/nodes.txt

192.168.0.100
192.168.0.101
192.168.0.102
192.168.0.103
192.168.0.104
192.168.0.105

Set Node Hostname

$ nano /etc/hosts

192.168.0.100 master
192.168.0.101 node1
192.168.0.102 node2
192.168.0.103 node3
192.168.0.104 node4
192.168.0.105 node5

Create SSH Master key
Hit Enter Do not Enter Passphase

$ ssh-keygen

Login through SSH to Slave Nodes and create SSH key
Hit Enter Do not Enter Passphase

$ ssh [email protected]

nodeX$ ssh-keygen

nodeX$ scp master:/home/pi/.ssh/id_rsa.pub /home/pi/.ssh/authorized_keys

nodeX$ exit

Get Slave SSH key via SCP

$ scp nodeX:/home/pi/.ssh/id_rsa.pub /dev/stdout && cat /dev/stdout >> /home/pi/.ssh/authorized_keys

Setting up Slave Node (Do this on Each Slave Node)

Set Master Node Hostname

$ echo"192.168.0.100 master" >> /etc/hosts

Create shared directory

$ mkdir shared

Setting Up Auto Mount on Boot

$ echo "master:/home/pi/shared /home/pi/shared nfs rwx 0 0"

Reboot Slave Node

$ sudo reboot

Check if the NFS Diretory Mounted
check for 'master' hostname

$ df -h

Testing MPI Cluster on Master

Create machinefile

nano machinefile

master
node1
node2
node3
node4
node5

Check if All node respond

$ mpiexec -f machinefile -n 6 hostname

you will see the output look like this

master
node1
node2
node3
node4
node5

raspi-mpi-cluster's People

Contributors

rafathasan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.