How To compile COOLFluiD in Parallel with Distcc
Distcc is a great tool to speed up the compilation of big projects... and COOLFluiD is BIG.
So, how can you use it to compile COOLFluiD?
- You need to have a set of machines with a distcc service running on them. Setting up this is not covered in this howto. Refer to the distcc webpage. Mind that the version of the compiler MUST be the same. If you have gcc 3.4, there must be gcc-3.4 as default in all the parallel machines.
- In your working machine, when configuring you must set in the coolfluid.conf the compiler to be distcc plus the compiler oyu want to use:
cc = distcc mpicc cxx = distcc mpic++ fc = gfortran
Note that distcc does not work with fortran.
- Then you must configure COOLFluiD (see HowToCompileCoolfluid)
- Then you set the environmental variable which informs distcc which parallel machines to use. Mind that you may include your own machine in it, although you don't need to run a distcc service on it.
export DISTCC_HOSTS="machine1 machine2 machine3" or export DISTCC_HOSTS="machine1 machine2 machine3 localhost"
- You may now compile by running multiple compilation jobs in parallel. Usually the number of machines where you want to compiling.
make -j4
Optional : Using distcc with ccache
!!! Recomended for faster compilation !!!
- If you want to mix the use of distcc with ccache you can do:
cc = ccache mpicc cxx = ccache mpic++ fc = gfortran
Note that ccache does not work with fortran.
- And then, when you need to use the parallel compilation just setup:
export CCACHE_PREFIX="distcc"
Optional : setting up the distcc hosts permanently
- If you want you can setup the hosts for parallel compilation once and for all by editing the file $HOME/.distcc/hosts
Example file $HOME/.distcc/hosts:
machine1 machine2 machine3 localhost
On the VKI network
Note that using distcc on the VKI network is limited to compiling in 32 bit. For the VKI network you can do:
ln -sf /ar_cfd/coolfluid/profiles/distcc-hosts $HOME/.distcc/hosts
Use this setting with up to 10 jobs:
$> make -j10
