Re: using intel i5 freqency governors

2021-12-03 Thread Tixy
On Fri, 2021-12-03 at 10:19 -0500, Stefan Monnier wrote:
> > I get 'powersave' as default too. According to the ArchWiki site
> > [1]
> > modern Intel CPUs use the intel_pstate driver which selects
> > 'powersave'
> > by default, and it goes on to say:
> > 
> >    The intel_pstate driver supports only two governors: powersave
> > and
> >    performance. Although they share the name with the generic
> >    governors, they do not work in the same way as the generic
> >    governors.
> 
> Hmm... on my machine I don't have the `intel_pstate` loaded,
> apparently.
> Doing `modprobe intel_pstate` does nothing (no output, no error,
> nothing
> in `dmesg` either).  Maybe my i3-4170 CPU is too old and it silently
> bows out (and then some other part of the default config favors
> `schedutil` over `powersave` when intel_pstate is not in use)?

The ArchWiki page [1] says of intel_pstate:

   This driver implements a scaling driver with an internal governor for
   Intel Core (Sandy Bridge and newer) processors. 
   
So yours is new enough. The docs on kernel.org [2] say it's Sandy
Bridge too.

On my kernel, the module is built-in to the kernel...

$cat /lib/modules/$(uname -r)/modules.builtin | grep pstate
kernel/drivers/cpufreq/intel_pstate.ko

And its sysfs directory exists...

$ ls -ld /sys/devices/system/cpu/intel_pstate
drwxr-xr-x 2 root root 0 Dec  3 07:52 /sys/devices/system/cpu/intel_pstate


[1] https://wiki.archlinux.org/title/CPU_frequency_scaling
[2] https://www.kernel.org/doc/html/v4.19/admin-guide/pm/intel_pstate.html

-- 
Tixy



Re: using intel i5 freqency governors

2021-12-02 Thread Lee
On 12/2/21, Stefan Monnier  wrote:
> How do I get the intel cpu "turbo boost" fully engaged when I'm
> running my script and go back into power save mode when the machine is
> idle?
>>>
>>> That should be the default behavior (i.e. if you don't touch any cpu
>>> power configuration).
>>
>> Unfortunately, it clearly is _not_ the behavior I get.  .. and I
>> hadn't touched any power config until I was trying things to get my
>> 900 second execution time down around the 600 seconds it takes on the
>> windows/cygwin machine.
>
> You might want to try and figure out why you get `powersave` as default
> governor,

How much weight should a debian user give the arch linux wiki?
Because that says you get powersave as the default:
  https://wiki.archlinux.org/title/CPU_frequency_scaling

> but until you've figured it out, you might like to force the
> use of the `schedutil` governor instead which should give you the same
> kind of speed as the `performance` governor under load while reverting
> to low-power state afterwards.

I'll take a look at it - thanks
Lee



Re: using intel i5 freqency governors

2021-12-02 Thread Tixy
On Thu, 2021-12-02 at 08:02 +, Tixy wrote:
> On Thu, 2021-12-02 at 00:38 -0500, Stefan Monnier wrote:
> > > > > 
> > [...]
> > You might want to try and figure out why you get `powersave` as
> > default governor, but until you've figured it out, you might like
> > to force the use of the `schedutil` governor instead
> 
> I get 'powersave' as default too. According to the ArchWiki site [1]
> modern Intel CPUs use the intel_pstate driver which selects 'powersave'
> by default

I should also add, I have no problem with CPU frequency automatically
boosting when needed...

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 
800101
$ while : ; do : ; done &
[1] 4817
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 
4600947
$ kill 4817
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 
800174

So that's 0.8GHz -> 4.6GHz -> 0.8GHz

-- 
Tixy



Re: using intel i5 freqency governors

2021-12-02 Thread Tixy
On Thu, 2021-12-02 at 00:38 -0500, Stefan Monnier wrote:
> > > > 
> [...]
> You might want to try and figure out why you get `powersave` as
> default governor, but until you've figured it out, you might like
> to force the use of the `schedutil` governor instead

I get 'powersave' as default too. According to the ArchWiki site [1]
modern Intel CPUs use the intel_pstate driver which selects 'powersave'
by default, and it goes on to say:

   The intel_pstate driver supports only two governors: powersave and
   performance. Although they share the name with the generic
   governors, they do not work in the same way as the generic
   governors.
   
[1] https://wiki.archlinux.org/title/CPU_frequency_scaling

-- 
Tixy



Re: using intel i5 freqency governors

2021-12-01 Thread David Christensen

On 12/1/21 9:08 PM, Lee wrote:

Hi,

On 12/1/21, David Christensen  wrote:

On 12/1/21 8:58 AM, Lee wrote:

The short story is that I have an Intel i3 windows 10 desktop with
cygwin installed and an Intel i5 debian desktop.  One of my scripts
takes about 10 minutes to run on the windows/i3 and 15 minutes on the
debian/i5!  ick

if i do
$ sudo cpupower frequency-set -g performance

then it takes about 10 minutes to run the script on the i5, **but**
the cpu frequency never drops down to power-saving mode when the
machine is idle - eg
$ sudo cpupower -c all frequency-info | grep 'call to kernel'
current CPU frequency: 3.99 GHz (asserted by call to kernel)
current CPU frequency: 3.95 GHz (asserted by call to kernel)
current CPU frequency: 4.01 GHz (asserted by call to kernel)
current CPU frequency: 3.91 GHz (asserted by call to kernel)
current CPU frequency: 3.96 GHz (asserted by call to kernel)
current CPU frequency: 4.00 GHz (asserted by call to kernel)



That is expected.  Performance runs the CPU at maximum frequency all of 
the time.





and more annoying, setting the frequency governor back to powersave
doesn't seem to drop the frequency all that much

$ sudo cpupower frequency-set -g  powersave
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5

$ sudo cpupower -c all frequency-info | egrep 'call to kernel|The
governor'
The governor "powersave" may decide which speed to use
current CPU frequency: 3.85 GHz (asserted by call to kernel)
The governor "powersave" may decide which speed to use
current CPU frequency: 3.58 GHz (asserted by call to kernel)
The governor "powersave" may decide which speed to use
current CPU frequency: 4.01 GHz (asserted by call to kernel)
The governor "powersave" may decide which speed to use
current CPU frequency: 3.55 GHz (asserted by call to kernel)
The governor "powersave" may decide which speed to use
current CPU frequency: 3.66 GHz (asserted by call to kernel)
The governor "powersave" may decide which speed to use
current CPU frequency: 3.57 GHz (asserted by call to kernel)



That is a problem.




How do I get the intel cpu "turbo boost" fully engaged when I'm
running my script and go back into power save mode when the machine is
idle?



I leave my governor at the default value (powersave) all of the time.



Which i3?


Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz



That should run a single-threaded program at 3.90 GHz.



  i5?


Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz



That should run a single-threaded program at 4.10 GHz.



There's an  'Operating frequency' graph at
   
https://www.cpu-world.com/Compare/414/Intel_Core_i3_i3-7100_vs_Intel_Core_i5_i5-9400.html
comparing the i3 to the i5.  It looks like they should be roughly even
.. which they seem to be if I do the
   sudo cpupower frequency-set -g performance
before running the script.



Sites like that typically use benchmarks that use all available cores. 
I looked at the Intel site to get the single-threaded numbers, above:


https://ark.intel.com/content/www/us/en/ark/compare.html?productIds=134898,97455



  Debian?  Linux?


  Debian 11 .. which is linux - yes?



Linux is the kernel.  'uname -a' (below) gives that information.



I assume your script is single-threaded (?).


You assume correctly :)



I am unfamiliar with 'cpupower'.  I use cpufreq-set(1) to set the
governor and the Xfce panel applet "CPU Frequency Monitor" to monitor
the CPU frequency and/or governor.


The CPU Frequency Monitor applet seems to work only if you're root :(



It is unwise to run a graphical desktop as root.


CPU Frequency Monitor works correctly with my normal account on Debian 9 
and 10.  I have not tried 11.



I added it to my xfce panel and it just says 0.80Ghz -- 



Right click on it, choose Properties, and set Display CPU to "max". 
Then run some CPU intensive programs and watch if the frequency 
displayed changes.





I've got the XFCE panel applet CPU Graph that never shows much of any
cpu usage. and the cli program top which will show 99.9% cpu busy when
I'm running meld on a pair of 500K line files (which seems very
excessive unless meld is multi-threaded).



That means meld is using one core 99.9%.  A parallel program should show 
the program on several lines with CPU utilization anywhere between 0 and 
100%.




My compute-bound single-threaded scripts cause the CPU frequency to
increase to maximum on my quad-core i7:

2021-12-01 17:48:27 root@tinkywinky ~
# cat /etc/debian_version ; uname -a ; cpufreq-info -p
9.13
Linux tinkywinky 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 (2021-07-19)
x86_64 GNU/Linux
80 330 powersave


Mine says:
# cat /etc/debian_version ; uname -a ; cpufreq-info -p
11.1
Linux spot 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux
80 410 powersave




Re: using intel i5 freqency governors

2021-12-01 Thread Stefan Monnier
 How do I get the intel cpu "turbo boost" fully engaged when I'm
 running my script and go back into power save mode when the machine is
 idle?
>>
>> That should be the default behavior (i.e. if you don't touch any cpu
>> power configuration).
>
> Unfortunately, it clearly is _not_ the behavior I get.  .. and I
> hadn't touched any power config until I was trying things to get my
> 900 second execution time down around the 600 seconds it takes on the
> windows/cygwin machine.

You might want to try and figure out why you get `powersave` as default
governor, but until you've figured it out, you might like to force the
use of the `schedutil` governor instead which should give you the same
kind of speed as the `performance` governor under load while reverting
to low-power state afterwards.


Stefan



Re: using intel i5 freqency governors

2021-12-01 Thread Lee
On 12/2/21, Stefan Monnier  wrote:
>>> The short story is that I have an Intel i3 windows 10 desktop with
>>> cygwin installed and an Intel i5 debian desktop.
>
> [ Side note: terms like `i3` and `i5` are basically marketing names
>   equivalent to "cheap" and "average price".  They do not correspond to
>   any specific set of features nor any specific performance level, so
>   they're of no technical relevance other than saying something like "an
>   intel CPU from ≥2009 with an amd64 instruction set".  ]

I found this site that compares the two cpus I have
https://www.cpu-world.com/Compare/414/Intel_Core_i3_i3-7100_vs_Intel_Core_i5_i5-9400.html

>>> How do I get the intel cpu "turbo boost" fully engaged when I'm
>>> running my script and go back into power save mode when the machine is
>>> idle?
>
> That should be the default behavior (i.e. if you don't touch any cpu
> power configuration).

Unfortunately, it clearly is _not_ the behavior I get.  .. and I
hadn't touched any power config until I was trying things to get my
900 second execution time down around the 600 seconds it takes on the
windows/cygwin machine.

> In that case, /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
> should usually say `schedutil` nowadays AFAIK (which has replaced the
> previous default of `ondemand`).

hrmm...  I get
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
powersave

$ sudo cpupower frequency-set -g performance
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5

$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance

Lee



Re: using intel i5 freqency governors

2021-12-01 Thread Lee
Hi,

On 12/1/21, David Christensen  wrote:
> On 12/1/21 8:58 AM, Lee wrote:
>> The short story is that I have an Intel i3 windows 10 desktop with
>> cygwin installed and an Intel i5 debian desktop.  One of my scripts
>> takes about 10 minutes to run on the windows/i3 and 15 minutes on the
>> debian/i5!  ick
>>
>> if i do
>> $ sudo cpupower frequency-set -g performance
>>
>> then it takes about 10 minutes to run the script on the i5, **but**
>> the cpu frequency never drops down to power-saving mode when the
>> machine is idle - eg
>> $ sudo cpupower -c all frequency-info | grep 'call to kernel'
>>current CPU frequency: 3.99 GHz (asserted by call to kernel)
>>current CPU frequency: 3.95 GHz (asserted by call to kernel)
>>current CPU frequency: 4.01 GHz (asserted by call to kernel)
>>current CPU frequency: 3.91 GHz (asserted by call to kernel)
>>current CPU frequency: 3.96 GHz (asserted by call to kernel)
>>current CPU frequency: 4.00 GHz (asserted by call to kernel)
>>
>> and more annoying, setting the frequency governor back to powersave
>> doesn't seem to drop the frequency all that much
>>
>> $ sudo cpupower frequency-set -g  powersave
>> Setting cpu: 0
>> Setting cpu: 1
>> Setting cpu: 2
>> Setting cpu: 3
>> Setting cpu: 4
>> Setting cpu: 5
>>
>> $ sudo cpupower -c all frequency-info | egrep 'call to kernel|The
>> governor'
>>The governor "powersave" may decide which speed to use
>>current CPU frequency: 3.85 GHz (asserted by call to kernel)
>>The governor "powersave" may decide which speed to use
>>current CPU frequency: 3.58 GHz (asserted by call to kernel)
>>The governor "powersave" may decide which speed to use
>>current CPU frequency: 4.01 GHz (asserted by call to kernel)
>>The governor "powersave" may decide which speed to use
>>current CPU frequency: 3.55 GHz (asserted by call to kernel)
>>The governor "powersave" may decide which speed to use
>>current CPU frequency: 3.66 GHz (asserted by call to kernel)
>>The governor "powersave" may decide which speed to use
>>current CPU frequency: 3.57 GHz (asserted by call to kernel)
>>
>>
>> How do I get the intel cpu "turbo boost" fully engaged when I'm
>> running my script and go back into power save mode when the machine is
>> idle?
>>
>> Thanks
>> Lee
>
>
> Which i3?

Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz

>  i5?

Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz

There's an  'Operating frequency' graph at
  
https://www.cpu-world.com/Compare/414/Intel_Core_i3_i3-7100_vs_Intel_Core_i5_i5-9400.html
comparing the i3 to the i5.  It looks like they should be roughly even
.. which they seem to be if I do the
  sudo cpupower frequency-set -g performance
before running the script.

But then I do
  sudo cpupower frequency-set -g  powersave
after the script completes and the machine doesn't drop down to much
of a lower frequency when it's idle:(  I had to reboot to get the cpu
frequency down around 800Mhz again.

>  Debian?  Linux?

 Debian 11 .. which is linux - yes?

> I assume your script is single-threaded (?).

You assume correctly :)


> I am unfamiliar with 'cpupower'.  I use cpufreq-set(1) to set the
> governor and the Xfce panel applet "CPU Frequency Monitor" to monitor
> the CPU frequency and/or governor.

The CPU Frequency Monitor applet seems to work only if you're root :(
I added it to my xfce panel and it just says 0.80Ghz -- which matches
what I get running cpupower as a lowly user:

$ cpupower -c all frequency-info | grep 'call to kernel'
  current CPU frequency: 800 MHz (asserted by call to kernel)
  current CPU frequency: 800 MHz (asserted by call to kernel)
  current CPU frequency: 800 MHz (asserted by call to kernel)
  current CPU frequency: 800 MHz (asserted by call to kernel)
  current CPU frequency: 800 MHz (asserted by call to kernel)
  current CPU frequency: 800 MHz (asserted by call to kernel)

lee@spot ~
$ sudo cpupower -c all frequency-info | grep 'call to kernel'
[sudo] password for lee:
  current CPU frequency: 3.50 GHz (asserted by call to kernel)
  current CPU frequency: 810 MHz (asserted by call to kernel)
  current CPU frequency: 947 MHz (asserted by call to kernel)
  current CPU frequency: 3.13 GHz (asserted by call to kernel)
  current CPU frequency: 1.52 GHz (asserted by call to kernel)
  current CPU frequency: 992 MHz (asserted by call to kernel)


I've got the XFCE panel applet CPU Graph that never shows much of any
cpu usage. and the cli program top which will show 99.9% cpu busy when
I'm running meld on a pair of 500K line files (which seems very
excessive unless meld is multi-threaded).


> My compute-bound single-threaded scripts cause the CPU frequency to
> increase to maximum on my quad-core i7:
>
> 2021-12-01 17:48:27 root@tinkywinky ~
> # cat /etc/debian_version ; uname -a ; cpufreq-info -p
> 9.13
> Linux tinkywinky 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 

Re: using intel i5 freqency governors

2021-12-01 Thread Nicholas Geovanis
On Wed, Dec 1, 2021, 8:06 PM David Christensen 
wrote:

> .
> But, the best answer is to rewrite your script as a parallel program.
> The challenge is: what programming language?  Shells can do simple
> parallelism via background tasks, if you can break up your script
> suitably.  I have been beating my head against multi-threaded Perl for
> several years, but I do not recommend it.  If you want a recent
> programming language designed for parallel programming, an obvious
> choice is Go.  Erlang is older, very robust, and adds distributed



You can save yourself some trouble by using a parallel or distributed
shell. The two that come to mind are pdksh and IBM's distributed shell dsh.
Then you can write shell scripts in more familiar ways that are concurrent
without learning a new language or environment.


> David
>
>


Re: using intel i5 freqency governors

2021-12-01 Thread David Christensen

On 12/1/21 8:58 AM, Lee wrote:

The short story is that I have an Intel i3 windows 10 desktop with
cygwin installed and an Intel i5 debian desktop.  One of my scripts
takes about 10 minutes to run on the windows/i3 and 15 minutes on the
debian/i5!  ick

if i do
$ sudo cpupower frequency-set -g performance

then it takes about 10 minutes to run the script on the i5, **but**
the cpu frequency never drops down to power-saving mode when the
machine is idle - eg
$ sudo cpupower -c all frequency-info | grep 'call to kernel'
   current CPU frequency: 3.99 GHz (asserted by call to kernel)
   current CPU frequency: 3.95 GHz (asserted by call to kernel)
   current CPU frequency: 4.01 GHz (asserted by call to kernel)
   current CPU frequency: 3.91 GHz (asserted by call to kernel)
   current CPU frequency: 3.96 GHz (asserted by call to kernel)
   current CPU frequency: 4.00 GHz (asserted by call to kernel)

and more annoying, setting the frequency governor back to powersave
doesn't seem to drop the frequency all that much

$ sudo cpupower frequency-set -g  powersave
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5

$ sudo cpupower -c all frequency-info | egrep 'call to kernel|The governor'
   The governor "powersave" may decide which speed to use
   current CPU frequency: 3.85 GHz (asserted by call to kernel)
   The governor "powersave" may decide which speed to use
   current CPU frequency: 3.58 GHz (asserted by call to kernel)
   The governor "powersave" may decide which speed to use
   current CPU frequency: 4.01 GHz (asserted by call to kernel)
   The governor "powersave" may decide which speed to use
   current CPU frequency: 3.55 GHz (asserted by call to kernel)
   The governor "powersave" may decide which speed to use
   current CPU frequency: 3.66 GHz (asserted by call to kernel)
   The governor "powersave" may decide which speed to use
   current CPU frequency: 3.57 GHz (asserted by call to kernel)


How do I get the intel cpu "turbo boost" fully engaged when I'm
running my script and go back into power save mode when the machine is
idle?

Thanks
Lee



Which i3?  i5?  Debian?  Linux?


I assume your script is single-threaded (?).


I am unfamiliar with 'cpupower'.  I use cpufreq-set(1) to set the 
governor and the Xfce panel applet "CPU Frequency Monitor" to monitor 
the CPU frequency and/or governor.  The latter tool lets me choose a 
specific core, minimum, average, or maximum frequency.



My compute-bound single-threaded scripts cause the CPU frequency to 
increase to maximum on my quad-core i7:


2021-12-01 17:48:27 root@tinkywinky ~
# cat /etc/debian_version ; uname -a ; cpufreq-info -p
9.13
Linux tinkywinky 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 (2021-07-19) 
x86_64 GNU/Linux

80 330 powersave


Perhaps your governor is somehow broken?


But, the best answer is to rewrite your script as a parallel program. 
The challenge is: what programming language?  Shells can do simple 
parallelism via background tasks, if you can break up your script 
suitably.  I have been beating my head against multi-threaded Perl for 
several years, but I do not recommend it.  If you want a recent 
programming language designed for parallel programming, an obvious 
choice is Go.  Erlang is older, very robust, and adds distributed 
programming, but the syntax is very different (Prolog based).  I 
attempted Clojure, but never got off the ground.  There are other choices.



David



Re: using intel i5 freqency governors

2021-12-01 Thread Johann Klammer
those powermanagement things are always broken.