Build Instructions

  • XGC has several external dependencies. If you are building XGC at one of the following HPC facilities, indicate which one by setting the environment variable XGC_PLATFORM before configuring, e.g.:

    export XGC_PLATFORM=summit
    

    System

    XGC_PLATFORM

    Cori Haswell

    cori_haswell

    Cori KNL

    cori_knl

    Greene

    greene

    JLSE

    jlse

    Summit

    summit

    Theta

    theta

    Traverse

    traverse

    After that, you should not have to worry further about dependencies.

    If you are not using one of the above facilities or want custom-built dependencies, then you have two options:

    1. Install the libraries manually (see 3rd Party Software Installations)

    2. Use the Superbuild, which will download, build, and install its dependencies for you. To enable this feature, pass

-DBUILD_DEPENDENCIES=ON to cmake when configuring the XGC build below.

  • Load modules and set environment variables

    Compiling and running on the supported systems may require modules and environment variables. See Building at HPC Facilities at the bottom of this page for the commonly used ones on your system.

  • Create and enter a directory.

    mkdir build; cd build
    
  • Run CMake to configure a build of XGC.

    cmake ..
    

    Additional settings can be passed as -D flags, e.g.:

    cmake -DBUILD_DEPENDENCIES=ON -DCONVERT_GRID2=ON -DSOLVERLU=OFF ..
    

    To interactively edit configuration settings, use ccmake . for a CLI or cmake-gui for a GUI.

    For a full list of XGC configure options, see XGC Preprocessor Macros.

  • Build all available targets:

    make -j
    

    Or just the one you want, e.g.:

    make -j xgc-es-cpp
    

    The executables will be in build/bin. Current available targets are: xgc-es-cpp, xgc-es-cpp-gpu, xgca-cpp, xgca-cpp-gpu, xgc-eem-cpp, xgc-eem-cpp-gpu, as well as kernels and tests (see Kernels and Tests).

Environment at HPC facilities

Compiling and running on the supported systems may require modules and environment variables. Below are the commonly used sets.

Cori (KNL partition)

module load cray-libsci
module switch craype-haswell craype-mic-knl
module load cray-hdf5-parallel
module load cray-fftw
module load cmake/3.20.5
export XGC_PLATFORM=cori_knl
export CRAYPE_LINK_TYPE=static

Greene

source /p/xgc/Software/greene_config

Summit

module load nvhpc/21.7
module load spectrum-mpi
module load python
module load netlib-lapack
module load hypre
module load fftw
module load hdf5
module load cmake/3.20.2
module load libfabric/1.12.1-sysrdma
export XGC_PLATFORM=summit
export OMP_NUM_THREADS=14
export FC=mpifort
export CC=mpicc
export NVCC_WRAPPER_DEFAULT_COMPILER=mpiCC
export CXX=/gpfs/alpine/world-shared/phy122/lib/install/summit/kokkos/nvhpc21.7/bin/nvcc_wrapper

Theta

module load cray-libsci
module load cray-hdf5-parallel
module load cray-fftw
module use -a /projects/TokamakITER/Software/modulefiles
module load adios2/DEFAULT
module load cmake/3.20.4
export CRAYPE_LINK_TYPE=dynamic
export XGC_PLATFORM=theta

Traverse

module load pgi/19.9/64
module load openmpi/pgi-19.9/4.0.4/64
module load cudatoolkit/10.1
module load hdf5/pgi-19.9/openmpi-4.0.4/1.10.6
module load fftw/gcc/openmpi-4.0.1/3.3.8
module load cmake/3.19.7
export NVCC_WRAPPER_DEFAULT_COMPILER=/opt/pgi/19.9/linuxpower/19.9/bin/pgc++
export CXX=/home/as85/Software/install/kokkos/pgi19.9/bin/nvcc_wrapper
export XGC_PLATFORM=traverse