7

Anyone know any good math functions that causes a lot of load on the CPU. I am wanting to create a simple program the just creates load for X amount of seconds while another program monitors it. I'm just looking for functions, not actual stress testing programs.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Chris Allen
  • 653
  • 4
  • 9
  • 17
  • 1
    What CPU ? What OS ? What language ? If it's Windows or Linux x86 then calling stuff in Intel's IPP library will certainly crank up the CPU core temperature. – Paul R Mar 05 '11 at 18:43
  • Knowing the language, framework and/or platform might help. – Paul Sasik Mar 05 '11 at 18:43
  • you could develop a mathematical sequence like the fibonacci sequence... Matrix operations like calculating the inverse, adjoint or solving large equation systems... partial differential equations... etc. – sled Mar 05 '11 at 18:44

3 Answers3

3

Try the Lucas-Lehmer primality test. It's what's used in the Prime95 executable, and Prime95's fairly standard for CPU stress testing.

Marc B
  • 356,200
  • 43
  • 426
  • 500
3

The Computer Language Benchmark Game has quite a few benchmarks, many of which are math-based. It's a good source because the source code for each algorithm is included and there are implementations of each benchmark in dozens of languages. That way, you can just use the implementation in whatever language you're comfortable compiling and running.

Rafe Kettler
  • 75,757
  • 21
  • 156
  • 151
0

A naive implementation of Fibonacci? Something like:

let fib = Seq.unfold(fun (p, c) -> Some((p, c), (c, p+c))) (1,1)
vcsjones
  • 138,677
  • 31
  • 291
  • 286