Skip to content

Commit 730a76d

Browse files
committed
Updating the installation guide
1 parent cb6fd9a commit 730a76d

File tree

2 files changed

+113
-64
lines changed

2 files changed

+113
-64
lines changed

doc/SW4-Installation.pdf

-4.66 KB
Binary file not shown.

doc/SW4-Installation.tex

Lines changed: 113 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
\title{Installing SW4 version 1.1}
5050

51-
\author{ N. Anders Petersson$^1$ \and Bj\"orn Sj\"ogreen\thanks{Center for Applied Scientific
51+
\author{ N. Anders Petersson$^*$ \and Bj\"orn Sj\"ogreen\thanks{Center for Applied Scientific
5252
Computing, Lawrence Livermore National Laboratory, PO Box 808, Livermore CA 94551. This work
5353
performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National
5454
Laboratory under contract DE-AC52-07NA27344. This is contribution LLNL-SM-662989.} \and Eric
@@ -187,14 +187,14 @@ \section{Unpacking the source code tar ball}
187187
%
188188
\begin{itemize}
189189
\item \verb+LICENSE.txt+ License information.
190-
\item \verb+INSTALL.txt+ Information about how to build \emph{SW4} (short version).
190+
\item \verb+INSTALL.txt+ A link to this document.
191191
\item \verb+README.txt+ General information about \emph{SW4}.
192192
\item \verb+configs+ Directory containing \verb+make+ configuration files.
193193
\item \verb+src+ C++ and Fortran source code of \emph{SW4}.
194194
\item \verb+tools+ Matlab/Octave scripts for post processing and analysis.
195195
\item \verb+examples+ Sample input files.
196196
\item \verb+Makefile+ Main makefile (don't change this file!).
197-
\item \verb+CMakeLists.txt+ CMake configuration file.
197+
\item \verb+CMakeLists.txt+ CMake configuration file (don't change this file either!).
198198
\item \verb+wave.txt+ Text for printing the "SW4 Lives" banner at the end of a successful build.
199199
\end{itemize}
200200

@@ -256,14 +256,16 @@ \subsubsection{Mac machines}
256256
shell> cd configs
257257
shell> cp make.osx make.inc
258258
shell> cat make.inc
259-
FC = openmpif77
260-
CXX = openmpicxx
261-
EXTRA_FORT_FLAGS = -fno-underscoring
262-
EXTRA_LINK_FLAGS = -framework vecLib -L/opt/local/lib/gcc47 -lgfortran
259+
etree = no
260+
proj = no
261+
FC = mpif77
262+
CXX = mpicxx
263+
EXTRA_FORT_FLAGS =
264+
EXTRA_LINK_FLAGS = -framework vecLib -L/opt/local/lib/gcc48 -lgfortran
263265
\end{verbatim}
264266
In this case, the \verb+blas+ and \verb+lapack+ libraries are assumed to be provided by the
265267
\verb+-framework vecLib+ option. The \verb+libgfortran+ library is located in the directory
266-
\verb+/opt/local/lib/gcc47+, which is where \verb+macports+ currently installs it.
268+
\verb+/opt/local/lib/gcc48+, which is where \verb+macports+ currently installs it.
267269

268270
\subsubsection{Linux machines}
269271
If you are on a Linux machine, we suggest you copy the configuration options from \verb+make.linux+,
@@ -354,6 +356,7 @@ \subsubsection{How do I setup the {\tt make.inc} file?}
354356
The following \verb+make.inc+ file includes all configurable options:
355357
\begin{verbatim}
356358
etree = no
359+
proj = no
357360
SW4ROOT = /Users/petersson1
358361
359362
CXX = mpicxx
@@ -370,9 +373,42 @@ \subsubsection{How do I setup the {\tt make.inc} file?}
370373
\verb+EXTRA_LINK_FLAGS+ variables should contain any additional arguments that need to be passed to
371374
the C++ compiler, Fortran compiler, or linker, on your system.
372375

376+
\subsection{Building {\tt sw4} with proj.4 and/or efile support}
377+
The installation of the proj.4, euclid, and cencalvm libraries is discussed in
378+
Section~\ref{sec:cencalvm-install}. Note that the proj.4 libraray enables the more advanced
379+
geographical mapping keywords in the {\tt grid} command and is also required by the {\tt rfile}
380+
command. To enable the {\tt efile} command, you have to also install the {\tt euclid} and {\tt
381+
cencalvm} libraries. Note that the latter two libraries are only needed by the {\tt efile}
382+
command. If you are not planning on using that command, there is no need to install those
383+
libraies. This is a change from \emph{SW4} version 1.0.
384+
385+
Once you have successfully installed the proj.4, and optionally the euclid and cencalvm libraries,
386+
it should be easy to re-configure \emph{SW4} to use them. Simply edit your configuration file
387+
(\verb+make.inc+) by adding two lines to the top of the file, setting the {\tt etree} keyword to
388+
{\tt yes} or {\tt no}, as appropriate.
389+
\begin{verbatim}
390+
proj = yes
391+
etree = no
392+
SW4ROOT = /thid/party/basedir
393+
...
394+
\end{verbatim}
395+
You then need to re-compile \emph{SW4}. Go to the \emph{SW4} main directory, clean up the previous
396+
object files and executable, and re-run make:
397+
\begin{verbatim}
398+
shell> cd /my/installation/dir/sw4-v1.1
399+
shell> make clean
400+
shell> make
401+
\end{verbatim}
402+
If all goes well, the ``SW4 lives'' banner is shown after the make command is
403+
completed. As before, the \verb+sw4+ executable will be located in the \verb+optimize+ or
404+
\verb+debug+ directories.
373405

374406
\section{Installing \emph{SW4} with CMake}\label{cha:installing-cmake-sw4}
375-
\emph{SW4} also allows building using CMake. The \emph{SW4} CMake configuration includes several tests used to ensure the code calculates the correct values for some well established benchmark cases and that answers converge appropriately to analytical solutions.
407+
\emph{SW4} also allows building using CMake. The \emph{SW4} CMake configuration also automates the
408+
testing of the code, which ensures that it functions correctly. The tests run a number of input
409+
scripts in the \verb+examples+ directory and evaluates the accuracy of the numerical solutions using
410+
various analytical solutions, see the Appendix of the \emph{SW4} user's guide~\cite{SW4-11} for
411+
details.
376412

377413
To use CMake, change to the sw4 directory and run the following commands:
378414
\begin{verbatim}
@@ -381,40 +417,63 @@ \section{Installing \emph{SW4} with CMake}\label{cha:installing-cmake-sw4}
381417
shell> cmake [options] ..
382418
shell> make
383419
\end{verbatim}
384-
The \verb+cmake+ command searches for the necessary libraries and other dependencies, then creates makefiles appropriate to your system. Running \verb+make+ compiles \emph{SW4} using these makefiles. For details about the exact commands being used in compilation, run \texttt{make VERBOSE=1}. Once SW4 is successfully compiled and linked you will see the ``SW4 Lives!'' banner on the screen.
420+
The two dots after {\tt cmake [options]} are essential and instructs it to look in the parent
421+
directory for the {\tt CMakeLists.txt} file.
422+
423+
The \verb+cmake+ command searches for the necessary libraries and other dependencies, then creates
424+
makefiles appropriate to your system. Running \verb+make+ compiles \emph{SW4} using these
425+
makefiles. For details about the exact commands being used in compilation, run \texttt{make
426+
VERBOSE=1}. Once SW4 is successfully compiled and linked you will see the ``SW4 Lives!'' banner
427+
on the screen.
385428

386429
\subsection{CMake Options}
387-
CMake provides several options to allow customized configuration of \emph{SW4}. To use any option, add \texttt{-D\textless option\textgreater=\textless value\textgreater} to the options in the \texttt{cmake} command. For example:
388-
430+
CMake provides several options to allow customized configuration of \emph{SW4}. To use any option,
431+
add \texttt{-D\textless option\textgreater=\textless value\textgreater} to the options in the
432+
\texttt{cmake} command. For example:
433+
%
389434
\begin{verbatim}
390435
cmake -DTESTING_LEVEL=1 -DCMAKE_BUILD_TYPE=Debug ..
391436
\end{verbatim}
392-
393-
will configure \emph{SW4} with testing level 1 and compile the debug version of the code. A list of options is shown in the table below.
394-
437+
%
438+
configures \emph{SW4} with testing level 1, to be compiled with debugging symbols in the object
439+
files. A list of options is shown in the table below.
440+
%
395441
\begin{center}
396442
\begin{tabular}{|l|c|p{0.55\textwidth}|}
397443
\hline
398444
Option & Default & Details \\
399445
\hline
400-
PROJ4\_HOME & (none) & The path to the Proj.4 installation to use when compiling \emph{SW4}. \\
401-
\hline
402-
CENCALVM\_HOME & (none) & The path to the cencalvm installation to use when compiling \emph{SW4}. \\
403-
\hline
404-
CMAKE\_BUILD\_TYPE & Release & Which type of build to perform. Can be either \texttt{Debug}, \texttt{Release}, or \texttt{RelWithDebInfo}. This affects the type of optimization and debug flags used in compiling \emph{SW4}. \\
405-
\hline
406-
TESTING\_LEVEL & 0 & Specifies the testing level for automated tests. Level 0 corresponds to tests which run in roughly a minute or less (7 total), level 1 to tests which run in roughly 10 minutes or less (13 total) and level 2 to tests which may require up to an hour or more (17 total). \\
407-
\hline
408-
MPI\_NUM\_TEST\_PROCS & 4 & Number of MPI processes to use in tests. Generally using more processes will result in tests finishing faster. We strongly recommend at least 8 processes if TESTING\_LEVEL is 1 or higher.\\
409-
\hline
446+
%
447+
PROJ4\_HOME & (none) & The path to the Proj.4 installation to use when compiling
448+
\emph{SW4}. \\ \hline
449+
%
450+
CENCALVM\_HOME & (none) & The path to the cencalvm installation to use when compiling
451+
\emph{SW4}. \\ \hline
452+
%
453+
CMAKE\_BUILD\_TYPE & Release & The type of build to setup. Can be either \texttt{Debug},
454+
\texttt{Release}, or \texttt{RelWithDebInfo}. This affects the type of optimization and debug flags
455+
used in compiling \emph{SW4}. \\ \hline
456+
%
457+
TESTING\_LEVEL & 0 & Specifies the testing level for automated tests. Level 0 corresponds to tests
458+
that run in roughly a minute or less (7 total), level 1 to tests that run in roughly 10 minutes or
459+
less (13 total) and level 2 to tests that may require up to an hour or more (17 total). \\ \hline
460+
%
461+
MPI\_NUM\_TEST\_PROCS & 4 & Number of MPI processes to use in tests. Generally using more processes
462+
will result in the tests finishing faster, but there is no point exceeding the number of available
463+
cores on your system. We strongly recommend at least 8 processes if TESTING\_LEVEL is 1 or
464+
higher.\\ \hline
465+
%
410466
\end{tabular}
411467
\end{center}
412468

413469
\subsection{CTest}
414-
The \emph{SW4} CMake configuration includes several test cases to confirm the code is working correctly. Each test consists of two parts, 1) it performs a run using an input file in the \verb+examples/+ directory, then 2) it confirms the results of the run are within accepted error tolerances.
470+
The \emph{SW4} CMake configuration includes several test cases, which can be used to confirm that
471+
the code is working correctly. Each test consists of two parts. First it runs a case using an input
472+
file in the \verb+examples/+ directory. Secondly, it confirms that the results are within
473+
a reasonable error tolerances from previously recorded results.
415474

416475
To run the tests, use either the command \texttt{make test} or \texttt{ctest} as follows:
417-
476+
%
418477
\begin{verbatim}
419478
build > make test
420479
Running tests...
@@ -436,7 +495,7 @@ \subsection{CTest}
436495
\end{verbatim}
437496

438497
You can run tests selectively using \texttt{ctest -R \textless regex\textgreater}, for example:
439-
498+
%
440499
\begin{verbatim}
441500
build > ctest -R twi-2
442501
Test project /.../sw4/build
@@ -454,11 +513,22 @@ \subsection{CTest}
454513
Total Test time (real) = 14.90 sec
455514
\end{verbatim}
456515

457-
You can use these tests to help ensure your \emph{SW4} installation is working correctly. If a test fails you can check the details in the output log at \texttt{Testing/Temporary/LastTest.log}.
516+
If a test fails you can check the details in the output log at
517+
\texttt{Testing/Temporary/LastTest.log}.
458518

459-
\section{Installing the cencalvm, proj.4, and euclid libraries}\label{sec:cencalvm-install}
460-
\index{installation!cencalvm}
461-
\index{installation!efile}
519+
\section{Installing the proj.4, euclid, and cencalvm packages}\label{sec:cencalvm-install}
520+
\index{installation!cencalvm} \index{installation!efile}
521+
522+
If you are only interested in using the advanced geographical mapping options of the {\tt grid} command,
523+
or the {\tt rfile} command, you only need to install the proj.4 package.
524+
525+
The following instructions describe how to install all three packages. For simplicity all packages
526+
are installed under the same top directory. If you are using {\tt cmake}, you may optionally put the
527+
proj.4 package in a separate directory. In the following we shall assume that all packages are
528+
installed under the same top directory, and that you assign the name of that directory to the
529+
environment variable \verb+SW4ROOT+. When you are finished installing the packages, the
530+
corresponding include and library files should be in the sub-directories \verb+${SW4ROOT}/include+
531+
and \verb+${SW4ROOT}/lib+, respectively.
462532

463533
The cencalvm library was developed by Brad Aagaard at USGS. Instructions for building the cencalvm
464534
library as well as downloading the Etree database files for Northern California, can
@@ -467,13 +537,9 @@ \section{Installing the cencalvm, proj.4, and euclid libraries}\label{sec:cencal
467537
http://earthquake.usgs.gov/data/3dgeologic/cencalvm_doc/INSTALL.html
468538
\end{verbatim}
469539
The installation process for cencalvm, which is outlined below, is described in detail on the above
470-
web page. Note that three libraries need to be installed: euclid (etree), proj4, and cencalvm. In
471-
order for \emph{SW4} to use them, they should all be installed in the same base directory and you
472-
should assign that directory to the \verb+SW4ROOT+ variable. When these three packages are installed, the
473-
corresponding include and library files should be in the directories \verb+${SW4ROOT}/include+ and
474-
\verb+${SW4ROOT}/lib+, respectively.
540+
web page. Note that cencalvm relies on both the euclid and the proj.4 libraries.
475541

476-
Note that the euclid library must be installed manually by explicitly copying all include files to
542+
The euclid library must be installed manually by explicitly copying all include files to
477543
the include directory and all libraries to the lib directory,
478544
\begin{verbatim}
479545
shell> cd euclid3-1.2/libsrc
@@ -488,8 +554,11 @@ \section{Installing the cencalvm, proj.4, and euclid libraries}\label{sec:cencal
488554
shell> make
489555
shell> make install
490556
\end{verbatim}
557+
We remark that the {\tt proj.4} library can alternatively be installed using {\tt macports} (if you are
558+
on a Mac OSX machine).
559+
491560
The cencalvm library should also be configured to be installed in \verb+${SW4ROOT}+. You also have to help
492-
the configure script finding the include and library files for the proj4 and etree libraries,
561+
the configure script finding the include and library files for the proj.4 and etree libraries,
493562
\begin{verbatim}
494563
shell> cd cencalvm-0.6.5
495564
shell> configure --prefix=${SW4ROOT} CPPFLAGS="-I${SW4ROOT}/include" \
@@ -498,45 +567,25 @@ \section{Installing the cencalvm, proj.4, and euclid libraries}\label{sec:cencal
498567
shell> make install
499568
\end{verbatim}
500569

501-
To verify that the libraries have been installed properly, you should go to the \verb+SW4ROOT+ directory
502-
and list the lib subdirectory (\verb+cd ${SW4ROOT}; ls lib+). You should see the following files (on
503-
Mac OSX machines, the .so extension is replaced by .dylib ):
570+
To verify that the libraries have been installed properly, you should go to the \verb+SW4ROOT+
571+
directory and list the {\tt lib} sub-directory (\verb+cd ${SW4ROOT}; ls lib+). You should see the
572+
following files (on Mac OSX machines, the .so extension is replaced by .dylib ):
504573
\begin{verbatim}
505574
shell> cd ${SW4ROOT}
506575
shell> ls lib
507576
libetree.so libetree.a
508577
libproj.so libproj.a libproj.la
509578
libcencalvm.a libcencalvm.la libcencalvm.so
510579
\end{verbatim}
511-
Furthermore, if you list the include subdirectory, you should see include files such as
580+
Furthermore, if you list the include sub-directory, you should see include files such as
512581
\begin{verbatim}
513582
shell> cd ${SW4ROOT} %$
514583
shell> ls include
515584
btree.h etree.h etree_inttypes.h
516585
nad_list.h projects.h proj_api.h
517586
cencalvm
518587
\end{verbatim}
519-
Note that the include files for cencalvm are in a subdirectory with the same name.
520-
521-
\subsection{Building {\tt sw4} with efile and proj.4 support}
522-
Once you have successfully installed the euclid, proj.4 and cencalvm libraries, it should be easy to
523-
re-configure \emph{SW4} to use them. Simply edit your configuration file (\verb+make.inc+)
524-
by adding two lines to the top of the file:
525-
\begin{verbatim}
526-
etree = yes
527-
SW4ROOT = /thid/party/basedir
528-
...
529-
\end{verbatim}
530-
You then need to re-compile \emph{SW4}. Go to the \emph{SW4} main directory, clean up the previous object
531-
files and executable, and re-run make:
532-
\begin{verbatim}
533-
shell> cd /my/installation/dir/sw4-v1.1
534-
shell> make clean
535-
shell> make
536-
\end{verbatim}
537-
If all goes well, the ``SW4 lives'' banner is shown after the make command is
538-
completed. As before, the \verb+sw4+ executable will be located in the \verb+optimize+ or
539-
\verb+debug+ directories.
588+
Note that the include files for cencalvm are in the sub-directory with the same name.
540589

541590
\section{Disclaimer}
542591
This document was prepared as an account of work sponsored by an agency of the United States

0 commit comments

Comments
 (0)