A PoC of distributed OpenCL on a Raspberry Pi 3 cluster
-
Follow the requirements and configration below
-
On one or many slave nodes of the cluster run:
cd node
sudo python3 service.py
- on the master node (which could be also a slave node) of the cluster run:
cd samples
python3 app_<SAMPLE_NAME>.py
A cluster of n Raspberry Pi 3 running each :
- Raspberry Pi OS (32-bit) Lite
- VC4CL
- optional pocl to have a second OpenCL platform using the ARM CPU
for Raspberry PIs 3:
-
Flash as Micro SD card using the latest Raspbian / Raspberry Pi OS
-
Before installing the SD Card, do the following
Enable Wifi
touch ssh
cat > wpa_supplicant.conf
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid="<your_ssid>"
psk="<your_wifi_password>"
}
- Set the Ethernet adapter with a static IP (ex: 10.0.0.5)
sudo nano /etc/dhpcd.conf
# It is possible to fall back to a static IP if DHCP fails:
# define static profile
profile static_eth0
static ip_address=10.0.0.5/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1
# fallback to static profile on eth0
interface eth0
fallback static_eth0
-
Install the SD card and boot
-
from the master node, copy its SSH keys
# copy rsa keys
ssh-copy-id 10.0.0.5
On each node of the cluster, run:
- copy the
node
folder sudo apt-get install libatlas-base-dev
sudo apt-get install python3-pip
sudo pip3 install pyopencl rpyc
- How to install
pocl
on the rpi 3?
sudo apt install git libhwloc-dev ocl-icd-opencl-dev ocl-icd-libopencl1 ocl-icd-dev libhwloc-dev zlib1g zlib1g-dev clinfo libglew-dev zlib1g-dev libedit-dev libclang-7-dev git cmake llvm-7 clang-7
#sudo apt install -y build-essential pkg-config libclang-dev ninja-build dialog apt-utils
git clone https://github.com/pocl/pocl.git
cd pocl
mkdir build; cd build
cmake -DLLC_HOST_CPU=cortex-a53 -DWITH_LLVM_CONFIG=/usr/bin/llvm-config-7 -DSTATIC_LLVM=1 -DENABLE_ICD=1 ..
make
sudo make install
make check
sudo cp /usr/local/etc/OpenCL/vendors/pocl.icd /etc/OpenCL/vendors/
sudo clinfo
- How to install
VC4CL
on the rpi 3?
# get third party software
sudo apt-get install cmake git ocl-icd-opencl-dev ocl-icd-dev opencl-headers clinfo libraspberrypi-dev
#get Clang compiler
sudo apt-get install clang clang-format clang-tidy
git clone https://github.com/doe300/VC4CLStdLib.git
git clone https://github.com/doe300/VC4C.git
git clone https://github.com/doe300/VC4CL.git
cd VC4CLStdLib
mkdir build
cd build/
cmake ..
make
sudo make install
sudo ldconfig
cd ../../VC4C
mkdir build
cd build/
cmake ..
make
sudo make install
sudo ldconfig
cd ../../VC4CL
mkdir build
cd build/
cmake ..
make
sudo make install
sudo ldconfig
sudo clinfo