Limit CPU time during night

Message boards : Number crunching : Limit CPU time during night

To post messages, you must log in.

AuthorMessage
TauFive

Send message
Joined: 24 May 16
Posts: 3
Credit: 52,852
RAC: 0
Message 80151 - Posted: 3 Jun 2016, 18:41:01 UTC

Is there any way to limit CPU time down to say 25% during a set period of time? For example 1800 to 0700 CPU is reduced to 25% and between 0700 to 1800 CPU is back to 100% usage.
ID: 80151 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Profile Timo
Avatar

Send message
Joined: 9 Jan 12
Posts: 185
Credit: 45,644,940
RAC: 8
Message 80152 - Posted: 3 Jun 2016, 19:30:59 UTC - in response to Message 80151.  

Is there any way to limit CPU time down to say 25% during a set period of time? For example 1800 to 0700 CPU is reduced to 25% and between 0700 to 1800 CPU is back to 100% usage.


This functionality is not built into BOINC as far as I know, but which operating system are you running? On Windows 7/8/10 I have set up some scheduled tasks to change the system power plan at set times of the day. I set the power plan's settings to limit the CPU clock to 100% or 70% or 40%, etc.

In my case I was aiming for the opposite (run 100% over night, run at 50% during the day when people are home, etc.)

If you're using Windows, I can provide more details of how to do this.
ID: 80152 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
TauFive

Send message
Joined: 24 May 16
Posts: 3
Credit: 52,852
RAC: 0
Message 80154 - Posted: 4 Jun 2016, 6:26:28 UTC - in response to Message 80152.  

Is there any way to limit CPU time down to say 25% during a set period of time? For example 1800 to 0700 CPU is reduced to 25% and between 0700 to 1800 CPU is back to 100% usage.


This functionality is not built into BOINC as far as I know, but which operating system are you running? On Windows 7/8/10 I have set up some scheduled tasks to change the system power plan at set times of the day. I set the power plan's settings to limit the CPU clock to 100% or 70% or 40%, etc.

In my case I was aiming for the opposite (run 100% over night, run at 50% during the day when people are home, etc.)

If you're using Windows, I can provide more details of how to do this.


Thanks, that's an interesting way of doing it. Now to determine which would be more power efficient - limiting CPU time to 25% or having Windows run the processor at the lowest p-state on 100%.
ID: 80154 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Profile Chilean
Avatar

Send message
Joined: 16 Oct 05
Posts: 711
Credit: 26,694,507
RAC: 0
Message 80156 - Posted: 4 Jun 2016, 16:25:33 UTC

I don't why they haven't implemented the number of cores utilization based on computer usage. I'd love to say use just my physical cores for BOINC while I'm using the computer (leaving the HT all for me), and letting BOINC take all the threads while I sleep.
ID: 80156 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Profile Timo
Avatar

Send message
Joined: 9 Jan 12
Posts: 185
Credit: 45,644,940
RAC: 8
Message 80157 - Posted: 4 Jun 2016, 17:17:17 UTC - in response to Message 80156.  
Last modified: 4 Jun 2016, 17:40:53 UTC

Here's the steps to change the target multiplier of a given power plan. Not sure if its the exact same as p states, but if you have CPU-Z open you will see the multiplier decrease/increase quite granulary (so it will go from say, 16 to 15 with a 6% change in the percentage)

The result for me is that I can run my 2.8Ghz i7 CPU at 1.6Ghz and cut the fan noise down to almost nothing.

Below the quoted instructions I also added some instructions for using a VBscript to change the power plans as part of a scheduled task.


To change the CPU multiplier settings of a given power plan, goto Power Options (Start->Search for 'Power Options' in the start menu is the easiest way, though it can also be accessed from Control Panel)

Then change the maximum CPU temps by modifying the plan settings (Note you may need to click on 'Change settings that are currently unavailable' in a couple places not shown in my screenshots here**)






Once you're here, you're looking for 'Maximum Processor State' under Processor power management which is a percentage that will allow the OS to control the CPU clock speed maximum in a much more robust way than BOINC itself can:


I hope that helps :)


Here's a modified version of someone else's VBS script that can switch between power plans, and thus be used to create scheduled power states -- note that I added some functionality to accept command line arguments, and also to write to a log file

Instructions:

- Save the below code (at bottom of this post) to a file, for example 'changePowerPlan.vbs'
- Double click the file to run it without any command line arguments, this will trigger it to display a list of Power Plans currently on the system like this:
(Take note of the number beside a given plan above, for example if I want to set the plan to my 'Power Saver' plan, that is plan #8)


- To run change this command via a command line, you can simply run the C:SomeFolderchangePowerPlan.vbs 8 - change the number 8 to a different number. If an argument is provided like this, no prompts will appear but - NOTE that the script will write a log to C:ProgramDatachangePowerPlan.log
- Then, you can set up scheduled tasks in windows to change the power plans around however you want, on a schedule.. You can just setup scheduled tasks in Task Scheduler to run at whatever time you want the plans to change. Here's what the 'Action to perform' screen is filled out to show on my setup:





[color=green]' ------------------------------- START OF CODE --------------
' Change the Power plan settings options using Pure VBScript [/color]
[color=green]' [/color]
[color=green]' Based on script by Phil Thomas[/color]
 
[color=green]' Define our variables [/color]
    [color=blue]Dim[/color] arrPlans[color=blue]([/color][color=blue])[/color] 
    [color=blue]Dim[/color] strState 
    [color=blue]Dim[/color] colPlan 
    [color=blue]Dim[/color] intCounter 
    [color=blue]Dim[/color] strPlanName 
    [color=blue]Dim[/color] strPlanDescription 
    [color=blue]Dim[/color] strPlanStatus 
    [color=blue]Dim[/color] objFSO[color=blue]:[/color] [color=blue]Set[/color] objFSO [color=blue]=[/color] [color=blue]CreateObject[/color][color=blue]([/color][color=red]"Scripting.FileSystemObject"[/color][color=blue])[/color]
    [color=blue]Dim[/color] myLog[color=blue]:[/color] [color=blue]Set[/color] myLog [color=blue]=[/color] objFSO[color=purple].[/color]OpenTextFile[color=blue]([/color][color=red]"C:ProgramDatachangePowerPlan.log"[/color][color=blue],[/color] [color=purple]8[/color][color=blue],[/color] [color=purple]True[/color][color=blue])[/color]

[color=green]' Get the winmanagment system power [/color]
    [color=blue]Set[/color] objWMI [color=blue]=[/color] [color=blue]GetObject[/color][color=blue]([/color][color=red]"winmgmts:\.rootcimv2power"[/color][color=blue])[/color]  
[color=green]' Do a search on win32_PowerPlan [/color]
    [color=blue]Set[/color] colPlans [color=blue]=[/color] objWMI[color=purple].[/color]ExecQuery[color=blue]([/color][color=red]"Select * From Win32_PowerPlan"[/color][color=blue])[/color]  
[color=green]' Resize the array that will hold the plans [/color]
    [color=blue]ReDim[/color] arrPlans[color=blue]([/color]colPlans[color=purple].[/color]count[color=blue])[/color] 
[color=green]' Start a counter (Real programmers start from 0) [/color]
    intCounter[color=blue]=[/color][color=purple]0[/color] 
[color=green]' Create the first part of our message to the user [/color]
    strOutput[color=blue]=[/color][color=red]"Available power plans:"[/color][color=blue]+[/color]vbcrlf 
 
[color=green]' Go through each of the returned plans objPlan contains the current plan [/color]
    [color=blue]For[/color] [color=blue]Each[/color] objPlan in colPlans 
[color=green]'  Get the details into some variables [/color]
[color=green]'   - The name of the plan eg Balanced [/color]
        strPlanName [color=blue]=[/color] objPlan[color=purple].[/color]ElementName   
[color=green]'   - The description of the plan (Not used in this example.) [/color]
        strPlanDescription [color=blue]=[/color] objPlan[color=purple].[/color]Description   
[color=green]'   - The current Status (Active=true Inactive=false) [/color]
        strPlanStatus [color=blue]=[/color] objPlan[color=purple].[/color]isActive[color=blue]=[/color][color=purple]True[/color] 
 
[color=green]'  Convert the status to some text for our inputbox [/color]
        [color=blue]If[/color] strPlanStatus[color=blue]=[/color][color=purple]True[/color] [color=blue]Then[/color] 
            strState[color=blue]=[/color][color=red]"Active"[/color] 
        [color=blue]Else[/color] 
            strState[color=blue]=[/color][color=red]"Inactive"[/color] 
        [color=blue]End[/color] [color=blue]If[/color] 
[color=green]'  Add a new line to our inputbox question string "<Serial number> - <Plan name> : <active/inactive> [/color]
        strOutput[color=blue]=[/color]strOutput[color=blue]&[/color][color=red]" "[/color][color=blue]&[/color]intCounter[color=blue]+[/color][color=purple]1[/color][color=blue]&[/color][color=red]" - "[/color][color=blue]&[/color]strPlanName [color=blue]&[/color][color=red]" : "[/color][color=blue]&[/color] strState [color=blue]&[/color]vbcrlf 
[color=green]'  Put the current plan into the array under its serial number. This is so we can access it by that number later. [/color]
[color=green]'  Note: it is an object so we have to use the Set command. [/color]
        [color=blue]Set[/color] arrPlans[color=blue]([/color]intCounter[color=blue])[/color][color=blue]=[/color]objPlan     
[color=green]'  Increment the serial number counter [/color]
        intCounter[color=blue]=[/color]intCounter[color=blue]+[/color][color=purple]1[/color] 
 
    [color=blue]Next[/color]  

[color=blue]if[/color] WScript[color=purple].[/color]Arguments[color=purple].[/color]Count [color=blue]>[/color] [color=purple]0[/color] [color=blue]then[/color] 
        intResponse [color=blue]=[/color] [color=blue]CInt[/color][color=blue]([/color]WScript[color=purple].[/color]Arguments[color=purple].[/color]Item[color=blue]([/color][color=purple]0[/color][color=blue])[/color][color=blue])[/color]
        [color=blue]else[/color]
        intResponse[color=blue]=[/color][color=blue]CInt[/color][color=blue]([/color]InputBox[color=blue]([/color]strOutput[color=blue],[/color][color=red]"Select Power Plan"[/color][color=blue])[/color][color=blue])[/color] 
[color=blue]end[/color] [color=blue]if[/color]    
[color=green]' Display our list of options  to the user and get response (Convert response to a number) [/color]
    
     
[color=green]' Check if the number corresponds to any of our power options [/color]
    [color=blue]If[/color] intResponse[color=blue]>[/color][color=purple]0[/color] And intResponse[color=blue]<[/color][color=blue]=[/color]intCounter [color=blue]Then[/color] 
[color=green]'  Check if the plan was already active - Note our options started at 1 so we need to correct [/color]
        [color=blue]If[/color] arrPlans[color=blue]([/color]intResponse[color=blue]-[/color][color=purple]1[/color][color=blue])[/color][color=blue].[/color]isActive[color=blue]=[/color][color=purple]True[/color] [color=blue]Then[/color] 
            [color=blue]if[/color] WScript[color=purple].[/color]Arguments[color=purple].[/color]Count [color=blue]>[/color] [color=purple]0[/color] [color=blue]then[/color]
            myLog[color=purple].[/color]WriteLine [color=blue]Now[/color] [color=blue]&[/color] [color=red]": Plan is already set to "[/color][color=blue]&[/color]arrPlans[color=blue]([/color]intResponse[color=blue]-[/color][color=purple]1[/color][color=blue])[/color][color=blue].[/color]elementName
            [color=blue]else[/color]
            [color=blue]MsgBox[/color] [color=blue]Now[/color] [color=blue]&[/color] [color=red]": Plan is already set to "[/color][color=blue]&[/color]arrPlans[color=blue]([/color]intResponse[color=blue]-[/color][color=purple]1[/color][color=blue])[/color][color=blue].[/color]elementName 
            [color=blue]end[/color] [color=blue]if[/color]
        [color=blue]Else[/color] 
[color=green]'  Set the plan to the chosen plan - The Activate() function is part of the Win32_PowerPlan class [/color]
            arrPlans[color=blue]([/color]intResponse[color=blue]-[/color][color=purple]1[/color][color=blue])[/color][color=blue].[/color]Activate[color=blue]([/color][color=blue])[/color]
            [color=blue]if[/color] WScript[color=purple].[/color]Arguments[color=purple].[/color]Count [color=blue]>[/color] [color=purple]0[/color] [color=blue]then[/color]
            myLog[color=purple].[/color]WriteLine [color=blue]Now[/color] [color=blue]&[/color] [color=red]": Plan set to "[/color][color=blue]&[/color]arrPlans[color=blue]([/color]intResponse[color=blue]-[/color][color=purple]1[/color][color=blue])[/color][color=blue].[/color]elementName
            [color=blue]else[/color]
            [color=blue]MsgBox[/color] [color=blue]Now[/color] [color=blue]&[/color] [color=red]": Plan set to "[/color][color=blue]&[/color]arrPlans[color=blue]([/color]intResponse[color=blue]-[/color][color=purple]1[/color][color=blue])[/color][color=blue].[/color]elementName
            [color=blue]end[/color] [color=blue]if[/color]
        [color=blue]End[/color] [color=blue]If[/color]  
    [color=blue]Else[/color] 
        [color=blue]if[/color] WScript[color=purple].[/color]Arguments[color=purple].[/color]Count [color=blue]>[/color] [color=purple]0[/color] [color=blue]then[/color]
            myLog[color=purple].[/color]WriteLine [color=blue]Now[/color] [color=blue]&[/color] [color=red]": No Changes Made"[/color] 
        [color=blue]else[/color]
        [color=blue]MsgBox[/color] [color=red]"No Changes Made"[/color] 
        [color=blue]end[/color] [color=blue]if[/color]
   [color=blue]End[/color] [color=blue]If[/color] 

myLog[color=purple].[/color][color=blue]Close[/color]
[color=blue]set[/color] myLog [color=blue]=[/color] [color=blue]Nothing[/color]
[color=blue]set[/color] objFSO [color=blue]=[/color] [color=blue]Nothing[/color]
WScript[color=purple].[/color]Quit

[color=green]' ------------------------------- END OF CODE --------------[/color]
ID: 80157 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
TauFive

Send message
Joined: 24 May 16
Posts: 3
Credit: 52,852
RAC: 0
Message 80166 - Posted: 8 Jun 2016, 0:17:54 UTC - in response to Message 80157.  

Here's the steps to change the target multiplier of a given power plan. Not sure if its the exact same as p states, but if you have CPU-Z open you will see the multiplier decrease/increase quite granulary (so it will go from say, 16 to 15 with a 6% change in the percentage)

The result for me is that I can run my 2.8Ghz i7 CPU at 1.6Ghz and cut the fan noise down to almost nothing.

Below the quoted instructions I also added some instructions for using a VBscript to change the power plans as part of a scheduled task.


Thank you for that in-depth explanation, Timo. I appreciate it.
ID: 80166 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote

Message boards : Number crunching : Limit CPU time during night



©2024 University of Washington
https://www.bakerlab.org