My Python maxes out my cpus…

May 7th, 2008 § 6 comments

… And it’s just the unittest I wrote for an appli­ca­tion I’m cook­ing up:

Picture 1.png

Python is con­sum­ing much in the way of proces­sor time. I <3 the processing module. All the workers are doing is tossing integers from one queue to another (in, out, result) and doing random multiplication on those integers.

Deli­cious.

  • Stan

    Time for quad core!

  • jnoller

    Using my lit­tle test app, I could really abuse $N cores by sim­ply increas­ing the worker count and work­load — it scales as far as I need it to right now.

  • patrick

    It’s pretty easy to max out your cpu if you never sleep to give the os some time. Even just this code will max things out, if you run enough processes to match your cpu count:

    while 1:
    pass

  • jnoller

    It’s a bit of a joke — in this case, I am actu­ally doing a unit test to ensure that the python appli­ca­tion is fully lever­ag­ing the cores on the machine. A test I ran shortly there­after on a 4 core box showed I could tap that out too with the workload.

    Func­tion­ally, the pro­cess­ing library is fork­ing processes under the cov­ers. The goal was not to max out for max­ing out’s sake, but rather to test an appli­ca­tion which has to be able to cleanly and eas­ily use al the cores on a box.

  • patrick

    It’s pretty easy to max out your cpu if you never sleep to give the os some time. Even just this code will max things out, if you run enough processes to match your cpu count:

    while 1:
    pass

  • http://jessenoller.com jnoller

    It’s a bit of a joke — in this case, I am actu­ally doing a unit test to ensure that the python appli­ca­tion is fully lever­ag­ing the cores on the machine. A test I ran shortly there­after on a 4 core box showed I could tap that out too with the workload.

    Func­tion­ally, the pro­cess­ing library is fork­ing processes under the cov­ers. The goal was not to max out for max­ing out’s sake, but rather to test an appli­ca­tion which has to be able to cleanly and eas­ily use al the cores on a box.

What's this?

You are currently reading My Python maxes out my cpus… at jessenoller.com.

meta