📌  相关文章
📜  sbatch (1)

📅  最后修改于: 2023-12-03 15:19:56.076000             🧑  作者: Mango

Introduction to sbatch

sbatch is a command-line tool used to submit batch jobs to a cluster with a Slurm workload manager. It is a powerful and flexible tool for managing and executing large-scale computing jobs.

What is sbatch used for?
  • Submitting jobs to a cluster
  • Managing job priorities
  • Specifying job dependencies
  • Setting environmental variables
  • Redirecting standard output/error
  • Requesting resources such as nodes, cores, and memory
How does sbatch work?

The basic workflow of using sbatch involves writing a job script that describes the computation you want to run, and then submitting this script to the cluster. The script can be written in any language that can be executed on the cluster, such as Python or R.

Here is an example of a simple job script:

#!/bin/bash
#SBATCH --job-name=myjob
#SBATCH --output=job.out
#SBATCH --error=job.err
#SBATCH --time=01:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=1

echo "Hello, world!"

This script requests a single node and a single task, sets the job name to "myjob", and specifies an output file for standard output and an error file for standard error. It also sets a time limit of 1 hour.

To submit this job script, simply run:

sbatch job.sh

This will submit the job to the cluster, and you can monitor its progress with the squeue command.

Conclusion

sbatch is a versatile tool for managing and submitting large-scale computing jobs to a cluster. With its many options and capabilities, it provides a powerful framework for running complex computations on a cluster.