Mobile Devices To The Rescue!

Written by Dmitry Moskalchuk

06/19/20 12:12:26

In the image below, you can see my home lab. All the devices that you see (as well as several thousand more in different countries all over the world) are working 24x7, performing various computing tasks. Basically, these tasks are scientific ones. And, as you might guess, these tasks are COVID-19-related, since COVID-19 is the hottest scientific topic nowadays.

Two and a half months ago, with the beginning of the COVID-19 pandemic, we focused all our efforts on these tasks. In modern biology, computer simulation of biological processes is essential. Usually, this is much faster than directly performing the same biological processes. And the number of different combinations and options that affect the result is enormous — it is a combinatorial explosion. Therefore, running millions of different variants on a computer simulation helps scientists determine which combinations of the input parameters are worth trying and which are definitely not. There's a problem, though — you need a lot of computational resources. Fortunately, the nature of these tasks allows scientists to parallelize them. Instead of running a thousand 1-hour long simulations one after another on a powerful computer, you can run a thousand simulations simultaneously on a thousand devices (one per device). Even if on such a device you have to wait a day instead of one hour, it's still much faster than a thousand hours (almost a month and a half!) on one super-powerful computer. And, if we are talking about millions of simulations, then the gap becomes even more noticeable.

We quickly realized that this is the ideal type of task for our platform. For those who do not know what it is about, we rent computing resources on regular Android phones all over the world and pay the owners of these phones for their usage. The owner of such a phone only needs to install our PhonePaycheck application from the Google Play store, ensure that the device is connected to Wi-Fi, and plug in the charger. After that, the device gets registered on our server and becomes ready for a job. When it happens, the phone owner sees the earning counter on the screen of his/her phone. Upon reaching the threshold of $10, the phone owner can withdraw the earned amount to PayPal. It's a win-win deal. We get computational resources that we sell to our customers who need them, and phone owners get some extra passive income.

However, although this sounds pretty rosy, there are several pretty serious technical difficulties in implementing this idea. The most serious difficulty is the technical compatibility of the software. The computing resources that we sell to our customers are only useful if they have software to run on them. And such software must be provided by customers. Otherwise, the approach is not scalable, and the business dies before it starts.

Thus, it was necessary to make our environment compatible with the GNU/Linux software world. And I managed to do it! Over the past few years, I have created a new technology for Linux containers on Android, and brought it to the production-ready state. The main difference between this technology and docker, lxc, and others is that it does not use Linux kernel namespaces and control groups. Therefore, it doesn't require root permissions to create a container and run Linux userspace in it. Because of that, we can run full-fledged Linux on Android phones, without requiring anything other than access to the network from the owners of these phones. Root permissions are not required, and in fact, we consider it to be a potential security risk, so we detect and block such rooted devices.

With this technology, our customers get remote access to the Linux container running on Android without access to Android itself (this is necessary both for technical reasons and to ensure the security of the phone owner's data such as contacts, photos, etc.). Such a Linux container looks and behaves the same as a remote Linux server, i.e., the customer does not need to do anything extra to use it. He can just take his existing software and just run it on our devices. There's a slight note though — most Android devices are Arm devices, so the customers' software should be built for Linux Arm. Of course, this applies only to the compiled components; if we are talking about scripts like python, js, or ruby, there's nothing to worry about — everything works out of the box. In short, we make full-fledged Linux computers from Android phones, and they are more powerful than you might expect! Modern Samsung devices like Note 9, S10, and S20 have eight powerful CPU cores, 8 or 12 GB RAM, and up to 512 GB storage — that's better than many laptops and desktops!

Now, after that introduction, I'll return to the beginning. We are talking about scientific calculations for COVID-19. Almost all such software has been written in C++. And, as you might guess, it works under Linux, but only under Linux x86_64. No one ever targeted it for Arm before. Therefore, we provide our customers with a free service for porting their software to Arm. It is important here to say that we're doing porting to Linux Arm, not to Android Arm, so there's no vendor lock for the customer — the ported software works equally well on our Linux containers and traditional Linux Arm machines like Raspberry Pi 4, Odroid N2, or AWS a1 instances. And for us, this greatly simplifies the job, because porting from Linux x86_64 to Linux Arm is significantly easier than porting from Linux x86_64 to Android Arm.

So, in the last two and a half months, I have been doing such porting for scientific projects dealing with COVID-19. The first such project, two months ago, was Rosetta@Home from the University of Washington. They design and investigate proteins. Since SARS-CoV-2 uses specific proteins to enter the live cell, the Rosetta@Home team switched to work in this direction in February 2020. Thanks to the high quality of the Rosetta@Home project code, porting to Arm took only a few days. Then I gave them patches, complete instructions for building and testing for Arm, and a few days later, they announced a public release with Arm support.

And a few days ago, I finished work on Folding@Home. This extremely popular project uses Gromacs under the hood, which simulates dynamic systems consisting of a huge number of particles (atoms), using the Newtonian equations and additional technics (Langevin dynamics, etc.), allowing us to simulate the behavior of such systems with high accuracy. It was a much harder project in terms of porting, but its natural complexity is quite high. It was worth doing it. The results of my efforts and the efforts of several more developers from the Gromacs project were accepted by the Folding@Home team. I expect to see the public release of a new version that supports Linux Arm in a few weeks.

As a developer, I personally feel pleased that all the porting to Linux Arm comes out clean — there are no special tricks nor hacks necessary to apply to the software to make it work in Neocortix secure containers. Everything that works on traditional Linux Arm machines works in Neocortix secure containers too. In fact, this was the main requirement from the very beginning, but still, there's a big difference between the requirement and the working solution, which you have built with your own hands. I think that anyone who has ever created a system that takes on a life of its own should understand me.

If you are interested in this technology, you can see how it works on your own. Just go to, register, and launch an instance. You will have one hundred free hours of machine time, during which you can run Linux containers on our users' Android devices, but only on weak Bronze devices. If you want to use more powerful devices of the Silver and Gold categories, you will need to switch to the paid level and register a payment method. In this case, you will be able to launch containers without restrictions, but you'll pay for each container ($0.0548/hr for devices of the Gold category and $0.0274/hr for devices of the Silver category).