Using the qsub Command (with examples)
- Linux
- November 5, 2023
Use case 1: Submit a script with default settings
qsub script.sh
Motivation
In this use case, the script.sh
file is submitted to the TORQUE queue management system without any specific settings. This is useful when the script doesn’t require any specific resource allocation or runtime limits.
Explanation
The qsub
command is used to submit a script to the queue management system TORQUE. By simply providing the name of the script file as an argument, the command will submit the script with default settings, which depend on the TORQUE configuration.
Example Output
The script will be added to the TORQUE queue and will start executing based on the availability of resources and the order in which it was submitted.
Use case 2: Submit a script with a specified wallclock runtime limit
qsub -l walltime=1:2:3 script.sh
Motivation
When executing long-running scripts, it is important to set a limit on the maximum runtime. This prevents scripts from running indefinitely and helps manage resource allocation effectively.
Explanation
The -l
option is used to specify resource limits for a job submission. In this case, walltime=1:2:3
sets the maximum runtime limit for the script to 1 hour, 2 minutes, and 3 seconds.
Example Output
The script will be added to the TORQUE queue and will start executing. However, if the script runs for more than 1 hour, 2 minutes, and 3 seconds, it will be terminated.
Use case 3: Submit a script executed on multiple nodes with specified cores per node
qsub -l nodes=2:ppn=4 script.sh
Motivation
Some scripts require parallel execution on multiple nodes with a set number of cores on each node. This allows for increased computing power and faster execution of tasks.
Explanation
The -l nodes=2:ppn=4
option specifies that the script should be executed on 2 nodes, and each node should have 4 cores allocated for the script execution.
Example Output
The script will be added to the TORQUE queue and will start executing on the allocated nodes. Each node will have 4 cores available for executing tasks in parallel.
Use case 4: Submit a script to a specific queue
qsub -q queue_name script.sh
Motivation
TORQUE allows the creation of different queues, each with its own configuration and resource limits. This allows for better management of jobs and provides flexibility in assigning appropriate resources for specific types of scripts.
Explanation
The -q
option is used to specify the name of the queue to which the script should be submitted. This allows the script to be processed based on the configuration and priority of that specific queue.
Example Output
The script will be added to the specified queue and will start executing based on the availability of resources and the order in which it was submitted. The runtime and other resource limits will be based on the configuration of that specific queue.
By understanding these different use cases of the qsub
command, you can effectively submit scripts to the TORQUE queue management system with specific resource allocation and runtime limits. This helps optimize the usage of computing resources and ensures efficient execution of scripts.