Skip to content

8.2 One node resources scratch and a safe Slurm launch

These are unexecuted teaching inputs and starting models. Original diagrams are schematics, not calculated results. Validate version-specific syntax, licensed or authorized data, numerical convergence and the scientific model before using this workflow.

8.2.1 Model, units and provenance

Geometry in Å; electronic energy in hartree; vibrational wavenumbers in cm⁻¹. Check each printed field and keep thermal and standard-state terms distinct.

Shared inputs, conventions and evidence

Original schematic: One node resources scratch and a safe Slurm launch. No numerical results are claimed.
Original schematic: One node resources scratch and a safe Slurm launch. No numerical results are claimed.

8.2.2 Unexecuted inputs and explicit deltas

Use the accompanying instructions to identify the parent calculation and placement of every delta; a snippet is not automatically a standalone input. Preserve all blank-line and file-provenance requirements.

8.2.2.1 Input block 1

#!/bin/bash
#SBATCH --job-name=g30-water
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=6G
#SBATCH --time=00:30:00
#SBATCH --output=g30-slurm-%j.out
#SBATCH --error=g30-slurm-%j.err
set -euo pipefail
module load Gaussian/g16
cd "$SLURM_SUBMIT_DIR"
base="${SLURM_TMPDIR:-${TMPDIR:-/tmp}}"
export GAUSS_SCRDIR
GAUSS_SCRDIR=$(mktemp -d "$base/g30-${SLURM_JOB_ID}-XXXXXX")
printf 'Scratch: %s\n' "$GAUSS_SCRDIR"
printf 'Started UTC: '; date -u
set +e
g16 < g30_water.com > "g30_water-${SLURM_JOB_ID}.log" 2>&1
status=$?
set -e
printf 'Gaussian exit code: %s\n' "$status"
printf 'Ended UTC: '; date -u
printf 'Scratch retained at %s until site cleanup\n' "$GAUSS_SCRDIR"
exit "$status"

8.2.3 Worked investigation

8.2.3.1 Intuition and prerequisites

A calculation consumes resources through two contracts: the scheduler reserves them, and Gaussian decides how to use them. Those contracts must agree. This example reserves one node and four shared-memory CPUs, gives Gaussian 4 GB inside a larger 6 GB allocation, and creates a job-specific scratch directory. The numbers are a teaching starting point, not a memory predictor. You need a cluster that uses Slurm, an authorized Gaussian module, and your administrator's local instructions. Multi-node Linda and GPU configurations are outside this basic script; adding mpirun does not turn a shared-memory executable into a distributed one.

8.2.3.2 Original batch template

Before using the script, replace the module name with the exact local value and ensure the input uses %nprocshared=4, %mem=4GB, and %chk=g30_water.chk.

See input block 1 above.

Derive g30_water.com from case 08 with the stated resource and checkpoint changes. The script intentionally leaves scratch rather than automatically deleting potentially useful failed-job data. Site-managed node scratch may disappear after the job, so retaining the path is not a durable backup. Large restart-critical scratch files require a separate, tested staging policy with sufficient persistent storage; do not promise that this minimal script preserves them.

8.2.3.3 Workflow

  1. Confirm module spelling, local scratch policy, memory accounting, and whether the site wraps g16. Adapt the launcher before submission.
  2. Match scheduler CPUs to %nprocshared. Keep application memory below total allocated memory by a locally appropriate margin.
  3. Run a short single-point smoke test before a long optimization. Check that logs/checkpoints go to persistent storage.
  4. Submit with sbatch, record the job ID, and inspect scheduler state without launching a duplicate while the first job remains active.
  5. After exit, examine both return status and scientific completion. A zero launcher exit code is insufficient if a linked job failed or the intended task never ran.
  6. Use scheduler accounting to compare requested and used memory/time before scaling.

8.2.3.4 Interpret check and limits

%mem is not multiplied by the core count. Oversubscribed cores can slow work and violate cluster policy. Scratch exhaustion may look like an electronic-structure error late in the log; inspect filesystem usage and scheduler messages. Shell traps cannot rescue files after all hard kills, node failures, or automatic cleanup. If benchmarking CPU counts, compare wall time and total core-hours for the same converged task; more cores are not always cheaper or faster. Never report an estimated classroom runtime as a measured result.

Exercise Modify the resource plan for eight CPUs while keeping total scheduler memory fixed. Explain why changing %mem to eight times its old value would be wrong.

8.2.5 Sources and further reading