High Performance Computing On The Raspberry Pi
High Performance Computing On The Raspberry Pi
Erin M. Hodgess
ABSTRACT
We considered building high performance tools on the Raspberry Pi 4. We implemented OpenMP and
OpenCoarrays Fortran in conjunction with the statistical language R. We found that the OpenCoarrays is
more effective when working with vectors, while OpenMP is better in the arena with large matrices in a
geostatistics application. These results can be very useful for researchers with limited access to high
performance tools or limited funding.
KEYWORDS
OpenMP, Coarrays Fortran, R.
1. INTRODUCTION
We have been working with spatial and spatio-temporal data for several years. Existing functions
either took an exhorbitant amount of time to process, or would not complete at all. We also have
worked with high performance computing tools, both on supercomputers and with gaming
laptops. We worked with the Stampede I and Bridges supercomputers [1]. We were able to
upgrade ordinary kriging processes which took 2 hours and speed them up to 6 minutes on the
Stampede supercomputer and 2.5 minutes on the Bridges supercomputer.
We then worked with gaming laptops with NVIDIA graphics cards. Initially, we used the Portland
Group (PGI) compiler with access the GPU processors for speed-up potential. We were able to
both reduce processing times as well as bringing in larger data sets [2].
In our investigations, our method was the single program, multiple data (SPMD) structure, as
discussed in Pacheco [5]. We used different data in each processor to produce our final results.
DOI : 10.5121/ijcsity.2022.10101 1
International Journal of Computational Science and Information Technology (IJCSITY)
Vol. 10, No. 1, February 2022
We then wrote code for two applications: estimation of the area under the curve for π, as discussed
in Mattson et al [6] and an ordinary kriging method for spatio-temporal data as found in Hodgess
and Mhoon [7]. We tied the OpenMP and OpenCoarrays programs into R [8] as subroutines in
order to generate our results.
(2.1)
We discussed 3 methods for solution. We first produced an R function using vectorization. Next,
we used the version found in Mattson et al for OpenMP and created a Fortran subroutine that is
called from R. Finally, we modified the OpenMP version into an OpenCoarrays subroutine, also
called from R.
We ran a simulation study on each method. We ran 10000 replications on each method, and
recorded the run time (in seconds) for each replication. Here are the results:
We saw that using vectorized R code is the clear winner for this case. But we did see an
interesting result between OpenMP and OpenCoarrays. The OpenCoarrays process was much
more efficient than the OpenMP process.
where si and ti are locations and times of the response variable from a Gaussian random field.
Ordinary kriging for spatio-temporal data is essentially a generalized least squares model. It is
more complicated, as we must take both space and time into account, which is what produces the
massive matrices. We make the assumption of first order stationarity:
E [z] = u (3.2)
2
International Journal of Computational Science and Information Technology (IJCSITY)
Vol. 10, No. 1, February 2022
|s − w| = h,
|t − v| = u
For spatio-temporal data, there are several authorized models of covariance structure, including
separable, metric, and sum-metric. For our process, we select the sum-metric, as it reflects real
world models. Our final covariance model is:
Csm = Cs (h) + Ct (u) + Cjoint (p(h2 + ku2)), (3.4)
where Cs(h) is the covariance matrix for the spatial direction, Ct(u) is the covariance matrix
for the temporal direction, and Cjoint is the joint effect component, with k as the parameter for
anistropy.
. (3.5)
We can create multiple point forecasts, both in space and in time. Our steps are:
1. Fit the semivariogram for the spatial, temporal, and joint effects using authorized models
via an automatic procedue in R.
2. Fit the sample space-time variograms.
3. Fit the space-time models based on the results of Steps 1 and 2.
4. Calculate the estimates of the sill, nugget, range, and anistropy from existingR functions.
5. Now we calculate the overall mean and covariance matrix.
6. Finally, we calculate the predicted values.
We look at the Irish Wind data, as seen in Pebesma [10], and which originally appeared in Haslett
and Raftery [11]. The data are daily wind speeds at 12 stations around Ireland, and they run from
January 1961 - December 1978. We begin with 3 months, 1 year and 2 years. The output is a
spatio-temporal grid with interpolated values.
We run the existing R functions, as well as the new methods with OpenMP and OpenCoarrays.
We see that all 3 methods are successful in the 3 month duration, and the new methods pull away
dramatically in the 1 year segment. Finally, for 2 years of spatio-temporal data, only the OpenMP
method is able run to completion. However, these results indicate that complex models can run on
a single board computer.
3
International Journal of Computational Science and Information Technology (IJCSITY)
Vol. 10, No. 1, February 2022
Table 2: Spatio-Temporal Run Times in Minutes
4. TECHNICAL NOTES
The actual Raspberry Pi cost $75, while the 128 GB micro disk card cost $19. We use the headless
setup for the Pi, and run it on an old MacBook laptop.
All of the software is free. The Raspberry Pi operating system has the gcc/gfortran and
OpenCoarrays already loaded. We also download OpenMP and OpenMPI [12] for some of our
processes. We use the pdbDMAT [13] package to aid with the large matrices.
5. CONCLUSION
We have demonstrated that the Raspberry Pi can be a viable tool for high performance computing
on a budget. For less than $100, we can produce efficient results in integration and spatio-
temporal analysis. These tools can be easily accessed via a laptop.
We hope that these studies may be useful for researchers without access to supercomputers or
even gaming laptops. The Raspberry Pi can be an effective tool for many extensive models.
REFERENCES
[1] E. Hodgess, “Using r with high performance tools on a windows laptop,” submitted to 3rd
Conference of the Arabian Journal of Geosciences, 2020.
[2] E. Hodgess and K. Mhoon, “Advances in ordinary kriging using the stampede and bridges
supercomputers,” Journal of Geological Resource and Engineering, vol. 6, pp. 14 – 18, 2018.
[3] R. Chandra, L. Dagum, D. Kohr, R. Menon, D. Maydan, and J. McDonald, Parallel programming in
OpenMP. Morgan Kaufmann, 2001.
[4] A. Fanfarillo, T. Burnus, V. Cardellini, S. Filippone, D. Nagle, and D. Rouson, “Opencoarrays:
open-source transport layers supporting coarray fortran compilers,” in Proceedings of the 8th
International Conference on Partitioned Global Address Space Programming Models, p. 4, ACM,
2014.
[5] P. S. Pacheco, Parallel Programming with MPI. Morgan Kaufmann, 1996.
[6] T. G. Mattson, Y. He, and A. E. Koniges, The OpenMP common core: making OpenMP simple
again. The MIT Press, 2019.
[7] E. M. Hodgess and K. Mhoon, “Ordinary kriging for spatio-temporal data sets using a windows
laptop,” in XIV Congreso de Informatica y Geociencias (GEOINFO 2019), p. 4, Cuban Geology
Society, 2019.
[8] R Core Team, R: A Language and Environment for Statistical Computing. R Foundation for
Statistical Computing, Vienna, Austria, 2021.
[9] D. G. Rossiter, “Geostatistics and open source statistical computing.”
http://www.css.cornell.edu/faculty/dgr2/teach/index.html# university-of-twente-nl, 2015. Accessed:
2022-01-15.
[10] E. J. Pebesma, “Multivariable geostatistics in s: the gstat package,” Computers and Geosciences, vol.
30, no. 7, pp. 683–691, 2004.
[11] J. Haslett and A. E. Raftery, “Space-time modelling with long-memory dependence: Assessing
ireland’s wind power resource,” Applied Statistics, vol. 38, no. 1, pp. 1 – 50, 1989.
[12] E. Gabriel, G. E. Fagg, G. Bosilca, T. Angskun, J. J. Dongarra, J. M. Squyres, V. Sahay, P.
Kambadur, B. Barrett, A. Lumsdaine, R. H. Castain, D. J. Daniel, R. L. Graham, and T. S. Woodall,
4
International Journal of Computational Science and Information Technology (IJCSITY)
Vol. 10, No. 1, February 2022
“Open MPI: Goals, concept, and design of a next generation MPI implementation,” in Proceedings,
11th European PVM/MPI Users’ Group Meeting, (Budapest, Hungary), pp. 97–104, September
2004.
[13] D. Schmidt, W.-C. Chen, G. Ostrouchov, and P. Patel, “pbddmat: Programming with big data –
distributed matrix algebra computation,” 2012. R Package.
APPENDIX
Here are the steps to prepare the Raspberry Pi for our processing.
OpenMPI
sudo apt-get install --reinstall openmpi-bin libopenmpi-dev
OpenMP
sudo apt-get install libomp-dev
Stuff for R:
java --version
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64
export PATH=$PATH:$JAVA_HOME/bin
sudo apt install texlive-latex-extra
sudo apt install emacs
tar xf R-4.1.2.tar.gz
./configure make sudo
make
install For s2
installation:
For BLAS
sudo apt install libblas3 liblapack3 liblapack-dev libblas-dev
For pbd:
remotes : : install_github("RBigData/pbdSLAP")
remotes : : install_github("RBigData/pbdBASE")
remotes : : install_github("RBigData/pbdDMAT")