|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +<%namespace name="helpers" file="helpers.mako"/> |
| 4 | + |
| 5 | +% if engine == 'batch': |
| 6 | +#SBATCH --uenv=icon/25.2:v1 |
| 7 | +#SBATCH --nodes=${nodes} |
| 8 | +#SBATCH --reservation=g183 |
| 9 | +#SBATCH --ntasks-per-node=${tasks_per_node} |
| 10 | +#SBATCH --job-name="${name}" |
| 11 | +#SBATCH --output="${name}.out" |
| 12 | +#SBATCH --error="${name}.err" |
| 13 | +#SBATCH --time=${walltime} |
| 14 | +% if account: |
| 15 | +#SBATCH --account=${account} |
| 16 | +% endif |
| 17 | +% if partition: |
| 18 | +#SBATCH --partition=${partition} |
| 19 | +% endif |
| 20 | +% if quality_of_service: |
| 21 | +#SBATCH --qos=${quality_of_service} |
| 22 | +% endif |
| 23 | +% if email: |
| 24 | +#SBATCH --mail-user=${email} |
| 25 | +#SBATCH --mail-type="BEGIN, END, FAIL" |
| 26 | +% endif |
| 27 | +% endif |
| 28 | + |
| 29 | +# NVHPC and CUDA env vars |
| 30 | +export NV_ACC_USE_MALLOC=0 # use cudaMallocManaged instead of malloc ( compiled using -gpu=mem:unified ) |
| 31 | +export NVCOMPILER_ACC_NO_MEMHINTS=1 # disable implicit compiler hints |
| 32 | +#export CUDA_BUFFER_PAGE_IN_THRESHOLD_MS=0.001 # workaround for copying to/from unpopulated buffers on GH |
| 33 | + |
| 34 | +# Cray MPICH |
| 35 | +export MPICH_GPU_SUPPORT_ENABLED=1 |
| 36 | +export FI_CXI_RX_MATCH_MODE=software |
| 37 | +export FI_MR_CACHE_MONITOR=disabled |
| 38 | +export MPICH_NO_BUFFER_ALIAS_CHECK=1 |
| 39 | + |
| 40 | +# CUSTOM env vars to MFC |
| 41 | +export NVIDIA_ALLOC_MODE=0 # do nothing |
| 42 | +export NVIDIA_MANUAL_GPU_HINTS=1 # prefloc GPU on some |
| 43 | +export NVIDIA_IGR_TEMPS_ON_GPU=3 # jac, jac_rhs, and jac_old on GPU |
| 44 | +export NVIDIA_VARS_ON_GPU=7 # q_cons_ts(1)%vf%sf for j=1-7 on GPU |
| 45 | + |
| 46 | +# NSYS |
| 47 | +export NSYS=1 # enable nsys profiling |
| 48 | +export NSYS_FILE=myreport.qdrep |
| 49 | + |
| 50 | +${helpers.template_prologue()} |
| 51 | + |
| 52 | +ok ":) Loading modules:\n" |
| 53 | +cd "${MFC_ROOT_DIR}" |
| 54 | +% if engine == 'batch': |
| 55 | +. ./mfc.sh load -c san -m ${'g' if gpu else 'c'} |
| 56 | +% endif |
| 57 | +cd - > /dev/null |
| 58 | +echo |
| 59 | + |
| 60 | +% for target in targets: |
| 61 | + ${helpers.run_prologue(target)} |
| 62 | + |
| 63 | + % if not mpi: |
| 64 | + (set -x; ${profiler} "${target.get_install_binpath(case)}") |
| 65 | + % else: |
| 66 | + (set -x; srun --unbuffered \ |
| 67 | + --ntasks=${nodes*tasks_per_node} \ |
| 68 | + --cpus-per-task 1 \ |
| 69 | + --cpu-bind=none \ |
| 70 | + % if gpu: |
| 71 | + --gpus-per-task 1 \ |
| 72 | + % endif |
| 73 | + --wait 200 --bcast=/tmp/${target.name} \ |
| 74 | + "${target.get_home_dirpath(case)}/misc/nvidia_uvm/bind.sh" \ |
| 75 | + % if target.name == 'simulation': |
| 76 | + "${target.get_home_dirpath(case)}/misc/nvidia_uvm/nsys.sh" \ |
| 77 | + % endif |
| 78 | + "${target.get_install_binpath(case)}") |
| 79 | + % endif |
| 80 | + |
| 81 | + ${helpers.run_epilogue(target)} |
| 82 | + |
| 83 | + echo |
| 84 | +% endfor |
| 85 | + |
| 86 | +${helpers.template_epilogue()} |
0 commit comments