16

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!

4
  • Use the compress option to deal with some files : a couple of fokders full of data...
    – Solar Mike
    Commented Mar 10, 2018 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
    Commented Mar 10, 2018 at 16:03
  • 2
    You can always try the Apple Diagnostics self-test.
    – SilverWolf
    Commented Mar 10, 2018 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
    Commented Mar 11, 2018 at 8:02

2 Answers 2

19

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

7
  • 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
    Commented Mar 10, 2018 at 15:43
  • Thank you. I have added your suggestion into the answer. Commented Mar 10, 2018 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
    Commented Mar 10, 2018 at 23:53
  • 1
    @Mark please can you suggest an alternative built-in command? The WebGL link however will reasonably stress the CPU. Commented Mar 11, 2018 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
    Commented Mar 12, 2018 at 19:17
11

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.

6
  • 5
    For a single core. Commented Mar 10, 2018 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. Commented Mar 11, 2018 at 6:22
  • 1
    @PeterCordes can you suggest an alternative built-in command that would exercise the CPU more completely? Commented Mar 11, 2018 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. Commented Mar 11, 2018 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.) Commented Mar 12, 2018 at 0:54

You must log in to answer this question.

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