| 1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Appendix . Appendix</title><link rel="stylesheet" href="../xml/XSLCustomizationLayer/G4HTMLStylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="up" href="index.html" title="Geant4 User's Guide for Application Developers"><link rel="prev" href="ch10s07.html" title="FAQ.7. User Support Policy"><link rel="next" href="apas02.html" title="2. Histogramming"><script language="JavaScript">
|
|---|
| 2 | function remote_win(fName)
|
|---|
| 3 | {
|
|---|
| 4 | var url = "AllResources/Detector/geometry.src/" + fName;
|
|---|
| 5 | RemoteWin=window.open(url,"","resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,width=520,height=520")
|
|---|
| 6 | RemoteWin.creator=self
|
|---|
| 7 | }
|
|---|
| 8 | </script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix .
|
|---|
| 9 | Appendix
|
|---|
| 10 | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s07.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="apas02.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="appendix" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="appendix.Appendix"></a>Appendix .
|
|---|
| 11 | Appendix
|
|---|
| 12 | </h2></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.TpPrgCmp"></a>1.
|
|---|
| 13 | Tips for Program Compilation
|
|---|
| 14 | </h2></div></div></div><p>
|
|---|
| 15 | This section is dedicated to illustrate and justify some of the
|
|---|
| 16 | options used and fixed by default in the compilation of the Geant4
|
|---|
| 17 | toolkit. It is also meant to be a simple guide for the
|
|---|
| 18 | user/installer to avoid or overcome problems which may occur on
|
|---|
| 19 | some compilers. Solutions proposed here are based on the experience
|
|---|
| 20 | gained while porting the Geant4 code to different
|
|---|
| 21 | architectures/compilers and are specific to the OS's and compiler's
|
|---|
| 22 | version valid at the current time of writing of this manual.
|
|---|
| 23 | </p><p>
|
|---|
| 24 | It's well known that each compiler adopts its own internal
|
|---|
| 25 | techniques to produce the object code, which in the end might be
|
|---|
| 26 | more or less perfomant and more or less optimised, depending on
|
|---|
| 27 | several factors also related to the system architecture which it
|
|---|
| 28 | applies to. A peculiarity of C++ compilers nowadays is the way
|
|---|
| 29 | templated instances are treated during the compilation/linkage
|
|---|
| 30 | process. Some C++ compilers need to store temporarily template
|
|---|
| 31 | instantiation files (object files or temporary source code files)
|
|---|
| 32 | in a "template repository" or directory that can be specified as
|
|---|
| 33 | unique or not directly from the compilation command (probably
|
|---|
| 34 | historically coming from the old cfront-based implementation of the
|
|---|
| 35 | C++ compiler).
|
|---|
| 36 | </p><p>
|
|---|
| 37 | After the installation of the libraries, we strongly suggest to
|
|---|
| 38 | always distinguish between the installation directory (identified
|
|---|
| 39 | by $G4INSTALL) and the working directory (identified by
|
|---|
| 40 | $G4WORKDIR), in order not to alter the installation area for the
|
|---|
| 41 | template repository.
|
|---|
| 42 | </p><p>
|
|---|
| 43 | In Geant4, the path to the template repository (for those
|
|---|
| 44 | compilers which make use of it) is specified by the environment
|
|---|
| 45 | variable $G4TREP, which is fixed and points by default to
|
|---|
| 46 | <code class="literal">$G4WORKDIR/tmp/$G4SYSTEM/g4.ptrepository/</code>, where
|
|---|
| 47 | <code class="literal">$G4SYSTEM</code> identifies the system-architecture/compiler
|
|---|
| 48 | currently used and <code class="literal">$G4WORKDIR</code> is the path to the user
|
|---|
| 49 | working directory for Geant4.
|
|---|
| 50 | </p><p>
|
|---|
| 51 | A secondary template repository <code class="literal">$G4TREP/exec</code> is
|
|---|
| 52 | created by default and can be used when building executables to
|
|---|
| 53 | isolate the main repository used for building the libraries in case
|
|---|
| 54 | of clashes provoked by conflicting class-names. This secondary
|
|---|
| 55 | template repository can be activated by defining in the environment
|
|---|
| 56 | (or in the GNUmakefile related to the test/example to be built) the
|
|---|
| 57 | flag <code class="literal">G4EXEC_BUILD</code>; once activated, the secondary
|
|---|
| 58 | repository will become the read/write one, while the primary
|
|---|
| 59 | repository will be considered read-only.
|
|---|
| 60 | </p><p>
|
|---|
| 61 | At the current time, only few compilers still make use of a
|
|---|
| 62 | template repository. A good recommendation valid in general such
|
|---|
| 63 | compilers is to make use of a single template repository (specified
|
|---|
| 64 | by the <code class="literal">$G4TREP</code> environment variable) for building all
|
|---|
| 65 | Geant4 libraries; then use a secondary template repository
|
|---|
| 66 | (<code class="literal">$G4TREP/exec</code>, together with the
|
|---|
| 67 | <code class="literal">$G4EXEC_BUILD</code> flag) when building any kind of example or
|
|---|
| 68 | application.
|
|---|
| 69 | </p><p>
|
|---|
| 70 | It's always good practise to clean-up the secondary template
|
|---|
| 71 | repository from time to time.
|
|---|
| 72 | </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.TpPrgCmp.Sun"></a>1.1.
|
|---|
| 73 | Sun
|
|---|
| 74 | </h3></div></div></div><p>
|
|---|
| 75 | OS: SunOS
|
|---|
| 76 | </p><p>
|
|---|
| 77 | Compiler: CC
|
|---|
| 78 | </p><p>
|
|---|
| 79 | The default optimisation level is <code class="literal">-O2</code>.
|
|---|
| 80 | </p><p>
|
|---|
| 81 | Since version 5.0 of the compiler, native-STL is supported and
|
|---|
| 82 | ISO/ANSI compliance is required.
|
|---|
| 83 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.TpPrgCmp.UnxLnxGpp"></a>1.2.
|
|---|
| 84 | Unix/Linux - g++
|
|---|
| 85 | </h3></div></div></div><p>
|
|---|
| 86 | OS: Linux
|
|---|
| 87 | </p><p>
|
|---|
| 88 | Compiler: GNU/gcc
|
|---|
| 89 | </p><p>
|
|---|
| 90 | Strict ISO/ANSI compilation is forced (<code class="literal">-ansi -pedantic</code>
|
|---|
| 91 | compiler flags), also code is compiled with high verbosity
|
|---|
| 92 | diagnostics (<code class="literal">-Wall</code> flag). The default optimisation level
|
|---|
| 93 | is <code class="literal">-O2</code>.
|
|---|
| 94 | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
|
|---|
| 95 | Additional compilation options (<code class="literal">-march=pentium4
|
|---|
| 96 | -mfpmath=sse</code>) to adopt Pentium4 chip specific floating-point
|
|---|
| 97 | operations on the SSE unit, can be activated by uncommenting the
|
|---|
| 98 | relevant part in the <code class="literal">Linux-g++.gmk</code> configuration script.
|
|---|
| 99 | By doing so, it has been verified a greater stability of results,
|
|---|
| 100 | making possible reproducibility of exact outputs between debug,
|
|---|
| 101 | non-optimised and optimised runs. A little performance improvement
|
|---|
| 102 | (in the order of 2%) can also be achieved in some cases. To be
|
|---|
| 103 | considered that binaries built using these chip-specific options
|
|---|
| 104 | will NOT be portable cross platforms; generated applications will
|
|---|
| 105 | only run on Pentium4-based architectures.
|
|---|
| 106 | </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.TpPrgCmp.WndMsVslCpp"></a>1.3.
|
|---|
| 107 | Windows - MS Visual C++
|
|---|
| 108 | </h3></div></div></div><p>
|
|---|
| 109 | OS: MS/Windows
|
|---|
| 110 | </p><p>
|
|---|
| 111 | Compiler: MS-VC++
|
|---|
| 112 | </p><p>
|
|---|
| 113 | Since version .NET 7.0 of the compiler, ISO/ANSI compliance is
|
|---|
| 114 | required.
|
|---|
| 115 | </p><p>
|
|---|
| 116 | See <a href="ch03.html#sect.ClassCate" title="3.1.
|
|---|
| 117 | Class Categories and Domains
|
|---|
| 118 | ">Section 3.1</a> of the Installation Guide for
|
|---|
| 119 | more detailed information.
|
|---|
| 120 | See also <a href="apas06.html#sect.BldMSV" title="6.1.
|
|---|
| 121 | Building on MS Visual C++
|
|---|
| 122 | ">Section 6.1</a> for more tips.
|
|---|
| 123 | </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.TpPrgCmp.McXCpp"></a>1.4.
|
|---|
| 124 | MacOS-X - g++
|
|---|
| 125 | </h3></div></div></div><p>
|
|---|
| 126 | OS: MacOS/Darwin
|
|---|
| 127 | </p><p>
|
|---|
| 128 | Compiler: GNU/gcc
|
|---|
| 129 | </p><p>
|
|---|
| 130 | The setup adopted for the <code class="literal">g++</code> compiler on MacOS
|
|---|
| 131 | resembles in great part the one for Linux systems.
|
|---|
| 132 | </p><p>
|
|---|
| 133 | The default optimisation level in this case is <code class="literal">-O2</code>.
|
|---|
| 134 | </p><p>
|
|---|
| 135 | Dynamic libraries (<code class="literal">.dylib</code>) are supported as well; once
|
|---|
| 136 | built, in order to run the generated application, the user must
|
|---|
| 137 | specify the absolute path in the system where they're installed
|
|---|
| 138 | with the <code class="literal">DYLD_LIBRARY_PATH</code> system variable.
|
|---|
| 139 | </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s07.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="apas02.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">FAQ.7.
|
|---|
| 140 | User Support Policy
|
|---|
| 141 | </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="AllResources/IconsGIF/home.gif" alt="Home"></a></td><td width="40%" align="right" valign="top"> 2.
|
|---|
| 142 | Histogramming
|
|---|
| 143 | </td></tr></table></div></body></html>
|
|---|