Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Boinc doesn't utilize all the cores #2549

Closed
adamradocz opened this issue Jun 5, 2018 · 55 comments · Fixed by #4051
Closed

[Android] Boinc doesn't utilize all the cores #2549

adamradocz opened this issue Jun 5, 2018 · 55 comments · Fixed by #4051

Comments

@adamradocz
Copy link
Member

adamradocz commented Jun 5, 2018

I have a LeEco Le Max 2 phone with LineageOS 15.1 (Android 8.1). It has Snapdragon 820 SOC with 4 cores. The power management is set to performance.

I set the boinc to use all the 4 cores, and if I check the CPU utilization with the Kernel Auditor, it shows that only 1 CPU is used. I've tried multiple scenarios with different options like use 1, 2 or 3 cores, but I got the same results.

screenshot_kernel_adiutor_20180605-155029

@AenBleidd
Copy link
Member

@adamradocz, could you please send the link to this application? Will try to check it with my 2 devices.

@adamradocz
Copy link
Member Author

@AenBleidd
Copy link
Member

Damn, it requires device to be rooted :(

@adamradocz
Copy link
Member Author

@AenBleidd
Copy link
Member

By the way, could you please share some boinc logs from your device as well?
I think this could help to identify the issue.

@adamradocz
Copy link
Member Author

adamradocz commented Jun 5, 2018

Client Messages

Tue Jun 05 15:50:44 GMT+02:00 2018||(to change preferences, visit a project web site or select Preferences in the Manager)
Tue Jun 05 15:50:44 GMT+02:00 2018||suspend work if non-BOINC CPU load exceeds 100%
Tue Jun 05 15:50:44 GMT+02:00 2018||don't use GPU while active
Tue Jun 05 15:50:44 GMT+02:00 2018||don't compute while active
Tue Jun 05 15:50:44 GMT+02:00 2018||max CPUs used: 2
Tue Jun 05 15:50:44 GMT+02:00 2018||Number of usable CPUs has changed from 4 to 2.
Tue Jun 05 15:50:44 GMT+02:00 2018||max disk usage: 43.82GB
Tue Jun 05 15:50:44 GMT+02:00 2018||max memory usage when idle: 3023.29MB
Tue Jun 05 15:50:44 GMT+02:00 2018||max memory usage when active: 1889.55MB
Tue Jun 05 15:50:44 GMT+02:00 2018||Preferences:
Tue Jun 05 15:50:44 GMT+02:00 2018||Reading preferences override file
Tue Jun 05 15:50:01 GMT+02:00 2018||(to change preferences, visit a project web site or select Preferences in the Manager)
Tue Jun 05 15:50:01 GMT+02:00 2018||suspend work if non-BOINC CPU load exceeds 100%
Tue Jun 05 15:50:01 GMT+02:00 2018||don't use GPU while active
Tue Jun 05 15:50:01 GMT+02:00 2018||don't compute while active
Tue Jun 05 15:50:01 GMT+02:00 2018||Number of usable CPUs has changed from 2 to 4.
Tue Jun 05 15:50:01 GMT+02:00 2018||max disk usage: 43.82GB
Tue Jun 05 15:50:01 GMT+02:00 2018||max memory usage when idle: 3023.29MB
Tue Jun 05 15:50:01 GMT+02:00 2018||max memory usage when active: 1889.55MB
Tue Jun 05 15:50:01 GMT+02:00 2018||Preferences:
Tue Jun 05 15:50:01 GMT+02:00 2018||Reading preferences override file
Tue Jun 05 15:46:00 GMT+02:00 2018||(to change preferences, visit a project web site or select Preferences in the Manager)
Tue Jun 05 15:46:00 GMT+02:00 2018||suspend work if non-BOINC CPU load exceeds 100%
Tue Jun 05 15:46:00 GMT+02:00 2018||don't use GPU while active
Tue Jun 05 15:46:00 GMT+02:00 2018||don't compute while active
Tue Jun 05 15:46:00 GMT+02:00 2018||max CPUs used: 2
Tue Jun 05 15:46:00 GMT+02:00 2018||Number of usable CPUs has changed from 1 to 2.
Tue Jun 05 15:46:00 GMT+02:00 2018||max disk usage: 43.82GB
Tue Jun 05 15:46:00 GMT+02:00 2018||max memory usage when idle: 3023.29MB
Tue Jun 05 15:46:00 GMT+02:00 2018||max memory usage when active: 1889.55MB
Tue Jun 05 15:46:00 GMT+02:00 2018||Preferences:
Tue Jun 05 15:46:00 GMT+02:00 2018||Reading preferences override file
Tue Jun 05 15:43:27 GMT+02:00 2018||(to change preferences, visit a project web site or select Preferences in the Manager)
Tue Jun 05 15:43:27 GMT+02:00 2018||suspend work if non-BOINC CPU load exceeds 100%
Tue Jun 05 15:43:27 GMT+02:00 2018||don't use GPU while active
Tue Jun 05 15:43:27 GMT+02:00 2018||don't compute while active
Tue Jun 05 15:43:27 GMT+02:00 2018||max CPUs used: 1
Tue Jun 05 15:43:27 GMT+02:00 2018||Number of usable CPUs has changed from 3 to 1.
Tue Jun 05 15:43:27 GMT+02:00 2018||max disk usage: 43.82GB
Tue Jun 05 15:43:27 GMT+02:00 2018||max memory usage when idle: 3023.29MB
Tue Jun 05 15:43:27 GMT+02:00 2018||max memory usage when active: 1889.55MB
Tue Jun 05 15:43:27 GMT+02:00 2018||Preferences:
Tue Jun 05 15:43:27 GMT+02:00 2018||Reading preferences override file
Tue Jun 05 15:42:52 GMT+02:00 2018||(to change preferences, visit a project web site or select Preferences in the Manager)
Tue Jun 05 15:42:52 GMT+02:00 2018||suspend work if non-BOINC CPU load exceeds 100%
Tue Jun 05 15:42:52 GMT+02:00 2018||don't use GPU while active
Tue Jun 05 15:42:52 GMT+02:00 2018||don't compute while active
Tue Jun 05 15:42:52 GMT+02:00 2018||max CPUs used: 3
Tue Jun 05 15:42:52 GMT+02:00 2018||Number of usable CPUs has changed from 2 to 3.
Tue Jun 05 15:42:52 GMT+02:00 2018||max disk usage: 43.82GB
Tue Jun 05 15:42:52 GMT+02:00 2018||max memory usage when idle: 3023.29MB

@AenBleidd
Copy link
Member

I have 8 cores. Looks like all of them have similar utilization
s80605-171925
s80605-171931

@AenBleidd
Copy link
Member

I see this in your log:
Tue Jun 05 15:42:52 GMT+02:00 2018||don't compute while active
Could you please enable option to compute when in use?

@adamradocz
Copy link
Member Author

That's strange, because it was enabled. I check then uncheck again the option, but nothing changed.

screenshot_boinc_20180605-163509

@AenBleidd
Copy link
Member

Maybe just an issue with logs. There are many other strange messages in the log that are not correct on Android.
I think I can do nothing here now as soon as we have no active Android developer here :(

@AenBleidd
Copy link
Member

It's interesting. I see 1 core 100% utilization when BOINC is not running. Maybe you have the same situation?
s80605-180403

@adamradocz
Copy link
Member Author

I'm pretty sure that the boinc not uses all the cores, because if I use set the boinc to use all the cores the WUs get done about 3 times longer than usually.

@adamradocz
Copy link
Member Author

I got another screenshot with another app. It shows that the boinc doesn't utilize the Big cores only the LITTLE cores.
screenshot_cpu_monitor_20180606-215456

@AenBleidd
Copy link
Member

Hm, I'm wondering whether it is a job of boinc client to utilize all cores?
I guess (I can be wrong) that boinc client get the info about all available cores, get the user core usage limitation and create as max parallel jobs as he can based on the previous information. I think all other is the job of os planner to assign particular processes to particular cores.

@AenBleidd
Copy link
Member

Another interesting case.
8 equal cores, 8 running tasks, only 3 cores are utilized.
s80606-231737
Either this application lies or it is a really strange behavior that needs to be investigated

@SETIguy
Copy link
Contributor

SETIguy commented Jun 7, 2018 via email

@adamradocz
Copy link
Member Author

I tried different performance profiles. Yes, I set boinc to run CPU 100% for all cores.
Battery and cpu temperature: 33 °C and 46 °C. Memory 64% and yes, I have enough storage.
I did put the memory use for boinc to 90%.

Nothing helped.

@adamradocz
Copy link
Member Author

I checked another phone. Leeco Le 2, it has Android 7.1 and Snapdragon 652.
The 4 LITTLE cores are crunching but the 4 big cores are not.

leeco le2 boinc

@JacobWKlein
Copy link

JacobWKlein commented Jul 11, 2018

My Pixel 2 has ARM big.LITTLE, using Heterogeneous Multi-Processing (HMP), with Qualcomm Snapdragon 835, that has 4 big Kryo cores and 4 little Kryo cores.

On my Pixel 2 (not rooted!), running Android Oreo 8.1.0, with BOINC set to run on 8 CPUs, I am noticing that BOINC:

  • Sometimes runs as fg (foreground CPU policy), which for me uses all 4 of my little cores and 2 of my 4 big cores
  • Sometimes runs as bg (background CPU policy), which for me uses only 2 of my 4 little cores, and 0 of my 4 big cores

It seems to me that BOINC's current behavior is:

  • runs as bg when Autostart was used to start it
  • runs as fg when user starts it, until:
    -- BOINC has been suspended and the app's UI is cleared in the task switcher by the user
    -- BOINC has been suspended for long enough that the os scheduler moves it to bg
  • can be set to run as fg again, if tasks are suspended, and user uses Settings > Apps > BOINC > Force Stop, then restarts the BOINC app

My expectation is that, by default, BOINC should run as fg (while keeping 'nice') if possible, to try to use as many of the device's CPUs as requested by the user.

I've fully documented my ongoing findings here, with a summary of steps/results below:
https://boinc.berkeley.edu/dev/forum_thread.php?id=12532

Steps:

  • Enabled developer options on the device
  • Enabled USB debugging on the device
  • Ran "adb shell" from an admin Command Prompt in Windows
  • Ran some of the commands below.

Useful commands:
top
top -o PID,USER,PR,NI,VIRT,RES,SHR,S,%CPU,%MEM,TIME+,PCY,CPU,CMDLINE
top -o PID,USER,PR,NI,VIRT,RES,SHR,S,%CPU,%MEM,TIME+,PCY,CPU,NAME
ps -A -o PID,TTY,TIME,CMD,CPU,PCY,PPID -P [BOINC_PARENT_PROCESS_ID]

Running as bg (BOINC is limited to CPUs 0 and 1 only, thus leaving 6 idle... so, using 2 of 8):

walleye:/ $ ps -A -o PID,TTY,TIME,CMD,CPU,PCY,PPID -P 5928
PID TTY TIME CMD CPU PCY PPID
6732 ? 00:00:46 rosetta_android 0 bg 5928
6996 ? 00:00:40 rosetta_android 1 bg 5928
7037 ? 00:00:45 rosetta_android 1 bg 5928
7253 ? 00:00:44 rosetta_android 0 bg 5928
7379 ? 00:00:39 rosetta_android 1 bg 5928
7380 ? 00:00:04 data_collect_v5 1 bg 5928
7480 ? 00:00:38 rosetta_android 0 bg 5928
7485 ? 00:00:38 rosetta_android 0 bg 5928
7514 ? 00:00:38 rosetta_android 1 bg 5928

Running as fg (BOINC is limited to all CPUs except 4 and 5, thus leaving 2 idle... so, using 6 of 8):

127|walleye:/ $ ps -A -o PID,TTY,TIME,CMD,CPU,PCY,PPID -P 3975
PID TTY TIME CMD CPU PCY PPID
4724 ? 00:00:11 rosetta_android 2 fg 3975
5191 ? 00:00:10 rosetta_android 7 fg 3975
5384 ? 00:00:13 rosetta_android 1 fg 3975
5561 ? 00:00:07 rosetta_android 7 fg 3975
5730 ? 00:00:07 rosetta_android 6 fg 3975
5731 ? 00:00:00 data_collect_v5 6 fg 3975
5893 ? 00:00:11 rosetta_android 3 fg 3975
6128 ? 00:00:09 rosetta_android 0 fg 3975
6341 ? 00:00:06 rosetta_android 6 fg 3975

@fxzjshm
Copy link

fxzjshm commented Jul 11, 2018

In my case ususally it looks like this:
screenshot_2018-07-11-23-29-23-475_com cgollner systemmonitor

After rebooting and open BOINC immediately I get this:

screenshot_2018-07-11-23-45-04-195_com cgollner systemmonitor
After several minutes(or hours) it back to normal.
Hope this helps you. Running on MI 5C, with XIAOMI Surge S1.
P.S. I dont know why CPU4 isnt fully working even I have 8 tasks running together.

@Ferroin
Copy link

Ferroin commented Jul 11, 2018

So, based on some quick experimentation here, I'm seeing essentially the same behavior on my Nexus 6P that @JacobWKlein is reporting, which would explain why computational performance for BOINC there is so seemingly inconsistent relative to what it theoretically should be given the device specs.

@JacobWKlein
Copy link

JacobWKlein commented Jul 11, 2018

@Ferroin :
Thanks for the confirmation! For bonus points, see if you can get top and ps to confirm "bg" versus "fg" :)

@fxzjshm :
Can you use the commands I posted, to determine if the difference in behavior that you're seeing, is because sometimes BOINC runs as "bg" and sometimes it runs as "fg"?

@fxzjshm
Copy link

fxzjshm commented Jul 11, 2018

Sorry for the delay. I was getting access to a computer.
Yes @JacobWKlein you are right
Before reboot (8 programs shared 1 little core CPU 0):

meri:/ $ ps -P
USER      PID   PPID  VSIZE  RSS   PCY WCHAN              PC  NAME
u0_a154   12216 344   2668980 45780 bg  SyS_epoll_ 0000000000 S edu.berkeley.boinc
u0_a154   15706 14573 205920 127324 bg             0000000000 R ../../projects/einstein.phys.uwm.edu/einsteinbinary_BRP4_1.46_arm-android-linux-gnu__ASIMDPIE

After (running on a big core):

USER      PID   PPID  VSIZE  RSS   PCY WCHAN              PC  NAME
u0_a154   2690  344   2746844 143084 ta             0000000000 R edu.berkeley.boinc
u0_a154   2863  2768  156768 121776 fg             0000000000 R ../../projects/einstein.phys.uwm.edu/einsteinbinary_BRP4_1.46_arm-android-linux-gnu__ASIMDPIE

@SETIguy
Copy link
Contributor

SETIguy commented Jul 11, 2018 via email

@cristipurdel
Copy link

This appears to be a common issue on ARM Android devices. Often the symptom is the task run time exceeding the CPU time a ratio of integers. I believe that the issue that the number of FPUs and NEON units doesn't match the number of integer cores. Low end devices may only have 1 FPU shared between 4 or 6 cores. Processes end up waiting for the resource they need, possibly being migrated to the CPU that owns the FPU. I've never really spent any time figuring out how to identify whether it is occurring. It makes processing less efficient, but doesn't seem to affect the quality of the results.

On Wed, Jun 6, 2018 at 1:22 PM, Vitalii Koshura @.***> wrote: Another interesting case. 8 equal cores, 8 running tasks, only 3 cores are utilized. [image: s80606-231737] https://user-images.githubusercontent.com/3234209/41063092-5e2c19fa-69e0-11e8-81c3-663d45c1518d.jpg Either this application lies or it is a really strange behavior that needs to be investigated — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#2549 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AKXcsi1walF_7VlGQGnP9_Ei1OiaBqiAks5t6Dn7gaJpZM4Ua4iH .
-- Eric Korpela korpela@ssl.berkeley.edu AST:7731^29u18e3

Hmmm, I am not getting this while running on WCG, and I am running on real cheap phones...

I lways thought it was a thermal throttling issues

Could someone (having issues with full load) please try running on WCG instead of SETI, and post the results again here?

@cristipurdel
Copy link

What I have done, on really cheap phones, to run for WCG is:

  1. root
  2. disable thermal throttle
  3. remove battery, replace with homemade cable :)

See my instructable, one really cheap phone (brand Landvo L700 :)) ) is still running after 2.5 years
https://www.instructables.com/id/How-to-Recycle-Android-Phones-for-BOINC-or-Folding/

@AenBleidd
Copy link
Member

@cristipurdel,

Could someone (having issues with full load) please try running on WCG instead of SETI, and post the results again here?

I did. Got almost the same results. on several phones.

Also not everyone want to root his phone and remove battery. Most people just want to run an application and do nothing more.
BTW, disabling thermal throttle is dangerous not for battery only, I got my RAM burned because of running BOINC 24/7 (ok, I believe it was the main reason, I have no possibility to reproduce this).

@adamradocz
Copy link
Member Author

On Android 9 with the latest dev build, this issue looks fine.

@cristipurdel
Copy link

cristipurdel commented Dec 27, 2018

Well there are 3 steps of disabling thermal throttle. I just use the first (safest) one, and I do not let the phone exceed 80degC.
My opinion is that if you really want to run BOINC 24/7, the battery is going to be a ticking time bomb, since it will eventually bloat/explode, that's why I removed them.

Can you please post the chipset soc for the affected phones here, since I tried on mostly mediatek and samsung octo-cores phones and did not find any issues.

Usually from what I saw, the thermal throttling started at 65-70degC if I remember correctly, but by using the safest (first) thermal throttle, it gave the phone 10-15degC of headroom.

Could you try lowering the freq if you have root with kernel adiutor?

@cristipurdel
Copy link

@adamradocz, in my case after several months battery begin to degrade even when it's not charged to 100% but because of constant charging.

It is a waste of energy and money to buy a new battery every months or so.
The battery is supposed to have around 500 charging cycles, over 2+ years. If you are constantly using it, you kind of use one charging cycle every 3-6 hours, so that most probably it will bloat after 4-8 weeks. I started to see the battery bloat / phone bend after 2 weeks. You are also not energy efficient since you are charging the battery which is feeding energy to the phone. The wasted heat is why the battery also gets hot.

From my experience, the Android OS is doing some checks when it needs to run an intensive task.
IF the battery temp is under a certain level, around 70degC
If it needs to use a single task, then it can go to max freq.
Else it depends on number of cores and energy allowable.
Usually there should be a power plan in a file, did not manage to modify this, since I guess only the OS can do this, maybe it could be done in LineageOS, maybe
https://cdn.instructables.com/FGG/ZADM/JEOIQTMT/FGGZADMJEOIQTMT.LARGE.jpg
So if you have the power budget, temp battery is ok, temp cpu is also ok, you could "fall" in one of the lower power plans. Without root and without enabling some the thermal throttling upper scenarios, for some phones I was getting 5/8 cores utilization, easy to do this with WCG CPU Time / Elapsed Time (hours), do not know if SETI has this also implemented.
You could use all cores, with lower freq with max utilization (I am getting around 97% in WCG), but you need to set the upper freq in the OS, e.g. kernel adiutor, although for some scenarios the OS is overwriting those settings after a while.

So basically I treated this as a heat problem, and removed the battery. Since there is no battery, I am not wasting energy/money on it. There is also no heat convection from the battery to the CPU, which is also getting hot from BOINC.

@JacobWKlein
Copy link

As I previously explained, in my scenarios, the usage of the BIG cores was dependent upon how BOINC was started. You might try to test using the scenarios that I provided, to confirm the behavior.

I'm told that dev builds of BOINC may have fixed the issue, and I could re-test if someone told me how to use one.

@numbermaniac
Copy link

numbermaniac commented Dec 30, 2018

@JacobWKlein
Copy link

Sorry, I'm a beta tester of beta or release candidate builds. I'm not tooled to compile them, nor do I want to be.

@cristipurdel
Copy link

cristipurdel commented Dec 30, 2018

I guess modifying boinc to act as a bg process with all available cores is really difficult to implement without root.
My feeling is that the OS Schedule will always prefer battery saving / thermal throttling over running 24/7. I am also seeing on some of my rooted phones, where sometimes the OS does not care about my cpu freq value or cores, and imposes it's schedule based on his mood.
If you do not want to root, then try

Photo attached when OS Schedule knows best (CPU % is normally staying at 99%), need to restart phone
image

@IRainman
Copy link

IRainman commented Jul 25, 2019

Same problem. I use Lineage 16 (based on Android 9) with root on OnePlus 3T and after reboot only 3 core (2 little and 1 big) may used for BOINC tasks, if I close BOINC GUI only 1 core for all tasks is still used. On my other devices with Android 6 (Samsung Galaxy Nexus) and 4.3.1 (Ainol Novo 10 Hero) this problem does not exist.

I’m frustrated with Google’s policy, they could have specifically made permission for the full utilization of resources, and not to break everything (as usual).

@AenBleidd
Copy link
Member

On every other platform (including Android) we are relying on kernel scheduler to manage running processes.
Since Android is even more closed platform than linux, there is nothing we can do here that will change the situation.
I'm closing this ticket for now,

BOINC Android automation moved this from Backlog to Done Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
BOINC Android
  
Done
Development

Successfully merging a pull request may close this issue.