ITK/Release 4/Wrapping/ccache: Difference between revisions

From KitwarePublic
< ITK‎ | Release 4‎ | Wrapping
Jump to navigationJump to search
No edit summary
Line 70: Line 70:
  cache size  593.9 Mbytes
  cache size  593.9 Mbytes
  max cache size  1.0 Gbytes
  max cache size  1.0 Gbytes
=== 12-cores (24 physical threads) ===
to be updated by AG or ashish.

Revision as of 13:50, 29 May 2011

Using CCache for WrapITK

Installation of CCACHE

Using CCache[1] to build WrapITK can improve the build times considerably. For all unix systems (including MacOS X), ccache is enabled by creating symbolic links to the g++/gcc compiler:

ln -s /usr/bin/ccache /usr/local/bin/g++
ln -s /usr/bin/ccache /usr/local/bin/gcc

Alternatively, on MacOS X, Install ccache with Macports. The Macports installation would automatically create the symbolic links to g++/gcc compilers and put them in the directory /opt/local/libexec/ccache. The only remaining thing then is to add this directory to the PATH variable (alternatively you can add it to the .bash_profile or .profile in home directory)

$ sudo port install ccache
$ export PATH= /opt/local/libexec/ccache:$PATH

ITK Specific configuration Flags

Note that ccache is installed outside of ITK, and will benefit any software project that uses gcc.

The other parts of WrapITK which can benefit from ccache are gccxml and swig. To enable ccache usage with them, just turn ON the option WRAP_ITK_USE_CCACHE and everything is gonna be set up for you automatically.

Example of speed-ups

8-cores (8 physical threads)

All the subsequent builds of WrapITK would use ccache and we can see a speedup of as much as 40 minutes for repeated invocations. For example, following lists the results for building WrapITK with & without ccache (for 8-core Quad-Core Intel Xeon with Mac OSX Snow Leopard):

Without cache:

time make -j 12
real  46m58.307s
user  41m49.829s
sys  4m22.580s

Repeated invocation:

make clean
time make -j 12
real  44m3.667s
user  39m29.606s
sys  3m49.870s

On enabling ccache, the build times reduce considerably as noted below:

With cache:

time make -j 12
real  45m44.488s
user  40m3.881s
sys  4m25.381s
 
ccache -s
cache hit (direct)  19
cache hit (preprocessed)  1
cache miss  2658
called for link  396
compile failed  22 
preprocessor error  12
no input file  21
files in cache  5307
cache size  593.9 Mbytes
max cache size  1.0 Gbytes

Repeated invocation:

make clean
time make -j 12
real  2m48.801s
user  1m28.743s
sys  0m40.986s
ccache -s
cache hit (direct)  2435
cache hit (preprocessed)  0
cache miss  0
called for link  152
files in cache  5307
cache size  593.9 Mbytes
max cache size  1.0 Gbytes