Slashdot Mirror


A Distributed Front-end for GCC

format writes "distcc is a distributed front-end for GCC, meaning you can compile that big project across n number of machines and get it done almost n times as fast. The machines don't have to be identical or be running the exact same GCC version, but having the same OS is helpful." With the advent of faster hardware, I can't complain about kernel compile times anymore, but larger source trees could definitely benefit from this.

20 of 195 comments (clear)

  1. GCC version by csnydermvpsoft · · Score: 5, Insightful

    The machines don't have to be identical or be running the exact same GCC version

    Well, to some extent they probably do. If you're running GCC 3.2 on one, you wouldn't be able to run 3.0 on another because of binary incompatibility.

  2. hmmm by Anonymous Coward · · Score: 5, Funny

    Yay! My 133 doesn't have to take 25 billion years to compile anymore! Uhm, wait, I don't have any other computers... Shoot.

    1. Re:hmmm by stevey · · Score: 5, Informative

      In that case you might like to look at ccache which is a compiler cache for a single machine.

      It will cache the compiler options for each source file and the resultant object file generated. I use a lot when I'm building packages for software - which require multiple compilations. It works very nicely - I'd love to see how well it would integrate with distcc....

  3. Interesting approach by PineGreen · · Score: 5, Interesting

    The sun compiler suite comes with dmake, which does the same on the level of make, rather than cc, but is essentially the same.
    Definitelly would make beowulf clusters interesting for compilation as well as hard core numerics (no joke intendend).

  4. Not N by Nashirak · · Score: 5, Informative

    You can almost never achevie a speed up of N. You can acheive S(N) = T(1)/(T(1)*alpha+((1-alpha)*T(1))/N+T0) Where T(1) is the time it takes to run the task with 1 computer, alpha is the part of the task that cannot be parallelised (as in startup registers etc.) and T0 is the communications overhead of the task.

    Just to clarify. :)

  5. Great for OpenOffice by IronTek · · Score: 5, Funny

    This could really spur the development of OpenOffice.

    With 50, 100 machines or so hooked up, OpenOffice's compile time could be reduced to as little as 1 or 2 days!!!

  6. YES! N! Re:Not N by angel'o'sphere · · Score: 5, Informative


    You can almost never achevie a speed up of N. You can acheive S(N) = (1)/ (T(1)*alpha+((1-alpha)*T(1)) / N+T0) Where
    T(1) is the time it takes to run the task with 1 computer, alpha is the part of the task that cannot be parallelised (as in startup registers etc.) and T0 is the communications overhead of the task.


    This is the text book. Amdahls law, IIRC.

    In reality, and also in most text books, there are exceptions where the solution scales with the number of processes.

    And it should be easy enough to see: 5 machines compiling one source file each are 5 times as fast as one machine compiling 5 source files.

    As long as you start gcc 5 times in a row you have
    the same initialization overhead for EACH instance of gcc one after the other.

    If you manage to start gcc with a couple of source files as argument to compile you save the laoding time of the binary at least. That would correspondend roughly to the alpha value.

    Amdahls law is usefull for a single program/problem: try to paralelize gcc and you find the compiling source can't get speed up very much. So 5 processors running several threads of one gcc instance, those do not scale by 5.

    However it says nothing about just solving the same problem multiple times in parallel.

    Regards,
    angel'o'sphere

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    1. Re:YES! N! Re:Not N by joib · · Score: 4, Informative

      That assumes you can divide the work equally. Consider that the number of source files probably aren't an integer*N, and that different source files take varying times to compile. Of course, as the number of source files approaches infinity, and if you have some load balancing scheme, this becomes a non-issue. Of course, in Real Life (TM) most projects don't have an infinite amount of source files.

  7. So, is it better? by FreeLinux · · Score: 5, Interesting

    Is this better than say, Group Compiler?

  8. Differece between distributed/parallel make? by angel'o'sphere · · Score: 4, Interesting

    Could someone please point out the difference between a parallel and/or distributed make, like pmake?

    It sounds not realy reasonable to put the coding work into gcc when you like to have yacc/bison and a bunch of perl scripts and what ever else you have in your makefile also speeded up.

    Regards,
    angel'o'sphere

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  9. Re:Don't need the same version? by Angry+White+Guy · · Score: 5, Informative

    From the FAQ:

    distcc doesn't care. However, in some circumstances, particularly for C++, gcc object files compiled with one version of gcc are not compatible with those compiled by another. This is true even if they are built on the same machine.
    It is usually best to make sure that every compiler name maps to a reasonably similar version on every machine. You can either make sure that gcc is the same everywhere, or use a version-qualified compiler name, such as gcc-3.2 or gcc-3.2-x86-linux.


    So in other words, keep them close, especially for gcc versions that break backwards capability.

    --
    You think that I'm crazy, you should see this guy!
  10. Big benifit by LoudMusic · · Score: 5, Interesting

    I think the biggest plus is that you can have one hella fast machine on your network running distcc that basically does all your compiling for all your other machines. I can see this being a big bonus for server farms like rackspace.com. The customers would be getting compile speeds from a big ass server, rather than just their little dinky Duron.

    ~LoudMusic

    --
    No sig for you. YOU GET NO SIG!
  11. Only true for C++ by FooBarWidget · · Score: 4, Informative

    The C ABI between *all* GCC versions (and probably other compilers too) are compatible. You can compile libgnome using GCC 2.95.2 and Nautilus using GCC 3.2 and not have any problems at all.

  12. good software design by ucblockhead · · Score: 4, Insightful

    If your system is well designed, compiling the entire thing should be a rare event. In a well designed project, most changes occur in c files or in headers only included in a few c files, so most changes only require compiling a very few files.

    Compiling the whole source tree should be the sort of thing you do fairly rarely (for a big project), perhaps once a night, perhaps automated so no one has to watch it.

    If compile time is something that is a significant problem for you, you really need to look at your code design.

    --
    The cake is a pie
  13. Check out also ccache.samba.org by GGarand · · Score: 5, Informative

    From the ccache homepage, which is also a Samba hosted project :

    ccache is a compiler cache.
    It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache.
    This often results in a 5 to 10 times speedup in common compilations.

  14. Source code by ucblockhead · · Score: 4, Insightful

    Running different versions could cause really nasty problems if different versions of gcc support different levels of C (like C99 or older C) or if one version has a compiler bug that another doesn't.

    Can you imagine code compiling or failing to compile randomly depending on which machine happens to compile it? Yikes! Debugging nightmare...

    --
    The cake is a pie
    1. Re:Source code by wik · · Score: 5, Insightful

      I've had bad experiences with this in a Condor cluster of linux machines which had different versions of glibc. Seemingly randomly, my jobs would blow up into the netherworld without running and without an error message. Until the administrators matched all of the glibc's (but not the linux distributions, for some reason), I had to compile everything with -static on one machine and pray.

      I wonder how much of a problem network bandwidth is in this system. With Condor, moving large datasets between machines is a problem. Object files can be pretty big and if you have a lot of them, you might risk pushing the compile bottleneck to the network. Even worse might be the link step, where all of the objects have to be visible to one machine (gcc doesn't have incremental linking yet, does it?).

      --
      / \
      \ / ASCII ribbon campaign for peace
      x
      / \
  15. security? by gooofy · · Score: 5, Informative

    looks like this one is not necessarily a good idea to run on a university workstation cluster...

    1.4 Security Considerations

    distcc should only be used on networks where all machines and all users are trusted.

    The distcc daemon, distccd, allows other machines on the network to run arbitrary commands on the volunteer machine. Anyone that can make a connection to the volunteer machine can run essentially any command as the user running distccd.

    distcc is suitable for use on a small to medium network of friendly developers. It's certainly not suitable for use on a machine connected to the Internet or a large (e.g. university campus) network without firewalling in place.

    inetd or tcpwrappers can be used to impose access control rules, but this should be done with an eye to the possibility of address spoofing.

    In summary, the security level is similar to that of old-style network protocols like X11-over-TCP, NFS or RSH.

    --
    time is a funny concept
  16. Live boot CD? by no_such_user · · Score: 5, Insightful

    I'd love a speedup, but the time I'd save compiling would be wasted on having to fully install another linux box. Being able to boot a CD with a live linux distro and this software, and then connect to these slave machines to help compile would be immensely helpful. My linux box is a Cyrix 200MHz PC. Being able to stick a CD into my Athlon 1800 to help the compile would be fabulous.

  17. Re:No, NOT N by angel'o'sphere · · Score: 4, Informative


    Let's say it takes 50 msec to initialize gcc and 500 msec to compile the average source file. Then it takes 5.05 sec to compile ten files with one copy of gcc


    Your calculation is wrong:

    I explicitly said: you start gcc N times for N files.

    So a call like gcc: 1.c 2.c 3.c ..... 10.c is not allowed.

    Because that call falls under amdahls law(in so far as a common initialization time is needed which is divided amoung the ten compile tasks).

    However 10 calls:
    gcc 1.c
    gcc 2.c
    gcc 3.c ...
    gcc 10.c

    Those ten calls scale with 10! running those ten calls one after the other on 1 machine takes exactly ten times the time then running one of them each on its own machine.

    I repeat: Amadahls law is about parallelizing one algorithm. It is not about starting the same algorithm on different problem sets (differnt c files) in parallel.

    Where as the first one does not scale infinite and not scale with N, the second one does(of course with some limitations in RL, e.g. if all compilers use the same file server via NFS).

    The interesting difference is this: under Amdahls law you have a maximum processors up to which the solution scales. Adding more processors does not make the problem solving faster. Very often it makes the problem solving slower indeed because of communication overhead. OTOH, by just duplicating the hardware and distributing the problem "identicaly" and not "divided and parallelized" you indeed get nearly infinite scale ups. You scale up to the point where the distributing and the gathering gets to expensive. (Distributing C sources from a CVS repository to compile farm machines and gathering the *.o files or better *.so during linking back)

    angel'o'sphere

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.