Slashdot Mirror


Not All Cores Are Created Equal

joabj writes "Virginia Tech researchers have found that the performance of programs running on multicore processors can vary from server to server, and even from core to core. Factors such as which core handles interrupts, or which cache holds the needed data can change from run to run. Such resources tend to be allocated arbitrarily now. As a result, program execution times can vary up to 10 percent. The good news is that the VT researchers are working on a library that will recognize inefficient behavior and rearrange things in a more timely fashion." Here is the paper, Asymmetric Interactions in Symmetric Multicore Systems: Analysis, Enhancements and Evaluation (PDF).

49 of 183 comments (clear)

  1. unsurprising. by Anonymous Coward · · Score: 5, Interesting

    Anyone who thinks computers are predictably deterministic hasn't used a computer. There are so many bugs in hardware and software that cause it to behave differently than expected, documented, designed. Add to that inevitable manufacturing defects, no matter how microscopic, and it's unimaginable to find otherwise.

    It's like discovering "no two toasters toast the same. Researches found some toasters browned toast up to 10% faster than others."

    1. Re:unsurprising. by Rod+Beauvex · · Score: 5, Funny

      It's those turny knobs. They lie.

    2. Re:unsurprising. by symbolset · · Score: 5, Funny

      You have to buy the one that goes to 11. You know how 10 makes the toast almost totally black? Well, what if you want your toast just a little bit more crispy? What if you want just that little bit more? That's what 11 is for. Those other toasters only go to 10, but this one goes to 11.

      --
      Help stamp out iliturcy.
    3. Re:unsurprising. by MightyYar · · Score: 4, Funny

      I had a Pentium that DEFINITELY went to 11.

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    4. Re:unsurprising. by ElectricTurtle · · Score: 2, Insightful

      Mod parent to 5, seriously, it's so true. There are more than a few times after working support for decade when I've had to say, 'that should be impossible' but a symptom nonetheless exists.

      --
      I support the Slashcott and will not be reading or commenting from 2/10/14 to 2/17/14. Beta is steaming pile of dog shit
    5. Re:unsurprising. by $RANDOMLUSER · · Score: 2, Interesting

      I remember HP-UX on PA-RISC from at least ten years ago making efforts to reassign a swapped out process to the processor that it had been running on before it was swapped out, on the notion that some code and data might still be in the cache. SMP makes for some interesting OS problems.

      --
      No folly is more costly than the folly of intolerant idealism. - Winston Churchill
    6. Re:unsurprising. by RuBLed · · Score: 5, Funny

      mine only went up to 10.998799799

    7. Re:unsurprising. by Anonymous Coward · · Score: 2, Funny

      The review for "Not All Cores Are Created Equal" was merely a two word review which simply read "Shit Sandwich".

    8. Re:unsurprising. by aaron+alderman · · Score: 5, Interesting

      Impossible like "xor eax, eax" returning a non-zero value and crashing windows?

    9. Re:unsurprising. by $RANDOMLUSER · · Score: 5, Funny

      Moral of the story: There's a lot of overclocking out there, and it makes Windows look bad.

      Oh. So that's what's been doing it.

      --
      No folly is more costly than the folly of intolerant idealism. - Winston Churchill
    10. Re:unsurprising. by zappepcs · · Score: 5, Interesting

      Actually, (sorry no link) there was a researcher that was using FPGAs and AI code to create simple circuits, but the goals was to have the AI design it. What he found is that due to minor manufacturing defects, the code that was built by AI was dependent on the FPGA it was tested on and would not work on just any FPGA of that specification. After 600 iterations, you'd think it would be good. One experiment went for a long time, and in the end when he analyzed the AI generated code, there were 5 paths/circuits inside that did nothing. If he disabled any or all of the 5 the overall design failed. Somehow, the AI found that creating these do nothing loops/circuits caused a favorable behavior in other parts of the FPGA that made for overall success. Naturally that code would not work on any other FPGA of the specified type. It was an interesting read, sorry that I don't have a link.

    11. Re:unsurprising. by Majik+Sheff · · Score: 2, Informative

      Processor affinity is still a nasty corner of OS design. It was one of the outstanding issues with the BeOS kernel that was not resolved before the company tanked.

      --
      Women are like electronics: you don't know how damaged they are until you try to turn them on.
    12. Re:unsurprising. by Anonymous Coward · · Score: 2, Funny

      Wow, a joke from 1995. It's true, Slashdot is at the forefront of cutting-edge humor.

    13. Re:unsurprising. by paulgrant · · Score: 2, Insightful

      Damn it, get one!
      At least a name for christs sake!

    14. Re:unsurprising. by johnw · · Score: 3, Informative

      A simple Google search for "fpga genetic algorithm" shows up references quite quickly - e.g.

      http://biology.kenyon.edu/slonc/bio3/AI/GEN_ALGO/gen_algo.html

      The only part of the GP story I haven't seen before (and can't find a reference for) is the bit about the design not working on other FPGAs of the same specification. The closest story is that of Adrian Thompson at the University of Sussex who got a circuit with unconnected elements which nonetheless seem to be needed in order for the whole thing to achieve its goal. Nothing about the design only working on specific instances of the FPGA.

    15. Re:unsurprising. by sowth · · Score: 3, Insightful

      They probably put in the if(1) lines because they were testing various aspects of the program, or maybe some like to turn off various aspects of the program, but don't want to be arsed to write the proper code to select options. I commonly do that in POVray (3d raytracing) scripts when testing, so I don't have to wait for long renders--fog, radiosity, lots of light and such take orders of magnitude more time.

      As for the AI adding crap, it is probably more trying random code than truly thinking about how the code should work. This leads to the useful code intertwined with lots of crap code. Unfortunately, there are programmers who write like this too... (cue funny mod)

      As for the code not working on other FPGAs, maybe the researcher should not use real chips to check the iterations. A simulated one which conforms to the spec exactly and upon where quirks and such are expected, dies or sends a signal back to the AI program. Testing after the fact on real chips to verify the AI didn't exploit bugs in the simulator would be more proper procedure.

      Maybe I have too much of a background in theory, but I am not completely sure why the FPGAs would be so different. Is it race time conditions? Or is the FPGA being used in some analog way? Or does the circuit depend on the exact timing of some input, so the speed / capacitance of each component make a huge difference? Or was the poster talking about FPGAs with different specs?

      Crazy things happen when you enter the real world. I remember back when I was in electronics assembly. One would first assume all the solder would wick onto the metal, but the boards would always have tonnes of solder bridges, and we had to carefully examine every component and correct them. Friggin' microprocessors had countless tiny legs too!

    16. Re:unsurprising. by Mr2cents · · Score: 2, Interesting

      There is a very interesting channel on youtube called googletechtalks. There, you can find a lecture called "We have it easy, but do we have it right" about performance measures that really made me worry. Basically you can't just easilly compare performance by measuring the cpu time, because there are a lot of factors that determine performance. E.g.: by adding a environment variable before running a program, this can cause page allignments to change (even if the environment variable isn't used by the program), changing the performance dramatically in some cases. Same goes for changing the link order: performance can change by 20%.

      So much for determinism.

      http://www.youtube.com/watch?v=DKVRkfXrBpg

      --
      "It's too bad that stupidity isn't painful." - Anton LaVey
    17. Re:unsurprising. by raynet · · Score: 4, Funny

      I am sure you mean to say; Wow, a joke from 1994.995994999.

      --
      - Raynet --> .
    18. Re:unsurprising. by Rakshasa+Taisab · · Score: 2, Funny

      That joke is so badly done it's not even funny.

      1994.995994999

      If you look carefully at this number, it's clearly one constructed by a human. The first '5' might be random, but the proceeding numbers do not have any specific reason to be weighted towards higher digits!!!

      Thus, a more realistic semi-random number would be:

      1994.995974983

      --
      - These characters were randomly selected.
    19. Re:unsurprising. by raynet · · Score: 2, Funny

      Actually, your number looks more like random number string by a human as human try to avoid using long chains of same numbers when writing random numbers. But you are right, my number was made by randomly punching multiple number keys on my keyboard and those happened to register. I did then edit it so that the first digit after to dot was 9.

      --
      - Raynet --> .
    20. Re:unsurprising. by TheRaven64 · · Score: 2, Interesting

      Yup, I found some interesting effects of this when doing my PhD. I tweaked my supervisor's code to add an abstraction layer in the middle before making changes, and found that this actually made things faster, even though it was doing more work (it was only meant to make things faster when I wrote something else on the other side of the abstraction layer). It was an entirely deterministic improvement though, even with different data sets, so most likely due to better instruction cache layout with the new code.

      --
      I am TheRaven on Soylent News
    21. Re:unsurprising. by TheRaven64 · · Score: 2, Interesting

      Processor affinity is even harder on modern CPUs. You often have 2 or so contexts sharing execution units and L1 cache in a core, then a few cores sharing L2 cache in a chip. Deciding whether to move a process is tricky. There's a penalty for moving, because you increase the cache misses proportionally to the distance you move it (if you move it to a context that shares the same L1 cache, it's not as bad as if you move it to one that shares only the L2 cache, for example), but there's also a cost for not moving it if a lot of processes on a single context are suddenly doing a lot of work while those on another core are idle.

      Cache isn't the only problem though - with something like the AMD architecture, each core has its own memory, so if you allocate memory on one RAM chip then migrate the process to a different one then you end up with memory accesses being slower (and slowing down accesses on the other chip, since its memory controller is having to interleave remote requests with local ones).

      --
      I am TheRaven on Soylent News
    22. Re:unsurprising. by Ant+P. · · Score: 2, Insightful

      If overclocking is the cause of so many of these problems, why hasn't Intel or AMD got a mechanism to tell the OS that the hardware's being run out of spec? The blame for these crashes should be directed where it belongs - with the -funroll-loops ricers.

    23. Re:unsurprising. by Lost+Race · · Score: 2, Funny

      ... spherical frictionless inelastic computer at 0 Kelvin ...

  2. who would've guessed... by Eto_Demerzel79 · · Score: 4, Insightful

    ...programs not designed for multi-core systems don't use them efficiently.

    1. Re:who would've guessed... by timeOday · · Score: 4, Insightful

      No, the programs are not the problem. The programmer should not have to worry about manually assigning processes to cores or switching a process from one core to another - in fact, there's no way the programmer could do that, since it would require knowing what the system load is, what other programs are running, and physical details (such as cache behavior) of processors not even invented yet. This is all the job of the OS.

  3. multicore dev is fun... much like prison rape! by Shadowruni · · Score: 4, Interesting
    The current state of dev reminds me sort of the issues that Nintendo had with the N64.... a beautiful piece of hardware with (at the time) a God-like amount of raw power, but *REALLY* hard to code for. Hence the really interesting titles for it either came from Rare who developed on SGI machines (a R10000 drive that beast) or Nintendo, who built the thing.

    /yeah yeah, I know the PS1 and Sega Saturn had optical media and that the media's storage capacity which lead to better and more complex were truly what killed the N64.

    //bonus capt was arrestor

    --
    "Chinese Amazons, power armor, laser swords.... things just meant to be." - Shampoo, A Very Scary Bet
    1. Re:multicore dev is fun... much like prison rape! by Ironchew · · Score: 2, Informative

      http://en.wikipedia.org/wiki/N64#Programming_difficulties
      The amount of video memory for textures was way too small.

    2. Re:multicore dev is fun... much like prison rape! by carlzum · · Score: 4, Interesting

      I believe the biggest problem with multi-core development is a lack of maturity in the tools and libraries available. Taking advantage of multiple cores requires a lot of thread management code, which is great for highly optimized applications but deters run-of-the-mill business and user app developers. There was a recent opinion piece in Dr Dobbs discussing the benefits a concurrency platforms I found interesting. The article is clearly promoting the author's company (Clik Arts), but I agree with his argument that the complexities of multi-core development need to be handled in a framework and not applications.

  4. Linux and Windows by WarJolt · · Score: 3, Insightful

    I don't know if Linux or Windows has an automatic mechanism to schedule task priority based on processor caches, but the study didn't even mention Windows. Seeing that the scheduling and managing the caches are OS problems this seems kind of important.

    The other thing that seems odd is they were using a 2.6.18 Kernel and in 2.6.23 they added the Completely Fair Scheduler which could potentially change their results. It doesn't seem logical to base a cutting edge study on stuff that was released years ago.

  5. Linux schedules better than this by bluefoxlucid · · Score: 3, Informative

    Last I checked, Linux was smart enough to try to keep programs running on cores where cache contained the needed data.

    1. Re:Linux schedules better than this by HRbnjR · · Score: 2, Interesting
    2. Re:Linux schedules better than this by nullchar · · Score: 4, Interesting

      Possibly... but it appears an SMP kernel treats each core as a separate physical processor.

      Take an Intel Core2 Quad machine and start a process that takes 100% of one CPU. Then watch top/htop/gnome-system-monitor/etc where you can watch the process hop around all four cores. It makes sense that the process might hop between two cores -- the two that share L2 cache -- but all four cores doesn't make sense to me. Seems like the L2 cache is wasted when migrating between each core2 package.

    3. Re:Linux schedules better than this by Krishnoid · · Score: 3, Interesting

      Wasn't there an article recently about this describing that if only one core was working at peak capacity that the die would heat unevenly, causing problems?

    4. Re:Linux schedules better than this by PitaBred · · Score: 2, Informative

      I thought that Intel specifically did that, that if one core were loaded it would overclock that core and downclock the others to get a speed boost...

      Yup, I thought I remembered correctly.

  6. NUMA NUMA by Gothmolly · · Score: 3, Informative

    Linux can already deal with scheduling tasks to processors where the necessary resources are "close". It may not be obvious to the likes of PC Magazine, but its trivially obvious that even multithreaded programs running on a non-location aware kernel are going to take a hit. This is a kernel problem, not an application library problem.

    --
    I want to delete my account but Slashdot doesn't allow it.
  7. This isn't news by nettablepc · · Score: 5, Informative

    Anyone who has been doing performance work should have known this. The tools to adjust things like core affinity and where interrupts are handled have been available in Linux and Windows for a long time. These effects were present in 1980s mainframes. DUH.

    1. Re:This isn't news by Clover_Kicker · · Score: 5, Insightful

      80s mainframe tech is NEW and EXCITING to a depressing number of tech people, look at how excited everyone got when someone remembered and re-implemented virtualization.

  8. it's the affinity by non-e-moose · · Score: 2, Informative

    It's just an Insel Intide thing. DAAMIT processors are more predictable. Or not. If you don't use numactl (1) to force socket (and memory) affinity, you get exactly what you ask for (randomly selected sockets, and unpredictable performance)

  9. not a surprise by Eil · · Score: 5, Insightful

    Here's an exercise: Take 2 brand-new systems with identical configurations and start them at the same time doing some job that takes a few hours and utilizes most of the hardware to some significant degree. Say, compiling some huge piece of code like KDE or OpenOffice. System administrators who do exactly this will tell you that you'll almost never see the two machines complete the job at precisely the same time. Even though the CPU, memory, hard drive, motherboard, and everything else is the same, the system as a whole is so complex that minute differences in timing somewhere compound into larger ones. Sometimes you can even reboot them and repeat the experiment and the results will have reversed. It shouldn't come as a surprise that adding more complexity (in the form of processor cores) would enhance the effect.

    1. Re:not a surprise by im_thatoneguy · · Score: 4, Interesting

      We have this problem at work.

      We have a render farm of 16 machines. 12 of them are effectively identical but despite all of our coaxing one of them always runs about 30% slower. It's maddening. But "What can you do?". Hardware is the same. We Ghost the systems so the boot data is exactly the same... and yet... slowness. It's just a handicapped system.

  10. Re:make -j 3 by bob.appleyard · · Score: 2, Funny

    It's OK. This is a Gentoo user. Getting make to work on multicore well has a significant impact on the usability of his computer.

    --
    How dare you be so modest!! You conceited bastard!!
  11. Re:Linux and Windows by swb · · Score: 3, Informative

    They mentioned this in an ESX class I took. I seem to remember it in the context of setting a processor affinity or creating multi-CPU VMs and how either the hypervisor was smarter than you (eg, don't affinity) or that multi-CPU VMs could actually slow other VMs because the hypervisor would try to keep multi-CPU VMs on the same socket, thus deny execution priority to other VMs (eg, don't assign SMP VMs because you can unless you have the CPU workload).

  12. Well known problem by sjames · · Score: 3, Insightful

    The problem is a complex one. Every possible scheduling decision has pluses and minuses. For example, keeping a process on the same core for each timeslice maximizes cache hits, but can lose if it means the process has to wait TOO long for it's next slice. Likewise, if a process must wait for something, should it yield to another process or busy wait. SHould interrupts be balanced over CPUs or should one CPU handle them?

    A lot of work has gone in to those questions in the Linux scheduler. For all of that, the scheduler only knows so much about a given app and if it takes TOO long to 'think' about it, it negates the benefits of a better decision.

    For special cases where you're quite sure you know more than the scheduler about your app, you can use the isolcpus kernel parameter to reserve CPUS to run only the apps you explicitly assign to them.

    You can also decide which CPU any given IRQ can be handled by (but not which core within a CPU as far as I know) wilt /proc/irq/*/smp_affinity.

    Unless your system is dedicated to a single application and you understand it quite well, the most likely result of screwing with all of that is overall loss of performance.

  13. Re:Yup by cetialphav · · Score: 3, Informative

    How about a "parallel foreach(Thing in Things)" ?

    That is easy. If your application can be parallelized that easily, then it is considered embarrassingly parallel. OpenMP exists today and does just this. All you have to do (in C) is add a "#pragma" above the for loop and you have a parallel program. OpenMP is commonly available on all major platforms.

    The real problem is that most desktop applications just don't lend themselves to this type of parallelism and so the threads have lots of data sharing. This data sharing causes the problem because the programmer must carefully use synchronization primitives to prevent race conditions. Since the programmer is using parallelism to boost performance, they only want to introduce synchronization when they absolutely have to. When in doubt, they leave it out. Since it is damn near impossible to test the code for race conditions, they have no indication when they have subtle errors. This is what makes concurrent programming so difficult. One researcher says that using threads makes programs "wildly nondeterministic".

    It is hard to blame the programmers for being aggressive in seeking performance gains because Amdahl's Law is a real killer. If you have 90% of the program parallelized, the theoretical maximum performance gain is 10X no matter how many cores you can throw at the problem.

  14. Close by coryking · · Score: 2, Interesting

    But you have to think about it too much.

    How about:


    Things.ParallelEach(function(thing){
      Console.Write("{0} is cool, but in parallel", thing);
      # serious business goes here
    });

    There are lots of stupid loop structures that are used in desktop apps that are just begging to be run in parallel, but the current crop of languages dont make it braindead easy to do so. Make it so every loop structure has a trivial and non ugly (OpenMP pragmas) way of doing it.

    Also, IMHO, not enough languages do stuff like the Javascript Array.Each(function(element){}). Am I blind, or is this construct missing from C#?

  15. This isn't hardware by multimediavt · · Score: 2, Informative

    Why is this article labeled as hardware? Sure they talk about different procs being ... well, different. Duh! The article is about the software Tom and others developed to run processes more efficiently in a multi-core (an possibly heterogenous) environment. Big energy savings as well as performance boost. Green computing. HELLO! Did you read page two?

  16. Reporter bias by symbolset · · Score: 2, Insightful

    Often, an issue presents that isn't reproducible in the presence of a tech support person who knows what he's doing.

    Sometimes it's a user error they don''t want to admit, and so they won't reproduce it in front of somebody who knows they should not have done that.

    Sometimes it's just a glitch. Regardless, the best thing to do is smile and say "The bug must be afraid of me" and close the ticket.

    --
    Help stamp out iliturcy.
  17. Reminds me of an issue... by GameboyRMH · · Score: 2, Interesting

    ...I had with an Asterisk VOIP server. Under certain conditions, calls transferred from one of two receptionist's phones were bouncing back and ending up at the wrong voicemail. Since only two phones had a problem I suspected it was something specific to these phones. After checking the configuration and even hardware on the phones, I checked the server. I narrowed the problem down to one macro (a macro in asterisk is basically a user-defined function) that allows a "fallback line" to ring if the first is busy, it seemed to be getting an argument for this line when there should have been none. Soon it became evident that the variable was changing "mid-macro", apparently out of nowhere (there are variables with special names that are used in macros to receive arguments, nowhere was this variable changed, the macro's less than 30 lines long). I eventually got so frustrated I put debugging lines in between every single line of the macro to make it print the variables to the output log. Then I narrowed it down to one line - one where a Dial() command is executed (this is the function that actually places the call, this function isn't supposed to even be able to change anything in the macro that called it, and there are no other problems like this). Now that had me totally stumped. I could demonstrate exactly what was happening but I couldn't figure out why. Stranger still, the results changed slightly with the debugging lines in place, as if it's a race condition of some sort.

    The problem still exists to this day :(

    --
    "When information is power, privacy is freedom" - Jah-Wren Ryel