Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > parallel tasks with rake ?

Reply
Thread Tools

parallel tasks with rake ?

 
 
quixoticsycophant@yahoo.com
Guest
Posts: n/a
 
      11-01-2006
I was excited to switch my makefile system to rake, but I just noticed
rake lacks a (GNU) make option I can't live without: -j4. It's like
"make & ; make & ; make & ; make &" but with the parallel jobs
properly synchronized. On a quad-core machine this makes a world of
difference, being around four times faster than a simple 'make'.

As I understand it, rake should be able to determine which targets can
be built in parallel just as (GNU) make does. rake's multitask
feature isn't quite right because it shouldn't be up to the user to
determine parallel vs non-parallel tasks. In fact, the user should
probably never decide parallelism by fiat; even if the user happens to
be correct, it creates a maintenance problem whereby additional tasks
will eventually render the parallel assertion false.

Perhaps there is something I'm missing about 'multitask' ?

 
Reply With Quote
 
 
 
 
Wilson Bilkovich
Guest
Posts: n/a
 
      11-01-2006
On 11/1/06, <> wrote:
> I was excited to switch my makefile system to rake, but I just noticed
> rake lacks a (GNU) make option I can't live without: -j4. It's like
> "make & ; make & ; make & ; make &" but with the parallel jobs
> properly synchronized. On a quad-core machine this makes a world of
> difference, being around four times faster than a simple 'make'.
>
> As I understand it, rake should be able to determine which targets can
> be built in parallel just as (GNU) make does. rake's multitask
> feature isn't quite right because it shouldn't be up to the user to
> determine parallel vs non-parallel tasks. In fact, the user should
> probably never decide parallelism by fiat; even if the user happens to
> be correct, it creates a maintenance problem whereby additional tasks
> will eventually render the parallel assertion false.
>
> Perhaps there is something I'm missing about 'multitask' ?
>
>


How does Make figure out which jobs can be run in parallel? In my
experience, it just runs everything in parallel, and things break when
the tasks aren't safely parallelizable. (e.g. doing make -j4 install
on a FreeBSD port)

 
Reply With Quote
 
 
 
 
quixoticsycophant@yahoo.com
Guest
Posts: n/a
 
      11-01-2006

Wilson Bilkovich wrote:
> On 11/1/06, <> wrote:
> > I was excited to switch my makefile system to rake, but I just
> > noticed rake lacks a (GNU) make option I can't live without: -j4.
> > It's like "make & ; make & ; make & ; make &" but with the
> > parallel jobs properly synchronized. On a quad-core machine this
> > makes a world of difference, being around four times faster than a
> > simple 'make'.
> >
> > As I understand it, rake should be able to determine which targets
> > can be built in parallel just as (GNU) make does. rake's
> > multitask feature isn't quite right because it shouldn't be up to
> > the user to determine parallel vs non-parallel tasks. In fact,
> > the user should probably never decide parallelism by fiat; even if
> > the user happens to be correct, it creates a maintenance problem
> > whereby additional tasks will eventually render the parallel
> > assertion false.
> >
> > Perhaps there is something I'm missing about 'multitask' ?

>
> How does Make figure out which jobs can be run in parallel? In my
> experience, it just runs everything in parallel, and things break when
> the tasks aren't safely parallelizable. (e.g. doing make -j4 install
> on a FreeBSD port)


The Make program figures it out from the dependency graph.
Unfortunately, the 'install' target you mention is a fake target which
depends on nothing. Such uses of 'install' are common but incorrect.
As a workaround, 'install' (and any other wrongly written targets)
should be treated as a special case and should not be run with -j.

 
Reply With Quote
 
Hugh Sasse
Guest
Posts: n/a
 
      11-01-2006
On Thu, 2 Nov 2006, wrote:

>
> Wilson Bilkovich wrote:
> >
> > How does Make figure out which jobs can be run in parallel? In my
> > experience, it just runs everything in parallel, and things break when
> > the tasks aren't safely parallelizable. (e.g. doing make -j4 install
> > on a FreeBSD port)

>
> The Make program figures it out from the dependency graph.
> Unfortunately, the 'install' target you mention is a fake target which
> depends on nothing. Such uses of 'install' are common but incorrect.
> As a workaround, 'install' (and any other wrongly written targets)
> should be treated as a special case and should not be run with -j.


Would marking it as a .PHONY help? I see little advice in the GNU
make manual about how to get this sort of thing right for parallel
make. Where should one look for such info?

Hugh

 
Reply With Quote
 
quixoticsycophant@yahoo.com
Guest
Posts: n/a
 
      11-01-2006

Hugh Sasse wrote:
> Would marking it as a .PHONY help? I see little advice in the GNU
> make manual about how to get this sort of thing right for parallel
> make. Where should one look for such info?


First of all, the workaround isn't so bad:

$ make -j4 && make install

In order for 'make -j4 install' to work, the install target must
simply depend on everything it needs. Needless to say, most Makefile
writers assume a 'make && make install' invocation and don't write
proper prerequisites for the install target. In other words, they
assume a single-process make.

Marking the target .PHONY just means it will run unconditionally (so
for example Make won't be confused by a file named 'install') and
won't affect the correctness or incorrectness of the dependencies.

To get back to the original point, the dependency graph is what
decides parallelism, not the other way around. Unless I misunderstand
the rake docs, the 'multitask' feature of rake is dangerous and should
be removed (see my original post).

Rake is a very nice tool, but it needs a -j equivalent in order to be
considered as an alternative to make (at least in my case). I put it
out to enterprising rubyists to give rake genuine parallel task
execution.

 
Reply With Quote
 
James Edward Gray II
Guest
Posts: n/a
 
      11-01-2006
On Nov 1, 2006, at 1:15 PM, wrote:

> Rake is a very nice tool, but it needs a -j equivalent in order to be
> considered as an alternative to make (at least in my case). I put it
> out to enterprising rubyists to give rake genuine parallel task
> execution.


I bet the pieces of this could be written up as a fun Ruby Quiz or
two. Determining what can be done in parallel from the dependancy
graph in particular sounds like a great quiz topic. Then you could
Rakify the solutions and submit a patch. Just a thought...

James Edward Gray II

 
Reply With Quote
 
gus
Guest
Posts: n/a
 
      11-01-2006
wrote:
> To get back to the original point, the dependency graph is what
> decides parallelism, not the other way around.


In the current implementation, is the dependency graph explicitly built
by rake? Or does it simply recursively run the dependencies as it goes
along?

Guillaume.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Testing Rake tasks with RSpec... and Rake John Feminella Ruby 0 04-25-2010 06:40 PM
Rake and rake aborted! Rake aborted! undefined method `gem' for main:Object peppermonkey Ruby 1 02-10-2007 04:43 AM
rakelibdir (was: Global rake tasks) Esad Hajdarevic Ruby 0 10-16-2006 06:33 PM
global rake tasks Esad Hajdarevic Ruby 1 10-09-2006 08:14 PM
Recording execution time across Rake tasks Francis Hwang Ruby 0 05-26-2006 11:52 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57