Tag Archives: Floating Point

ELK Software and Raspberry Pi

ELK is a software package for density functional theory calculations. Raspberry Pi is an inexpensive computer. I was interested in whether the RasPi might be useful for ELK calculations. This post reports on some timing tests.

ELK is open source software, written in Fortran, available via the SourceForge link given below. ELK runs its calcs on multiple parallel processors. My typical config for using ELK is to run on a two-core or four-core processor such as an Intel i3, i5 or i7 based Laptop, with Linux (Slackware) as the operating system, and OpenMP as the task coordination mechanism. I usually run several jobs, with various parameter choices, exploring some material model. Each job might take from a few hours to a couple days, depending upon the fineness of the grid used for modelling. On a supercomputer cluster, I have in the past run up to 100 jobs concurrently, with a selection of parameter choices, in order to develop an understanding of how the parameters affect the calculation results for the material.

More recently I have been running jobs sequentially, using a more directed exploration of the parameter space vs model results. That latter approach allows for more interaction with the investigation as it progresses, and leads to better intuition. One of my beliefs is that the dynamic tension between improving calculation speed and improving model and math, leads to better understanding. That belief goes back decades, to some success I had in number theory problems by using the tension between calculation and description. To do the work faster, instead of using a faster computer, one can replace parts of the problem description with better math. Eventually, sometimes, the problem collapses into good math and a fairly rapid calculational model. I have a hope in the back of my wish list that certain DFT, QCD, and Molecular Dynamics problems will someday be discovered to have such simplifications.

Anyway, given that approach, I was interested in perhaps using the RasPi as an ELK machine, thereby leaving my main Linux laptop free for other work. The RasPi (couple of links below) has impressive specs, with the model 2B, the current product, having a quad-core processor, 1 GB memory, 8 GB to 32 GB of local disk (depending on the sD photo card installed) with net 4 GB to 28 GB of free storage for user files, an ethernet port, four usb ports for keyboard, mouse, etc, and … best of all … very modest cost. RasPi comes with Linux (Debian based) and a copy of Mathematica. Although I don’t use Mathematica at present, having “paid my dues” already by learning Maple, and not wishing to have to re-learn the quirks of a new tool unless necessary, the low cost access to Mathematica is a nice plus, of possible future benefit.

So, I ran some timing tests. The results in summary: ELK installs on RasPi with no difficulty (details below) and runs its post-install tests successfully. However, RasPi is slow in running ELK, taking 79 elapsed minutes to complete the collection of 18 test calculations. The “top” and “1” command sequence shows that all four of the processor threads were active, so the problem may lie with some other aspect — for example, speed of the sD card or the low (1 GB) memory resulting in less in-memory-buffer file access. Whatever. In contrast, my Intel i5-core based laptop (Lenovo ThinkPad T420 with disk replaced by a 1 TB drive, and Slackware installed instead of Windows) completes the test calculations in 8 minutes. With a 10x speed difference, the ELK approach is not cost effective. It might cost about $600 to get ten stripped down RasPi boards (with board itself, with only power and ethernet connected, and controlled via ssh login sessions), whereas the T420 laptop cost only $300 refurbished. So, I will stick with laptops. However, I look for the next generation of RasPi boards. I think it is an excellent product. There are other applications besides ELK. GROMACS, for molecular dynamics calculations, for instance, might be suitable for the RasPi. For the future.

Some details about the RasPi setup may be helpful to record, for others. The RasPi in Canada is available from canakit.com and one can find other suppliers elsewhere. I was pleased with the speed of delivery from Canakit. I got the full kit, eg with Wifi dongle, but one just needs a stripped down kit for second and subsequent RasPi boards. I replaced the 8 GB sD storage card with a 32 GB sD card, with the latest operating system version (Nov-2015) downloaded from the RasPi support website. The OS boots to an X-Windows screen, and one logs in as user “pi”. To get root access and a command line, I used “sudo passwd root” and set my own password on the root user. Then one can work a bit easier. The aptitude utility was used to install the software needed for ELK, including “aptitude xxx” commands where xxx was these in sequence: “update”, “search fortran”, “install gfortran”, “search openmp”, “install libblacs-openmpi1”, “search lapack”, “install liblapack3”, “search fft”, “install fftw3”. ELK was set up to use the GNU fortran compiler (gfortran), etc.

It is interesting that the ELK test runs produce some warning messages regarding IEEE floating point arithmetic errors: IEEE_INVALID_FLAG, IEEE_OVERFLOW_FLAG, IEEE_UNDERFLOW_FLAG, IEEE_DIVIDE_BY_ZERO. These exceptions are discussed in a post at SourceForge, URL given below. Although I found the specific recommendations of that post to be ineffective, the insight into cause, and why it “does not matter”, is useful — see the third comment in that post. It is something that can guide investigation. Running ELK on Slackware / Intel i5-core with gfortran does not produce those errors, though it produces identical test results. I think that is simply because floating point exception warnings have been turned off in the latter configuration.

That’s it about RasPi and ELK. Each device/program is worth one’s attention if it matches one’s objectives, as these do with my objectives. Neither is perfect, but they are understandable, affordable, open for improvement, and a net benefit for serious work.

URLs below.

Best wishes,
Ken Roberts
25-Jan-2016

For ELK density functional theory calculational software:
http://sourceforge.net/projects/elk/

For Raspbery Pi supply, and for community projects website:
https://www.element14.com/community/welcome
https://www.raspberrypi.org/

Discussion of ELK tests producing IEEE floating point exceptions:
http://sourceforge.net/p/elk/discussion/897820/thread/e87237ad/

[end]