Joule 2.0

如果这是您第一次在 Joule2 上构建 MFIX-Exa,请先查看下面的常规说明和 基础知识 部分。

  • 要访问 Joule2,您需要一个 NETL HPC 账户,一个 yubikey(双因素认证)以及 HPC 客户端

  • 这些说明在登录节点上使用 -j8 个 CPU 构建 MFIX-Exa。如果流量较高,您可能需要减少此值;或者如果您在计算节点上交互使用,您可能希望增加此值。

  • cmake 指令会编译到一个 build 目录。gmake 指令会编译到一个 exec 目录。

  • 对于依赖项,假设您已设置以下环境变量:

    export HYPRE_INSTALL_DIR=$HOME/<path/to/my/hypre-install-dir>
    export CSG_INSTALL_DIR=$HOME/<path/to/my/csg-dep-install-dir>
    export CSG_LIB_DIR=$HOME/<path/to/my/csg-lib-install-dir>
    export ASCENT_INSTALL_DIR=$HOME/<path/to/my/ascent-install-dir>
    

    到您有读写权限的路径。如果您想使用可选依赖项构建 MFIX-Exa,您需要记住这些路径。

  • 在使用 cmake 构建 mfix 可执行文件后,您可以通过在 build 目录中执行以下命令来构建 PIC-to-DEM 重启应用程序:

    cmake --build . --target pic2dem
    

基础知识

源代码

在构建之前,首先根据 MFIX-Exa 网站 上的说明获取源代码副本。

模块

下面的所有构建说明都经过以下模块测试

module purge
module load cmake/3.23.1
module load gnu/9.3.0
module load openmpi/4.0.4_gnu9.3

启用 GPU 的构建还需要

module load cuda/11.3

利用外部依赖项的完整构建还需要设置某些环境变量,如下所述。

构建 MFIX-Exa

下面的命令是超级构建说明,即 AMReX 作为 MFIX-Exa 构建过程的一部分被构建。 要使用 hyprecsg 和/或 ascent 依赖项构建 MFIX-Exa,您首先需要构建和安装这些库及其依赖项。 安装必要依赖项的说明如下,应该首先成功安装。构建代码有两种主要方法 cmakegmake,分别如下提供。

cmake

cmake -DCMAKE_C_COMPILER=gcc \
      -DCMAKE_CXX_COMPILER=g++ \
      -DMFIX_MPI=yes \
      -DMFIX_OMP=no \
      -DMFIX_GPU_BACKEND=NONE \
      -DAMReX_TINY_PROFILE=no \
      -DMFIX_CSG=no \
      -DMFIX_HYPRE=no \
      -DCMAKE_BUILD_TYPE=Release \
      ../
make -j8

gmake

make -C exec -j8 \
     COMP=gnu \
     USE_MPI=TRUE \
     USE_OMP=FALSE \
     USE_CUDA=FALSE \
     USE_TINY_PROFILE=FALSE \
     USE_CSG=FALSE \
     USE_HYPRE=FALSE \
     DEBUG=FALSE

Optional build dependencies

The following dependencies need to be built and installed prior to following any of the full build instructions above.

  1. Set environment helpers

    export CC=$(which mpicc)
    export CXX=$(which mpic++)
    export F77=$(which mpif77)
    export FC=$(which mpifort)
    export F90=$(which mpif90)
    mkdir $HOME/scratch && cd $HOME/scratch
    
  2. HYPRE

    git clone https://github.com/hypre-space/hypre.git
    pushd hypre/src/
    git checkout v2.26.0
    ./configure --prefix=$HYPRE_INSTALL_DIR --with-MPI
    make -j8 install
    popd
    
  3. Catch2

    git clone --depth 1 --branch v2.13.7 https://github.com/catchorg/Catch2
    pushd Catch2/
    cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$CSG_INSTALL_DIR
    cd build/
    make -j8 install
    popd
    
  4. GMP

    wget --no-check-certificate https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
    tar -xf gmp-6.2.1.tar.xz
    pushd gmp-6.2.1
    ./configure --prefix=$CSG_INSTALL_DIR
    make -j8 install
    popd
    
  5. MPFR

    wget --no-check-certificate https://ftp.gnu.org/gnu/mpfr/mpfr-4.1.0.tar.xz
    tar -xf mpfr-4.1.0.tar.xz
    pushd mpfr-4.1.0/
    ./configure --with-gmp=$CSG_INSTALL_DIR --prefix=$CSG_INSTALL_DIR
    make -j8 install
    popd
    
  6. CGAL

    git clone --depth 1 --branch v5.3 https://github.com/CGAL/cgal
    pushd cgal/
    cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$CSG_INSTALL_DIR
    cd build/
    make -j8 install
    popd
    
  7. PEGTL

    git clone --branch 3.2.2 https://github.com/taocpp/PEGTL
    pushd PEGTL/
    cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$CSG_INSTALL_DIR
    cd build/
    make -j8 install
    popd
    
  8. CSG EB library (gmake)

    For the gmake install instructions, you need to install libcsgeb to $CSG_LIB_DIR using either cmake or gmake:

    cd subprojects/csg-eb
    
    module load boost/1.77.0_gnu9.3
    
    export Boost_INCLUDE_DIR="-I/nfs/apps/Libraries/Boost/1.77.0/gnu/9.3.0/openmpi/4.0.4/include"
    export CSG_DIR=$CSG_INSTALL_DIR
    export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$CSG_DIR
    
    cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$CSG_LIB_DIR \
                        -DCMAKE_BUILD_TYPE=Release
    
    cd build
    make -j8 install
    
  9. Conduit

    git clone --recursive https://github.com/LLNL/conduit.git
    pushd conduit/
    git checkout v0.8.6
    mkdir build && cd build
    cmake -S ../src -DCMAKE_INSTALL_PREFIX=$ASCENT_INSTALL_DIR \
          -DENABLE_OPENMP=OFF \
          -DENABLE_MPI=ON \
          -DENABLE_CUDA=OFF \
          -DCMAKE_BUILD_TYPE=Release
    make -j8 install
    popd
    
  10. Vtk-m

    git clone --branch master https://gitlab.kitware.com/vtk/vtk-m.git
    pushd vtk-m/
    git checkout v1.9.0
    mkdir build && cd build/
    cmake -S ../ -DCMAKE_INSTALL_PREFIX=$ASCENT_INSTALL_DIR \
          -DVTKm_ENABLE_OPENMP=OFF \
          -DVTKm_ENABLE_MPI=ON \
          -DVTKm_ENABLE_CUDA=OFF \
          -DVTKm_USE_64BIT_IDS=OFF \
          -DVTKm_USE_DOUBLE_PRECISION=ON \
          -DVTKm_USE_DEFAULT_TYPES_FOR_ASCENT=ON \
          -DVTKm_NO_DEPRECATED_VIRTUAL=ON \
          -DCMAKE_BUILD_TYPE=Release
    make -j8 install
    popd
    
  11. Ascent

    git clone --recursive https://github.com/Alpine-DAV/ascent.git
    pushd ascent
    git checkout v0.9.0
    mkdir build && cd build/
    cmake -S ../src -DCMAKE_INSTALL_PREFIX=$ASCENT_INSTALL_DIR \
          -DCONDUIT_DIR=$ASCENT_INSTALL_DIR \
          -DVTKM_DIR=$ASCENT_INSTALL_DIR \
          -DENABLE_VTKH=ON \
          -DENABLE_FORTRAN=OFF \
          -DENABLE_PYTHON=OFF \
          -DENABLE_DOCS=OFF \
          -DBUILD_SHARED_LIBS=ON \
          -DCMAKE_BUILD_TYPE=Release \
          -DENABLE_GTEST=OFF \
          -DENABLE_TESTS=OFF
    make -j8 install
    popd
    

运行作业

常用的 Slurm 命令:

  • sinfo 查看可用/已分配的资源

  • sbatch runit_cpu.sh 提交一个 CPU 作业到队列

  • squeue -u USER 查看用户 USER 的作业状态

  • squeue -p PARTITION 查看分区 PARTITION 的作业状态

  • scancel JOBID 终止 ID 为 JOBID 的作业

  • salloc -N 1 -p gpu 交互式获取一个 GPU 节点(最长 48 小时)

  • salloc -N 2 -p dev -q dev 获取两个开发节点(最长 2 小时)

示例运行脚本:

#!/bin/bash -l

##账户信息
#SBATCH --partition=general  #bigmem, dev
#SBATCH --qos=normal         #long, dev

##提交信息
#SBATCH --nodes=1
#SBATCH --job-name="mfix-exa-run"
#SBATCH --output=job.out
#SBATCH [email protected]
#SBATCH --mail-type=ALL

##加载模块
module purge
module load gnu/9.3.0
module load openmpi/4.0.4_gnu9.3

##运行程序
mpirun -np 36 ./mfix inputs > screen.txt