Submit Compute Jobs
Before submitting a job, please understand two concepts: interactive jobs and batch jobs.
As the name implies, an interactive job allows users to interact with the job in real time while it runs. This type of job is similar to a remote session that logs directly into a compute node, where you can enter commands, view output, debug programs, and so on while the job is running. A batch job runs in the background and does not require real-time user interaction. Users write all instructions in a script file in advance and submit that script to run automatically on the specified resources.
Submit an Interactive Job
Example:
srun --ntasks=1 --cpus-per-task=4 --mem=4G --time=01:00:00 --pty bash
This command requests 1 task, 4 CPUs, 4 GB memory, 1 hour of runtime, and starts an interactive bash shell.
Submit a Batch Job
Example:
Suppose there is a batch script named job_script.sh with the following content:
#!/bin/bash
#SBATCH --job-name=example_job
#SBATCH --output=output.txt
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=4G
#SBATCH --time=01:00:00
module load my_software
srun my_program arg1 arg2
You can submit the job with the following command:
sbatch job_script.sh
Fsched will automatically schedule the job when resources are available and save the output to the output.txt file.