so what do those job contracts look like?
- User
so what do those job contracts look like?
Assistant
Okay, let's look at examples of job contracts (job submission scripts) for a couple of common schedulers: Slurm and PBS Pro. These are text files, and you'd create them using a text editor on the login node. I'll explain the key parts.
1. Slurm Script (Example:
my_simulation.slurm)#!/bin/bash #SBATCH --job-name=my_simulation #SBATCH --nodes=10 # Request 10 compute nodes #SBATCH --ntasks-per-node=32 # Request 32 tasks (cores) per node #SBATCH --cpus-per-task=1 # Each task uses 1 CPU core #SBATCH --mem=128GB # Request 128 GB of memory per node #SBATCH --time=01:30:00 # Request a walltime of 1 hour 30 minutes #SBATCH --output=my_sim.out # Redirect standard output to this file #SBATCH --error=my_sim.err # Redirect standard error to this file #SBATCH --partition=compute # Specify the partition (queue) to use # Load any necessary modules (software environment) module load intel/2023 module load mpi/openmpi/4.1.4 # Run your program mpirun -np ${SLURM_NTASKS} ./my_simulation_programExplanation of Slurm Directives (lines starting with
#SBATCH):#!/bin/bash: Shebang line – tells the system to use bash to interpret the script.#SBATCH --job-name=my_simulation: A descriptive name for your job.#SBATCH --nodes=10: Requests 10 compute nodes.#SBATCH --ntasks-per-node=32: Requests 32 tasks (usually corresponding to cores) per node. This means 32 parallel processes will run on each node.#SBATCH --cpus-per-task=1: Specifies how many CPUs each task will use.#SBATCH --mem=128GB: Requests 128 GB of memory per node.#SBATCH --time=01:30:00: Sets a maximum runtime (walltime) of 1 hour and 30 minutes. If your job exceeds this time, it will be killed.#SBATCH --output=my_sim.out: Redirects the standard output (what your program prints to the screen) to a file namedmy_sim.out.#SBATCH --error=my_sim.err: Redirects the standard error (error messages) to a file namedmy_sim.err.#SBATCH --partition=compute: Specifies the queue (partition) to submit the job to. Different partitions might have different resource limits or priorities.module load ...: Loads specific software modules (compilers, libraries, etc.) to set up the environment your program needs.mpirun -np ${SLURM_NTASKS} ./my_simulation_program: This is the command that actually runs your program.mpirunis a common command for launching parallel MPI programs.${SLURM_NTASKS}is an environment variable set by Slurm that tellsmpirunhow many total tasks to launch (nodes * ntasks-per-node).
2. PBS Pro Script (Example:
my_simulation.pbs)#!/bin/bash #PBS -N my_simulation #PBS -l nodes=10:ppn=32 #PBS -l mem=128GB #PBS -l walltime=01:30:00 #PBS -o my_sim.out #PBS -e my_sim.err #PBS -q compute # Load any necessary modules module load intel/2023 module load mpi/openmpi/4.1.4 # Run your program mpirun -np ${PBS_NUM_PPN} ./my_simulation_programExplanation of PBS Pro Directives (lines starting with
#PBS):#!/bin/bash: Same as Slurm.#PBS -N my_simulation: Job name.#PBS -l nodes=10:ppn=32: Requests 10 nodes, with 32 processes per node (ppnstands for "processes per node").#PBS -l mem=128GB: Requests 128 GB of memory.#PBS -l walltime=01:30:00: Sets the walltime limit.#PBS -o my_sim.out: Redirects standard output.#PBS -e my_sim.err: Redirects standard error.#PBS -q compute: Specifies the queue.module load ...: Loads software modules.mpirun -np ${PBS_NUM_PPN} ./my_simulation_program: Runs the program.${PBS_NUM_PPN}is an environment variable set by PBS Pro that contains the number of processes per node.
Key Differences & Commonalities:
- Syntax: The directives are different (
#SBATCHvs.#PBS -). - Resource Specification: The way you specify the number of nodes and cores differs slightly.
- Environment Variables: The environment variables used to get the number of tasks/processes are different (
SLURM_NTASKSvs.PBS_NUM_PPN). - Core Concept: Both scripts achieve the same goal: they tell the scheduler what resources you need and how to run your program.
Submitting the Job:
Once you've created the script, you submit it using a command like:
- Slurm:
sbatch my_simulation.slurm - PBS Pro:
qsub my_simulation.pbs
These are simplified examples. Job scripts can become much more complex, with options for specifying input/output file locations, dependencies between jobs, and more. The specific options available will depend on the supercomputer's configuration and the version of the scheduler it's using. You'll usually find detailed documentation on the center's website.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.