Building PISM¶
To make sure that the key PETSc and MPI prerequisites work properly together, so that you
can run PISM in parallel, you might want to make sure that the correct mpiexec can be
found, by setting your PATH. For instance, if you used the option
--download-mpich=1 in the PETSc configure, the MPI bin directory will have a path
like $PETSC_DIR/$PETSC_ARCH/bin. Thus the following lines might appear in your
.bashrc or .profile, if not there already:
export PETSC_DIR=/home/user/petsc-3.10.2/
export PETSC_ARCH=opt
export PATH=$PETSC_DIR/$PETSC_ARCH/bin/:$PATH
From now on we will assume that the PETSC_ARCH and PETSC_DIR variables are set.
Note
The PETSC_ARCH variable is not needed if PETSc was configured using the
--prefix= option.
Follow these steps to build PISM:
Get the latest source for PISM using the Git version control system by running
git clone https://github.com/pism/pism.git pism-stable
A directory called “
pism-stable” will be created. Note that in the future when you enter that directory,git pullwill update to the latest revision of PISM. [1]Note
You can also download a tarball from GitHub.
Build PISM:[2]
mkdir -p pism-stable/build cd pism-stable/build export CC=mpicc export CXX=mpicxx cmake -DCMAKE_INSTALL_PREFIX=~/pism .. make -j install
Here
pism-stableis the directory containing PISM source code while~/pismis the directory PISM will be installed into.Variables
CCandCXXspecify MPI compiler wrappers provided by your MPI installation.Note
When using MPI’s compiler wrappers, make sure that
mpiccandmpicxxyou select were used to compile the PETSc library: PISM and PETSc have to use the same MPI installation.Commands above will configure PISM to be installed in
~/pism/binand~/pism/lib/then compile and install all its executables and scripts.If your operating system does not support shared libraries[3], then set
Pism_LINK_STATICALLYto “ON”. This can be done by either runningcmake -DPism_LINK_STATICALLY=ON ..
or by using
ccmake[4] runccmake ..and then change
Pism_LINK_STATICALLY(and then presscto “configure” andgto “generate Makefiles”). Then runmake install.Temporary files created during the build process (located in the
buildsub-directory) are not automatically deleted after installing PISM, so run “make clean” if space is an issue. You can also delete the build directory altogether if you are not planning on re-compiling PISM.Note
When using Intel’s compiler and high optimization settings such as
-O3,-fp-model precisemay be needed to get reproducible model results. Set it usingccmakeor by settingCFLAGSandCXXFLAGSenvironment variables when building PISM’s prerequisites (such as PETSc) and PISM itself.export CFLAGS="-fp-model precise" export CXXFLAGS="-fp-model precise" cmake [other options] ..
Note
To achieve best performance it can be useful to tell the compiler to target the “native” architecture. (This gives it permission to use CPU instructions that may not work on older CPUs.)
export CFLAGS="-march=native" export CXXFLAGS="-march=native" cmake [other options] ..
PISM executables can be run most easily by adding the
bin/sub-directory in your selected install path (~/pism/binin the example above) to yourPATH. For instance, this command can be done in the Bash shell or in your.bashrcfile:export PATH=~/pism/bin:$PATH
Now see section Quick tests of the installation or Getting started: a Greenland ice sheet example to continue.
PISM’s build-time configuration¶
Some of PISM’s features (the ones requiring additional libraries, for example) need to be enabled when building PISM. This section lists important build-time options.
Option |
Description |
|---|---|
|
"build type": set to "Debug" for development |
|
build shared (as opposed to static) libraries (this is the default) |
|
set CMake flags to try to ensure that everything is linked statically |
|
specifies whether PISM should look for libraries (disable this on Crays) |
|
build additional executables (needed to run |
|
build PISM’s Python bindingd; requires |
|
use the PROJ library to compute latitudes and longitudes of grid points |
|
use NetCDF for parallel file I/O |
|
use PnetCDF for parallel file I/O |
|
enables extra sanity checks in the code (this makes PISM a lot slower but simplifies development) |
To enable PISM’s use of PROJ, for example, run
cmake -DPism_USE_PROJ [other options] ..
Building PISM with libraries in non-standard locations¶
To build PISM with libraries installed in a non-standard location such as ~/local/,
use CMake’s variable CMAKE_PREFIX_PATH. Set it to a semicolon-separated list of
directories.
For example, if netcdf.h is located in ~/local/netcdf/include/ and
libnetcdf.so is in ~/local/netcdf/lib, add ~/local/netcdf to
CMAKE_PREFIX_PATH:
cmake -DCMAKE_PREFIX_PATH=$HOME/local/netcdf [other options] ..
Note
Use $HOME and not “~” to indicate the home directory.
To build PISM using parallel I/O libraries installed as described in Installing parallel I/O libraries, do this:
cmake -DCMAKE_PREFIX_PATH="$HOME/local/netcdf;$HOME/local/pnetcdf;$HOME/local/parallelio" \
-DPism_USE_PNETCDF \
-DPism_USE_PARALLEL_NETCDF4 \
..
Footnotes
| Previous | Up | Next |