Version 10 (modified by 13 years ago) (diff) | ,
---|
Compiling GiBUU
Compiling GiBUU usually is as easy as typing make in the GiBUU base directory. However, a couple of options are available for special situations (see also Makefile Documentation).
Before compiling, make sure that all prerequisites are fulfilled.
Note that the whole compilation process is steared by GNU make. GiBUU is always compiled statically, so that we get a monolithic executable which does not depend on system libraries (with the exception of Mac OS X where static linking is not supported).
Choosing a Compiler
By default the Makefile uses the first supported compiler which is found on your system (ifort, gfortran, g95, sunf95 or pgf95 - in this order). But you can also tell the Makefile which compiler to use, by doing e.g.:
make FORT=gfortran
In this way you can also specify the exact path of the compiler explicitly:
make FORT=/opt/g95-install/bin/g95
Choosing an Optimization Level
By default GiBUU is compiled with debugging flags, which is good for development and bug tracking, but the produced executable may be quite slow. If you want an optimized executable, you should compile with
make MODE=opt3
This works with all compilers and lets you specify the optimization level (0-3). Another option is to use profiling flags:
make MODE=prof
Currently this only works with ifort & gfortran, and produces an executable which is suitable for profiling with gprof.
Static vs. Dynamic Linking
The GiBUU executable is usually linked statically, in order to be independent of the libraries present on a particular system (an exception is Mac OS, where static linking is not supported). Recently we added the possibility to switch to dynamic linking (e.g. for the case that static libraries are not available). This can be done via:
make STATIC=0
Unfortunately this option is not available in the 1.4.x release yet, but will be supported in a future release.
Floating Point Exceptions
Checks for floating point exceptions are turned off by default. To change this you can use e.g.
make FPE=0
This sets the level for floating point exceptions, which can be 0-3, where FPE=3 means none and FPE=0 means all. FPE=3 is the default. This flag is only supported with ifort and gfortran. Note: We recommend not to use FPE, unless you feel really adventurous. The resulting executable is likely to crash (in particular, PYTHIA has trouble with FPE).
Parallel Make
If you have a multi-core machine, you can speed up the compilation process by specifying the number of cores to be used by make. E.g. on a quad-code machine you could do
make -j4
This can potentially be up to four times faster than the standard single-threaded make ("-j1"), since four files can be compiled in parallel.
Rebuilding from scratch
If you want to discard all the object files which have already been generated (e.g. to rebuild with a different compiler or different options, or after making major changes to the code), you should type
make renew
This will clean up all present object and module files and rebuild the dependencies, giving you a fresh start in building GiBUU.