How to use the command 'qsub' (with examples)

How to use the command 'qsub' (with examples)

The qsub command is pivotal for those working with resource management systems like TORQUE. It enables users to submit shell scripts to a queue management system, allowing for efficient job scheduling and execution on shared computational resources. In environments where computational power is shared among many users, ensuring that jobs are properly queued and scheduled is crucial. The qsub command provides various options for tailoring job submission to specific needs, such as setting resource limits, defining the number of nodes and cores, and specifying different queues.

Use case 1: Submit a script with default settings

Code:

qsub script.sh

Motivation:
Submitting a script with default settings is often the first step for newcomers to TORQUE or for tasks with unspecified resource requirements. This straightforward command leverages the default configurations established by the system administrator, simplifying the submission process for quick or small-scale tasks.

Explanation:

  • qsub: The command used for submitting jobs to the TORQUE queue system.
  • script.sh: This specifies the shell script you want to execute. By not specifying additional options, you accept whatever default settings the queue system has in place.

Example output:
Upon successful submission, the terminal might respond with something like:

12345.server_name

This response gives you the job ID (12345) and the server name, which you can use to monitor the job’s status.

Use case 2: Submit a script with a specified wallclock runtime limit

Code:

qsub -l walltime=1:2:3 script.sh

Motivation:
In computational tasks where precise timing is critical or where resources should be freed after a set period, specifying a wallclock runtime limit ensures that jobs do not exceed their intended execution time. This benefits both users and administrators by preventing resource hogging and improving overall system efficiency.

Explanation:

  • -l: This flag is used to indicate a resource request.
  • walltime=1:2:3: Defines the maximum time that the script is allowed to run, in an hour-minute-second format (1 hour, 2 minutes, and 3 seconds). TORQUE will terminate the job if it surpasses this duration.
  • script.sh: The script you are submitting for execution.

Example output:
After submission, you receive a job ID, similar to:

12346.server_name

This confirms that the script has been queued with the specified walltime constraint.

Use case 3: Submit a script executed on multiple nodes

Code:

qsub -l nodes=2:ppn=4 script.sh

Motivation:
Resource-intensive programs, such as simulations or large-scale data analyses, often require more than one node or multiple processing cores. By allocating resources explicitly, this command enhances the script’s performance, enabling faster completion times and optimized resource usage.

Explanation:

  • -l: Specifies a request for system resources.
  • nodes=2: Requests the script to be executed using two nodes.
  • ppn=4: Refers to processors per node, indicating the script should utilize 4 cores on each requested node.
  • script.sh: The shell script intended for execution with these specific resource allocations.

Example output:
After running the command, you should see:

12347.server_name

This indicates successful submission, and you have reserved the requested nodes and cores for your job.

Use case 4: Submit a script to a specific queue

Code:

qsub -q queue_name script.sh

Motivation:
Submitting to a particular queue is beneficial when working in environments with varying queue configurations. Certain queues may prioritize different job types or have different resource limits. This allows users more control over how their job is processed and can expedite execution under specific circumstances.

Explanation:

  • -q: This flag specifies the name of the queue you wish to submit the job to.
  • queue_name: Designated queue that may have specific policies or resource configurations tailored for different job requirements.
  • script.sh: The script you are looking to submit.

Example output:
A typical output after submission might be:

12348.queue_name@server_name

This notation acknowledges the job’s acceptance into the selected queue with the allotted resources.

Conclusion:

The qsub command is an integral tool within the TORQUE resource management system, offering substantial flexibility and control over job submissions. Whether needing to adhere to default settings, manage runtime with precision, allocate complex resource configurations, or select specific execution queues, qsub facilitates streamlined operations within shared computational environments. Through these examples, users can grasp the command’s fundamental capabilities to maximize efficiency and effectiveness in their computational tasks.

Tags :

Related Posts

How to use the command 'docker diff' (with examples)

How to use the command 'docker diff' (with examples)

Docker is a platform that enables developers to build, ship, and run applications inside containers, which are lightweight, portable units of software.

Read More
How to Use the Command 'sntpd' (with Examples)

How to Use the Command 'sntpd' (with Examples)

The sntpd command is an SNTP (Simple Network Time Protocol) server that synchronizes the local system clock with a remote server.

Read More
How to use the command `select` (with examples)

How to use the command `select` (with examples)

The select command is a bash built-in construct that can be used to create menus in a shell script.

Read More