May 01 11:57:28 oh, incidentally, i thought you might be interested in this: May 01 11:57:29 http://samba.org/ftp/unpacked/distcc/README May 01 11:58:54 yes I do May 01 11:58:55 much May 01 11:59:11 it seems to be going really well May 01 11:59:18 i think it's quite promising May 01 11:59:22 in fact, I fully expect to have 3 machines or so underfoot to try that on May 01 11:59:33 cool May 01 11:59:40 it's what I want: more machines = faster compile May 01 11:59:44 exactly! May 01 11:59:45 it's not *that* hard May 01 12:00:03 you have to get the required files to the machine, get the compiled files back May 01 12:00:07 right May 01 12:00:21 the net traffic is not much overhead, anyway, it's pipelined May 01 12:00:27 the neat thing about shipping the preprocessed source is that there is only one file going in each direction May 01 12:00:45 http://samba.org/ftp/unpacked/distcc/src/HACKING May 01 12:01:19 and, because it's not secure, it will fun inserting compiler-viruses May 01 12:01:21 new sport May 01 12:01:41 the other situation where it works nicely is when you're working on a laptop but happen to have a faster machine around May 01 12:01:44 um May 01 12:01:48 i did think about that May 01 12:01:59 you can imagine running it over ssh May 01 12:02:19 but there will be a fair cpu hit from that, possibly enough to make it impractical May 01 12:02:39 where did you see the part about the preprocessor? May 01 12:02:55 which part about the preprocessor? May 01 12:03:08 the neat thing about shipping the preprocessed source May 01 12:03:12 oh, right May 01 12:03:21 so, i always run cpp on the local machine May 01 12:03:33 and then ship that to the remote one, which runs cc1, cc2, as, etc May 01 12:03:49 that avoids the need to have header files etc on the remote machine May 01 12:03:49 ok May 01 12:03:50 right May 01 12:03:52 headers May 01 12:03:55 yesss May 01 12:03:57 running cpp is really cheap compared to the other stages May 01 12:04:08 yup May 01 12:04:16 <-- digdude has quit (Ping timeout: 272 seconds) May 01 12:04:27 in fact, i think that insight is the really novel part that makes it work May 01 12:04:31 I need this May 01 12:04:34 without that it's possible, but just too hard to set up May 01 12:04:40 yes May 01 12:05:05 e.g. sun have a distributed build system, but you need all the machines to (a) share an NFS directory mounted at the exact same location, and (b) have the exact same system headers May 01 12:05:11 nice hack, now lemessee - I should be able to get a sub-minute compile with that May 01 12:05:28 it's a bit rough at the moment, but it works May 01 12:05:48 i booted a kernel built using it, and it seemed to work May 01 12:05:53 (how' that for confidence :-) May 01 12:06:24 one thing i might do is gently gzip -2 the cpp output; it tends to be v large and v compressible; May 01 12:06:36 at the moment the network seems to be the limiting factor May 01 12:06:40 so, please try it out May 01 12:06:43 it's in anoncvs May 01 12:06:52 grab me if you have any issues May 01 12:06:57 basically, you just need to do May 01 12:07:10 make; ./distccd&; CC=`pwd`/distcc May 01 12:07:17 make; ./distccd&; CC="`pwd`/distcc gcc" May 01 12:07:19 and off you go May 01 12:09:26 --> sfr (~sfr@CPE-203-51-25-76.nsw.bigpond.net.au) has joined #ozlabs May 01 12:09:50 that would be a most interesting number May 01 12:09:59 ? May 01 12:10:14 i.e., does the compression cost more than the transmit time it saves May 01 12:10:14 very interesting May 01 12:10:18 oh, right May 01 12:10:26 in fact, compression increases scalability May 01 12:11:01 it consumes more cpu on the master machine, in return for being able to squeeze more stuff across the network and therefore do more work remotely May 01 12:11:53 it might really come down to how fast the network is. Another thing, the network transmit really just turns into latency, not loss of throughput May 01 12:11:58 with e.g. a really slow laptop, 100mbps network, and fast remote machine, you probably wouldn't want it because the laptop might be flat out running cpp and sending the files May 01 12:12:10 so by that measure, it's better to leave all the cpu for compiling May 01 12:12:38 well, at hp we have 3 x 1700Mhz P4s, and a 100Mbps non-switched hub May 01 12:12:51 on that situation, the network saturates and the remote machines are ~50% idle May 01 12:13:06 so, possibly spending a *little* time on compression would get more work done May 01 12:13:40 back-of-envelope tests with "time gzip -2" vs "time cpp" show it uses relatively little cpu May 01 12:13:59 oh, however, we can do more pipelining here than we do at the moment, which might help the situation May 01 12:14:06 the network is only intermittently flooded May 01 12:14:26 it may be better to run cpp into a pipe, and gcc from a pipe, so that their work can be overlapped May 01 12:14:31 at the moment i just use tmpfiles May 01 12:18:12 --> digdude (~digdude@dsl-g1-42.surfcity.net) has joined #ozlabs May 01 12:18:13 --> dave0 (^dave@cabal.evilplot.org) has joined #ozlabs May 01 12:19:50 mbp, I didn't realize right away that this is your project May 01 12:19:56 oh right :-) May 01 12:20:01 that's why i like it so much :-) May 01 12:20:12 hey, I like it more now :-) May 01 12:21:57 well I wasn't quite precise about the pipeline thing May 01 12:22:21 *so long as the compile is faster than the network* you're better off using the cpu for the compiler May 01 12:22:27 I thinkg ;) May 01 12:22:46 hm May 01 12:23:06 erk May 01 12:23:08 like many parallelization things, even though it gets less efficient as you increase parallelism, you still get more work done May 01 12:23:11 I meant the opposite May 01 12:23:16 well May 01 12:23:43 *so long as the compile throughput is less than the network throughput* you're better off using the cpu for the compiler May 01 12:23:55 do you mean using the master's cpu? May 01 12:24:22 i think it's a qn of opportunity cost May 01 12:24:23 if the master has time left over, should it not be compiling too? May 01 12:24:34 by default (without distcc), the master's cpu does all the compilations May 01 12:24:39 oh, right May 01 12:24:42 absolutely May 01 12:24:58 so typically you set DISTCC_HOSTS='localhost jonquille nevada' May 01 12:25:07 and it distributes jobs amongst the three May 01 12:25:22 "localhost" is a special case, of course, where it just execs() the compiler directly May 01 12:25:31 so... what are your numbers? How far off linear? May 01 12:26:24 it's early days, but i got a 40% reduction in wall clock time from adding a second machine May 01 12:26:53 oh, sorry, May 01 12:26:58 from adding a second *faster* machine May 01 12:27:38 you can see some numbers in the readme May 01 12:27:58 running at hp threw up a few small bugs; i haven't rerun benchmarks yet May 01 12:28:26 it's the coolest hack I've heard about for some time May 01 12:28:38 wow, thanks (-: May 01 12:28:42 i thought that too May 01 12:28:50 i just woke up one morning and the idea was in my mind May 01 12:29:17 of course, you need to run it with make -j, so that it runs local and remote jobs in parallel May 01 12:29:54 the thing is that while sending across the network takes a lot of time, it takes barely any CPU, and so it basically does not interfere with compiling something else locally at the same time May 01 12:30:08 right May 01 12:30:45 so, even if you get just a few jobs done remotely, you've still won May 01 12:31:17 (local compiles become very slightly slower, because we need to decide where to run them, but not by much) May 01 12:31:35 of course, if there was only a small improvement, people might not be bothered to install it May 01 12:31:46 I was thinking something related: when I'm on my road, rsync my source files back to my server, compile there, and send the binary back to me May 01 12:31:51 faster than compiling on the laptop May 01 12:31:51 but i reckon installation can be quite simple, and the improvement is actually quite large May 01 12:31:54 yep May 01 12:31:56 i've tried that May 01 12:31:59 but it's too much hassle! May 01 12:32:09 this way, you can compile from within emacs (or whatever) May 01 12:32:10 not if somebody makes it easy :) May 01 12:32:22 and remote error messages come up looking exactly as if they were local May 01 12:32:35 and I did waste a lot of time waiting for my laptop May 01 12:32:40 line numbers and filenames in errors exactly correspond to ones on your local disk May 01 12:33:05 it takes 3 minutes to do a diff of two trees on the laptop, 1.5 seconds on the server May 01 12:33:10 oh, the other problem with rsyncing is that it becomes bloody confusing if the remote machine's libraries are out of sync May 01 12:33:13 some obvious May 01 12:33:18 some obvious advantage there May 01 12:33:38 i guess rsync is a better solution if there's a really slow link between you and the fast machine May 01 12:33:46 I can see a lot of potetential for confusion May 01 12:34:09 33k6, not 100m May 01 12:34:47 oh May 01 12:34:57 tim just pointed out that our hub says on the front "10Mbps" May 01 12:35:02 so it's probably not 100Mbps :-/ May 01 12:35:34 i'm sure we asked for a 100mbps one May 01 12:35:36 fooey May 01 12:38:15 "i've always wanted to use sendfile(), but never had a reason until now" May 01 12:38:15 :-) May 01 12:39:23 mbp: interesting May 01 12:39:30 mbp: I played with distributed compiles a few years back May 01 12:39:47 mbp: nothing as clever as this - just gcc invoked over ssh on an NFS share May 01 12:39:52 mm May 01 12:39:53 yep May 01 12:40:00 that's the standard solution May 01 12:40:28 I suspect the CPU load per se of ssh would be acceptable, but the start up cost is very high so you'd need to do as much as possible over one ssh connection May 01 12:40:33 right May 01 12:40:41 that was my original idea; i wanted to hoard ssh connections May 01 12:40:52 tridge persuaded me to not use it by default May 01 12:41:10 What are you using as the transport now? May 01 12:41:30 it also reminded me of ANU's bunyip, where they just use rsh and so on inside the secured network May 01 12:41:41 dgibson: plain TCP, with an easily parseable format: May 01 12:41:48 right May 01 12:41:56 4-character command, 8-character hex length, data May 01 12:41:58 So you run a server which listens on the farm machines? May 01 12:42:05 right May 01 12:42:12 either from inetd, or standalone May 01 12:42:32 standalone is a bit better, because then it can control the number of jobs running at once May 01 12:42:34 distcc over jabber! May 01 12:42:48 Hmmm.. you could do that anyway May 01 12:42:53 from inetd, yep May 01 12:42:57 The other big problem you will encounter is that most Makefiles are complete crap May 01 12:43:03 and can't handle -j? May 01 12:43:13 or have gcc hardcoded? May 01 12:43:24 mbp: If running from inetd running over ssh should be pretty easy, since it's already using stdin May 01 12:43:35 Can't handle -j properly May 01 12:43:56 well, y'know, people have to make *some* effort if they want parallel compiles May 01 12:44:02 The for $$i in $(SUBDIRS); do $(MAKE) -C $$i; done construct is the most common problem May 01 12:44:37 mind you, even if you can't parallelize, transparently shifting compilation to a faster machine (e.g. laptop -> regatta) might be worthwhile May 01 12:44:50 That's true May 01 12:45:45 Presumably you could plug this into the backed of ccache quite easily too May 01 12:45:51 s/backed/backend/ May 01 12:46:00 oh, right May 01 12:46:23 in fact it works quite nicely, because ccache runs cpp itself to work out whether the files have really changed May 01 12:46:41 That's exactly what I was thinking May 01 12:46:42 and so the marginal cost to the master machine of runing distcc becomes v small May 01 12:46:53 CC='ccache distcc gcc' works well May 01 12:49:04 Can you control what preference is given to each machine May 01 12:49:16 e.g. for each compile on my laptop run 24 on the regatta? May 01 12:49:23 that part of it is v crude at the moment, but yes May 01 12:49:37 DISTCC_HOSTS='localhost ego ego ego ego ego ego ego ego ego ego' May 01 12:49:44 they're uniformly distributed May 01 12:49:49 it's kind of stochastic at the moment May 01 12:49:54 --> vmarshall (~vmarshall@user-vcaur38.dsl.mindspring.com) has joined #ozlabs May 01 12:49:54 right May 01 12:50:04 mbp has a big ego? May 01 12:50:07 really the client ought to keep track of how busy it thinks each slave is, but i haven't done that yet May 01 12:50:12 tpot: no, paulus does May 01 12:50:15 tpot: No, lots of them, but they're each quite small ;-) May 01 12:50:55 At least make -jn now works meaningfully in recursive makefiles May 01 12:51:04 It didn't when I was playing with this which was a big problem May 01 12:51:22 dgibson: i've tried building rsync, samba, and 2.4 with it, with apparent success May 01 12:51:33 i guess the next biggest projects would be all of GNOME, or mozilla May 01 12:51:47 heh. now try X, and do battle with the monstrosity that is imake May 01 12:52:19 is imake used instead of make, or does it generate a makefile? May 01 12:52:34 It generates a makefile May 01 12:53:33 hm May 01 12:53:34 oh well May 01 12:53:38 i'll try it sometime May 01 12:53:45 well, many makefiles actually May 01 12:54:14 I'd recommend not eating right beforehand May 01 12:54:17 ha ha May 01 12:54:44 well, it's not necessary that distcc help every single project May 01 12:54:53 anyhow, let me know if you get a chance to try it May 01 12:59:55 do you pick a target machine in the farm randomly or deterministically? May 01 13:06:52 --> Rasmus (~rasmus@07-034.006.popsite.net) has joined #ozlabs May 01 13:07:19 Server has been working ok I take it? May 01 13:08:34 yup May 01 13:09:33 it's in Sifry's basement now May 01 13:17:11 i notice you had a major isp change May 01 13:19:19 <-- shawnm has quit (Client Exit: Client Exiting) May 01 13:21:37 night everybody May 01 13:21:48 birds are singing out there, time for zzz's May 01 13:24:03 cheep! May 01 13:25:57 --> anton (~anton@CPE-203-51-24-59.nsw.bigpond.net.au) has joined #ozlabs May 01 13:29:20 dgibson: at the moment it's randomly distributed across the specified hosts, May 01 13:29:27 because i don't know how busy they are May 01 13:29:48 mbp: ok. round robin might be better than random and easier than keeping track of how busy they are May 01 13:30:29 yep May 01 13:30:35 that's what i thought i'd do next May 01 13:30:59 it just requires a reliable, simple mechanism of sharing a global counter between all processes May 01 13:31:10 i thought perhaps just truncating a lock file to length n May 01 13:31:20 since races are not too harmful May 01 13:31:23 other suggestions welcome May 01 13:37:07 use a tdb! May 01 13:40:50 Hmm... if you're not so worried about races surely it would be easier just to write the counter to a file May 01 13:41:16 well May 01 13:41:33 you might have somebody running two compilations in different windows, with different _HOSTS settings May 01 13:41:42 in that case a simple counter would get confusing May 01 13:41:58 it might not be any worse than random, but it's not much better May 01 13:42:12 True, but that's probably not a terribly common case May 01 13:42:33 <-- daniel has quit (Ping timeout: 272 seconds) May 01 13:42:47 the race can be avoided just by doing a fcntl() lock, read value, write value, fcntl() unlock May 01 13:43:12 Use value % length as the index into _HOSTS May 01 13:43:16 yep May 01 13:43:25 that's what i had in mind May 01 13:43:50 randomness actually turns out to be somewhat more reasonable if each host only accept()s one or two jobs at a time May 01 13:44:02 because everybody else will just block waiting May 01 13:44:29 ? May 01 13:46:32 --> enigma (~eriddle@adsl-63-195-7-203.dsl.chic01.pacbell.net) has joined #ozlabs May 01 13:47:32 hm, nevermind May 01 13:47:33 good job Rasmus. Did you set your DNS to update more frequently in anticipation or do you just keep it that way? May 01 13:47:40 i think my reasoning there is a bit dodgy May 01 13:47:44 hi mbp