Linux
The most common Linux distributions are
RHEL, CentOS Stream, Rocky Linux, Fedora (RPM-based Linux)
Debian, Ubuntu, Mint (Debian-based Linux)
with which the installation instructions below can be applied.
prerequisites
The following packages must be installed first:
gfortran
cmake
ninja
perl
These packages can be installed using OS-specific package managers.
RPM-based Linux distributions
The default package manager is dnf. First, update the system
sudo dnf update
Next, run the following command to install GCC (GNU Compiler Collection) on the system
sudo dnf install gcc
and then gfortran
sudo dnf install gcc-gfortran
To install cmake, enter
sudo dnf install cmake
Finally, install ninja by running the following command
dnf install ninja-build
Before installing perl, check if it is already present on your Linux distribution, by typing
perl -v
If perl is not installed, the shell reports that this command is not found.
In that case, install the perl interpreter as follows
sudo dnf install perl
Debian-based Linux distributions
The package manager is apt-get. Open a command line terminal and run the following commands:
sudo apt-get update
followed by
sudo apt-get install build-essential cmake ninja-build gfortran
Note
The build-essential package installs essential tools and libraries for compiling the source code, including gcc and make.
The Linux flavors Debian, Ubuntu and Mint have perl installed by default.
verify installations
Verify the required installations by checking their versions, as follows
gfortran --version
cmake --version
ninja --version
perl --version
If no error is reported, then the installation was successful.
Important
The
CMakeversion must be at least 3.20 or newer.The
perlversion is 5 or higher.
installation SWASH
Once the prerequisites are taken care of, installing SWASH on your machine is a four-step process.
download SWASH
git clone https://gitlab.tudelft.nl/citg/wavemodels/swash.git && cd swash
Paste this into a shell terminal.
configure SWASH
make config
build SWASH
make
install SWASH
make install
SWASH is installed at folder $HOME/wavemodels/swash by default.
To run SWASH, you need to make sure that the /bin folder in this directory is added to your system’s PATH.
Open the terminal and enter
export PATH=$PATH:$HOME/wavemodels/swash/bin
You can check the new value of PATH by echoing it: echo $PATH. However, to set this permanently, you need to add it to
your ~/.bash_profile (or ~/.bashrc file), as follows
echo export PATH=$PATH:$HOME/wavemodels/swash/bin >> ~/.bash_profile
options for configuring SWASH
If desired, the build can be configured by passing one or more options below to make config.
fc=<compiler>the Fortran90 compiler to use [default is determined by
CMake]
mpi=onenable build of SWASH with MPI [
offby default]
prefix=<folder>set the installation folder [
$HOME/wavemodels/swash bydefault]
For example, the following command
make config fc=gfortran prefix=/usr/local/swash
will configure SWASH to be built using gfortran and then install it at /usr/local/swash.
building with MPI support
The SWASH source code also supports memory-distributed parallelism for high performance computing applications. A message passing approach is employed based on the Message Passing Interface (MPI) standard that enables communication between independent processors.
Popular implementations are Open MPI and MPICH. The first one is typically offered by the package managers of Linux and macOS and can be combined with GCC such as gfortran.
Before installing Open MPI, make sure that your system is up to date and that GCC has been installed, see prerequisites.
To install Open MPI on a RPM-based Linux (e.g., Rocky Linux), run
dnf install openmpi openmpi-devel
To install Open MPI on a Debian-based Linux (e.g., Ubuntu), run
sudo apt install openmpi-bin libopenmpi-dev
To verify whether the installation was successful, run the following command
ompi_info --version
or
mpirun --version
Once Open MPI is operational, we proceed to build SWASH. First, we configure SWASH to be built with support for Open MPI, as follows
make config fc=mpifort mpi=on
The actual building is done by typing
make
Finally, to install SWASH, run the following command
make install
SWASH is now ready for high performance computing.
clean up
To remove all files installed by make install, type the following command
make uninstall
If you want to remove the build directory and all files that have been created after running make or make build, then run
make clobber