CPU burn test

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
badidea
Posts: 1620
Joined: May 24, 2007 22:10
Location: The Netherlands

CPU burn test

Postby badidea » Nov 29, 2019 0:08

I'm having some cooling issues with my laptop from work (Dell E7450), so a needed some program to stress the CPU.
There are a million on-line, but writing your own is more fun.

Code: Select all

const NUM_THREAD = 8
const RUN_TIME = 60.0

'some floating point and memory action
sub burn(id as integer, runTime as double)
   dim as double ptr pArray = callocate(1024 * 1024, sizeof(double))
   if pArray <> 0 then
      print "start"; id
      dim as double tEnd = timer + runTime
      while timer < tEnd
         for i as integer = 0 to 1024 * 1024 - 1
            pArray[i] = i ^ (sqr(i) + sin(i) + tan(i))
         next
      wend
      deallocate(pArray)
   else
      print "callocate fail"
   end if
end sub

dim pThread(NUM_THREAD - 1) as any ptr
print "run for about " & RUN_TIME & " seconds"
for i as integer = 0 to ubound(pThread)
   pThread(i) = threadcall burn(i, RUN_TIME)
   sleep 100
next
for i as integer = 0 to ubound(pThread)
   threadwait pThread(i)
   print "end"; i
   sleep 1
next
print "All done"
deltarho[1859]
Posts: 2103
Joined: Jan 02, 2017 0:34
Location: UK

Re: CPU burn test

Postby deltarho[1859] » Nov 29, 2019 1:30

Nice one!

What CPU temperatures are you getting?
badidea
Posts: 1620
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: CPU burn test

Postby badidea » Nov 29, 2019 7:53

80 degrees C, with 'turbo boost' disabled.
deltarho[1859]
Posts: 2103
Joined: Jan 02, 2017 0:34
Location: UK

Re: CPU burn test

Postby deltarho[1859] » Nov 29, 2019 8:38

That is a bit warm considering it is December in a few days but then that is a heck of a workload. I hit 60°C with turbo disabled but I have a liquid cooler on board.
D.J.Peters
Posts: 7858
Joined: May 28, 2005 3:28

Re: CPU burn test

Postby D.J.Peters » Nov 29, 2019 14:31

Funy I have done a stress test for the GPU a week ago also.
After last Windows 10 Update the automatic fanspeed control of an older NVIDIA GT240 was not working anymore :-(
I got strange pink pixels while watching videos than the PC crashes (without a blue screen message) I found out the GPU cooler was never regulted by the OS/gfx driver.
Than I wrote a stress test and installed afterburner to controll the GPU fan speed manualy.
A reinstall of the lastes gfx driver doesn't enabled the fan control I don't know what's going on here but afterburner does the job now.

By the way your CPU stress test doesn't increment the CPU temp. not more than 44 grad celsius here and the CPU fan speed doesn't grow up.
(may be I must run it more than 60 seconds )

Joshy
badidea
Posts: 1620
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: CPU burn test

Postby badidea » Nov 29, 2019 16:07

D.J.Peters wrote:By the way your CPU stress test doesn't increment the CPU temp. not more than 44 grad celsius here and the CPU fan speed doesn't grow up.
(may be I must run it more than 60 seconds )

Desktop or laptop? Desktops have a larger heat sink, so longer duration is probably needed.
Also, I did not test the program on Windows yet.

I had random complete freezes on linux only, so I expected some issue in the linux kernel. But it seemed to occur more often with higher CPU load (a web-browser flash game running) and with the lid closed. This Dell laptop has a diagnostics check which can be selected on boot (F12). With 'turbo-boost' on, I have seen up to 90 deg C. To re-apply thermal paste properly, I have to completely disassemble the laptop. I did check the fan and heat pipe radiator; not too much dust.

Being a laptop from work, I could ask for a new one (~4 years old now). But Windows 10 was just installed with the latest Ubuntu Mate LTS (dual boot) and a complete disc clone. I'm not very eager to do al this again soon. I hope to postpone this to the first 'point 1' release time of Ubuntu 20.04, somewhere in August next year. Then the battery will also be wasted.
Stonemonkey
Posts: 587
Joined: Jun 09, 2005 0:08

Re: CPU burn test

Postby Stonemonkey » Nov 30, 2019 11:12

Just some thoughts, i don't know much about it but maybe more randomish memory addressing when you're accessing the array would push the cache more, then there's also the SSE units that you might not be touching with that code, depends if the compiler uses the FPU or SSE instructions, but even if it is SSE it won't be working on multiple registers in parallel.
badidea
Posts: 1620
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: CPU burn test

Postby badidea » Nov 30, 2019 20:25

The most used CU stress tool by overclockers (10 years ago) seemed to be Prime95 in 'small FFT' mode. Meaning all data fighting in L2 cache and RAM is not used (much).
There is also a cpu check / stress test tool from intel, but only for Windows.
D.J.Peters
Posts: 7858
Joined: May 28, 2005 3:28

Re: CPU burn test

Postby D.J.Peters » Dec 01, 2019 19:16

@Stonemonkey normally you need a stress test only to test the stability of your system but most important to test the cooling system (fan speed control)

In scope of cooling, such a stress test should create much heat on the CPU cores at posible.

Using short arrays for number cruncher like FFT are the most efficient solution to create heat.

The short arrays guaranteed that only the CPU caches are involved max speed is max heat !

if you use larger arrays with SSE the slower PC memory bus are used and the head is much lower as a cashe only solution.

Chache is 2-6 times faster than slow memory transfer over the PC bus.

"Max Speed = Max Heat" I hope that makes sense :-)

Joshy

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest