/[escript]/trunk/doc/install/srcommon.tex
ViewVC logotype

Annotation of /trunk/doc/install/srcommon.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2538 - (hide annotations)
Fri Jul 17 06:24:15 2009 UTC (10 years, 2 months ago) by caltinay
File MIME type: application/x-tex
File size: 10886 byte(s)
Install guide: Reworked introduction and enabled hyperref package

1 jfenwick 2289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2     %
3     % Copyright (c) 2003-2008 by University of Queensland
4     % Earth Systems Science Computational Center (ESSCC)
5     % http://www.uq.edu.au/esscc
6     %
7     % Primary Business: Queensland, Australia
8     % Licensed under the Open Software License version 3.0
9     % http://www.opensource.org/licenses/osl-3.0.php
10     %
11     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12    
13     % This file contains material common to all src distributions.
14    
15     % The original version of this content came from the esscc twiki page maintained by ksteube
16    
17 caltinay 2536 This chapter describes how to build \esfinley from source assuming that the dependencies are already installed (for example using precompiled packages for your OS).
18 caltinay 2538 \Sec{sec:deps} describes the dependencies, while \Sec{sec:compilesrc} gives the compile instructions.
19 jfenwick 2529
20 caltinay 2538 If you would prefer to build all the dependecies from source in the escript-support packages please see \Chap{chap:allsrc}
21 jfenwick 2529
22 jfenwick 2289 \esfinley is known to compile and run on the following systems:
23     \begin{itemize}
24 caltinay 2536 \item \linux using gcc\footnote{There are some problems with \openmp under gcc prior to version 4.3.2. Also do not link the gomp library with gcc 4.3.3 - it causes problems.} - \Sec{sec:srclinux}
25     \item \linux using icc on SGI ICE 8200.
26     \item \macosx using gcc - \Sec{sec:srcmac}
27     \item \winxp using the Visual C compiler (we do not specifically discuss Windows builds in this guide).
28 jfenwick 2289 \end{itemize}
29    
30     \section{External dependencies}
31 jfenwick 2529 \label{sec:deps}
32 jfenwick 2289 The following external packages are required in order to compile and run \esfinley.
33     Where version numbers are specified, more recent versions can probably be subsituted.
34     You can either try the standard/precompiled packages available for your operating system or you can download and build them from source.
35 caltinay 2536 The advantage of using existing packages is that they are more likely to work together properly.
36 jfenwick 2289 You must take greater care if downloading sources separately.
37    
38     \begin{itemize}
39 jfenwick 2317 \item python-2.5.1 (\url{http://python.org}) \\
40 caltinay 2536 - Python interpreter (You must compile with shared libraries.)
41 jfenwick 2512 \item numpy 1.1.0 (\url{http://numpy.scipy.org})
42 jfenwick 2289 - Arrays for python.
43 artak 2326 \item boost-1.35 (\url{http://www.boost.org}) \\
44 jfenwick 2289 - Provides an interface between C++ and python.
45 jfenwick 2317 \item scons-0.989.5 (\url{http://www.scons.org/}) \\
46 jfenwick 2289 - a python-based alternative to ``make''.
47     \end{itemize}
48    
49 caltinay 2536 The version numbers given here are not strict requirements, more recent (and in some cases older) versions will still work.
50 jfenwick 2289 The following packages should be sufficient (but not necessarily minimal) for Debian 5.0 (``Lenny''):
51 jfenwick 2512 python-dev, libboost1.35-dev, scons, python-numpy, g++.
52 jfenwick 2289
53    
54 caltinay 2536 These packages may be required for some of the optional capabilities of the system:
55 jfenwick 2289
56     \begin{itemize}
57     \item netcdf-3.6.2 (\url{http://www.unidata.ucar.edu/software/netcdf}) \\-
58     Used to save data sets in binary form for checkpoint/restart (must be compiled with -fPIC).
59 caltinay 2536 \item vtk-5.0.4 (\url{http://www.vtk.org}) \\-
60 jfenwick 2289 This is used to save VTK files for visualization.
61     \begin{itemize}
62 caltinay 2536 \item cmake-2.4.6 (\url{http://www.cmake.org}) \\-
63     Required to build VTK.
64     \item mesa-7.0.3 (\url{http://www.mesa3d.org})\\-
65 jfenwick 2289 Free OpenGL replacement used by VTK.
66     \end{itemize}
67 caltinay 2536 \item netpbm (\url{http://netpbm.sourceforge.com}) \\-
68     Tools for producing movies from images
69     \item mpich2-1.0.7 (\url{http://www.mcs.anl.gov/research/projects/mpich2}) \\-
70 jfenwick 2289 Parallelization with MPI.
71 caltinay 2536 \item parmetis-3.1 (\url{http://glaros.dtc.umn.edu/gkhome/metis/parmetis/overview}) \\-
72 jfenwick 2289 Optimization of the stiffness matrix.
73 caltinay 2536 \item MKL \\(\url{http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm}) \\-
74     Intel's Math Kernel Library for use with their C compiler.
75 jfenwick 2289 \end{itemize}
76    
77     The following packages might be useful for mesh generation:
78     \begin{itemize}
79     \item gmsh-2.2.0 (\url{http://www.geuz.org/gmsh}) \\-
80     Mesh generation and viewing.
81     \begin{itemize}
82 caltinay 2536 \item fltk-1.1.9 (\url{http://www.fltk.org}) \\-
83     Required to build gmsh
84     \item gsl-1.10 (\url{http://www.gnu.org/software/gsl}) \\-
85     Required to build gmsh
86     \end{itemize}
87     \item triangle-1.6 (\url{http://www.cs.cmu.edu/~quake/triangle.html})
88 jfenwick 2289 \end{itemize}
89    
90     Packages for visualization:
91     \begin{itemize}
92     \item mayavi-1.5 (\url{http://mayavi.sourceforge.net}) \\-
93     MayaVi is referenced in our User Guide for viewing VTK files.
94 caltinay 2536 \item visit-1.11 (\url{https://wci.llnl.gov/codes/visit/}) \\-
95     A featureful visualization system with movie-making capabilities.
96 jfenwick 2289 \end{itemize}
97    
98 jfenwick 2324 \section{Compilation}\label{sec:compilesrc}
99 jfenwick 2529 Throughout this section we will assume that the source code is uncompressed in a directory called \filename{escript.d}.
100 jfenwick 2289 You can call the directory anything you like, provided that you make the change before you compile.
101    
102     You need to indicate where to find the external dependencies.
103     Unless specified otherwise, all paths will be relative to the top level of the source.
104 caltinay 2536 To do this, create a file in the \filename{scons} directory called \filename{x_options.py} where ``x'' is the name of your computer (output of the \texttt{hostname} command).
105 jfenwick 2289 As a starting point use one of the following:
106     \begin{itemize}
107     \item \filename{scons/linux_options_example.py} (\linux desktop)
108     \item \filename{scons/mac_options_example.py} (\macosx desktop)
109     \item \filename{ice_options_example.py} (SGI ICE 8200)
110     \item \filename{winxp_options_example.py} (\winxp)
111     \end{itemize}
112    
113     To actually compile (if you have $n$ processors, then you can use \texttt{scons -j$n$} instead):
114    
115     \begin{shellCode}
116 jfenwick 2529 cd escript.d
117 jfenwick 2289 scons
118     \end{shellCode}
119    
120     As part of its output, scons will tell you the name of the options file it used as well as a list of features
121     and whether they are enabled for your build.
122    
123     If you require debug versions of the libraries, use:
124     \begin{shellCode}
125     scons usedebug=yes
126     \end{shellCode}
127 caltinay 2536 A note about scons: if you recompile later with different options (e.g. leaving out usedebug), scons will revert
128 jfenwick 2289 to its default values. If you wish to make a change more permanent, then modify your options file.
129    
130    
131     You can install the binaries/libraries in a different location with:
132     \begin{shellCode}
133     scons prefix=some_dir
134     \end{shellCode}
135    
136     You can test your build using
137     \begin{shellCode}
138     scons all_tests
139     \end{shellCode}
140 caltinay 2536 Grab a coffee or two while the tests compile and run.
141     An alternative method is available for performing tests on \openmp and \mpi builds.
142 jfenwick 2289
143     \subsection{Compilation with \openmp}
144 caltinay 2536 You will need to consult your compiler documentation for the precise switches to use to enable \openmp features.
145 jfenwick 2289 Once you know the options, modify the omp_optim, omp_debug and omp_libs variables in your options.py file.
146    
147 caltinay 2536 For example, for gcc compilers which support \openmp use:
148 jfenwick 2289 \begin{shellCode}
149     omp_optim = '-fopenmp'
150     omp_debug = '-fopenmp'
151     omp_libs = ['gomp']
152     \end{shellCode}
153 caltinay 2536 Depending on your version, the last change may not be required.
154     If you're unsure try without the gomp library first and add it if you get linker errors.
155 jfenwick 2289
156     Then recompile.
157     \begin{shellCode}
158     scons useopenmp=yes
159     \end{shellCode}
160    
161 caltinay 2536 You can test your build, e.g. using 4 threads by issuing
162 gross 2363 \begin{shellCode}
163     export ESCRIPT_NUM_THREADS=4
164     scons all_tests
165     \end{shellCode}
166    
167 caltinay 2536 \subsection{Compilation with \mpi}
168     You will need to have \mpi installed on your system.
169 jfenwick 2289 There are a number of implementations so we do not provide any specific advice here.
170     You will need to modify the following variables in your options file.
171     \begin{itemize}
172 caltinay 2536 \item \texttt{mpi_flavour} \\
173     which \mpi implementation is used. Valid values are
174     \begin{itemize}
175     \item[\texttt{MPT}] SGI MPI implementation \\
176     \url{http://techpubs.sgi.com/library/manuals/3000/007-3687-010/pdf/007-3687-010.pdf}
177     \item[\texttt{MPICH2}] Argonne's MPICH version 2 implementation \\
178     \url{http://www.mcs.anl.gov/research/projects/mpi/mpich2/}
179     \item[\texttt{MPICH}] Argonne's MPICH implementation \\
180     \url{http://www.mcs.anl.gov/research/projects/mpi/mpich1/}
181     \item[\texttt{OPENMPI}] Open MPI \\
182     \url{http://www.open-mpi.org/}
183     \item[\texttt{INTELMPI}] Intel's MPI \\
184     \url{http://software.intel.com/en-us/intel-mpi-library/}
185     \end{itemize}
186 jfenwick 2289 \item \texttt{mpi_path} \\
187     where to find \filename{mpi.h}
188 caltinay 2536 \item \texttt{mpi_lib_path} \\
189     where to find libraries for \mpi
190     \item \texttt{mpi_libs} \\
191 jfenwick 2289 which libraries to link to.
192     \end{itemize}
193    
194 jfenwick 2290 Then compile with:
195     \begin{shellCode}
196     scons usempi=yes
197     \end{shellCode}
198    
199     As with debug and openmp, you can make this a more permanent setting by modifying your options file.
200    
201 caltinay 2536 To test your build using 6 processors enter:
202 gross 2363 \begin{shellCode}
203     export ESCRIPT_NUM_NODES=6
204 gross 2370 scons usempi=yes all_tests
205 gross 2363 \end{shellCode}
206 caltinay 2536 and on 6 processors with 4 threads each using
207 gross 2363 \begin{shellCode}
208     export ESCRIPT_NUM_THREADS=4
209     export ESCRIPT_NUM_NODES=6
210 gross 2370 scons usempi=yes all_tests
211 gross 2363 \end{shellCode}
212     Alternatively, you can give a hostfile
213     \begin{shellCode}
214     export ESCRIPT_NUM_THREADS=4
215     export ESCRIPT_HOSTFILE=myhostfile
216 gross 2370 scons usempi=yes all_tests
217 gross 2363 \end{shellCode}
218 caltinay 2536 Note that depending on your \mpi flavour it may be required to start a daemon before running the tests under \mpi.
219 gross 2363
220    
221 jfenwick 2289 \subsection{Difficulties}
222    
223 caltinay 2536 %This is copied from Ken's notes on the old Twiki page
224 jfenwick 2289 \subsubsection{``Bad magic number''}
225     Some reasons for this error message include:
226     \begin{itemize}
227     \item Using different versions of python when installing and running escript (Use \texttt{which python} and \texttt{python --version} to check)
228 caltinay 2536 \item Using different versions of libraries (Make sure \texttt{LD_LIBRARY_PATH} has \filename{x/lib} listed first, where x is the escript install path)
229 jfenwick 2289 \item Using different versions of python modules (Make sure \texttt{PYTHONPATH} has \filename{/trunk/escript} directory listed first)
230     \end{itemize}
231    
232     Another error we sometimes see is unsatisfied externals when trying to run a python script. This is usually due to not having \texttt{LD_LIBRARY_PATH} and \texttt{PYTHONPATH} set correctly so that you run with different libraries from the ones the code was compiled against. Check which libraries you are running against with \texttt{ldd lib/libfinley.so} and \texttt{ldd esys/finley/finleycpp.so}.
233    
234 caltinay 2536 It is also possible that incompatible libraries were used when compiling \esfinley.
235     For example, if you run with Python2.4 but the software was compiled against Python2.5 then you will get unsatisfied externals or a large error message with a long traceback.
236     Another case is when Boost or Numarray was compiled against the wrong Python library.
237     To avoid these problems both builder and user must ensure they are using the same python libraries.
238 jfenwick 2512
239 caltinay 2536 \subsubsection{\openmp builds segfault running examples}
240 jfenwick 2512
241     One known cause for this is linking the \filename{gomp} library with escript built using gcc 4.3.3.
242 caltinay 2536 While you need the \texttt{-fopenmp} switch you should not need to link \filename{gomp}.
243    

  ViewVC Help
Powered by ViewVC 1.1.26