14

I need to stress my rMBP components (e.g. CPU/GPU/RAM) without loading any additional software tools.

Background - My rMBP has a hardware fault (similar to this issue) which causes system freezes that only manifests itself once it has been in use for hours and is under daily load (freezes 4/5 times a day on average) - I can use geekbench which causes the system to freeze quite quickly but want to reproduce the error quickly with no 3rd party software installed so to show genius team that the problem can be reproducible of a fresh install of High Sierra & without any 3rd party software installed just to speed up the process of diagnoses & eliminate user error.

Currently I'm watching 4K youtube videos & visiting greensock.com to get Safari to stress & trying to open photos but the machine isn't even noticing the extra load!

  • Use the compress option to deal with some files : a couple of fokders full of data... – Solar Mike Mar 10 '18 at 10:20
  • 25
    Get it a mortgage, credit card debt, a dead end job with a boss who's impossible to please and two kids in private school about to graduate and enter college; it'll be stressed out in no time. – Allan Mar 10 '18 at 16:03
  • 2
    You can always try the Apple Diagnostics self-test. – SilverWolf - Reinstate Monica Mar 10 '18 at 17:35
  • Posted as a comment since it doesn't really answer the question. But my favorite way to stress-test a Mac is to run BOINC. Run something like SETI@Home on each core plus the GPU. Definitely is 3rd party though. – l008com Mar 11 '18 at 8:02
17

Consuming All the CPU Cores

The command below runs a yes instance for each CPU core and consumes a near maximum of the computer's processing capability:

CPU=$(sysctl -n hw.ncpu)
seq $CPU | xargs -I{} -P $CPU yes > /dev/null

The command builds upon Mike's answer, but runs multiple instances of yes with xargs. One yes process will max out a CPU core, so multiple processes are needed. Thanks to @lights0123 for refining this command.

This deals with the CPU but not GPU or RAM.

CPU + GPU = WebGL

To stress the CPU and GPU, visit ShibuyaCrowd, a WebGL experiment (open source).

A minute after running this site, your MacBook Pro should be under reasonable computational load.

enter image description here

  • 3
    To automatically get the number of cores, CPU="$(sysctl -n hw.ncpu)" seq $CPU | xargs -I{} -P $CPU yes > /dev/null will work. – lights0123 Mar 10 '18 at 15:43
  • Thank you. I have added your suggestion into the answer. – Graham Miln Mar 10 '18 at 16:37
  • 7
    Your yes technique will heat the CPU up, but won't really stress it: it barely touches the caches, doesn't do anything with the floating-point calculation units, and for that matter, barely touches the integer-arithmetic circuits. Unless the fault is somewhere in the small part of the CPU it actually uses, it likely won't cause a freeze. – Mark Mar 10 '18 at 23:53
  • @Mark please can you suggest an alternative built-in command? The WebGL link however will reasonably stress the CPU. – Graham Miln Mar 11 '18 at 8:49
  • When I run ShibuyaCrowd it can be a bit glitchy for a few seconds at a time. Would you suppose that's saying anything about my PC? ibb.co/dR43A7 – 5uperdan Mar 12 '18 at 19:17
9

Just enter the command yes > /dev/null in a Terminal session. That will max out a CPU core until you Ctrl-C it or close the Terminal window.

  • 4
    For a single core. – Thorbjørn Ravn Andersen Mar 10 '18 at 15:00
  • 2
    This doesn't come close to heating up your CPU as much as a Prime95 stress-test would. Not all "100% CPU" workloads are equal when it comes to how many transistors are actually switching every clock cycle inside the CPU. – Peter Cordes Mar 11 '18 at 6:22
  • @PeterCordes can you suggest an alternative built-in command that would exercise the CPU more completely? – Graham Miln Mar 11 '18 at 10:52
  • @GrahamMiln: Honestly I'd recommend just downloading Prime95. IDK what OS X comes with that's seriously computationally intensive. If it comes with Python + numpy, octave, or some other numerical language, then maybe a medium-sized matrix multiply in a loop could do the trick. The SIMD FP multiply execution units make a lot of heat when they're kept busy. Oh, video encoding is quite demanding, especially more complex codecs like h.264. That might do the trick if you have any source data to use. But don't use GPU-offload (low power fixed-function), you want CPU encoding. – Peter Cordes Mar 11 '18 at 10:58
  • 1
    @GrahamMiln: cat /dev/urandom > /dev/null might keep a CPU busy. Depending on how multi-threaded the kernel's PRNG is, running it on multiple cores might not help, though. Even just awk 'BEGIN { while(1){} }' will probably do more than yes, which spends all its time in system calls. (And the CPU doesn't make much heat when stalled during user -> kernel transitions.) – Peter Cordes Mar 12 '18 at 0:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .