Saturday, April 19, 2008

Distributed Compile and Caching

This trick has boosted my compilation several times faster now. Here is the steps:

  1. First, you need to install both ccache and icecream (search on the Internet!). The default place for icecream files are under /opt/icecream.
  2. Create a folder /opt/ccache and /opt/ccache/bin
  3. Create file named "gcc" and type:
  4. #! /bin/sh
    export CCACHE_PATH=/opt/icecream/bin
    export PATH=/opt/icecream/bin:/usr/bin:$PATH
    ccache gcc "$@"
  5. Repeat step 3 and 4, but change line "ccache gcc" to "ccache c++" and name the file c++.
  6. Do the same thing (step 5) for cc abd g++
  7. Modify path (I put this in my ~/.profile): export PATH=/opt/ccache/bin:$PATH


To start icecream, as root do this: /etc/init.d/icecream restart
This will start the icecc daemon (iceccd). Here is my processes:

> ps -ef | grep ice
icecream 3944 1 0 19:33 ? 00:00:03 /usr/sbin/scheduler -d -l /var/log/icecc_scheduler -n icecream -vv
root 3957 1 0 19:33 ? 00:00:06 /usr/sbin/iceccd -d -l /var/log/iceccd --nice 5 -s linux-hp -n icecream -u icecream -b /var/cache/icecream -vv


(Modify file /etc/sysconfig/icecream as you needed (especially the scheduler and netname). I still not able to make my other computer to participate in the parallel compile (it is separated by a wireless router but in the same IP subnet). I don't know the root cause yet (the log said it was not able to find the scheduler, although I explicitly specify it [not thru broadcast]).

No comments:

Post a Comment