source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apa.html@ 901

Last change on this file since 901 was 901, checked in by garnier, 17 years ago

Add Geant4 Documentation at 8.12.2008

File size: 8.5 KB
Line 
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">
2function 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 . 
9Appendix
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 . 
11Appendix
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. 
13Tips for Program Compilation
14</h2></div></div></div><p>
15This section is dedicated to illustrate and justify some of the
16options used and fixed by default in the compilation of the Geant4
17toolkit. It is also meant to be a simple guide for the
18user/installer to avoid or overcome problems which may occur on
19some compilers. Solutions proposed here are based on the experience
20gained while porting the Geant4 code to different
21architectures/compilers and are specific to the OS's and compiler's
22version valid at the current time of writing of this manual.
23</p><p>
24It's well known that each compiler adopts its own internal
25techniques to produce the object code, which in the end might be
26more or less perfomant and more or less optimised, depending on
27several factors also related to the system architecture which it
28applies to. A peculiarity of C++ compilers nowadays is the way
29templated instances are treated during the compilation/linkage
30process. Some C++ compilers need to store temporarily template
31instantiation files (object files or temporary source code files)
32in a "template repository" or directory that can be specified as
33unique or not directly from the compilation command (probably
34historically coming from the old cfront-based implementation of the
35C++ compiler).
36</p><p>
37After the installation of the libraries, we strongly suggest to
38always distinguish between the installation directory (identified
39by $G4INSTALL) and the working directory (identified by
40$G4WORKDIR), in order not to alter the installation area for the
41template repository.
42</p><p>
43In Geant4, the path to the template repository (for those
44compilers which make use of it) is specified by the environment
45variable $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
48currently used and <code class="literal">$G4WORKDIR</code> is the path to the user
49working directory for Geant4.
50</p><p>
51A secondary template repository <code class="literal">$G4TREP/exec</code> is
52created by default and can be used when building executables to
53isolate the main repository used for building the libraries in case
54of clashes provoked by conflicting class-names. This secondary
55template repository can be activated by defining in the environment
56(or in the GNUmakefile related to the test/example to be built) the
57flag <code class="literal">G4EXEC_BUILD</code>; once activated, the secondary
58repository will become the read/write one, while the primary
59repository will be considered read-only.
60</p><p>
61At the current time, only few compilers still make use of a
62template repository. A good recommendation valid in general such
63compilers is to make use of a single template repository (specified
64by the <code class="literal">$G4TREP</code> environment variable) for building all
65Geant4 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
68application.
69</p><p>
70It's always good practise to clean-up the secondary template
71repository 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. 
73Sun
74</h3></div></div></div><p>
75OS: SunOS
76</p><p>
77Compiler: CC
78</p><p>
79The default optimisation level is <code class="literal">-O2</code>.
80</p><p>
81Since version 5.0 of the compiler, native-STL is supported and
82ISO/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. 
84Unix/Linux - g++
85</h3></div></div></div><p>
86OS: Linux
87</p><p>
88Compiler: GNU/gcc
89</p><p>
90Strict ISO/ANSI compilation is forced (<code class="literal">-ansi -pedantic</code>
91compiler flags), also code is compiled with high verbosity
92diagnostics (<code class="literal">-Wall</code> flag). The default optimisation level
93is <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>
95Additional compilation options (<code class="literal">-march=pentium4
96-mfpmath=sse</code>) to adopt Pentium4 chip specific floating-point
97operations on the SSE unit, can be activated by uncommenting the
98relevant part in the <code class="literal">Linux-g++.gmk</code> configuration script.
99By doing so, it has been verified a greater stability of results,
100making possible reproducibility of exact outputs between debug,
101non-optimised and optimised runs. A little performance improvement
102(in the order of 2%) can also be achieved in some cases. To be
103considered that binaries built using these chip-specific options
104will NOT be portable cross platforms; generated applications will
105only 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. 
107Windows - MS Visual C++
108</h3></div></div></div><p>
109OS: MS/Windows
110</p><p>
111Compiler: MS-VC++
112</p><p>
113Since version .NET 7.0 of the compiler, ISO/ANSI compliance is
114required.
115</p><p>
116See <a href="ch03.html#sect.ClassCate" title="3.1. 
117Class Categories and Domains
118">Section 3.1</a> of the Installation Guide for
119more detailed information.
120See also <a href="apas06.html#sect.BldMSV" title="6.1. 
121Building 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. 
124MacOS-X - g++
125</h3></div></div></div><p>
126OS: MacOS/Darwin
127</p><p>
128Compiler: GNU/gcc
129</p><p>
130The setup adopted for the <code class="literal">g++</code> compiler on MacOS
131resembles in great part the one for Linux systems.
132</p><p>
133The default optimisation level in this case is <code class="literal">-O2</code>.
134</p><p>
135Dynamic libraries (<code class="literal">.dylib</code>) are supported as well; once
136built, in order to run the generated application, the user must
137specify the absolute path in the system where they're installed
138with 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. 
140User 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. 
142Histogramming
143</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.