1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
|
<?xml version="1.0" ?>
<!-- vim:set ts=4 noet syntax=xml: -->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
<!ENTITY ccache "<application>ccache</application>">
<!ENTITY distcc "<application>distcc</application>">
<!ENTITY icecc "<application>icecc</application>">
<!ENTITY icemon "<application>icemon</application>">
]>
<refentry id="icecream">
<refentryinfo>
<title>Icecream User's Manual</title>
<author>
<personname>
<firstname>Cornelius</firstname>
<surname>Schumacher</surname>
</personname>
</author>
<date>April 21th, 2005</date>
<productname>Icecream</productname>
</refentryinfo>
<refmeta>
<refentrytitle>icecream</refentrytitle>
<manvolnum>7</manvolnum>
</refmeta>
<refnamediv>
<refname>icecream</refname>
<refpurpose>A distributed compile system</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>Icecream is a distributed compile system for C and C++.</para>
<para>Icecream is created by SUSE and is based on ideas and code by &distcc;. Like
&distcc; it takes compile jobs from your build and distributes it to remote
machines allowing a parallel build on several machines you have got. But unlike
&distcc; Icecream uses a central server that schedules the compile jobs to the
fastest free server and is as this dynamic. This advantage pays off mostly for
shared computers, if you are the only user on X machines, you have full control
over them anyway.</para>
</refsect1>
<refsect1>
<title>How to use icecream</title>
<para>You need:</para>
<itemizedlist>
<listitem>
<para>One machine that runs the scheduler
(<command>icecc-scheduler <option>-d</option></command>)</para>
</listitem>
<listitem>
<para>Many machines that run the daemon
(<command>iceccd <option>-d</option></command>)</para>
</listitem>
</itemizedlist>
<para>If you want to compile using icecream, make sure
<filename class="directory">$prefix/lib/icecc/bin</filename>
is the first entry in your path, e.g. type
<command>export PATH=/usr/lib/icecc/bin:$PATH</command>
(Hint: put this in <filename>~/.bashrc</filename> or <filename>/etc/profile</filename>
to not have to type it in everytime)
</para>
<para>Then you just compile with
<command>make <option>-j <replaceable>num</replaceable></option></command>,
where <parameter>num</parameter> is the amount of jobs you want to compile in parallel.
Do not exaggerate. Too large numbers can overload your machine or the compile cluster
and make the build in fact slower.</para>
<para><warning>
Never use icecream in untrusted environments. Run the daemons and
the scheduler as unpriviliged user in such networks if you have to! But you will
have to rely on homogeneous networks then (see below).
</warning></para>
<para>If you want an overview of your icecream compile cluster, or if you just want funny stats,
you might want to run &icemon;.</para>
</refsect1>
<refsect1>
<title>Using icecream in heterogeneous environments</title>
<para>If you are running icecream daemons in the same icecream
network but on machines with incompatible compiler versions, icecream needs to send
your build environment to remote machines (note: they <emphasis>all</emphasis> must be running as
root if compiled without libcap-ng support. In the future icecream might gain the ability to know when machines cannot
accept a different environment, but for now it is all or nothing).</para>
<para>Under normal circumstances this is handled transparently by the icecream
daemon, which will prepare a tarball with the environment when needed.
This is the recommended way, as the daemon will also automatically update
the tarball whenever your compiler changes.</para>
<para>If you want to handle this manually for some reason, you have to tell
icecream which environment you are using. Use <command>icecc <option>--build-native</option></command> to
create an archive file containing all the files necessary to setup the compiler
environment. The file will have a random unique name like
<filename>ddaea39ca1a7c88522b185eca04da2d8.tar.bz2</filename> per default. Rename it to something
more expressive for your convenience, e.g. <filename>i386-3.3.1.tar.bz2</filename>. Set
<command>ICECC_VERSION=<replaceable>filename_of_archive_containing_your_environment</replaceable></command>
in the shell environment where you start the compile jobs and the file will be
transferred to the daemons where your compile jobs run and installed to a chroot
environment for executing the compile jobs in the environment fitting to the
environment of the client. This requires that the icecream daemon runs as root.
</para>
</refsect1>
<refsect1>
<title>Cross-Compiling using icecream</title>
<para>SUSE got quite some good machines not having a processor from Intel or
AMD, so icecream is pretty good in using cross-compiler environments similar
to the above way of spreading compilers. There the ICECC_VERSION variable looks
like
<literal><native_filename>(,<platform>:<cross_compiler_filename>)*</literal>,
for example like this:
<literal>/work/9.1-i386.tar.bz2,ia64:/work/9.1-cross-ia64.tar.bz2</literal>
</para>
<para>How to package such a cross compiler is pretty straightforward if you look
what is inside the tarballs generated by
<command>icecc <option>--build-native</option></command>.</para>
</refsect1>
<refsect1>
<title>Cross-Compiling for embedded targets using icecream</title>
<para>When building for embedded targets like ARM often you will have a toolchain
that runs on your host and produces code for the target. In these situations you
can exploit the power of icecream as well.</para>
<para>Create symlinks from where &icecc; is to the name of your cross compilers
(e.g. <filename class="symlink">arm-linux-g++</filename> and
<filename class="symlink">arm-linux-gcc</filename>), make sure that these symlinks are in the
path and before the path of your toolchain, with <varname>$ICECC_CC</varname>
and <varname>$ICECC_CXX</varname> you need to tell icecream which compilers to
use for preprocessing and local compiling. e.g. set it to
<command>ICECC_CC=arm-linux-gcc</command> and
<command>ICECC_CXX=arm-linux-g++</command>.</para>
<para>As the next step you need to create a <literal role="extension">.tar.bz2</literal>
of your cross compiler,
check the result of build-native to see what needs to be present.</para>
<para>Finally one needs to set <varname>ICECC_VERSION</varname> and point it to
the <literal role="extension">.tar.bz2</literal> you have created.
When you start compiling your toolchain will be used.</para>
<para><note>
With <varname>ICECC_VERSION</varname> you point out on which
platforms your toolchain runs, you do not indicate for which target code will be
generated.
</note></para>
</refsect1>
<refsect1>
<title>Cross-Compiling for multiple targets in the same environment using icecream</title>
<para>When working with toolchains for multiple targets, icecream can be
configured to support multiple toolchains in the same environment.</para>
<para>Multiple toolchains can be configured by appending =<target> to the
tarball filename in the <varname>ICECC_VERSION</varname> variable. Where the <target> is
the cross compiler prefix. There the <varname>ICECC_VERSION</varname> variable will look
like <native_filename>(,<platform>:<cross_compiler_filename>=<target>)*.</para>
<para>Below an example of how to configure icecream to use two toolchains,
/work/toolchain1/bin/arm-eabi-[gcc,g++] and /work/toolchain2/bin/arm-linux-androideabi-[gcc,g++],
for the same host architecture:</para>
<itemizedlist>
<listitem>
<para>Create symbolic links with the cross compilers names
(e.g. arm-eabi-[gcc,g++] and arm-linux-androideabi-[gcc,g++])
pointing to where the icecc binary is. Make sure these symbolic links are
in the $PATH and before the path of the toolchains.</para>
</listitem>
<listitem>
<para>Create a tarball file for each toolchain that you want to use with
icecream. The <filename>icecc-create-env</filename> script can be used to
create the tarball file for each toolchain, for example:
<command>icecc-create-env /work/toolchain1/bin/arm-eabi-gcc</command>
<command>icecc-create-env /work/toolchain2/bin/arm-linux-androideabi-gcc</command>.</para>
</listitem>
<listitem>
<para>Set <varname>ICECC_VERSION</varname> to point to the native tarball file and for each
tarball file created to the toolchains (e.g <varname>ICECC_VERSION</varname>=/work/i386-native.tar.gz,/work/arm-eabi-toolchain1.tar.gz=arm-eabi,/work/arm-linux-androideabi-toolchain2.tar.gz=arm-linux-androideabi).</para>
</listitem>
</itemizedlist>
<para>With these steps the icecrem will use <filename>/work/arm-eabi-toolchain1.tar.gz</filename>
file to cross compilers with the prefix <literal>arm-eabi</literal>
(e.g. <command>arm-eabi-gcc</command> and <command>arm-eabi-g++</command>), use
<filename>/work/arm-linux-androideabi-toolchain2.tar.gz</filename>
file to cross compilers with the prefix <literal>arm-linux-androideabi</literal>
(e.g. <command>arm-linux-androideabi-gcc</command> and <command>arm-linux-androideabi-g++</command>)
and use <filename>/work/i386-native.tar.gz</filename> file to compilers without prefix,
the native compilers.</para>
</refsect1>
<refsect1>
<title>How to combine icecream with &ccache;</title>
<para>The easiest way to use &ccache; with icecream is to set <varname>CCACHE_PREFIX</varname>
to &icecc; (the actual icecream client wrapper)
<screen><command>export CCACHE_PREFIX=icecc</command></screen>
</para>
<para>This will make &ccache; prefix any compilation command it needs to do with icecc,
making it use icecream for the compilation (but not for preprocessing alone).</para>
<para>To actually use &ccache;, the mechanism is the same like with using icecream alone.
Since &ccache; does not provide any symlinks in
<filename class="directory">/opt/ccache/bin</filename>,
you can create them manually:
<screen>mkdir /opt/ccache/bin
ln -s /usr/bin/ccache /opt/ccache/bin/gcc
ln -s /usr/bin/ccache /opt/ccache/bin/g++</screen>
</para>
<para>And then compile with
<screen>export PATH=/opt/ccache/bin:$PATH</screen>
</para>
<para>Note however that &ccache; is not really worth the trouble if you are not
recompiling your project three times a day from scratch (it adds quite some overhead
in comparing the preprocessor output and uses quite some disc space and I found
a cache hit of 18% a bit too few, so I disabled it again).</para>
</refsect1>
<refsect1>
<title>Debug output</title>
<para>You can use the environment variable <varname>ICECC_DEBUG</varname> to
control if icecream gives debug output or not. Set it to
<literal>debug</literal> to get debug output. The other possible values are
<literal>error</literal>, <literal>warning</literal> and <literal>info</literal>
(the <option>-v</option> option for daemon and scheduler raise the level per
<option>-v</option> on the command line - so use <option>-vvv</option>
for full debug).</para>
</refsect1>
<refsect1>
<title>Avoiding old hosts</title>
<para>It is possible that compilation on some hosts fails because they are too old
(typically the kernel on the remote host is too old for the glibc from the local host).
Recent icecream versions should automatically detect this and avoid such hosts
when compilation would fail. If some hosts are running old icecream versions and
it is not possible to upgrade them for some reason, use
<screen>export ICECC_IGNORE_UNVERIFIED=1</screen>
</para>
</refsect1>
<refsect1>
<title>Some Numbers</title>
<para>
Numbers of my test case (some STL C++ genetic algorithm)
<itemizedlist>
<listitem>
<para><command>g++</command> on my machine: 1.6s</para>
</listitem>
<listitem>
<para><command>g++</command> on fast machine: 1.1s</para>
</listitem>
<listitem>
<para>icecream using my machine as remote machine: 1.9s</para>
</listitem>
<listitem>
<para>icecream using fast machine: 1.8s</para>
</listitem>
</itemizedlist>
</para>
<para>The icecream overhead is quite huge as you might notice, but the compiler
cannot interleave preprocessing with compilation and the file needs to be
read/written once more and in between the file is transferred.</para>
<para>But even if the other computer is faster, using <command>g++</command> on my local machine
is faster. If you are (for whatever reason) alone in your network at some point,
you lose all advantages of distributed compiling and only add the overhead. So
icecream got a special case for local compilations (the same special meaning
that localhost got within $DISTCC_HOSTS). This makes compiling on my machine
using icecream down to 1.7s (the overhead is actually less than 0.1s in
average).</para>
<para>As the scheduler is aware of that meaning, it will prefer your own
computer if it is free and got not less than 70% of the fastest available
computer.</para>
<para>Keep in mind, that this affects only the first compile job, the second one
is distributed anyway. So if I had to compile two of my files, I would get
<itemizedlist>
<listitem>
<para><command>g++ <option>-j1</option></command> on my machine: 3.2s</para>
</listitem>
<listitem>
<para><command>g++ <option>-j1</option></command> on the fast machine: 2.2s</para>
</listitem>
<listitem>
<para>using icecream <option>-j2</option> on my machine: max(1.7,1.8)=1.8s</para>
</listitem>
<listitem>
<para>(using icecream <option>-j2</option> on the other machine: max(1.1,1.8)=1.8s)</para>
</listitem>
</itemizedlist>
</para>
<para>The math is a bit tricky and depends a lot on the current state of the
compilation network, but make sure you are not blindly assuming
<command>make <option>-j2</option></command> halves your compilation time.</para>
</refsect1>
<refsect1>
<title>What is the best environment for icecream</title>
<para>In most requirements icecream is not special, e.g. it does not matter what
distributed compile system you use, you will not have fun if your nodes are
connected through than less or equal to 10MBit. Note that icecream compresses
input and output files (using <literal>lzo</literal>), so you can calc with ~1MBit per compile job
- i.e. more than <command>make <option>-j10</option></command> will not
be possible without delays.</para>
<para>Remember that more machines are only good if you can use massive
parallelization, but you will for sure get the best result if your submitting
machine (the one you called <command>g++</command> on) will be fast enough to feed the others.
Especially if your project consists of many easy to compile files, the
preprocessing and file I/O will be job enough to need a quick machine.</para>
<para>The scheduler will try to give you the fastest machines available, so even
if you add old machines, they will be used only in exceptional situations, but
still you can have bad luck - the scheduler does not know how long a job will
take before it started. So if you have 3 machines and two quick to compile and
one long to compile source file, you are not safe from a choice where everyone
has to wait on the slow machine. Keep that in mind.</para>
</refsect1>
<refsect1>
<title>Network setup for Icecream (firewalls)</title>
<para>A short overview of the ports icecream requires:
<itemizedlist>
<listitem>
<para>TCP/10245 on the daemon computers (required)</para>
</listitem>
<listitem>
<para>TCP/8765 for the the scheduler computer (required)</para>
</listitem>
<listitem>
<para>TCP/8766 for the telnet interface to the scheduler (optional)</para>
</listitem>
<listitem>
<para>UDP/8765 for broadcast to find the scheduler (optional)</para>
</listitem>
</itemizedlist>
</para>
<para>If the monitor cannot find the scheduler, use
<command>ICECC_SCHEDULER=<replaceable>host</replaceable> icemon</command>.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>icecc-scheduler(1), iceccd(1), icemon(1)</para>
</refsect1>
<refsect1>
<title>Icecream Authors</title>
<para>Stephan Kulow <coolo@suse.de></para>
<para>Michael Matz <matz@suse.de></para>
<para>Cornelius Schumacher <cschum@suse.de></para>
<para>...and various other contributors.</para>
</refsect1>
</refentry>
|