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

Maximum CPU time - spread tasks evenly over timeslot #4181 #4207

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

cnergyone
Copy link

Fixes #4181

Description of the Change
Modified the behavior of cpu_usage_limit to run tasks spread over a 100 second window, instead of all at once.

Alternate Designs
The old implementation gave a bad user experience, as all tasks where running for a short time, blocking to PC for other processes. This implementation will smooth out the cpu usage over a longer time window.

Release Notes
Changed the cpu_usage_limit throttling behavior to spread out tasks over time.

@codecov
Copy link

codecov bot commented Feb 19, 2021

Codecov Report

Merging #4207 (a954b99) into master (9becb35) will increase coverage by 16.19%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##             master    #4207       +/-   ##
=============================================
+ Coverage      7.01%   23.21%   +16.19%     
  Complexity      756      756               
=============================================
  Files           278      100      -178     
  Lines         34962     7130    -27832     
  Branches       1507     1507               
=============================================
- Hits           2452     1655      -797     
+ Misses        32398     5363    -27035     
  Partials        112      112               
Impacted Files Coverage Δ Complexity Δ
vda/vda_lib.cpp
lib/crypt.cpp
apps/1sec.cpp
sched/transitioner.cpp
lib/str_util.h
sched/sched_send.h
sched/sched_version.cpp
tools/dir_hier_path.cpp
sched/sched_main.cpp
sched/adjust_user_priority.cpp
... and 168 more

@davidpanderson
Copy link
Contributor

I don't understand what this does, or what problem it solves; please explain.

@cnergyone
Copy link
Author

From the ticket:

Describe the problem
When choosing a value of 'Maximum % of CPU time" BOINC will schedule the runtime in seconds.
For example, selecting 25% will make BOINC tasks run for one second, and sleep for 3 seconds.
In a multi core environment this is quite detrimental for performance, power spikes and more.
Also when all the tasks start at once, the computer often is less responsive for one second, and then 3 seconds is very usable.

Describe the solution you'd like
It would be beneficial for the system to spread the multi-core tasks in time, using slots.
For example, if we have an 8 core system with a 25% usage selected, we have have 8 tasks running:

First second: run 2 tasks out of the 8 (tasks 1, 2)
Second second: run next 2 tasks out of the 8 (task 3, 4)
Third second: run other 2 tasks (task 5, 6)
Fourth second: run other 2 tasks (tasks 7,8)
Second example:
In a 100 core system with a 1% CPU load selected:
In the old situation all 100 cores would run for 1 second, completely bogging down the system.
For the next 99 seconds there would be no BOINC tasks running.
In the new situation, every task would run for 1 second in consecutive order.

This would provide a better user experience:

Fans will not throttle up and down that aggressively reducing noise
Power supplies have a less hard time
More gentle thermal effect on CPU (less expansion/contraction cycles
Computer is more usable in general
Simply makes much more sense
Additional context
In case you want your computer to consume a steady amount of power this is the only way.

Note: It would be beneficial that CPU % LOAD is separately configurable to GPU % LOAD. Same concept, but time slots also take into account amount of GPUs installed in the system.

 - The old algorithm enabled enable all tasks at the same time, starving CPU cache and memory bandwidth.
 - The old algorithm did not optimaly make use of XFR because again all threads where enabled and disable in sync
 - The old algorithm put more strain on PSU and VRMs as there are high power spikes every time

The new algorithm should result on more stable and lower temperatures on most CPUs while increasing overall throuput.
@dirspb
Copy link

dirspb commented Jun 12, 2023

if we have an 8 core system with a 25% usage selected, we have have 8 tasks running:
First second: run 2 tasks out of the 8 (tasks 1, 2)
Second second: run next 2 tasks out of the 8 (task 3, 4)
Third second: run other 2 tasks (task 5, 6)
Fourth second: run other 2 tasks (tasks 7,8)

Such behavior can already be achieved by configuring: Use 25% of the CPUs, use 100% of CPU time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maximum CPU time - spread tasks evenly over timeslot
4 participants