Installation
The most convenient way to install ASCOT5 is to use Conda.
Without MPI:
git clone https://github.com/ascot4fusion/ascot5.git
cd ascot5
conda env create -f environment.yaml
conda activate ascot-env
make libascot -j
make ascot5_main -j # Also bbnbi5 if needed
pip install -e .
The executables are located in the build
directory.
With MPI:
git clone https://github.com/ascot4fusion/ascot5.git
cd ascot5
conda env create -f environment-mpi.yaml
conda activate ascot-mpi
make libascot -j MPI=1
make ascot5_main -j MPI=1 # Also bbnbi5 if needed
pip install -e .
Do note that this method uses the MPI packaged with Conda. This might not be preferred on some HPC clusters, so it is usually best to use the native MPI library instead. To switch to native MPI, do the following:
module load <local-mpi-library>
mpirun -V # Prints the version of the MPI library to be used in the next line
conda install "<local-mpi-library>=x.y.z=external_*"
export HDF5_CC=$(which mpicc)
export HDF5_CLINKER=$(which mpicc)
# If you have installed mpi4py already, it needs to be reinstalled
# with the new MPI library.
python -m pip cache remove mpi4py
python -m pip install mpi4py
Conda does not have all versions of MPI libraries available, so one might have to use asterix in the minor version number, for example:
conda install "openmpi=4.*=external_*"
Note
Add the following lines in your batch script to use the conda environment when submitting jobs via SLURM:
eval "$(conda shell.bash hook)"
conda activate ascot-env
If Conda is not available on your cluster, it can be easily installed (doesn’t require sudo) with:
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
Building the code from the source (without Conda) provides a light installation with the capability to run simulations using native libraries and perform limited pre- and post-processing. A typical way to use ASCOT5 is to run simulations on a computing cluster and carry out pre- and postprocessing on a home cluster or a workstation. For optimal performance, use this method on the HPC cluster for running simulations, and then the full installation where you process the data.
Requirements
Install the requirements or use the module system:
C compiler (Intel)
HDF5
OpenMP
MPI
Python3.10
Download the source and set up the virtual environment:
git clone https://github.com/ascot4fusion/ascot5.git python -m venv ascot-env source activate ascot-env/bin/activate
Install
a5py
and compile the executables which will be located atbuild/
:cd ascot5 pip install -e . make ascot5_main -j MPI=1 # Also bbnbi5 if needed
See here for tips on how to compile the code on different platforms.
Optional Add the following lines to your .bashrc to automatically activate ASCOT5 environment each time you login:
<module loads and exports here>
source activate /path/to/ascot5env
This is a full installation from the source (using Conda) and with the optional packages present that are required to build ascot2py.py
and the documentation.
Note that the first step requires you to add SSH keys on GitHub whenever on a new machine.
git clone git@github.com:ascot4fusion/ascot5.git
cd ascot5
conda env create -f environment-dev.yaml
conda activate ascot-dev
make libascot -j
make ascot5_main -j
pip install -e .
The simulation options are edited with the local text editor, which usually happens to be vim
.
Consider adding the following line to your .bashrc
(or .bash_profile
if working locally):
export EDITOR=/usr/bin/emacs
Whenever there is a new release, you can update the code as:
git pull
make clean
make ascot5_main -j (MPI=1)
make libascot -j (MPI=1)
pip install -e .
Always use the main
branch when running simulations unless you specifically need something from a feature branch.
Version numbers are specified via tags.
To switch to a different version number:
git checkout <version-number> # e.g. 5.5.3
make clean
make ascot5_main -j (MPI=1)
make libascot -j (MPI=1)
pip install -e .
Test that ASCOT5 was properly installed by running the introduction.
Troubleshooting
Conda complains that freeqdsk
was not found or could not be installed.
Remove
freeqdsk
fromenvironment.yaml
and install it withpip
once the environment is activated. The cause of this error is unknown.
Make stops since libhdf5*.a
could not be located.
The compiler should be using shared libraries, not static. Add the following flag for the compiler:
make ascot5_main FLAGS="-shlib"
Compiling on different platforms
Here are instructions on how to compile ASCOT5 in some of the platforms where the code has been used. If you are using ASCOT5 in a cluster that is not listed here, feel free to amend the list.
module load StdEnv intel/19.0.4 hpcx-mpi/2.4.0 intel-mkl/2019.0.4 hdf5/1.10.4-mpi python-data
make -j ascot5_main MPI=1
Alternatively:
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -vecabi=cmdtarget"
module load hdf5/mpi/intel/2019.3/1.10.5
make ascot5_main MPI=1 CC=mpicc FLAGS="-no-multibyte-chars -qno-openmp-offload -diag-disable 3180 -xmic-avx512 -vecabi=cmdtarget" LFLAGS="-lhdf5_hl -lhdf5" -j
make libascot MPI=1 CC=mpicc FLAGS="-no-multibyte-chars -qno-openmp-offload -diag-disable 3180" LFLAGS="-lhdf5_hl -lhdf5" -j
make ascot5_main MPI=0 CC=gcc
For libascot, one user needed to revert to python/3.5.1 and command
make libascot MPI=0
module load GCCcore/11.3.0 zlib/1.2.12-GCCcore-11.3.0 binutils/2.38-GCCcore-11.3.0 intel-compilers/2022.1.0 numactl/2.0.14-GCCcore-11.3.0 UCX/1.12.1-GCCcore-11.3.0 impi/2021.6.0-intel-compilers-2022.1.0 iimpi/2022a Szip/2.1.1-GCCcore-11.3.0 HDF5/1.13.1-iimpi-2022a
make ascot5_main CC=h5pcc FLAGS=-qno-openmp-offload -diag-disable 3180
make ascot5_main CC=h5cc MPI=0
module load hdf5/1.8.19 intel/2018.4 impi/2018.4 zlib szip/2.1.1
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -xcommon-avx512 -vecabi=cmdtarget"
module load intel/pe-xe-2018--binary intelmpi/2018--binary szip/2.1--gnu--6.1.0 zlib/1.2.8--gnu--6.1.0 hdf5/1.8.18--intelmpi--2018--binary python/3.5.2
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -xmic-avx512 -vecabi=cmdtarget"
module load xl spectrum_mpi/10.3.1--binary gnu/8.4.0 hdf5/1.12.0--spectrum_mpi--10.3.1--binary szip
With MPI:
module load intel/pe-xe-2020--binary intelmpi/2020--binary gnu/8.3.0 zlib/1.2.11--gnu--8.3.0 szip/2.1.1--gnu--8.3.0 hdf5/1.12.2--intelmpi--2020--binary
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -xcommon-avx512 -vecabi=cmdtarget"
Without MPI (for working on the login node):
module load load intel/pe-xe-2020--binary gnu/8.3.0 zlib/1.2.11--gnu--8.3.0 szip/2.1.1--gnu--8.3.0 hdf5/1.12.2--intel--pe-xe-2020--binary
make ascot5_main MPI=0 FLAGS="-qno-openmp-offload -diag-disable 3180"
make libascot MPI=0 FLAGS="-qno-openmp-offload -diag-disable 3180"
module load intel/19.1.3 impi/2019.9 git hdf5-mpi
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180" CC=h5pcc
module load intel/19.1.2 impi/2019.8 git hdf5-mpi anaconda/3/2020.02
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180"
module load cray-hdf5-parallel
export PMI_NO_FORK=1
export PMI_NO_PREINITIALIZE=1
export HDF5_USE_FILE_LOCKING=FALSE
make ascot5_main CC=h5cc MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180"
port install gcc10
port install openmpi-gcc10
port install hdf5 +gcc10 +openmpi +hl
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -vecabi=cmdtarget"
make libascot MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -vecabi=cmdtarget"
module load anaconda
make ascot5_main MPI=0 CC=h5cc
module load intel/18.0.5 impi/2018.4 hdf5-mpi/1.8.21
make -j ascot5_main MPI=0 FLAGS="-qno-openmp-offload -diag-disable 3180"
.. tab-item:: Triton.aalto.fi
For GCC (outdated):
module load hdf5/1.10.7-openmpi
make -j ascot5_main MPI=1
And in the Makefile:
-CFLAGS+=-O2 -lm -Wall -fopenmp -fPIC -std=c11 $(DEFINES) $(FLAGS)
+CFLAGS+=-O2 -lm -Wall -fopenmp -fPIC -std=c11 -lhdf5_hl $(DEFINES) $(FLAGS)
-libascot.so: CFLAGS+=-shlib -fPIC -shared
+libascot.so: CFLAGS+=-fPIC -shared
For Intel:
module purge
module load intel-parallel-studio hdf5/1.10.2-openmpi
export OMPI_MPICC=icc
make ascot5_main MPI=1 FLAGS="-qno-openmp-offload -diag-disable 3180 -vecabi=cmdtarget"
# Copy binary somewhere safe and use it in batch jobs. These are for the login node
make clean
make -j ascot5_main MPI=0 CC=icc FLAGS="-qno-openmp-offload -diag-disable 3180 -vecabi=cmdtarget"
make -j libascot MPI=0 CC=icc FLAGS="-qno-openmp-offload -diag-disable 3180 -vecabi=cmdtarget"
module load anaconda
(Add -xcommon-avx512 to optimize for skl/csl nodes)
Serial version:
For the serail version (without MPI, such as python GUI)
module purge ; module load cineca intel/pe-xe-2017–binary intelmpi/2017–binary gnu/6.1.0 zlib/1.2.8–gnu–6.1.0 szip/2.1–gnu–6.1.0 hdf5/1.8.17–gnu–6.1.0 itm-python/3.10
MPI=0 FLAGS="-I${HDF5_INCLUDE}"
Parallel version:
For the parallel version (e.g. to be run on the worker nodes)
module purge ; module load cineca intel/pe-xe-2017–binary intelmpi/2017–binary gnu/6.1.0 zlib/1.2.8–gnu–6.1.0 szip/2.1–gnu–6.1.0 hdf5/1.8.17–intelmpi–2017–binary itm-python/3.10
MPI=1 FLAGS="-I${HDF5_INCLUDE}"
(this hasn’t been really tested, but it is a starting point)
Settings when compiling
Some of the ASCOT5 options require recompiling the code.
Parameters that can be given arguments for make
are (the default values are shown)
make -j ascot5_main NSIMD=16 CC=h5cc TARGET=0 VERBOSE=1 MPI=0
NSIMD |
Number of particles simulated in parallel in each SIMD vector. These are processed simultaneously by each thread and the optimal number depends on the hardware. If unsure, keep the default value. |
CC |
C compiler to use. |
TARGET |
Offload computation to this many Xeon Phi accelerator(s). If unsure, do not use this setting. |
VERBOSE |
Print increasing amounts of progress information.
|
MPI |
Enable MPI. The code can also be run on multiple nodes without MPI, but doing so requires manual labor. |
Compiler flags can be provided with FLAGS
(and linker flags with LFLAGS
) parameter, e.g.
make -j ascot5_main FLAGS="-qno-offload"
Some parameters relevant for ASCOT5 are (these are compiler dependent):
|
Disables offload. Recommended when not using Xeon Phi. |
|
Disables Intel compiler warnings about unrecognized pragmas when the offloading is disabled. |
|
Compile the code for Skylake or KNL processors, optimize for Skylake, optimize for KNL. |
|
Enables vector instructions for NSIMD > 2. |
|
“Interprocedural Optimization” which might increase the performance somewhat. |
|
Generate vectorization reports in *optrpt files. Only useful for developers. |
Additional compile-time parameters can be found in ascot5.h
, but there is rarely a need to change those.