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

From KitwarePublic
< ITK‎ | Release 4‎ | Wrapping
Jump to navigationJump to search
No edit summary
Line 10: Line 10:
'''Without cache:'''
'''Without cache:'''
  time make -j 12
  time make -j 12
  real     46m58.307s
  real 46m58.307s
  user     41m49.829s
  user 41m49.829s
  sys       4m22.580s
  sys 4m22.580s


Repeated invocation:
Repeated invocation:
  make clean
  make clean
  time make -j 12
  time make -j 12
  real     44m3.667s
  real 44m3.667s
  user   39m29.606s
  user 39m29.606s
  sys     3m49.870s
  sys 3m49.870s
 
On enabling ccache, the build times reduce considerably as noted below:


On enabling ccache, the build times reduce considerably as noted below
'''With cache:'''
'''With cache:'''
  time make -j 12
  time make -j 12
  real   45m44.488s
  real 45m44.488s
  user   40m3.881s
  user 40m3.881s
  sys     4m25.381s
  sys 4m25.381s
    
    
  ccache -s
ccache -s
  cache hit (direct)                    19
cache hit (direct)                    19
  cache hit (preprocessed)      1
cache hit (preprocessed)      1
  cache miss                              2658
cache miss                              2658
  called for link                          396
called for link                          396
  compile failed                        22  
compile failed                        22  
  preprocessor error                12
preprocessor error                12
  no input file                              21
no input file                              21
  files in cache                          5307
files in cache                          5307
  cache size                                593.9 Mbytes
cache size                                593.9 Mbytes
  max cache size                      1.0 Gbytes
max cache size                      1.0 Gbytes


Repeated invocation:
Repeated invocation:
Line 44: Line 45:
  time make -j 12
  time make -j 12


  real     2m48.801s
  real 2m48.801s
  user   1m28.743s
  user 1m28.743s
  sys     0m40.986s
  sys 0m40.986s


  ccache -s
  ccache -s

Revision as of 22:00, 22 March 2011

Using CCache for WrapITK

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

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