vxp has asked for the wisdom of the Perl Monks concerning the following question:

I've a 26 node cluster at my full disposal. 3.06Ghz CPU, 2 of them per node. I thought it might be an interesting idea to write a client/server set of scripts that would basically act as a distributed compiler.

Say you have a large project to compile (example: linux kernel). Its a collection of small(ish) .c files, basically. Master node would run the preprocessor locally, so there would be no need to have the identical header files across the compute nodes (nevermind the fact that compute nodes _are_ identical.. but why not do this for the people who dont have identical 26 machines at their disposal).

Then it would take the .c files and distribute them over to the compute nodes, which would gladly compile them and return them over to the master node when done, for linking. That is it, in a very brief nutshell.

What do you, fellow monks, think about this idea? Good? Bad? Any CPAN modules you'd recommend to use for this task? Any wisdom to share at all, about the idea?

May perl be with you.

Replies are listed 'Best First'.
Re: distributed compiler
by valdez (Monsignor) on Jul 23, 2004 at 15:41 UTC

    Have a look at distcc, it is exactly what you described:

    distcc is a program to distribute builds of C, C++, Objective C or Objective C++ code across several machines on a network. distcc should always generate the same results as a local build, is simple to install and use, and is often two or more times faster than a local compile.
    See also Parallel::Pvm on CPAN, it could be a good starting point.

    Ciao, Valerio

Re: distributed compiler
by pbeckingham (Parson) on Jul 23, 2004 at 15:46 UTC

    Don't forget that there are often several lengthy link operations that could themselves be distributed, so the master is not doing all of that work.

    But I would use distcc.

      of course you would, because there's no perl-distcc yet! :D

      just kidding of course.
      but, i'm going to try and out-do distcc and prolly take a bit less lines of code to do it :)

        Then best wishes to you! I imagine you'll enjoy the challenge, and learn lots from it. Nice project.