/[escript]/release/4.1/doc/install/source.tex
ViewVC logotype

Contents of /release/4.1/doc/install/source.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5767 - (show annotations)
Wed Jul 29 01:33:52 2015 UTC (3 years, 8 months ago) by sshaw
File MIME type: application/x-tex
File size: 18338 byte(s)
more examples using lib check for natgrid
1 %!TEX root = install.tex
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % Copyright (c) 2012-2015 by The University of Queensland
4 % http://www.uq.edu.au
5 %
6 % Primary Business: Queensland, Australia
7 % Licensed under the Open Software License version 3.0
8 % http://www.opensource.org/licenses/osl-3.0.php
9 %
10 % Development until 2012 by Earth Systems Science Computational Center (ESSCC)
11 % Development 2012-2013 by School of Earth Sciences
12 % Development from 2014 by Centre for Geoscience Computing (GeoComp)
13 %
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16 % Notes about compilers
17
18 \chapter{Installing from Source}\label{chap:source}
19
20 This chapter assumes you are using a unix/posix like system (including MacOSX).
21
22 \section{Parallel Technologies}\label{sec:par}
23 It is likely that the computer you run \escript on, will have more than one processor core.
24 \escript can make use of multiple cores [in order to solve problems more quickly] if it is told to do so,
25 but this functionality must be enabled at compile time.
26 Section~\ref{sec:needpar} gives some rough guidelines to help you determine what you need.
27
28 There are two technologies which \escript can employ here.
29 \begin{itemize}
30 \item OpenMP -- the more efficient of the two [thread level parallelism].
31 \item MPI -- Uses multiple processes (less efficient), needs less help from the compiler.
32 \end{itemize}
33
34 Escript is primarily tested on recent versions of the GNU and Intel suites (``g++'' / ``icpc'').
35 However, it also passes our tests when compiled using ``clang++''.
36
37 Our current test compilers include:
38 \begin{itemize}
39 \item g++ 4.7.2, 4.9.2
40 \item clang++ (OSX 10.10 default)
41 \item intel icpc v15
42 \end{itemize}
43
44 g++ 5 is known to have an optimisation bug that will cause \escript to
45 crash. An alternate compiler will be required until this bug has been fixed.
46
47 Note that:
48 \begin{itemize}
49 \item OpenMP will not function correctly for g++ $\leq$ 4.2.1 (and is not currently supported by clang).
50 \item icpc v11 has a subtle bug involving OpenMP and c++ exception handling, so this combination should not be used.
51 \end{itemize}
52
53 \subsection{What parallel technology do I need?}\label{sec:needpar}
54 If you are using any version of Linux released in the past few years, then your system compiler will support
55 \openmp with no extra work (and give better performance); so you should use it.
56 You will not need MPI unless your computer is some form of cluster.
57
58 If you are using BSD or MacOSX and you are just experimenting with \escript, then performance is
59 probably not a major issue for you at the moment so you don't need to use either \openmp or MPI.
60 This also applies if you write and polish your scripts on your computer and then send them to a cluster to execute.
61 If in the future you find escript useful and your scripts take significant time to run, then you may want to recompile
62 \escript with more options.
63
64
65
66 Note that even if your version of \escript has support for \openmp or MPI, you will still need to tell the system to
67 use it when you run your scripts.
68 If you are using the \texttt{run-escript} launcher, then this is controlled by the \texttt{-t} and \texttt{-p} options.
69 If not, then consult the documentation for your MPI libraries (or the compiler documentation in the case of OpenMP
70 \footnote{It may be enough to set the \texttt{OMP\_NUM\_THREADS} environment variable.}).
71
72 If you are using MacOSX, then see the next section, if not, then skip to Section~\ref{sec:build}.
73
74 \section{MacOS}
75 This release of \escript has only been tested on OSX 10.9 and 10.10.
76 For this section we assume you are using either \texttt{homebrew} or \texttt{MacPorts} as a package
77 manager\footnote{Note that package managers will make changes to your computer based on programs configured by other people from
78 various places around the internet. It is important to satisfy yourself as to the security of those systems.}.
79 You can of course install prerequisite software in other other ways.
80 For example, we have had \emph{some} success changing the default
81 compilers used by those systems. However this is more complicated and we do not provide a guide here.
82 Successful combinations of OSX and package managers are given in the table below.
83
84 \begin{center}
85 \begin{tabular}{|c|c|c|}\hline
86 & \texttt{homebrew} & \texttt{MacPorts} \\\hline
87 OSX 10.9 & Yes & No\\\hline
88 OSX 10.10& Yes & Yes\\\hline
89 \end{tabular}
90 \end{center}
91
92 \noindent Both of those systems require the XCode command line tools to be installed\footnote{As of OSX10.9, the
93 command \texttt{xcode-select --install} will allow you to download and install the commandline tools.}.
94
95 \section{Building}\label{sec:build}
96
97 To simplify things for people, we have prepared \texttt{_options.py} files for a number of
98 systems\footnote{These are correct a time of writing but later versions of those systems may require tweaks.
99 Also, these systems represent a cross section of possible platforms rather than meaning those systems get particular support.}.
100 The \texttt{_options.py} files are located in the \texttt{scons/templates} directory. We suggest that the file most relevant to your os
101 be copied from the templates directory to the scons directory and renamed to the form XXXX_options.py where XXXX
102 should be replaced with your computer's name.
103 If your particular system is not in the list below, or if you want a more customised
104 build,
105 see Section~\ref{sec:othersrc} for instructions.
106 \begin{itemize}
107 \item Debian - \ref{sec:debsrc}
108 \item Ubuntu - \ref{sec:ubsrc}
109 \item OpenSuse - \ref{sec:susesrc}
110 \item Centos - \ref{sec:centossrc}
111 \item Fedora - \ref{sec:fedorasrc}
112 \item MacOS (macports) - \ref{sec:macportsrc}
113 \item MacOS (homebrew) - \ref{sec:homebrewsrc}
114 \item FreeBSD - \ref{sec:freebsdsrc}
115 \end{itemize}
116
117 Once these are done proceed to Section~\ref{sec:cleanup} for cleanup steps.
118
119 All of these instructions assume that you have obtained the \escript source (and uncompressed it if necessary).
120 \subsection{Debian}\label{sec:debsrc}
121
122 \begin{shellCode}
123 sudo aptitude install python-dev python-numpy libboost-python-dev libnetcdf-dev
124 sudo aptitude install scons lsb-release libboost-random-dev
125 sudo aptitude install python-sympy python-matplotlib python-scipy
126 sudo aptitude install python-pyproj python-gdal
127 \end{shellCode}
128
129 \noindent If you are running \textit{Jessie}, (or if \textit{wheezy-backports} is in your \texttt{apt} sources) you can use:
130 \begin{shellCode}
131 sudo aptitude install gmsh
132 \end{shellCode}
133 to add extra meshing functionality.
134
135 \begin{optionalstep}
136 If for some reason, you wish to rebuild the documentation, you would also need the following:
137 \begin{shellCode}
138 sudo aptitude install python-sphinx doxygen python-docutils texlive
139 sudo aptitude install zip texlive-latex-extra latex-xcolor
140 \end{shellCode}
141 \end{optionalstep}
142
143 \noindent In the source directory execute the following (substitute wheezy for XXXX):
144 \begin{shellCode}
145 scons -j1 options_file=scons/templates/XXXX_options.py
146 \end{shellCode}
147
148 \noindent If you wish to test your build, you can use the following:
149 \begin{shellCode}
150 scons -j1 py_tests options_file=scons/templates/XXXX_options.py
151 \end{shellCode}
152
153 \subsection{Ubuntu}\label{sec:ubsrc}
154
155 If you have not installed \texttt{aptitude}, then substitute \texttt{apt-get} in the following.
156 \begin{shellCode}
157 sudo aptitude install python-dev python-numpy libboost-python-dev
158 sudo aptitude install libnetcdf-dev libboost-random-dev
159 sudo aptitude install scons lsb-release
160 sudo aptitude install python-sympy python-matplotlib python-scipy
161 sudo aptitude install python-pyproj python-gdal gmsh
162 \end{shellCode}
163
164
165 \begin{optionalstep}
166 If for some reason, you wish to rebuild the documentation, you would also need the following:
167 \begin{shellCode}
168 sudo aptitude install python-sphinx doxygen python-docutils texlive
169 sudo aptitude install zip texlive-latex-extra latex-xcolor
170 \end{shellCode}
171 \end{optionalstep}
172
173 \noindent In the source directory execute the following (substitute precise, quantal or raring as appropriate for XXXX):
174 \begin{shellCode}
175 scons -j1 options_file=scons/templates/XXXX_options.py
176 \end{shellCode}
177
178 \noindent If you wish to test your build, you can use the following:
179 \begin{shellCode}
180 scons -j1 py_tests options_file=scons/templates/XXXX_options.py
181 \end{shellCode}
182
183
184
185 \subsection{OpenSuse}\label{sec:susesrc}
186 These instructions were prepared using release $13.2$.
187
188 \noindent Install packages from the main distribution:
189 \begin{shellCode}
190 sudo zypper install libboost_python1_54_0 libboost_random1_54_0
191 sudo zypper python-devel python-numpy libnetcdf_c++-devel
192 sudo zypper install python-scipy python-sympy python-matplotlib
193 sudo zypper install gcc gcc-c++ scons boost-devel netcdf-devel
194 \end{shellCode}
195 These will allow you to use most features except some parts of the \downunder inversion library.
196 If you wish to use those, you will need some additional packages [python-pyproj, python-gdal].
197 This can be done now or after Escript installation.
198
199 \begin{shellCode}
200 sudo zypper addrepo \
201 http://ftp.suse.de/pub/opensuse/repositories/Application:/Geo/openSUSE_13.2/ osgf
202 sudo zypper install python-pyproj python-gdal
203 \end{shellCode}
204
205 Now to build escript itself.
206 In the escript source directory:
207 \begin{shellCode}
208 scons -j1 options_file=scons/templates/opensuse13.1_options.py
209 \end{shellCode}
210
211 \noindent If you wish to test your build, you can use the following:
212 \begin{shellCode}
213 scons -j1 py_tests options_file=scons/templates/opensuse13.1_options.py
214 \end{shellCode}
215
216 \noindent Now go to Section~\ref{sec:cleanup} for cleanup.
217
218 \subsection{Centos}\label{sec:centossrc}
219 These instructions were prepared using centos release $7.0$.
220 The core of escript works, however some functionality is not availible because the default packages for some dependencies in Centos are too old.
221
222 \noindent Add the \texttt{EPEL} repository.
223 \begin{shellCode}
224 yum install epel-release.noarch
225 \end{shellCode}
226
227 \noindent Install packages:
228 \begin{shellCode}
229 yum install netcdf-devel netcdf-cxx-devel gdal-python
230 yum install python-devel numpy scipy scons boost-devel
231 yum install python-matplotlib gcc gcc-c++
232 yum install boost-python
233 \end{shellCode}
234
235 The above packages will allow you to use most features except
236 the \downunder inversion library.
237 If you wish to use those it, you will need to install some additional packages.
238
239 \noindent For some coordinate transformations, \downunder can also make use of the python interface to a tool called \texttt{proj}.
240 There does not seem to be an obvious centos repository for this though.
241 If it turns out to be necessary for your particular application, the source can be downloaded.
242
243 \noindent Now to build escript itself.
244 In the escript source directory:
245 \begin{shellCode}
246 scons -j1 options_file=scons/templates/centos7_0_options.py
247 \end{shellCode}
248
249 \noindent Now go to Section~\ref{sec:cleanup} for cleanup.
250
251 \subsection{Fedora}\label{sec:fedorasrc}
252 These instructions were prepared using release $21.5$. Release $22$ by default
253 uses gcc 5.2, which currently has an optimisation bug that will cause
254 \escript to crash.
255
256 \noindent Install packages
257 \begin{shellCode}
258 yum install netcdf-cxx-devel gcc-c++ scipy
259 yum install sympy scons pyproj gdal python-matplotlib
260 yum install boost-devel
261 \end{shellCode}
262
263 \noindent Now to build escript itself.
264 In the escript source directory:
265 \begin{shellCode}
266 scons -j1 options_file=scons/templates/fedora21_5_options.py
267 \end{shellCode}
268
269 \noindent If you wish to test your build, you can use the following:
270 \begin{shellCode}
271 scons -j1 py_tests options_file=scons/templates/fedora21_5_options.py
272 \end{shellCode}
273
274 \noindent Now go to Section~\ref{sec:cleanup} for cleanup.
275
276 \subsection{MacOS 10.10 (macports)}\label{sec:macportsrc}
277
278 The following will install the capabilities needed for the \texttt{macports_10.10_options.py} file.
279
280 \begin{shellCode}
281 sudo port install scons
282 sudo port select --set python python27
283 sudo port install boost
284 sudo port install py27-numpy
285 sudo port install py27-sympy
286 sudo port select --set py-sympy py27-sympy
287 sudo port install py27-scipy
288 sudo port install py27-pyproj
289 sudo port install py27-gdal
290 sudo port install netcdf-cxx
291 sudo port instal silo
292 \end{shellCode}
293
294 \begin{shellCode}
295 scons -j1 options_file=scons/templates/macports_10.10options.py
296 \end{shellCode}
297
298
299 \subsection{MacOS 10.9, 10.10 (homebrew)}\label{sec:homebrewsrc}
300
301 The following will install the capabilities needed for the \texttt{homebrew_10.10_options.py} file.
302 OSX 10.9 can use the same file.
303
304 \begin{shellCode}
305 brew install scons
306 brew install boost-python
307 brew install homebrew/science/netcdf --with-cxx-compat
308 \end{shellCode}
309
310 There do not appear to be formulae for \texttt{sympy} or \texttt{pyproj} so if you wish to use those features, then
311 you will need to install them separately.
312
313
314 \begin{shellCode}
315 scons -j1 options_file=scons/templates/homebrew_10.10_options.py
316 \end{shellCode}
317
318
319 \subsection{FreeBSD}\label{sec:freebsdsrc}
320
321 At time of writing, \texttt{numpy} does not install correctly on FreeBSD.
322 Since \texttt{numpy} is a critical dependency for \escript, we have been unable to test on FreeBSD.
323
324 \begin{comment}
325 \subsubsection{Release 10.0}
326
327 Install the following packages:
328 \begin{itemize}
329 \item python
330 \item scons
331 \item boost-python-libs
332 \item bash
333 \item netcdf
334 \item silo
335 \item py27-scipy
336 \item py27-gdal
337 \item py27-matplotlib
338 \item py27-pyproj
339 \item py27-sympy
340 \end{itemize}
341
342 \noindent Next choose (or create) your options file.
343 For the setup as above the escript source comes with a prepared file in
344 \texttt{scons/templates/freebsd10.0_options.py}.
345 Finally to build escript issue the following in the escript source directory
346 (replace the options file as required):
347 \begin{shellCode}
348 scons -j1 options_file=scons/templates/freebsd10.0_options.py
349 \end{shellCode}
350
351 \emph{Note:} Some packages installed above are built with gcc 4.7. Somewhere
352 in the toolchain a system-installed gcc library is pulled in which is
353 incompatible with the one from version 4.7 and would prevent escript from
354 executing successfully. As explained in the FreeBSD
355 documentation\footnote{see \url{http://www.freebsd.org/doc/en/articles/custom-gcc/article.html}}
356 this can be fixed by adding a line to \texttt{/etc/libmap.conf}:
357 \begin{shellCode}
358 libgcc_s.so.1 gcc47/libgcc_s.so.1
359 \end{shellCode}
360
361 \end{comment}
362 \subsection{Other Systems / Custom Builds}\label{sec:othersrc}
363
364 \escript has support for a number of optional packages.
365 Some, like \texttt{netcdf} need to be enabled at compile time, while others, such as \texttt{sympy} and the projection packages
366 used in \downunder are checked at run time.
367 For the second type, you can install them at any time (ensuring that python can find them) and they should work.
368 For the first type, you need to modify the options file and recompile with scons.
369 The rest of this section deals with this.
370
371 To avoid having to specify the options file each time you run scons, copy an existing \texttt{_options.py} file from the
372 \texttt{scons/} or \texttt{scons/templates/} directories. Put the file in the \texttt{scons} directory and name
373 it \textit{yourmachinename}\texttt{_options.py}.\footnote{If the name
374 has - or other non-alpha characters, they must be replaced with underscores in the filename}.
375 For example: on a machine named toybox, the file would be \texttt{scons/toybox_options.py}.
376
377 Individual lines can be enabled/disabled, by removing or adding \# (the python comment character) to the beginning of the line.
378 For example, to enable OpenMP, change the line
379 \begin{verbatim}
380 #openmp = True
381 \end{verbatim}
382 to
383 \begin{verbatim}
384 openmp = True
385 \end{verbatim}
386
387 If you are using libraries which are not installed in the standard places (or have different names) you will need to
388 change the relevant lines.
389 A common need for this would be using a more recent version of the boost::python library.
390 You can also change the compiler or the options passed to it by modifying the relevant lines.
391
392 \subsubsection*{MPI}
393 If you wish to enable or disable MPI, or if you wish to use a different implementation of MPI, you can use the \texttt{mpi}
394 configuration variable.
395 You will also need to ensure that the \texttt{mpi_prefix} and \texttt{mpi_libs} variables are uncommented and set correctly.
396 To disable MPI use, \verb|mpi = 'none'|.
397
398 \subsubsection{Python3}
399 \escript works with \texttt{python3} but until recently, many distributions have not distributed python3 versions of their packages.
400 You can try it out though by modifying or adding the following variables in your options file:
401
402 \begin{verbatim}
403 pythoncmd='python3'
404 \end{verbatim}
405
406 \begin{verbatim}
407 usepython3=True
408 \end{verbatim}
409
410 \begin{verbatim}
411 pythonlibname='whateveryourpython3libraryiscalled'
412 \end{verbatim}
413
414
415
416
417 \subsubsection{Testing}
418 As indicated earlier, you can test your build using \texttt{scons py_tests}.
419 Note however, that some features like \texttt{netCDF} are optional for using \escript, the tests will report a failure if
420 they are missing.
421
422 \section{Cleaning up}
423 \label{sec:cleanup}
424
425 Once the build (and optional testing) is complete, you can remove everything except:
426 \begin{itemize}
427 \item bin
428 \item esys
429 \item lib
430 \item doc
431 \item CREDITS.TXT
432 \item README_LICENSE
433 \end{itemize}
434 The last two aren't strictly required for operation.
435 The \texttt{doc} directory is not required either but does contain examples of escript scripts.
436
437 You can run escript using \texttt{\textit{path_to_escript_files}/bin/run-escript}.
438 Where \texttt{\textit{path_to_escript_files}} is replaced with the real path.
439
440 \begin{optionalstep}
441 You can add the escript \texttt{bin} directory to your \texttt{PATH} variable.
442 The launcher will then take care of the rest of the environment.
443 \end{optionalstep}
444
445 \section{Optional Extras}
446
447 Some other packages which might be useful include:
448 \begin{itemize}
449 \item support for silo format (install the relevant libraries and enable them in the options file).
450 \item Visit --- visualisation package. Can be used independently but our \texttt{weipa} library can make a Visit
451 plug-in to allow direct visualisation of escript files.
452 \item gmsh --- meshing software used by our \texttt{pycad} library.
453 \item Mayavi2 --- another visualisation tool.
454 \end{itemize}
455
456
457 %Need a better title but this is stuff like visit and silo (for non-debian distros)
458 %Perhaps - optional extras
459
460
461
462
463

  ViewVC Help
Powered by ViewVC 1.1.26