0

I've been programming normally using an AMD 1100 6 core chip. Previously (using the same code) I was able to max out all CPU's (6 threads)

Now, the same code is doing this (still 6 threads):

low cpu usage

Before, I was able to get them right to 100% (all 6 cores would go straight up and draw straight lines right across the top. Now I can't seem to figure why the application isn't maxing out the CPU cores, even though there are 6 parallel threads, and the same code used to max out the CPU just a day ago.

I'm running no extra processes, and am doing nothing generally different.

I'm running an extra fan on the CPU as well, and the CPU fan remains calm (which indicates it's not overheating).

bobobobo
  • 64,917
  • 62
  • 258
  • 363
  • I think showing some code would help coz there might be some bug which didnt show up yesterday but its coming up today :) – Arunmu Jan 09 '12 at 10:17
  • What exactly do you expect from us? Tell us where your code behaves wrong without seeing it? Listing gazillions of reasons why this might be happening? – PlasmaHH Jan 09 '12 at 10:17
  • @PlasmaHH Just kidding. I don't know what to expect. If you know / have seen this before, the you could provide a comment. Other than that, you should just move on. – bobobobo Jan 09 '12 at 10:19
  • @ArunMu Well, you're not going to want to see code, and it was working for literally _months_ before this lack-of-CPU-saturation problem started showing up _today_. I tested old checkpoints of the code (that used get 100% usage too) and still the same problem appears – bobobobo Jan 09 '12 at 10:20
  • 3
    Why is this a *problem*? Most people are happy when their code uses less CPU. (Is it doing work at a slower rate? If so, **that** is the problem.) – David Schwartz Jan 09 '12 at 10:21
  • @bobobobo: Should I say this is one of the reasons I do not prefer threads :) – Arunmu Jan 09 '12 at 10:23
  • @bobobobo: thanks, I will remember to always move on when seeing some post by you. – PlasmaHH Jan 09 '12 at 10:24
  • 3
    @bobo - Same code, different data? Different number of cache misses? – Bo Persson Jan 09 '12 at 10:26
  • Did you do any timings before? If you do them again now, have they changed? It's going to be really hard to suggest anything if you have nothing to compare it against (other than these visual graphs). – Bart Jan 09 '12 at 10:28
  • Was it previously not IO bound, but now your hard drive is dying and can't read/write as fast as it used to and it's now IO bound? – ta.speot.is Jan 09 '12 at 10:31
  • 1
    If we're talking about cache misses (@BoPersson) it might pay to analyse your code with http://developer.amd.com/documentation/videos/pages/IntroductiontoAMDCodeAnalystPerformanceAnalyzer.aspx (Since you have an AMD CPU, you should have all the analysis options available.) – ta.speot.is Jan 09 '12 at 10:35
  • Ok WAIT. Actually, you may be onto something Bo x 1. – bobobobo Jan 09 '12 at 10:36
  • @baboon: without code this question is useless - perhaps it should be closed? – Jared Krumsie Jan 09 '12 at 12:53
  • @Jared Who are you talking to? I got some very useful pointers in this thread alone. – bobobobo Jan 09 '12 at 14:41
  • @David it is a problem because not 100% CPU utilization (70% in this case) means the computations aren't being crunched out as fast as they could be – bobobobo Jan 09 '12 at 14:43
  • @bobobobo: No, it doesn't mean that at all. In fact, it much more likely means the opposite. – David Schwartz Jan 09 '12 at 17:13
  • @DavidSchwartz Yes, it will be. The work will be done faster if you use 100% of your computing capacity towards the task in question. – bobobobo Jan 12 '12 at 00:50
  • @bobobobo That's a completely false assumption. It's true if, and only if, the tasks are CPU bound. The fact that the CPU's aren't at 100% strongly suggests that the tasks are *not* CPU bound. So using more CPU wouldn't make them any faster. If you're getting the same amount of work done with less CPU usage, you should be happy. If you're not getting the same amount of work done, you should be trying to figure out why. (What are your threads doing if they're not getting work done?!) – David Schwartz Jan 12 '12 at 01:51
  • Well, they're raytracing. It's a highly parallelizable task and very much [CPU bound](http://stackoverflow.com/a/868577/111307) – bobobobo Jan 12 '12 at 04:00
  • 2
    Wow! I found the problem. It was a bug in my threadpool dispatcher, where if the first submitted job completed faster than the second job _could be submitted_, then there would be one less thread for the program – bobobobo Jan 15 '12 at 20:01

1 Answers1

3

First off we need to see the code. Without that I'd be looking to see if you have any synchronisation mechanisms (e.g. mutexes), I/O or use of shared resources that could be giving the CPU some breathing space. If there is any I/O, such as disk, network or other external devices going on, access speed is liable to change from run to run, and the program may be I/O bound rather than CPU bound.

SmacL
  • 22,555
  • 12
  • 95
  • 149