Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Software Hardware

Easy, Fast, Cheap Way to Generate CPU Load? 158

jsailor asks: "A large client and their engineering team will be evaluating cabinets and their ability to cool high density blade server deployments. Some of these systems can consume upward of 21 kW per rack and accordingly require a lot of airflow and/or liquid systems to cool. The systems actively monitor heat conditions, increase airflow rates, and can throttle CPU speeds if necessary. What we need is an easy, fast, and cheap way to run the 2-way and 4-way blades at or near peak CPU utilization for extended periods of time so thermal analysis can be performed. Ideally, we would be able to boot them off a CD and have some means of monitoring the CPU on each or even setting the level of CPU utilization we'd like them to run at. Please note that we do NOT need to simulate a real world application and disk and network access are not of much concern. While running your favorite compute-intensive project is a nice idea, we need something simple so I've come to the Slashdot community for assistance. What are your thoughts?"
This discussion has been archived. No new comments can be posted.

Easy, Fast, Cheap Way to Generate CPU Load?

Comments Filter:
  • How about these? (Score:5, Informative)

    by brejc8 ( 223089 ) * on Thursday April 07, 2005 @06:58PM (#12171281) Homepage Journal
    CPU Burn-in [bigpond.net.au] and cpuburn [sbcglobal.net]
    • EDIT.COM (Score:5, Funny)

      by mosel-saar-ruwer ( 732341 ) on Thursday April 07, 2005 @07:37PM (#12171574)

      Back in the day, the old MS-DOS editing program, EDIT.COM, ran a polling loop that would drive the CPU up to 100%.

      The Intel guys used to recommend it as a way to stress test your system.

      • by mystran ( 545374 ) on Thursday April 07, 2005 @10:00PM (#12172462)
        That title says it. It's bash syntax. Will give you about 100% CPU utilization on Linux. Run several instances at once to load more CPU's. (while true; do true; done) & (while true; do true; done) & (while true; do true; done) & Since true is /bin/true, each iteration forks twice, which means zero-filling at least a few pages of memory per iteration, which recent Linux AFAIK does with SIMD instructions where possible (someone correct me if that's not correct), so that actually loads more of the CPU core than one would think at first.
        • It should read:
          while true; do /bin/true; done
          otherwise the shell built-in is used and not fork is executed.
          • Indeed, this seems to be true.

            I actually tried to check this, but obviously I was too lazy; bash(1) doesn't seem to list true as built-in, but checking (by renaming /bin/true indeed confirms that you are right).

            Sorry about that.

        • Will this generate maximum heat?

          I would think that something like Prime95, while larger, would be better.

          Your method will exercise a small portion of the ALU. Prime95 will pump up the RAM, and floating-point unit. More transistors switching = more heat!
          1. That title says it. It's bash syntax. Will give you about 100% CPU utilization on Linux. Run several instances at once to load more CPU's.

          Tried it. Got 30% on one instance and 17% each for up to 8 instances (when I stopped). Plenty of remaining space to run many instances of this loop.

          OS & tools: Linux: Fedora Core 3 with latest updates.

          Hardware: P4 3ghz with hyperthreading enabled.

    • Re:How about these? (Score:2, Informative)

      by Anonymous Coward
      The LiveCD List [livecdlist.com] has several bootable CDs which include cpuburn. Check out Stresslinux [stresslinux.org] and Overclockix [octeams.com]. If they don't meet your needs you could modify them.
    • So simple. (Score:5, Informative)

      by leonbrooks ( 8043 ) <SentByMSBlast-No ... .brooks.fdns.net> on Thursday April 07, 2005 @09:10PM (#12172186) Homepage
      Boot Knoppix, open (BASH) shell, type:

      for cpu in 1 2 3 4; do
      ( while true; do true; done ) &
      done

      If you want to exercise the disks a bit too, replace the middle line with:

      ( while true; do find / -type f -exec cp {} /dev/null \; ; done ) &
      • 'while :' is more efficient than 'while true' because you don't have to fork the external process /bin/true. Not sure that your 'for 1 2 3 4' would ever fork more than one process either. Logically this is the same:

        while :; do :; done

        Unless you can provide some example of true becoming false in the while loop; you would never get 4 forks this way.
        • Re:So simple. (Score:3, Informative)

          by lewp ( 95638 )
          The parens spawn a subshell. The ampersand at the end backgrounds the subshell. His example is, in fact, right. As far as /bin/true not being as efficient... well, the idea is to load the CPU.
      • and for 75% load do:

        for cpu in 1 2 3; do
        ( while true; do true; done ) &
        done

        SO the parent's solution this is the best solution for this.
    • Re:How about these? (Score:5, Informative)

      by GoRK ( 10018 ) on Friday April 08, 2005 @12:36AM (#12173355) Homepage Journal
      I was going to suggest these two tools also. They are specifically designed for what you want to do. I use CPU burn exclusively to test cooling performance in new white box server setups; it is particularly useful in conjunction with lmsensors to determine optimum cooling.

      The utility is designed to run instruction loops which require the most POWER CONSUMPTION from the cpu and thus generate the most heat. There are versions tuned from pentiums up to current CPU's. There is also a version designed to cause your ram to use the maximum amount of power it can.

      Unlike running any old utility that gives you "100% cpu load" such as the comments about running 'true' in an endless loop presented in this thread, cpuburn is actually targeted at generating heat, power, and system stress. 100% processor utalization does not necessarily mean that you are stressing a computer.

      Unsuprisingly, many times cpuburn will often cause a computer that you believe is fine and works properly 100% of the time to hard lock after only a couple of minutes. Over time, dust builds up; fans get slower and give out, etc. and a computer with an adequate cooling solution a year ago may not be able to take the heat anymore. CPUBurn can reveal that. It is a very very good utility.
    • Linpack (Score:2, Interesting)

      On a serious note, linpack ( http://www.netlib.org/linpack/ [netlib.org]) You can run as many processes as required for your machine (i.e. 1 process per cpu) and with care you can use as much memory as you want (memory gets really hot and takes a lot more power than most people think). I do development testing for manufacturers who want us to sell their kit, I have burnt out many (now the manufacturers believe me that they are underspec'd) power supplies by using a well tuned linpack run to overload the system. It will
  • A Heater. (Score:1, Interesting)

    by Anonymous Coward
    Why not stick a heater in the cabinet that also consumes 21kW of power?
  • by mooingyak ( 720677 ) on Thursday April 07, 2005 @06:59PM (#12171289)
    maybe a simple script like:
    #!/bin/sh
    sh $0

    or in c

    while ( 1 )
    fork();
    • I've been using int main() { while(1); } to stop the Dev-C++ run window from closing as soon as the execution is done - it seems to eat up 100% of my processing power, but dammit, I want to be able to see the results! The only thing it seems to mess up is if I'm listening to music at the time.
  • Flash ads (Score:5, Funny)

    by BandwidthHog ( 257320 ) <inactive.slashdo ... icallyenough.com> on Thursday April 07, 2005 @07:00PM (#12171292) Homepage Journal
    Always do it for me. The Vonage ones are the best, especially when you end up with like three of them on a page. Sometimes I swear they can even spike the cpu load of other machines in the same room.
    • by ErikZ ( 55491 )
      My little forum that I run, has a bank of animated GIF smileys you can choose from. When you open the page that gives you all of them at once to pick from, my CPU pegs 100%.

      Animated. GIF. Smileys.

      Other people use their processing cycles to find puslars. Me? I use mine to have little yellow smiley faces chase each other around with machine guns.
  • quite simple (Score:3, Interesting)

    by timdorr ( 213400 ) * on Thursday April 07, 2005 @07:01PM (#12171306) Homepage
    `yes`

    A little hack someone showed me a while ago. Just set that in the startup script and away you go! Eats up memory and CPU time, so you'll end up with a very very high load and disk activity to boot.
    • Re:quite simple (Score:2, Informative)

      by Student_Tech ( 66719 )
      Every time I tried that in a bash shell, it would kill the shell after minute.

      So you might want to expand that to
      while [ /bin/true ] ; do sh -c '`yes`' ; done

      so when this happens:
      "sh: xrealloc: ../bash/subst.c:4197: cannot reallocate 268435456 bytes (0 bytes allocated)"

      It just restarts it. (Hmm, the comment appears to be formatted correctly for the command).
  • POVRay (Score:2, Informative)

    by eskwayrd ( 575069 )
    Render something [povray.org]: repeatable, high CPU usage test with visible (and interesting) progress.
    • Or install Folding@Home on all the systems, set the CPU usage to 100%, and set every client to the same User ID and Team. Top user in no time!
  • int main (void)
    {
    for (int i=0; 1; i++)
    ;
    }
    • by p2sam ( 139950 )
      boo!! my infinite loop is far superior!!

      int main() { for( ;; ) ; }

    • Back in the day, Microsoft used to write a nifty little Java "compiler" called jvc.exe [to differentiate itself from Sun's javac.exe] - this was back before Sun sued them over their Java implementation.

      Anyway, jvc.exe in combination with Microsoft's java.exe had the uncanny ability to spot empty loops like that and jump write over them.

      [Which, no doubt, did not bring pleasure to the ghost of poor ol' Alan Turing...]

    • you might want to throw a float in there too. I'm sure the integer ALU consumes a lot less power than the float ALU. I think something like a video game would also be good for this. It tests integers, floats, and cache. All together, those will generate some serious heat. And since this guy is interested in heat, why not utilize the entire data path plus the cache?
  • How about Project Bovine [distributed.net]?
  • by Myrkur ( 621981 ) on Thursday April 07, 2005 @07:04PM (#12171339)
    Post the address on slashdot.
  • First, make it into a server. Host a web page on it, perferably about a popular topic like Star Wars. Next, successfully submit a Slashdot story that links to it. You'll be overloaded in no time.
  • by Kris_J ( 10111 ) * on Thursday April 07, 2005 @07:06PM (#12171353) Homepage Journal
    Distributed.Net [distributed.net] always shows me what happens to a PC permanently at 100% CPU load. Had to remove it from the student labs because it caused all the Dells to turn their fans up full. The noise! There are ports for pretty much everything.
  • openssl benchmark (Score:4, Informative)

    by molo ( 94384 ) on Thursday April 07, 2005 @07:06PM (#12171357) Journal
    Fire off one of these per processor:

    > while true ; do openssl speed ; done
    Doing md2 for 3s on 16 size blocks: 511846 md2's in 3.00s
    Doing md2 for 3s on 64 size blocks: 278228 md2's in 3.00s
    Doing md2 for 3s on 256 size blocks: 98836 md2's in 3.00s
    Doing md2 for 3s on 1024 size blocks: 27645 md2's in 3.00s
    Doing md2 for 3s on 8192 size blocks: 3574 md2's in 3.01s
    [... continues ...]

    -molo
    • by Anonymous Coward
      You need to run that on each CPU. This should do it under Linux 2.6:
      #!/bin/sh
      for x in /sys/devices/system/cpu/*; do
      (while true ; do openssl speed; done) &
      done
      wait
  • by OAB_X ( 818333 ) on Thursday April 07, 2005 @07:06PM (#12171358)
    Run seti@home, folding@home, and distributed.net all at once. That should really go for them. Plus they are all linux compatible as well as windows.
  • Gentoo (Score:5, Funny)

    by dasalvagg ( 667838 ) on Thursday April 07, 2005 @07:07PM (#12171364)
    Finally...a REAL use for Gentoo
    • It was my suggestion. se the Gentoo live cd and install to /dev/null of the live cd.

      that should keep things busy for a while.
  • by gusnz ( 455113 ) on Thursday April 07, 2005 @07:07PM (#12171365) Homepage
    Prime95 [mersenne.org]. Available for numerous OSs.
  • int main() {
    int x=1;
    while (1=1) {
    x++;
    }
    return 0;
    }

    That's one sure fire way to spike CPU usage.
    • no it's not, try running it. you cannot assign to a constant. i think you mean while(1)
    • That's not quite the answer. Loading up the CPU to 100% won't guarantee it gets as hot as you would like it too. You need to run CPU instructions that use the most power (floating point, SIMD type instructions, preferably.

      Try seti@home or something similar. That would do much more than just a tight - relatively efficient loop.

      A
  • Some sort of fractal generator, which is avalible on knoppix.
  • good ol' Hiren's (Score:2, Informative)

    by Fry-kun ( 619632 )
    There's an ISO circulating the net, called Hiren's Boot Disk. It has a lot of utilities for diagnosing and fixing nearly any PC. The only big problem with it is that it's probably less than legal - it has rescue versions of programs such as Partition Magic, Norton Antivirus, etc. It has copies of different burn-in tests (CPU, memory, HD, you name it). Up to you if you want to try it.

    And if you don't like that, you can try Knoppix bootable CD. It has (i think) multi-CPU support and you can most likely find
  • by Anonymous Coward on Thursday April 07, 2005 @07:15PM (#12171423)
  • while(1) { if(fork() == 0) while(1); } :)
  • loop.c (Score:1, Redundant)

    by icemax ( 565022 )
    void main(void)
    {
    while(true)
    {}
    }
  • Or protein folding@home, or SETI... hell, just fork a bunch of threads each counting to 1,000,000,000...
  • this is what I've used to make sure our cluster was cooling properly.. you can even do it in perl.. Of course this won't check to make sure any of your memory is okay or anything else.. but is a simple, straightforward and easy enough to implement..
    main() {
    a = 0;
    for (;;) {
    double a;
    a *= 1.00001;
    }
    }

    • fredegar vogel $ cc -Wall -g slashdot.c
      slashdot.c:1: warning: return type defaults to `int'
      slashdot.c: In function `main':
      slashdot.c:2: error: `a' undeclared (first use in this function)
      slashdot.c:2: error: (Each undeclared identifier is reported only once
      slashdot.c:2: error: for each function it appears in.)
  • Comment removed based on user account deletion
  • How about Netbench? (Score:3, Interesting)

    by msoftsucks ( 604691 ) on Thursday April 07, 2005 @07:59PM (#12171769)
    A few years back Ziff Davis released some decent benchmarking tools. The ones for file serves were called Netbench [etestinglabs.com] You can set up different tests that exercise different aspects of file servers. With just a couple of PCs you can create significant load that would peg the CPU utils to 100% for a whole weekend. Although these tools are no longer supported, they still work quite well.
  • LAPACK or LABLAS linear algebra libraries

    That's what they use to spec and rank supercomputers. It'll burn, burn, burn!

  • At one time I heard Intel used this because it was real good at filling up the CPU pipelines.

    Seti@Home is another alternative along the same lines, although Seti will utilize more Hard drive. (Signal processing vs huge Mathematical algorithm).
  • Since you said you'd like a bootable CD for your load, I'd recommend The Ultimate Bootable CD (UBCD). The UBCD has memtest and some other utilities that will stress the CPU. It has dozens of other utilities that you'll love.

    Burn it to a DVD and it will load even faster.

  • md5sum (Score:3, Interesting)

    by jacobdp ( 698004 ) on Thursday April 07, 2005 @08:42PM (#12172021)
    md5sum < /dev/urandom

    /dev/urandom produces an infinite stream of random data - just pipe that throgh MD5 for some nice numerical CPU load. Not disk- or network-bound either.
  • by gtrubetskoy ( 734033 ) * on Thursday April 07, 2005 @08:51PM (#12172067)

    Disk drives generate heat (and fail first from it). To keep your drives excercised, check out Bonnie [garloff.de].
  • cat > swamp.c
    int main(){ for(;;) ; }
    ^D
    gcc -o swamp swamp.c
    sudo nice -20 ./swamp
    100 percent CPU load, nice as you please.
  • Easiest way (Score:1, Funny)

    by PKPerson ( 784484 )
    Try running windows
    • by Glytch ( 4881 )
      Oh, Slashdot, why are you so placid and intolerant of a good old-fashioned flamewar these days? I had to scroll through two pages of boring serious answers before finding this, the proper reply to this story.

  • bc
    1234123412341234^1234123412


    Should work for at least an hour or two on current CPU's.
  • gzip (Score:5, Informative)

    by CyberVenom ( 697959 ) on Thursday April 07, 2005 @09:15PM (#12172213)
    So you need simple, fast, no-need-for-network CPU load?

    Boot any linux liveCD that supports your hardware, and run the following command:

    cat /dev/urandom | gzip > /dev/null

    Sould eat one whole CPU and run forever. If you have an SMP machine, run one instance of that per CPU, and you should max out. The system should still remain responsive enough that you can terminate the processes at will, even though the CPU is at 100% usage.

    I would try to pick a liveCD that does not bother starting X since that just adds to the boot time.

    You may want to consider the heat generated by components other than the CPU. Hard drives put off a significant amount of heat, as do memory and video, and to a lesser extent network hardware.

    To utilize a lot of memory as well as CPU, you might look for something like a prime-factoring program. (prime seives love to eat memory)

    For video heat, try something like an unlimited framerate demo in Quake 2. (I think there is even a Linux port)

    For network load, just use a ping utility that supports flood-ping and arbitrary payloads. Then floodping yourself or something on the LAN with huge packets.

    For hard drive heat, you could just dd /dev/zero to a blank HD (since you are booting from CD, destroying the contents of the HD won't crash the OS)
  • There are some CPU spinners in the CPU scheduler evaluation [sourceforge.net] project that should be of assistance.

    The actual download page is here [sourceforge.net]
  • Can't believe nobody's suggested just doing kernel compiles in a loop...?
    • Can't believe nobody's suggested just doing kernel compiles in a loop...?

      I was about to, and saw your post when making sure I wouldn't be modded redundant. It's the best method I've found to stress-test your CPU and memory subsystem. In particular, do a make -j to compile in parallel, and use all your CPUs. Be careful, though, the 2.6 kernel will drive your load up to about 80 if you don't restrict it.

      I've previously used the kernel-compile trick to test processor stability (when overclocking). Comp

  • by DaoudaW ( 533025 ) on Thursday April 07, 2005 @09:36PM (#12172326)
    we need something simple so I've come to the Slashdot community for assistance.

    Thanks! I think...
  • The powder2glass team is #4 for Google Toolbar Compute folks [powder2glass.com] - we'd love to get some boost in our ranking if you want to fire up FAH and contribute some work units. Note that you can use the FAH client from Stanford [stanford.edu] and we'll still get some credit if you team=0, and username=powder2glass.

    Sounds like you got some serious, serious horsepower, so I can't resist asking! ;-)

  • It's not so easy (Score:4, Insightful)

    by Phil Karn ( 14620 ) <karn&ka9q,net> on Thursday April 07, 2005 @10:18PM (#12172558) Homepage
    I don't think it's quite as easy as running a simple infinite loop. That will certainly peg the CPU utilization at 100%, but it probably won't maximize the power drain and heat output.

    Modern CPUs are complicated beasts, with multiple execution units, deep pipelines and big caches. And they're connected to big external memories and disk drive arrays. If you want to stress-test the cooling system, then you need code that keeps all the execution units and all the pipelines and the caches and main memory and the disk array all going full blast. That's not as easy as it sounds. Intel has mentioned various test programs that they use when thermally testing their CPUs, but I don't know that they've ever released them. Perhaps they're afraid they'd might cause damage, and they'd have to deal with a lot of irate customers.

  • yes|grep no
  • perl -e "for(2..$ARGV[0]){last unless fork}print$$,$/;sqrt(rand(1<<32))while 1"

    This will suck up all the CPU for one processor, add the number of processes to run on the end of the command line to load multiple CPUs.
  • I have a few simulations that are taking upwards of 48 hours each to run on puny Athlon 1300s. I could load your systems for a couple hours. :-)

  • Download CPUBurn here [sbcglobal.net].
    Run x instances, where x is the number of CPUs in your machine.
    As easy as that.
  • - Minimal linux distribution running from a bootable cdrom or via PXE.

    - Uses of some utitlities like: stress, cpuburn, hddtemp, lm_sensors, smartmontools .

    - Dedicated to users who want to test their systems entirely on high load and monitoring their health.

    http://www.stresslinux.org/ [stresslinux.org]
  • You need stress (Score:3, Informative)

    by Dysan2k ( 126022 ) on Friday April 08, 2005 @10:11AM (#12176248) Homepage
    There's a software package called 'stress' that should fill your needs nicely.

    http://weather.ou.edu/~apw/projects/stress/ [ou.edu]

    I use it at work for testing all of our servers. You have the option of testing CPU, Memory, IO, or VM, and it will most certainly put a heavy load on the server.
  • run 7zip compressing a very large file to 7z format in ULTRA mode, large file being CD ISO sized or so. either that or video encoding, but video encoding has been improved greatly over the years while 7z ULTRA mode is basically designed to not care about resource usage and squeeze an extra 2 megs off a 5 gig DVD image even if it takes 3 more hours to do it. (BTW, ULTRA is amazing with game compression, HL2 in 1.5 gigs anyone?)
  • Add a link to your servers, and post a front page link on slashdot!
  • Here's an idea for you:
    1. Get 10-20 older Athlon boxes.
    2. Put them in the same room with the blade servers you want to test.
    (3. And do I need to add this step - profit!)

To be is to program.

Working...