OpenBLAS on DragonBoard

I’m curious if anyone is familiar with building and running https://github.com/xianyi/OpenBLAS on DragonBoard?

Thanks,
ce.

No experience although by the time you’re running in userspace there’s nothing special about building for Dragonboard… you’re just building for AArch64/Debian so if you having trouble widening your google searches a little may help. Note that you should probably avoid doing parallel builds (make -j 4) on the board since for some styles of code (especially heavy C++) there’s not really enough RAM to do parallel builds.

PS I’d also note that openblas is already packaged for Debian so you could just take the distro version

I read the post and decided to investigate libblas, and OpenBLAS because I had no idea what they were. To benchmark I used R and followed these instructions https://www.r-bloggers.com/for-faster-r-use-openblas-instead-better-than-atlas-trivial-to-switch-to-on-ubuntu/ It turns out that R is not installed so you need to install R with

sudo apt-get install -y r-base r-base-dev

When you install r-base it installs libblas as a dependency. The package r-cran-suppdists is no longer valid so when I ran the benchmark I got an error message indicating the package is missing, but the test appears to run completely.

I then installed OpenBLAS and reran the benchmark.

sudo apt-get install libopenblas-base libopenblas-dev

This installs OpenBLAS and replaces the basic libblas-base when you are running R.

I found timing results for the R benchmark here: http://r.research.att.com/benchmarks/ . When I ran the benchmarks on the 410c, they are running on a single core and are is not quite as fast as a Mac Pro, about 7x slower when using libblas.s0.3.7.0, and about 3.5x slower when using libopenblas_arm8vp-r0.2.19.so

In my initial testing I had used the prebuilt packages, so I decided to build OpenBLAS from scratch:

git clone https://github.com/xianyi/OpenBLAS.git
cd OpenBLAS
make
sudo make install PREFIX=/usr
sudo ldconfig

This was quick and easy, everything went smooth (including the parallel build with -j4). I didn’t have to change anything to get it compiled and installed. R is now running with libopenblas_armv8p-r0.3.0.dev.so rerunning the benchmarks (still single core) with the newest version gets down to only 3.4x slower than a Mac Pro.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.

Very cool. I love reading success stories!

Still not quite sure what to do about advice on parallel builds. My experience is that some shoot though just fine, other builds break in confusing ways. Thus if the poster seems “worried” about compiling something (:slight_smile:, sorry @ce1, hope that’s an OK description for you) I tend to recommend avoiding parallel builds.

As far as running out of memory when doing parallel compiles goes, it really depends on what you are trying to compile. In the case of OpenBLAS it is almost pure ‘C’ code and none of the modules are particularly large (but there are lots of them). If you are trying to compile something large like OpenCV, or ROS, then you will run out of memory and the compile breaks.

My solution is to add a swap space, then I have no problems. Here is the script I keep handy to setup my boards:

echo Creating 1.5GB swapfile
sudo dd if=/dev/zero of=/swapfile count=1500 bs=1M
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo sed -i '$a /swapfile none swap sw 0 0\n' /etc/fstab

Run these commands to build a swap file (you can change the count if you want a smaller swap). The sed command at the end adds the swapfile to the fstab so it is always there after you reboot.

Full disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.