All Products
Search
Document Center

Use the CLI to create and submit a job

Last Updated: Sep 03, 2021

Elastic High Performance Computing (E-HPC) supports the following job scheduling systems: PBS, Slurm, and Oracle Grid Engine. This topic describes how to use CLI to create and submit a job based on these scheduling systems.

Prerequisites

  • A user is created. For more information, see Create a user.

    Note

    We recommend that you do not use a root account to create and submit jobs. This prevents cluster data from being damaged due to job script misoperations.

  • Job files are stored in the $HOME directory of the current user.

Background information

In this topic, CLI is used to create and submit a job based on PBS, Slurm, and Oracle Grid Engine. Sample job file path:

$HOME/test.py           # The job execution program
$HOME/test.data         # The data about the job

Sample job execution command:

test.py -i test.data

Procedure

  1. Remotely log on to the cluster by using an SSH client. For more information, see Log on to a cluster.

  2. Select a scheduler to run the job execution command based on your needs.

    • PBS

      The following example shows how to create and submit a job by using PBS. For more information, visit the PBS official website.

      $ cat > test.pbs
      #!/bin/sh
      # PBS -l ncpus=4,mem=1 gb   # The expected computing resources consumed for the job. In this example, 4 vCPUs and 1 GB of memory are expected. 
      # PBS -l walltime=00:10:00     # The expected running time of the job. In this example, 10 minutes is expected. 
      # PBS -o test_pbs.log              # The output file of stdout.       
      # PBS -j oe                              # Redirects stderr and stdout to the preceding output file. 
      cd $HOME
      test.py -i test.data
      $ qsub test.pbs
    • SLURM

      The following example shows how to create and submit a job by using Slurm. For more information, visit the Slurm official website.

      For information about high-performance computing examples of SLURM, see Use LAMMPS to perform high-performance computing and Use WRF to perform high-performance computing.

      $ cat > test.slurm
      #!/bin/sh
      # SBATCH --job-name=slurm-quickstart   # The name of the job. In this example, slurm-quickstart is the job name.
      # SBATCH --output=test_slurm.log           # The output file of stdout. 
      # SBATCH --nodes=1                                 # The number of nodes. 
      # SBATCH --ntasks=1                                 # The number of tasks. 
      # SBATCH --cpus-per-task=1                     # The number of CPUs required for each task. 
      # SBATCH --time=00:10:00                        # The expected running time of the job. In this example, 10 minutes is expected. 
      # SBATCH --mem-per-cpu=1024              # The memory allocated by each CPU. 
      cd $HOME
      test.py test.data
      $ sbatch test.slurm
    • Oracle Grid Engine

      The following example shows how to create and submit a job by using Oracle Grid Engine. For more information, visit the Oracle Grid Engine official website.

      qsub -V -b y -cwd hostname
      qsub -V jobscript.sh