Skip to content

Commit

Permalink
Merge pull request #146 from houjun/master
Browse files Browse the repository at this point in the history
Makefile changes for Spack on MacOS
  • Loading branch information
andersp committed Dec 1, 2022
2 parents d4f1f4f + 9195458 commit 3ee429b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
24 changes: 10 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,19 @@ ifeq ($(USERMAKE),configs/make.inc)
include configs/make.inc
foundincfile := "configs/make.inc"
else

# Below are commented out for Spack install
# if configs/make.inc does not exist
ifeq ($(UNAME),Darwin)
# for Anders' old laptop
ifeq ($(findstring chebyshev,$(HOSTNAME)),chebyshev)
include configs/make.chebyshev
foundincfile := "configs/make.chebyshev"
# for Anders' new laptop
else ifeq ($(findstring fourier,$(HOSTNAME)),fourier)
include configs/make.fourier
foundincfile := "configs/make.fourier"
# ifeq ($(UNAME),Darwin)
# for Anders' laptop
# ifeq ($(findstring chebyshev,$(HOSTNAME)),chebyshev)
# include configs/make.chebyshev
# foundincfile := "configs/make.chebyshev"
# for any other MacOS system
# else
# include configs/make.osx
# foundincfile := "configs/make.osx"
endif
endif
# endif
# endif

# put the variables in the configs/make.xyz file
ifeq ($(UNAME),Linux)
Expand Down Expand Up @@ -164,8 +160,8 @@ else
optdir := $(optdir)_mp
profiledir := $(profiledir)_mp
ifeq ($(UNAME),Darwin)
CXXFLAGS += -lomp
FFLAGS += -lomp
CXXFLAGS += -Xpreprocessor -fopenmp
FFLAGS += -Xpreprocessor -fopenmp
else
CXXFLAGS += -fopenmp
FFLAGS += -fopenmp
Expand Down
Binary file modified doc/SW4-Installation.pdf
Binary file not shown.
34 changes: 25 additions & 9 deletions doc/SW4-Installation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,23 @@
\section{Introduction}
The sole purpose of this document is to describe the installation process of the seismic wave
propagation code \emph{SW4}. A comprehensive user's guide is provided in the report by
Petersson and Sjogreen~\cite{SW4-v3}.
Petersson, Sjogreen, and Tang~\cite{SW4-v3}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Installing \emph{SW4} with spack}\label{cha:installing-sw4-spack}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\emph{SW4} can be installed with Spack (\url{https://spack.io}), which is a package manager for supercomputers, Linux, and macOS. It can automatically install \emph{SW4} together with all its dependent libraries, such as MPI, Proj, OpenMP, blas, lapack, HDF5, FFTW, and ZFP.
\begin{verbatim}
> git clone -c feature.manyFiles=true https://github.com/spack/spack.git
> . spack/share/spack/setup-env.sh
> spack install sw4
\end{verbatim}

Run the following command to add the installed \emph{SW4} executable to your system PATH:
\begin{verbatim}
> . spack/share/spack/setup-env.sh
> spack load sw4
\end{verbatim}

\section{Compilers and third party libraries}

Expand Down Expand Up @@ -189,7 +205,7 @@ \section{Installing \emph{SW4} with make}\label{cha:installing-sw4}

The classical way of building \emph{SW4} uses \verb+make+. We recommend using GNU make, sometimes called \verb+gmake+. You can check the version of make on you system with the command
\begin{verbatim}
make -v
> make -v
\end{verbatim}
If you don't have GNU make installed on your system, you can obtain it from www.gnu.org.

Expand Down Expand Up @@ -281,8 +297,8 @@ \subsubsection{Using make}
\end{verbatim}
You can also build an executable with debugging symbols by adding the \verb+debug=yes+ option to \verb+make+,
\begin{verbatim}
cd /enter/your/path/sw4-v3.0
make debug=yes
> cd /enter/your/path/sw4-v3.0
> make debug=yes
\end{verbatim}
In this case, the executable will be located in
\begin{verbatim}
Expand Down Expand Up @@ -342,8 +358,8 @@ \subsection{Building \emph{SW4} with PROJ, HDF5, and ZFP support}
You then need to re-compile \emph{SW4}. Go to the \emph{SW4} main directory, clean out the previous
object files and executable, and re-run make:
\begin{verbatim}
make clean
make
> make clean
> make
\end{verbatim}
If all goes well, the ``SW4 lives'' banner is shown after the make command is
completed. As before, the \verb+sw4+ executable will be located in the \verb+optimize+ or
Expand All @@ -358,8 +374,8 @@ \subsection{Testing the \emph{SW4} installation}
\verb+test_sw4.py+. If the \verb+sw4+ executable resides in the \verb+optimize+ directory, you can
run the basic tests by doing:
\begin{verbatim}
cd pytest
./test_sw4.py ("./test_sw4.py -u 0" if HDF5 is not installed)
> cd pytest
> ./test_sw4.py ("./test_sw4.py -u 0" if HDF5 is not installed)
\end{verbatim}
If all goes well, you should see the following output:
\begin{verbatim}
Expand All @@ -374,7 +390,7 @@ \subsection{Testing the \emph{SW4} installation}
\verb+test_sw4.py+. For a complete list of options do \verb+test_sw4.py --help+, which currently
give the output:
\begin{verbatim}
./test_sw4.py --help
> ./test_sw4.py --help
usage: test_sw4.py [-h] [-v] [-l {0,1,2}] [-m MPITASKS] [-d SW4_EXE_DIR]
optional arguments:
Expand Down

0 comments on commit 3ee429b

Please sign in to comment.