Wednesday, August 31, 2016

Running BOINC on Banana Pi M3

So I have my Banana Pi M3 sitting on my shelf, pretty much only serving as a low-power file server with samba shares. 8 cores, doing nothing 99% of the time. So I though, why not run BOINC on it and contribute to science projects a bit?

Hardware

  • Banana Pi M3 (clocked down to 1GHz)
  • Seagate 2 TB HDD
  • Debian Jessie, as shown below.
lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux 8.5 (jessie)
Release:    8.5
Codename:    jessie
uname -a
Linux bananapi 3.4.39-BPI-M3-Kernel #22 SMP PREEMPT Wed Mar 16 12:07:48 CST 2016 armv7l GNU/Linux

Install

Installation is pretty straightforward and worked for me out of the box on the above mentioned installation.
  1. sudo apt-get update && sudo apt-get upgrade
  2. sudo apt-get install boinc-client

Running

Now I don't have a screen attached to my Banana Pi M3, so I didn't download the boinc manager. There is the text interface tool, called boinctui, however I made the experience that it doesn't allow to connect to BAM! account manager. Hence I would rather connect from another machine on my local network with the boinc manager.
Furthermore, I would strongly recommend using an account manager (https://boincstats.com) and making a new "Work Preference" setting especially for the Banana Pi / other ARM devices. I have assigned 6 CPU cores total and a maximum usage of 100%. Also, the CPU clock rate of my device is throttled down to 1GHz to avoid overheating. (Yes, 8 cores heat quite a bit) Like this I am getting up to 63 degrees Celsius, thanks to my new over-sized heat sink!

To allow a remote boinc manager to connect I am running the client with the following command:

boinc --daemon --dir /path/to/BOINC/directory --no_gpus --allow_remote_gui_rpc 

As you can see I have a --dir option in there, which specifies the BOINC default directory. I have specified this on my 2 TB HDD so that there is plenty of space and not the 8 GB eMMC is used. It is running smoothly.
Running BOINC on my Banana Pi M3, currently 6 cores at 1 GHz.
Running BOINC on my Banana Pi M3, currently 6 cores at 1 GHz.


Connect remotely

On your remote machine launch Boinc manager and go to File/Select Computer. In the popup window enter the IP address of the Banana Pi and the password. The latter is stored in the default BOINC directory under /Boinc/directory/gui_rpc_auth.cfg.  You can edit this simply with 
sudo nano /Boinc/directory/gui_rpc_auth.cfg
Select computer to control with Boinc manager
Select computer to control with Boinc manager.
After this you can easily add an account manager and synchronize with the projects and settings as per configured at https://boincstats.com. This way you can remotely adjust the settings as needed later on.

Considerations

HDD spin up/down timeout

By default you may have noticed that an attached hard drive is on continuously, it doesn't enter sleep/stand-by mode. To avoid this, I have added the following to my /etc/rc.local
sudo hdparm -S 25 /dev/sdb
This tells the drive to spin down if there was no activity in the last 25*5 seconds. Now if you have done the same, the smart thing to do (I guess) would be to limit  how often the boinc client can access the drive. I don't want it to have access every 60 seconds and spin up the drive for 5 seconds to write something and then wait 60 seconds again. This would be wasteful in terms of drive lifetime. Hence I would recommend setting the "Write to disk at most" parameter in the client settings to reasonably value. I am testing 1000 seconds for the moment.
This can be configured in your BAM! account at https://boincstats.com/en/bam/workPreferences/.

CPU clock settings

At the maximum of 2 GHz the 8 cores produce quite a bit of heat and therefore would continuously throttle back the whole device. Therefore I would recommend setting the maximum frequency a bit lower. The relevant system directory is /sys/devices/system/cpu/cpu0/cpufreq.
To see the available frequencies
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

I have made the following script that sets up my CPU clockrate on every boot. From this you can easily deduct how to set what.
#!/bin/sh

#Sets the CPU's core frequency

echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 480000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
You can save this script, make it executable with
sudo chmod +x script.sh
And then call it from e.g. /etc/rc.local to run at system boot.

You can experiment a bit to see what is best.

Heating

Check out my post to see how I have resolved this issue.
Large Heat Sink on the Banana Pi M3.

No comments:

Post a Comment