PDA

View Full Version : CPU temperature



Jonax
14-01-2023, 05:23 PM
Fellow Pascal game developers!


I'm happy to show the first achievement in the new year 2023.
Accessing and processing some data from my new NUC system's temperature sensors.


Program for data access written in Lazarus Pascal, animated GIF generated with GIMP. OS is Debian.


The GIF below shows the temperature during the process of generating an animated GIF with GIMP.
Total shown time 24 minutes. The red area is the CPU temperature, the blue line is the NVMe, which happens to be a WD Blue.
The green dots are for something Intel calls package temperature.


https://jonax.se/pic/temp/NUC-temperature.gif


The image may be removed from the server at some later time

SilverWarior
15-01-2023, 02:36 PM
Interesting. Which library are you using for accessing HW data?

Jonax
15-01-2023, 06:53 PM
I have no idea which library is involved in accessing the data.

it seems as for (my) Linux system the sensor data can be collected from plain text files located in one of four following directories:


/sys/class/hwmon/hwmon0/
/sys/class/hwmon/hwmon1/
/sys/class/hwmon/hwmon2/
/sys/class/hwmon/hwmon3/

It also seems as the sensors are assigned different directories after each restart.

Fortunately there are only four directories (in my system) and there is a plain text file named 'name' in each directory saying which sensors were assigned there during the last/current restart.

/sys/class/hwmon/hwmon'*/name

So first make a routine to check which directory to look in and then retrieve the actual data from files of the type

/sys/class/hwmon/hwmon*/temp*_input

Then you do whatever magic you want to do with this temperature data :)
it seems the temperature files are updated every 2 seconds.

From what I read different systems behave differently. So I guess it depends on what you got under the hood. So far I have only tried this on my own computer.

SilverWarior
16-01-2023, 09:16 AM
So you are just parsing files that were stored by some other sensor monitoring program.

Jonax
16-01-2023, 06:15 PM
So you are just parsing files that were stored by some other sensor monitoring program.

I guess. Makes it incredibly convenient, except for the minor hassle of deciding where to look. I have no idea how the data ends up in those files. I certainly haven't installed any monitoring program. I guess I have to thank team Linux and Intel and some unknown heroes.

SilverWarior
17-01-2023, 01:01 PM
I guess. Makes it incredibly convenient, except for the minor hassle of deciding where to look. I have no idea how the data ends up in those files. I certainly haven't installed any monitoring program. I guess I have to thank team Linux and Intel and some unknown heroes.

Well Linux actually has The Linux Hardware Monitoring kernel API https://docs.kernel.org/hwmon/hwmon-kernel-api.html that allows easy and standardized monitoring of computer hardware. It even allows of dumping information to files like the one you are using.
Now I don't know enough about Linux to tell you where and how you can set this up. I do know here are several programs that do make this much easier. And there is available API that you can use directly from your program to retrieve current information. But i haven't seen readily library for pascal so far.

Jonax
23-01-2023, 03:28 PM
Thanks for input. :) Those suggestions seems useful. However currently for my part there is no pressing need to get access to more precise temperature data. I made this quick attempt mostly to get an idea about my own system's general temperture behaviour before and after the next project - removing the fan, for passive cooling. Haven't begun that procedure yet, got to get a special case for cooling first. Last time I tried this the main problem was to get the system out from the pretty tightly built NUC case without causing too much damage. Actually I lost the microphone and the WiFi + Bluetooth last time. Still it was worth it because the result was a totally silent PC.

For the future it could be cool to include cpu temperature feedback in some game. Alas that will not happen, at least not in near time. :)

SilverWarior
23-01-2023, 09:14 PM
I made this quick attempt mostly to get an idea about my own system's general temperture behaviour before and after the next project - removing the fan, for passive cooling. Haven't begun that procedure yet, got to get a special case for cooling first. Last time I tried this the main problem was to get the system out from the pretty tightly built NUC case without causing too much damage. Actually I lost the microphone and the WiFi + Bluetooth last time. Still it was worth it because the result was a totally silent PC.

Making a passive cooled PC so it can be completely silent is an intriguing idea. An idea that I was considering several years ago after seeing Passive cooling built from Linus Tech Tips YouTube channel.
But I never went through with it since I realized that passive cooling has one big flaw. And that is that it is heavily dependent of ambient temperature. After doing some thermodynamics calculations I realized that such approach would not work for me. Why? Since I don't have any AC in my house during summer temperature in my house could reach even to 28 degrees Celsius which is 5 to 7 degrees more that I have during winter time. And this 5-7 degrees temperature difference of ambient temperature would mean 15-20 degrees diference in temperature of passively cooled components.

Jonax
24-01-2023, 06:52 PM
I haven't done any thermodynamic calculations on the problem but I really have used a few passively cooled computers for years now. I have roughly the same indoor temperature as you, though cooler in winter time, because heating is expensive. No AC in the summer so can indeed be pretty warm some days. 8)


So far I haven't experienced any overheating problems but I'm not taxing the systems so much. I don't write code fast enough to make the PC burn.


In my case the systems are low end low power (and low electricity bill) processors. The last one a J 5005 Pentium system on a chip and before that J 1900 Celeron. Integrated graphics. Those systems are not producing sooo much waste heat, which simplifies the passive cooling. The Celeron system is a backbone from shuttle.eu with some heat-pipe / heatsink combination. That one still runs but is annoyingly slow nowadays. The newer Pentium was bought as a NUC and unfortunately I damaged it a bit while removing the case. Anyway.. most of it still works and I bought a case from AKASA constructed for passive cooling but lacking heat-pipes, it seemes. So now the whole case does the job as a heatsink. The system is running well. The case do tend to get warm as it's supposed to, but not dramatically. I don't think it's hot enough to fry eggs on it. 8)


All in all I think you could realistically get a fanless computer for home use if you one day decide to get a new one. That is if you can make do with low end computer. There are no doubt fanless high end computers too but I haven't explored that market much. A Pentium is sufficient for me. Most of the time. ;D

SilverWarior
24-01-2023, 10:40 PM
In my case the systems are low end low power (and low electricity bill) processors. The last one a J 5005 Pentium system on a chip and before that J 1900 Celeron. Integrated graphics. Those systems are not producing sooo much waste heat, which simplifies the passive cooling. The Celeron system is a backbone from shuttle.eu with some heat-pipe / heatsink combination. That one still runs but is annoyingly slow nowadays.

Well you really don't need much for cooling this kind of computers. I mean we are talking here about 10 W TDP. I'm wondering if using heat-pipes in such applications is even viable. Heat-pipes do need to reach certain temperature before they are effective at transferring heat. You could probably get away by using solid copper pipe or simply transferring heat to a decent sized aluminium casing using thermal pads.

Any way since you are interested in such computer types I strongly recommend you check AMD Ryzen Embeded solutions https://www.amd.com/en/products/embedded-minipc-solutions
With last two Ryzen generations AMD managed to greatly increase performance per watt. Not to mention that embedded graphics solution that AMD provides are more than capable of 4K video output. This gave AMD ability to beat Inter in mini PC market. But it is still behind ARM based solutions. And Apple M1 and M2 processors also stirred the market quite a bit.


All in all I think you could realistically get a fanless computer for home use if you one day decide to get a new one. That is if you can make do with low end computer. There are no doubt fanless high end computers too but I haven't explored that market much. A Pentium is sufficient for me. Most of the time. ;D

Unfortunately my computing demands are quite larger than yours therefore making passive cooling much less viable solution.
So instead lately I'm thinking about making myself a custom PC case that would rely on using air ducts for routing cold air to where it is needed most. Unfortunately existing case solutions don't provide enough room for the needed duct system. Therefore I'm actually considering of making a custom PC case from wood. Why from wood you ask? Wood is much easier to work with than metals and it is also good for sound dampening.

Jonax
27-01-2023, 06:31 PM
AMD certainly has done great stuff recently. Their integrated graphics seems to be really good. Maybe my next computer will be an AMD, or an ARM. But for now I can't buy yet a new computer. Got to make do with what I have until pressing need for a new one. Typically those pressing needs occur every four years or so. For various reasons.


I also hear that ARM or perhaps RISC is the future. From my point of view it doesn't matter much as long as they can be built fan-less and team Lazarus supports that architecture. Of course losing access to a lot of old software and probable problems with peripherals is a hassle. I still have an ancient Win 7 laptop only for occsionally using an ancient but fully operational scanner. It also has Minesweeper.


Your wooden case/ air duct system sounds interesting. Please keep us updated and let us know if/when you pursue that path.


There are no doubt a plethora of possible solutions to the fan-noise problem out there.


Any other forum member having some clever solution to share?

Chebmaster
10-02-2023, 06:15 AM
something Intel calls package temperature.
That thing is quite treacherous. I was monitoring my laptop for more than a decade with SpeedFan in Win7. There are three temps, ACPI, Intel Core 0 and Intel Core 1. The acpi one follows the core 0 graph closely, a bit more smoothed, with core 1 colder, zigzagging likewise a bit below them. No notable surprises in this behavior in 10 years.

Then, suddenly, I play Brutal Doom and get a huuge overdraw and fps slowdown: it's Intel integrated gpu and I am guarding a doorway rushed by half the monsters on the map (random map generator sometimes makes things FUN), like 300 spartans with a bfg. Of course the doorway gets splattered over with so many layers of blood decals it brings Intel HD 3000 to its knees.

But there's the interesting part: I look at the graph and suddenly see this "package temperature" soaring towards 90C, away from the cores steadily zigzagging around 75.
Conclusion: it's the only sensor that takes gpu into consideration - and that gpu *could* heat up horribly in rare, rare circumstances.
I'd provide a screenshot (a screnshot is worth a thousand words) but my site's Let'sEncrypt config is broken and I am still too lazy to fix it.

Real use cases, wild and woolly, always have untold number of surprises in store.

SilverWarior
10-02-2023, 02:44 PM
But there's the interesting part: I look at the graph and suddenly see this "package temperature" soaring towards 90C, away from the cores steadily zigzagging around 75.
Conclusion: it's the only sensor that takes gpu into consideration - and that gpu *could* heat up horribly in rare, rare circumstances.

If you call that rare circumstances then I guess you are one of the smarter people that keeps V-Sync enabled all the time.
There are so many games (both Indy and AAA) that are literally capable of melting integrated GPU's when simply left at main menu since it reaches so high FPS there. High FPS even when doing simple 2D rendering of main menu can still cause High GPU utilization and when you consider that in order to reach such high FPS the CPU also needs to send lots of render calls to the GPU (high utilization of at least one CPU core) you can quickly understand why this can be so dangerous.

I'd provide a screenshot (a screnshot is worth a thousand words) but my site's Let'sEncrypt config is broken and I am still too lazy to fix it.

Real use cases, wild and woolly, always have untold number of surprises in store.[/QUOTE]

Chebmaster
11-02-2023, 09:39 AM
I guess you are one of the smarter people that keeps V-Sync enabled all the time.
Nope.
HD 3000 is just that wimpy.
OpenArena (a quake3 clone) only can 60 fps at 1024x768
Factorio ran ~25fps on minimals, causes an overheat shutdown, stopped playing @this machine
Team Fortress 2 ran ~30fps on minimals, causes an overheat shutdown, stopped playing @this machine
So, I only play outdated Zandronum + Brutal Doom here, at 1280x720, at that.

Note that I managed to heat it to 85C once, by rendering a rotating cube with immense supersampling (more than 4k, AFAIR) downsampled to FullHD in a pixel shader.
But even then, the package graph never strayed far from the Core 0 graph.

Hmm... The circumstances were quite specific: tons of overdraw *but* most of those decals were the same texture, quite stretched.
Maybe the gpu in my case is always limited by how much system memory bandwidth it could scrounge -- but if all textures fit in its own cache it has a chance to go all out and clock up?

SilverWarior
12-02-2023, 03:21 PM
Nope.
HD 3000 is just that wimpy.

Can't comment on other games but I do know that Factorio is CPU heavy game that actually supports mutit-hreading and thus can fully utilize both of your CPU cores. Having bigger base in Factorio can cause FPS drop even on my Acer Aspire 6530 laptop with 2 Core AMD Athlon processor since it maxes out both CPU cores. At the same time dedicated ATI Mobility Radeon HD 3200 graphics card never even reaches toward full utilization. And yes this is laptop that is actually capable of running original Crysis albeit on minimal settings.

Any way when was the last time you tried playing Factorio on your laptop?
Factoprio developers managed to do some huge optimizations of the game before its full release like optimized belt simulation, optimized robotic path-finding and simulation, massively optimized biter path-finding, redesigned pipe fluid simulation, masive path-finding, collision detection and overall simulation of trains and much more.
They even managed to make some improvements of rendering pipeline and thus improving performance even on low end computers with integrated graphic cards.

Any way in order to see if your computer is CPU or GPU bound I would recommend using tools like Process Explorer (https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer) that can monitor your system utilization in real time. This was most used application on my laptop since it allowed me to track down any background processed that could hog down my computer. Not to mention that with its help I managed to adjust graphics settings of individual games to the point where neither my CPU or GPU would be fully utilized.

Jonax
21-02-2023, 04:22 PM
I had no idea what the 'package temperature' was. Nice to have an idea about that now.


I can add that what I call CPU temperature is actually from Core 1. I got 4 cores but so far they've all shown the same value when I check so I simplified things by just logging Core 1.


CPU vs GPU constrained:


For my part the GPU is mostly not a problem. I don't play modern games and the games I make are 2D and not very demanding for the hardware.


Most of the time the integrated graphics is enough for me. First time I noticed a GPU limit at all was like 5 years ago when the monitor crashed and I bought a larger one. Then the old J1900 integrated graphics turned out to be inadequate for watching movies. That was one big motivation to buy a newer PC and then I got a J 5005 pentium and just recently also the latest Pentium dedicated for Linux.


My programming project. I'm dabbling with yet a Linux mini game with short playtime and low hardware demands. Working title:


"Vesta forever"


I hope to be able to present a beta any week now. Then looking forward to feedback from the community for further polishing..