Page 1 of 2

Folding on Android with UserLAnd and the new Linux ARM build

Posted: Thu Dec 17, 2020 12:33 am
by demorgan
I was curious to see if I could get folding going on as I have a lot of Android phones and tablets sitting around my house. The answer is yes, if you install UserLAnd on your phone and install the FAHClient package for ARM, it works (UserLAnd runs a choice of stripped down Linux distros inside an Android app, and allows you to connect via VNC or SSH)

The way I did it was to install xfce and installed Chromium from a terminal to browse to the download site here and get the ARM client, but this is not the best way. You could probably just start with SSH instead of VNC and copy and type "wget url_of_arm_linux_fahclient.deb" to download it, type: sudo dpkg -i "name_of_arm_linux_fahclient.deb" to install it, and then it's started, I believe. However, you can't see the progress on the terminal unless you end the UserLAnd program, restart debian in SSH, and type "FAHClient", then you should get the terminal output. There are also ways to re-direct the output of a running process to your ssh terminal, which would probably work too and be a cleaner way of doing it instead of killing UserLAnd from Android and restarting, but that is beyond this post (not because it wouldn't be useful information, but because I haven't ever done it.)

Note: I only discovered that I had this working when I saw that the username of the client "demorganphone" had completed a WU. It did not look like it was running, and no service was found, and starting FAHClient didn't seem to work. But when I restarted UserLAnd and typed "FAHClient" I could see it.

If you start via VNC, you can use the web client in a browser. I didn't have much luck with Firefox, so try Chromium.

I was actually reluctant to post this because I don't think it was intended for the ARM Linux program to be used this way, although I'd be happy to be wrong about this. This is not something you can just carry around with you running in the background on your phone, your phone will lose charge quickly, so have your phone charging with a good charger that provides a lot of current. I tried doing this with my Galaxy S9 plugged into my laptop, the phone started at 4% and actually went out of power and died even though it was charging! Plugging it into the wall worked though. Keep in mind this is basically a stress test on your phone, so don't blame me if your processor melts down or your RAM goes bad or something. With a lot of people working from home and being quarantined, their phones can stay plugged in for a while, so this might give a boost to to activity. I do not think it would be a good idea to do this unless you have many hours on hand to complete a WU, it could clog things up I imagine, so I would just wait until you have time if you don't.

Phones do have non-ARM processors occasionally. ARM is used in about 95% of phones last I read. This will definitely not work on an Android phone or tablet based on another architecture like x86. ARM only!

I should note that I have only tested this on a Samsung Galaxy S9. If anyone has another story, please tell!

I realize this may have not been the best overview, but it's a start. I'd be interested to read others' input on this...

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sat Dec 19, 2020 9:44 pm
by bruce
My guess is that this is a stress-test on the battery. Any processor running FAH is a good source of heat and batteries don't like heat.

Thanks for the report. I'm sure others will evaluate it on their hardware.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sun Dec 20, 2020 3:36 am
by demorgan
The issue with the battery I definitely acknowledge...I especially don't recommend letting it run without charging; it would generate a lot of heat around the battery unless there's like zero resistance between the battery and the rest of the phone.

After folding for a few days, I can say that it works, but it is highly recommended by me to run it in "Medium" and not "Full". It folds less, but I had my phone get so hot that Android terminated UserLAnd when it sensed how hot the phone had become. However, when doing it on "medium" I have had 0 issues.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sun Dec 20, 2020 5:24 am
by Darth_Peter_dualxeon
Just curious, how much PPD did you get? And how hot was the phone?
If I'm understanding correctly it does not use the GPU of the phones yet?
demorgan wrote: This is not something you can just carry around with you running in the background on your phone, your phone will lose charge quickly, so have your phone charging with a good charger that provides a lot of current. I tried doing this with my Galaxy S9 plugged into my laptop, the phone started at 4% and actually went out of power and died even though it was charging! Plugging it into the wall worked though.
I guess USB2.0 connectors only supply 500 mA, and 3.0 connectors can supply something like 2A. Wall chargers maybe more.
The charging circuit or software in phone can also misunderstand the situation sometimes and don't charge as fast, and then a different cable or a restart may help.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sun Dec 20, 2020 6:46 am
by demorgan
My PPD on my S9 right now is 1153, on medium setting using 7 cores of the Snapdragon out of 8. I have, I think, 8 devices going total, all but two using various Debian-based Linux distros, mostly computers and laptops between 2010 and 2018 except for a Raspberry Pi 4 (just got that working) and the Galaxy S9. The S9 is the third fastest. There are, however, no GPUs that are supported on any of the devices yet (just bought a few GPUs off ebay though), so...

The phone, when going on full, is quite hot. It's so hot you wouldn't want to hold it, even. However, when on medium it's just a little hot. The GPU is not supported, and I'm not sure it would be possible to interface with the hardware directly like would be needed if UserLAnd is being used.

What you said about USB is true, here's an article about USB power differences; it's a quite complex issue when it comes to determining how much power you get to your phone (the ads may annoy, but the information is useful):

https://www.extremetech.com/computing/1 ... blowing-up

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sun Dec 20, 2020 4:33 pm
by bruce
My S9 is still my primary phone, so I'm not interested in it getting too hot. I do have some older equipment around. Before I start experimenting, what is the oldest hardware and/or Android that would be supported by UserLAnd+Linux?

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Mon Dec 21, 2020 6:47 am
by demorgan
I contacted the email given for UserLAnd support asking for what would be the minimum hardware requirements, but they have not gotten back to me yet. The minimum version of Android stated on the Google Play store is 5.0.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Mon Dec 21, 2020 8:17 am
by PantherX
FYI, you may find that on ARM architectures that use BIG.little CPUs, setting the value of threads that is equal to BIG CPUs might provide a boost in PPD. That would work well since you can get higher PPD without generating too much heat.

Reason for that is if you're using all CPUs in BIG.little, then the BIG CPUs would wait for the little CPUs to finish before things are synced up. Hence, the boost in PPD even though you're using fewer CPUs.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Mon Dec 21, 2020 6:31 pm
by bruce
In a perfect world, it would be nice to be able to run one WU on the BIG CPUs and a separate one on the LITTLE cores. That's a complex challenge for somebody who understands how to set affinity (Falsely assuming that heat would not be a problem.)

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Mon Dec 21, 2020 8:10 pm
by demorgan
For Linux, I think a script could almost be made using a program called "taskset" if one knew how the cores were numbered (which is the next thing I'm looking at):

https://www.looklinux.com/how-to-run-pr ... -in-linux/

However, it would require running more than one instance of fahclient.

Edit: No, wait, that wouldn't work since fahclient itself sets cores?

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Mon Dec 21, 2020 8:43 pm
by bruce
demorgan wrote:No, wait, that wouldn't work since fahclient itself sets cores?
Possibly ... or maybe it's the Wrapper.

In WIndows you have a choice of "idle" and "low"

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Tue Dec 22, 2020 10:12 am
by gunnarre
You just need to run two CPU slots in one client. If you can find a mask for big and little cores, put it into this script:

Code: Select all

#!/bin/bash
CPUPROCESSES=$(pgrep FahCore_a)
BIGMASK="f"
LITTLEMASK="f"

i=1
for pid in $CPUPROCESSES; do
    if (($i % 2)); then
        taskset -a -p $BIGMASK $pid >/dev/null
    else
        taskset -a -p $LITTLEMASK $pid >/dev/null
    fi
    ((i=i+1))
done
And run it via the cron command

Code: Select all

bash /usr/local/sbin/FahCore-taskset.sh >/dev/null
Edit: Note that this script only sets every other CPU slot to a different mask; it gives you no control over which one of the slots is given each mask - it just assigns the BIGMASK mask to folding CPU core with the lowest process ID. If you need to set a particular slot to a particular mask, then I wonder if "extra-core-options" in FAH can be used somehow?

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sat Nov 27, 2021 12:08 pm
by manalog
I am doing the same on my Motorola G5S+ (Qualcomm MSM8953), Lineage OS, Userland and remote control enabled in order to control FAHClient running on the smartphone from my computer.
It seems to run very smoothly, PPD is around 5000 and I think it is a very good number for a mobile device. The smartphone now it's pretty hot but not extremely hot; I think that a fan would be enough to keep temperatures low. CPU temp without fan is 70°, battery 37,5°; my house is old at the moment (17°-18°). All cores are used at around 80%, don't know why they aren't used 100% but I think it is an Android limitation (remember the same with Boinc).

Yesterday I installed FAHClient also on my SBC Orange Pi 4, based on Rockchip RK3399 and it seems it is doing the same PPD as the smartphone.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sat Nov 27, 2021 12:16 pm
by Neil-B
manalog wrote:I am doing the same on my Motorola G5S+ (Qualcomm MSM8953), Lineage OS, Userland and remote control enabled in order to control FAHClient running on the smartphone from my computer.
It seems to run very smoothly, PPD is around 5000 and I think it is a very good number for a mobile device. The smartphone now it's pretty hot but not extremely hot; I think that a fan would be enough to keep temperatures low. CPU temp without fan is 70°, battery 37,5°; my house is old at the moment (17°-18°). All cores are used at around 80%, don't know why they aren't used 100% but I think it is an Android limitation (remember the same with Boinc).

Yesterday I installed FAHClient also on my SBC Orange Pi 4, based on Rockchip RK3399 and it seems it is doing the same PPD as the smartphone.
Are any of these able to complete the wus within the timeout or expriry deadlines ... the client may estimate 5000ppd but if the wu isnt completed before the expiry date it will be dumped and 0 points awarded - it will also be worse than useless for the science as it will put a delay loop into the completion of that wu by something that can complete it within the deadline.

Re: Folding on Android with UserLAnd and the new Linux ARM b

Posted: Sat Nov 27, 2021 12:40 pm
by manalog
Yes, started folding yesterday and both the device were able to stay inside the "timeout" mark. The Motorola already finished a WU.

I don't know if soon or later they will get wu that stay inside "expire" but not "timeout". This, curiously, happened to me not on arm devices rather on a powerful Ryzen 5 laptop. In this case it is better to continue crunching the WU or abort it?

By the way starting from yesterday I've seen 3WUs in my "ARM Cluster", 1 completed, 2 in progress, 100% completed or predicted to be completed widely under the "Timeout" deadline.