Leveraging HPX on the Raspberry Pi Platform

By Jesse Goncalves

This summer, with support from the National Science Foundation and LSU’s Center for Computation and Technology, I sought to leverage HPX on a Raspberry Pi cluster, the objective being to show that the C++ library and run-time system ports to even the simplest of computer architectures. This blog post will describe in detail the challenges I faced in my effort to build HPX on the Pi platform. The procedure I followed definitely needs to be optimized, but it may still prove helpful for replicating the feat of building HPX for the Pi in the future.

I began by installing Raspbian-Jessie on a Raspberry Pi 3 Model B using the NOOBs package, which is available here. With the OS set up, I began working to satisfy HPX’s dependencies on the Pi. First, I installed jemalloc-dev using the built-in package manager. Unfortunately, the boost and hwloc packages available from the package manager were not updated enough to meet the requirements of HPX, so I downloaded and installed the unix versions of Boost-1.64.0 and hwloc-1.11.7, only specifying in the build options that they be installed in the root file system of the Pi. Lastly, I also installed cmake and ia32-libs with the Raspbian package manager. With all dependencies now satisfied on the Pi, I attempted to directly compile HPX many times without success, and I remain unsure as to why it did not work. Abandoning that method, I transferred the root file system of the Pi to my desktop in order to cross-compile HPX.

Now working on my desktop, I downloaded toolchain files designed to cross-compile applications for the Raspberry Pi. There are excellent instructions on Stack Overflow for utilizing these toolchain files, which I followed to the letter, excepting the compilers they use in their example. In order for the g++ and gcc compilers to be updated sufficiently for HPX, I used those located in toolchain_install_path/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin instead of those in toolchain_install_path/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin. Finally, I managed to cross-compile HPX by messing with the cmake flags in my build script and slightly changing the toolchain file. The cmake flags in the build script reference the Boost, hwloc, and jemalloc installations in the root file system of the Raspberry Pi as well as linking to the compilation toolchain. A hiccup I ran into with cross-compilation was that HPX had to be built in the same absolute location on my desktop as it would then be transferred to on the Pi. However, after building HPX in the root file system of my desktop and transferring the build directory to the same location on the Pi, I was able to run HPX applications and even show excellent parallel and distributed scaling!

If I were to attempt to build HPX for the Pi platform again, I would change many of the steps I followed. Firstly, I would start with a Raspbian image with the minimum requirements necessary for HPX and its dependencies to build and run. Secondly, I would not directly compile the entire Boost library on the Pi, as that required a lot of computation time. Instead, I would either use the package manager to get only the Boost libraries required by HPX or else cross-compile Boost for the Pi on my desktop. Thirdly, I would look into building my own cross-compilation toolchain because the highest version of gcc supported by the one I used was 4.9.3, but also because of the valuable opportunity it would present to better understand the process of cross-compilation.

Leave a Reply

Your email address will not be published. Required fields are marked *