ubuntu - How to force Grunt tasks to use more CPU cores

07
2014-07
  • oliakaoil

    I am currently running Ubuntu 12.04.4 LTS and using Grunt along with various contrib packages for my build toolset. Among other things, I am using grunt-contrib-watch to automatically detect file changes and run grunt-contrib-sass to compile my SASS to CSS. For reasons that are unimportant to this post, there is way too much SASS and the build takes almost 18 seconds.

    I noticed that when grunt launches a sass process, that process will only ever use up to 100 percent of a single CPU core. The machine running the process has 8 cores which are idle most of the time. Is there a way to use taskset or some other relatively simple method to allow the launched sass process to use more cores? Obviously I am trying to speed up my build.

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    CPU Cores: The more the better?
  • Questioner

    I currently have a dual-core processor at work and a quad-core at home. I've noticed both PCs are pretty equal as far as launching applications/surfing the web.

    The difference I can see is that my dual-core is 2.8GHz and my quad-core is 2.4GHz.

    Is it better to have a dual-core with a fast clock speed or a quad-core with a mediocre clock speed?


  • Related Answers
  • Seasoned Advice (cooking)

    Your primary problem is software not written for multi-core.

    Look at Jeff Atwood's excellent article on Choosing Dual core or Quad Core.

    for most software, you hit a point of diminishing returns very rapidly after two cores. In Quad-Core Desktops and Diminishing Returns, I questioned how effectively today's software can really use even four CPU cores, much less the inevitable eight and sixteen CPU cores we'll see a few years from now.

    You are answered here (highlight copied from Jeff's article),

    However, there were some surprises in here, such as Excel 2007, and the Lost Planet "concurrent operations" setting. It's possible software engineering will eventually advance to the point that clock speed matters less than parallelism. Or eventually it might be irrelevant, if we don't get to make the choice between faster clock speeds and more CPU cores. But in the meantime, clock speed wins most of the time. More CPU cores isn't automatically better. Typical users will be better off with the fastest possible dual-core CPU they can afford.


    The issue of the Front-Side Bus (that term always amused me).
    With Nehalem things change... as ArsTechnica said last year.

    Moore's Law has given processor designers an embarrassment of transistor riches, and nowhere is that more apparent than in Intel's 45nm Nehalem processor. Debuting in 4- and 8-core variants later this year, Nehalem packs a ton of hardware into a single processor socket. (Early numbers put the transistor count of a quad-core Nehalem at 781 million; no numbers for the 8-core model have appeared yet.) But trying to feed all of that hardware with the Intel platform's existing frontside bus architecture would be folly. So, just as importantly, Nehalem also sounds the long-overdue death knell for Intel's positively geriatric frontside bus architecture.

    The radical change in Intel's system bandwidth situation that Intel's new QuickPath Interconnect (QPI) represents is perhaps the largest single factor that shaped Nehalem's design. Between QuickPath and Nehalem's integrated memory controller, a Nehalem processor will have access to an unprecedented amount of aggregate bandwidth, especially in two- and four-socket implementations.

    AMD moved the memory controller into the processor earlier and used Hypertransport.