how to set static frequency for intel pstate drivers? - ubuntu-14.04

I am doing some research on frequency scaling and I need to run different experiments on different static frequencies.
I can easily map a static frequency by using acpi-cpufreq drivers, but I could not manage to set a static frequency to the new intel_pstate drivers. I tried changing cpuinfo_min_freq and cpuinfo_max_freq in /sys/devices/system/cpu/cpu0/cpufreq and also try to change it from pstate-frequency -G -n and pstate-frequency -G -m, but couldn’t manage to make it work.

Actually intel_pstates is a hardware governor, so it's not possible to select a precise frequency.
To set maximum and mininum value, I use the following command:
sudo cpufreq-set -g powersave
sudo cpufreq-set -u MAX_FREQ_VALUE

Related

Is there any way in debian/ubuntu to put CPU under load until it reaches a certain temperature? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 months ago.
Improve this question
I need this for some stress testing with my CPU. It uses Linux-Debian/Ubuntu OS and I was wondering if there's any way that I could put it under load until it reaches a certain temperature.
Are there any commands, packages or bash scripts for this?
Any help is appreciated!
Download Prime95 from here or use any other CPU-Stress test that works under Debian/Ubuntu.
Get the following package:
sudo apt-get install lm-sensors
Start the sensors in terminal and update continously:
watch sensors
Now start Prime95 or your preferred stress-test and you can see cpu-temp inside terminal. Stop Stress test if cpu-temp exceeds your desired temperature. (modern cpu's are lowering clockspeed or shutting down automatically before damage from overheating is taken)
OR (automatically stopping at a user-specified temp)
Get the following packages:
sudo apt-get install lm-sensors
sudo apt-get install stress
store the following code as bashfile i.e. stresstest.sh and run it with sh /path/to/stresstest.sh
#!/bin/bash
sensors=/usr/bin/sensors
read_temp() {
# get max Packagetemp from lm-sensors
${sensors} | grep 'Package' | awk '{print int($4)}'
}
echo 'Maximum CPU-Temperature:'
# insert tjMax manually
read tjMax
echo 'Workers for testing:'
# more workers cause higher load on the cpu
read workers
echo 'starting stress-test.'
pckgMax=$( read_temp )
while [ $tjMax -gt $pckgMax ]
do
# update Packagetemp
pckgMax=$( read_temp )
# do 10sec stress-test
# if you discover high temperature overhead, try lowering the --timeout
stress --cpu ${workers} --timeout 10
done
echo 'reached tjMax.'
echo 'stopping stress-test.'
# kill this script and all running sub-processes
kill -- -0
I don't know of an existing software package (other than prime95 for max heating), but it's relatively easy to create loops with differing amounts of heat, like awk 'BEGIN{for(i=0;i<100000000;i++){}}' keeps a CPU busy for a while making some heat.
See How to write x86 assembly code to check the effect of temperature on the performance of the processor for some suggestions on creating loops that heat the CPU more vs. less.
To hit a target temperature, you'll need to write some code to implement control loop that reads the temperature (and the direction it's trending) and adjusts the load by starting/stopping threads, or changing up how power-intensive each thread is. Without this feedback, you won't consistently hit a given CPU temperature; the actual temperature for an fixed workload will depend on ambient temp, how dusty your heat-sink is, and how the BIOS manages your fan speeds, etc.
Perhaps your CPU-heating threads could branch on a global atomic variable in an outer loop, so you can change what work they do by changing a variable. e.g. 2 FMAs per clock, 1 FMA per clock, FMAs bottlenecked by latency (so 1 per 4 clocks), or just integer work, or a loop just running pause instructions, so it does the minimum. Or 256-bit vs. 128-bit vs. scalar.
Perhaps also changing your EPP setting (on Intel Skylake or newer) with sudo sh -c 'for i in /sys/devices/system/cpu/cpufreq/policy[0-9]*/energy_performance_preference;do echo performance > "$i";done' or balance_performance or balance_power (emphasize power-saving); these may affect what turbo clock speeds your CPU chooses to run at.
Read the temperature with lm-sensors, or by reading from the "coretemp" kernel driver directly on modern x86 hardware, e.g. /sys/class/hwmon/hwmon3/temp1_input reads as 36000 for 36 degrees C.
$ grep . /sys/class/hwmon/hwmon3/*
/sys/class/hwmon/hwmon3/name:coretemp
/sys/class/hwmon/hwmon3/temp1_input:36000
/sys/class/hwmon/hwmon3/temp1_label:Package id 0
/sys/class/hwmon/hwmon3/temp2_input:35000
/sys/class/hwmon/hwmon3/temp2_label:Core 0
/sys/class/hwmon/hwmon3/temp5_input:33000
/sys/class/hwmon/hwmon3/temp5_label:Core 3
I'm not sure if the temperature is available directly to user-space without the kernel's help, e.g. via CPUID, on Intel or AMD.

How to disable panning of X11 with a screen larger than the connected output without shrinking the screen?

Hi crowd intelligence,
I'm trying to configure my X11 server on a ubuntu 18.04 server in a way, so I can have a larger virtual screen than my connected output without having the output in panning mode. My system is running with an nvidia gpu.
Perfect would be, if I could achieve this programmatically.
Looking into the RandR protocol, I found that there is a method XRRSetPanning which should be able to disable panning for a certain CRTC when the x and y value are set to zero. This should be identical to what is executed when I call xrandr --output $MyOutput --panning 0x0.
The issue is, that when I do this, I get a BadValue error.
When trying to call xrandr --fb 3000x4000 --output $MyOutput --panning 1920x1080 and the output is 1920x1080 as well, I also get a BadValue. When calling xrandr --fb 3000x4000 --output $MyOutput --panning 1920x1200 the screen size gets adopted to 1920x1200 as well, which is what I don't want. I would have expected that in all cases, the screen stays 3000x4000 and that the panning is set correctly without errors...
Interesting enough, I saw this working on another machine before, so I think there is a way around it.
Having digged a bit deeper, I found, that this seems to be a feature of the nvidia driver called TwinView I suppose.
I think, that I have to disable this feature in order to achieve my intentions... The question is how... And this is where I hope that you can help me.

centOS 7 screen resolution - HyperV hosted

Just spun up centOS 7 in Hyper V and the screen resolution is 1152:864. The display is 'Unknown Display', how do I fix that and get the resolution higher? 1920x1080 at least but preferably higher.
grubby --update-kernel=ALL --args="video=hyperv_fb:1600x1200"
Run this command. Select resolution based on aspect ratio what you see. For me it was 4:3. The maximum allowed in my case was 1600x1200. Google for resolutions list based on aspect ratios.
First of all, Did you configured GPU support on Hyper-V ? This problem sounds like your Hype-V is trying to install only basic driver/software, so I'm suggesting you to check first of all Hyper-V setting more carefully.
This link may be helpful for you --> READ ME

What's the maximum baud rate in MATLAB?

Ubuntu 16.04 & MATLAB R2017a.
I'm trying to set serial port like that:
s=serial_port('/dev/ttyUSB0','BaudRate',115200,'DataBits',8,'InputBufferSize',80000)
It's working fine, but when I try to change baud rate, say 1000000.
I got this message:
Open failed: BaudRate could not be set to the specified value.
So, I have 2 question:
1) Is it possible to set not common baud rates, say 2000000?
2) I found, that 1500000 and 3000000 is working for me.
Is there maximum speed?
** UPDATE**
I know how to change the baud rate in OS, in my case (Ubuntu 16.04)
setserial is not working, so I'm using sudo stty -F /dev/ttyUSB3 3500000 (not all speed is allowed) or via asm/termios.h> -- all speed is allowed.
So, I'm using second way.
After that, I can easily listen the port like that cu -l /dev/ttyUSB0
And at the same time I cant set the speed in matlab.. (Error above)
Although this link should provide you enough information about how to manage baud rates on Matlab side, as #Cris Luengo already stated in his command, I would like to elaborate a little bit on the hardware side of the problem.
Using the following command:
stty -F /dev/ttyUSB0
you should be able to retrieve the current baud rate of the targeted device. Alternatively, the following command also retrieves that value:
setserial -ag /dev/ttyUSB0
together with other important information:
/dev/ttyUSB0, Line ..., UART: ..., Port: ..., IRQ: ...
Baud_base: ..., close_delay: ..., divisor: ...
closing_wait: ..., closing_wait2: ...
Flags: ...
OS side, you can play with the baud rate of some devices but if you want to avoid problems, you always have to set a coherent value when establishing a connection. Generally speaking, devices have a tolerance level (of, I think, no more than ±5%) on overspeed and underspeed concerning baud rate deviance... so you can try to force an arbitrary baud rate different from the current one, but you don't want to go too far from it.

tcpdump catching mac and rssi in linux

I'm trying to use a wlan adapter (TP-link TL-WN722N) in monitor mode to pick up RSS from signals in the environment (both beacons and clients). What I would like to do is to get the MAC address and RSS value into my own code somehow (preferably python). I'm planning to use these values for a rough estimate of locations of nearby devices.
I've looked into scapy, but it does not seem to provide RSS values.
tcpdump seems to be able to get both values, but I have been unable to catch client devices.
Is it possible?
If so can I filter MAC and RSS somehow?
I got it working with tcpdump!
To setup a monitor mode adapter, you first need to check which interface to use:
iw list
Select the correct phy (for me its phy1) and create an adapter (I called it moni0):
sudo iw phy phy1 interface add moni0 type monitor
Then add your adapter to the ifconfig:
sudo ifconfig moni0 up
See this guide for more details.
I used the following params for tcpdump to get the values that I needed. (you can pipe the output to your program, main.py in my case):
sudo tcpdump -n -e -tttt -vvvv -i moni0 | python main.py
You can find my project here.

Resources