Skip to content
Snippets Groups Projects
job-submission-and-execution.md 24.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Hrbáč's avatar
    David Hrbáč committed
    # Job Submission and Execution
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ## Job Submission
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    When allocating computational resources for the job, specify:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    1. a suitable queue for your job (the default is qprod)
    1. the number of computational nodes required
    1. the number of cores per node required
    1. the maximum wall time allocated to your calculation, note that jobs exceeding the maximum wall time will be killed
    1. your Project ID
    1. a Jobscript or interactive switch
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
        Use the **qsub** command to submit your job to a queue for allocation of computational resources.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Submit the job using the qsub command:
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -A Project_ID -q queue -l select=x:ncpus=y,walltime=[[hh:]mm:]ss[.ms] jobscript
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The qsub command submits the job to the queue, i.e. the qsub command creates a request to the PBS Job manager for allocation of specified resources. The resources will be allocated when available, subject to the above described policies and constraints. **After the resources are allocated, the jobscript or interactive shell is executed on the first of the allocated nodes.**
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
        PBS statement nodes (qsub -l nodes=nodespec) are not supported on the Anselm cluster.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ### Job Submission Examples
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        Anselm ... ncpus=16, Salomon ... ncpus=24, Barbora ... ncpus=36 orc ncpus=24 for accelerate node
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -A OPEN-0-0 -q qprod -l select=64:ncpus=16,walltime=03:00:00 ./myjob
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, we allocate 64 nodes, 16 cores per node, for 3 hours. We allocate these resources via the qprod queue, consumed resources will be accounted to the Project identified by Project ID OPEN-0-0. The jobscript 'myjob' will be executed on the first node in the allocation.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -q qexp -l select=4:ncpus=16 -I
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, we allocate 4 nodes, 16 cores per node, for 1 hour. We allocate these resources via the qexp queue. The resources will be available interactively.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -A OPEN-0-0 -q qnvidia -l select=10:ncpus=16 ./myjob
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, we allocate 10 nvidia accelerated nodes, 16 cores per node, for 24 hours. We allocate these resources via the qnvidia queue. the jobscript 'myjob' will be executed on the first node in the allocation.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -A OPEN-0-0 -q qfree -l select=10:ncpus=16 ./myjob
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, we allocate 10 nodes, 16 cores per node, for 12 hours. We allocate these resources via the qfree queue. It is not required that the project OPEN-0-0 has any available resources left. Consumed resources are still accounted for. The jobscript myjob will be executed on the first node in the allocation.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    All qsub options may be [saved directly into the jobscript][1]. In such cases, it is not necessary to specify any options for qsub.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub ./myjob
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    By default, the PBS batch system sends an e-mail only when the job is aborted. Disabling mail events completely can be done as follows:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -m n
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ### Salomon - Intel Xeon Phi Co-Processors
    
    To allocate a node with Xeon Phi co-processor, user needs to specify that in select statement. Currently only allocation of whole nodes with both Phi cards as the smallest chunk is supported. Standard PBSPro approach through attributes "accelerator", "naccelerators" and "accelerator_model" is used. The "accelerator_model" can be omitted, since on Salomon only one type of accelerator type/model is available.
    The absence of specialized queue for accessing the nodes with cards means, that the Phi cards can be utilized in any queue, including qexp for testing/experiments, qlong for longer jobs, qfree after the project resources have been spent, etc. The Phi cards are thus also available to PRACE users. There's no need to ask for permission to utilize the Phi cards in project proposals.
    
    ```console
    $ qsub  -A OPEN-0-0 -I -q qprod -l select=1:ncpus=24:accelerator=True:naccelerators=2:accelerator_model=phi7120 ./myjob
    ```
    
    In this example, we allocate 1 node, with 24 cores, with 2 Xeon Phi 7120p cards, running batch job ./myjob. The default time for qprod is used, e. g. 24 hours.
    
    ```console
    $ qsub  -A OPEN-0-0 -I -q qlong -l select=4:ncpus=24:accelerator=True:naccelerators=2 -l walltime=56:00:00 -I
    ```
    
    In this example, we allocate 4 nodes, with 24 cores per node (totalling 96 cores), with 2 Xeon Phi 7120p cards per node (totalling 8 Phi cards), running interactive job for 56 hours. The accelerator model name was omitted.
    
    #### Salomon - Intel Xeon Phi - Queue QMIC
    
    Examples executions
    
    ```console
    -l select=1
    exec_vnode = (r21u05n581-mic0:naccelerators=1:ncpus=0)
    -l select=4
    (r21u05n581-mic0:naccelerators=1:ncpus=0)+(r21u05n581-mic1:naccelerators=1:ncpus=0)+(r21u06n582-mic0:naccelerators=1:ncpus=0)+(r21u06n582-mic1:naccelerators=1:ncpus=0)
    -l select=4:naccelerators=1
    (r21u05n581-mic0:naccelerators=1:ncpus=0)+(r21u05n581-mic1:naccelerators=1:ncpus=0)+(r21u06n582-mic0:naccelerators=1:ncpus=0)+(r21u06n582-mic1:naccelerators=1:ncpus=0)
    -l select=1:naccelerators=2
    (r21u05n581-mic0:naccelerators=1+r21u05n581-mic1:naccelerators=1)
    -l select=2:naccelerators=2
    (r21u05n581-mic0:naccelerators=1+r21u05n581-mic1:naccelerators=1)+(r21u06n582-mic0:naccelerators=1+r21u06n582-mic1:naccelerators=1)
    -l select=1:ncpus=24:naccelerators=2
    (r22u32n610:ncpus=24+r22u32n610-mic0:naccelerators=1+r22u32n610-mic1:naccelerators=1)
    -l select=1:ncpus=24:naccelerators=0+4
    (r33u17n878:ncpus=24:naccelerators=0)+(r33u13n874-mic0:naccelerators=1:ncpus=0)+(r33u13n874-mic1:naccelerators=1:ncpus=0)+(r33u16n877-mic0:naccelerators=1:ncpus=0)+(r33u16n877-mic1:naccelerators=1:ncpus=0)
    ```
    
    ### Salomon - UV2000 SMP
    
    !!! note
        13 NUMA nodes available on UV2000
        Per NUMA node allocation.
        Jobs are isolated by cpusets.
    
    The UV2000 (node uv1) offers 3TB of RAM and 104 cores, distributed in 13 NUMA nodes. A NUMA node packs 8 cores and approx. 247GB RAM (with exception, node 11 has only 123GB RAM). In the PBS the UV2000 provides 13 chunks, a chunk per NUMA node (see [Resource allocation policy][1]). The jobs on UV2000 are isolated from each other by cpusets, so that a job by one user may not utilize CPU or memory allocated to a job by other user. Always, full chunks are allocated, a job may only use resources of the NUMA nodes allocated to itself.
    
    ```console
     $ qsub -A OPEN-0-0 -q qfat -l select=13 ./myjob
    ```
    
    In this example, we allocate all 13 NUMA nodes (corresponds to 13 chunks), 104 cores of the SGI UV2000 node for 24 hours. Jobscript myjob will be executed on the node uv1.
    
    ```console
    $ qsub -A OPEN-0-0 -q qfat -l select=1:mem=2000GB ./myjob
    ```
    
    In this example, we allocate 2000GB of memory on the UV2000 for 24 hours. By requesting 2000GB of memory, memory from 10 chunks and 8 cores are allocated. Jobscript myjob will be executed on the node uv1.
    
    ```console
    $ qsub -A OPEN-0-0 -q qfat -l select=1:mem=3099GB,walltime=48:00:00 ./myjob
    ```
    
    In this example, we allocate 3099GB of memory on the UV2000 for 48 hours. By requesting 3099GB of memory, memory from all 13 chunks and 8 cores are allocated. Jobscript myjob will be executed on the node uv1.
    
    ```console
    $ qsub -A OPEN-0-0 -q qfat -l select=2:mem=1000GB,walltime=48:00:00 ./myjob
    ```
    
    In this example, we allocate 2000GB of memory and 16 cores on the UV2000 for 48 hours. By requesting 1000GB of memory per chunk, 2000GB of memory and 16 cores are allocated. Jobscript myjob will be executed on the node uv1.
    
    ### Useful Tricks
    
    All qsub options may be [saved directly into the jobscript][2]. In such a case, no options to qsub are needed.
    
    ```console
    $ qsub ./myjob
    ```
    
    By default, the PBS batch system sends an e-mail only when the job is aborted. Disabling mail events completely can be done like this:
    
    ```console
    $ qsub -m n
    ```
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ## Advanced Job Placement
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ### Placement by Name
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Specific nodes may be allocated via the PBS
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    $ qsub -A OPEN-0-0 -q qprod -l select=1:ncpus=16:host=cn171+1:ncpus=16:host=cn172 -I
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    qsub -A OPEN-0-0 -q qprod -l select=1:ncpus=24:host=r24u35n680+1:ncpus=24:host=r24u36n681 -I
    ```
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    In this example, we allocate nodes cn171 and cn172, all 16 cores per node, for 24 hours.  Consumed resources will be accounted to the Project identified by Project ID OPEN-0-0. The resources will be available interactively.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ### Anselm - Placement by CPU Type
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Nodes equipped with an Intel Xeon E5-2665 CPU have a base clock frequency of 2.4GHz, nodes equipped with an Intel Xeon E5-2470 CPU have a base frequency of 2.3 GHz (see the section Compute Nodes for details).  Nodes may be selected via the PBS resource attribute cpu_freq .
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    #### Anselm
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    | CPU Type           | base freq. | Nodes                  | cpu_freq attribute |
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    | ------------------ | ---------- | ---------------------- | ------------------ |
    
    David Hrbáč's avatar
    David Hrbáč committed
    | Intel Xeon E5-2665 | 2.4GHz     | cn[1-180], cn[208-209] | 24                 |
    | Intel Xeon E5-2470 | 2.3GHz     | cn[181-207]            | 23                 |
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -A OPEN-0-0 -q qprod -l select=4:ncpus=16:cpu_freq=24 -I
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, we allocate 4 nodes, 16 cores per node, selecting only the nodes with Intel Xeon E5-2665 CPU.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ### Anselm - Placement by IB Switch
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    Groups of computational nodes are connected to chassis integrated Infiniband switches. These switches form the leaf switch layer of the [Infiniband network][2] fat tree topology. Nodes sharing the leaf switch can communicate most efficiently. Sharing the same switch prevents hops in the network and facilitates unbiased, highly efficient network communication.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    Nodes sharing the same switch may be selected via the PBS resource attribute ibswitch. Values of this attribute are iswXX, where XX is the switch number. The node-switch mapping can be seen in the [Hardware Overview][3] section.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    We recommend allocating compute nodes to a single switch when best possible computational network performance is required to run the job efficiently:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    $ qsub -A OPEN-0-0 -q qprod -l select=18:ncpus=16:ibswitch=isw11 ./myjob
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, we request all of the 18 nodes sharing the isw11 switch for 24 hours. a full chassis will be allocated.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ### Salomon - Placement by Network Location
    
    Network location of allocated nodes in the [InifiBand network][3] influences efficiency of network communication between nodes of job. Nodes on the same InifiBand switch communicate faster with lower latency than distant nodes. To improve communication efficiency of jobs, PBS scheduler on Salomon is configured to allocate nodes - from currently available resources - which are as close as possible in the network topology.
    
    For communication intensive jobs it is possible to set stricter requirement - to require nodes directly connected to the same InifiBand switch or to require nodes located in the same dimension group of the InifiBand network.
    
    ### Salomon - Placement by InifiBand Switch
    
    Nodes directly connected to the same InifiBand switch can communicate most efficiently. Using the same switch prevents hops in the network and provides for unbiased, most efficient network communication. There are 9 nodes directly connected to every InifiBand switch.
    
    !!! note
        We recommend allocating compute nodes of a single switch when the best possible computational network performance is required to run job efficiently.
    
    Nodes directly connected to the one InifiBand switch can be allocated using node grouping on PBS resource attribute switch.
    
    In this example, we request all 9 nodes directly connected to the same switch using node grouping placement.
    
    ```console
    $ qsub -A OPEN-0-0 -q qprod -l select=9:ncpus=24 -l place=group=switch ./myjob
    ```
    
    ### Salomon - Placement by Specific InifiBand Switch
    
    !!! note
        Not useful for ordinary computing, suitable for testing and management tasks.
    
    Nodes directly connected to the specific InifiBand switch can be selected using the PBS resource attribute _switch_.
    
    In this example, we request all 9 nodes directly connected to r4i1s0sw1 switch.
    
    ```console
    $ qsub -A OPEN-0-0 -q qprod -l select=9:ncpus=24:switch=r4i1s0sw1 ./myjob
    ```
    
    List of all InifiBand switches:
    
    ```console
    $ qmgr -c 'print node @a' | grep switch | awk '{print $6}' | sort -u
    r1i0s0sw0
    r1i0s0sw1
    r1i1s0sw0
    r1i1s0sw1
    r1i2s0sw0
    ...
    ```
    
    List of all all nodes directly connected to the specific InifiBand switch:
    
    ```console
    $ qmgr -c 'p n @d' | grep 'switch = r36sw3' | awk '{print $3}' | sort
    r36u31n964
    r36u32n965
    r36u33n966
    r36u34n967
    r36u35n968
    r36u36n969
    r37u32n970
    r37u33n971
    r37u34n972
    ```
    
    ### Salomon - Placement by Hypercube Dimension
    
    Nodes located in the same dimension group may be allocated using node grouping on PBS resource attribute ehc\_[1-7]d .
    
    | Hypercube dimension | node_group_key | #nodes per group |
    | ------------------- | -------------- | ---------------- |
    | 1D                  | ehc_1d         | 18               |
    | 2D                  | ehc_2d         | 36               |
    | 3D                  | ehc_3d         | 72               |
    | 4D                  | ehc_4d         | 144              |
    | 5D                  | ehc_5d         | 144,288          |
    | 6D                  | ehc_6d         | 432,576          |
    | 7D                  | ehc_7d         | all              |
    
    In this example, we allocate 16 nodes in the same [hypercube dimension][4] 1 group.
    
    ```console
    $ qsub -A OPEN-0-0 -q qprod -l select=16:ncpus=24 -l place=group=ehc_1d -I
    ```
    
    For better understanding:
    
    List of all groups in dimension 1:
    
    ```console
    $ qmgr -c 'p n @d' | grep ehc_1d | awk '{print $6}' | sort |uniq -c
         18 r1i0
         18 r1i1
         18 r1i2
         18 r1i3
    ...
    ```
    
    List of all all nodes in specific dimension 1 group:
    
    ```console
    $ $ qmgr -c 'p n @d' | grep 'ehc_1d = r1i0' | awk '{print $3}' | sort
    r1i0n0
    r1i0n1
    r1i0n10
    r1i0n11
    ...
    ```
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ## Advanced Job Handling
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ### Selecting Turbo Boost Off
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    Intel Turbo Boost Technology is on by default. We strongly recommend keeping the default.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    If necessary (such as in the case of benchmarking) you can disable the Turbo for all nodes of the job by using the PBS resource attribute cpu_turbo_boost:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    $ qsub -A OPEN-0-0 -q qprod -l select=4:ncpus=16 -l cpu_turbo_boost=0 -I
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    More information about the Intel Turbo Boost can be found in the TurboBoost section
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    ### Advanced Examples
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In the following example, we select an allocation for benchmarking a very special and demanding MPI program. We request Turbo off, and 2 full chassis of compute nodes (nodes sharing the same IB switches) for 30 minutes:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    $ qsub -A OPEN-0-0 -q qprod
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        -l select=18:ncpus=16:ibswitch=isw10:mpiprocs=1:ompthreads=16+18:ncpus=16:ibswitch=isw20:mpiprocs=16:ompthreads=1
        -l cpu_turbo_boost=0,walltime=00:30:00
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        -N Benchmark ./mybenchmark
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The MPI processes will be distributed differently on the nodes connected to the two switches. On the isw10 nodes, we will run 1 MPI process per node with 16 threads per process, on isw20 nodes we will run 16 plain MPI processes.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    Although this example is somewhat artificial, it demonstrates the flexibility of the qsub command options.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ## Job Management
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        Check status of your jobs using the **qstat** and **check-pbs-jobs** commands
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qstat -a
    $ qstat -a -u username
    $ qstat -an -u username
    $ qstat -f 12345.srv11
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Example:
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qstat -a
    
    srv11:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
                                                                Req'd Req'd   Elap
    Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time S Time
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    --------------- -------- --  |---|---| ------ --- --- ------ ----- - -----
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    16287.srv11     user1    qlong    job1         6183   4 64    --  144:0 R 38:25
    16468.srv11     user1    qlong    job2         8060   4 64    --  144:0 R 17:44
    16547.srv11     user2    qprod    job3x       13516   2 32    --  48:00 R 00:58
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    
    In this example user1 and user2 are running jobs named job1, job2 and job3x. The jobs job1 and job2 are using 4 nodes, 16 cores per node each. job1 has already run for 38 hours and 25 minutes, and job2 for 17 hours 44 minutes. job1 has already consumed `64 x 38.41 = 2458.6` core hours. job3x has already consumed `0.96 x 32 = 30.93` core hours. These consumed core hours will be accounted for on the respective project accounts, regardless of whether the allocated cores were actually used for computations.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The following commands allow you to; check the status of your jobs using the check-pbs-jobs command; check for the presence of user's PBS jobs' processes on execution hosts; display load and processes; display job standard and error output; continuously display (tail -f) job standard or error output;
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ check-pbs-jobs --check-all
    $ check-pbs-jobs --print-load --print-processes
    $ check-pbs-jobs --print-job-out --print-job-err
    $ check-pbs-jobs --jobid JOBID --check-all --print-all
    $ check-pbs-jobs --jobid JOBID --tailf-job-out
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Examples:
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ check-pbs-jobs --check-all
    JOB 35141.dm2, session_id 71995, user user2, nodes cn164,cn165
    Check session id: OK
    Check processes
    cn164: OK
    cn165: No process
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example we see that job 35141.dm2 is not currently running any processes on the allocated node cn165, which may indicate an execution error.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ check-pbs-jobs --print-load --print-processes
    JOB 35141.dm2, session_id 71995, user user2, nodes cn164,cn165
    Print load
    cn164: LOAD: 16.01, 16.01, 16.00
    cn165: LOAD:  0.01,  0.00,  0.01
    Print processes
           %CPU CMD
    cn164:  0.0 -bash
    cn164:  0.0 /bin/bash /var/spool/PBS/mom_priv/jobs/35141.dm2.SC
    cn164: 99.7 run-task
    ...
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example we see that job 35141.dm2 is currently running a process run-task on node cn164, using one thread only, while node cn165 is empty, which may indicate an execution error.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ check-pbs-jobs --jobid 35141.dm2 --print-job-out
    JOB 35141.dm2, session_id 71995, user user2, nodes cn164,cn165
    Print job standard output:
    ======================== Job start  ==========================
    
    David Hrbáč's avatar
    David Hrbáč committed
    Started at    : Fri Aug 30 02:47:53 CEST 2013
    Script name   : script
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    Run loop 1
    Run loop 2
    Run loop 3
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    In this example, we see actual output (some iteration loops) of the job 35141.dm2
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        Manage your queued or running jobs, using the **qhold**, **qrls**, **qdel**, **qsig** or **qalter** commands
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    You may release your allocation at any time, using the qdel command
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qdel 12345.srv11
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    You may kill a running job by force, using the qsig command
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsig -s 9 12345.srv11
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    Learn more by reading the pbs man page
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ man pbs_professional
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ## Job Execution
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ### Jobscript
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        Prepare the jobscript to run batch jobs in the PBS queue system
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The Jobscript is a user made script controlling a sequence of commands for executing the calculation. It is often written in bash, though other scripts may be used as well. The jobscript is supplied to the PBS **qsub** command as an argument, and is executed by the PBS Professional workload manager.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        The jobscript or interactive shell is executed on first of the allocated nodes.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -q qexp -l select=4:ncpus=16 -N Name0 ./myjob
    $ qstat -n -u username
    
    srv11:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
                                                                Req'd Req'd   Elap
    Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time S Time
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    --------------- -------- --  |---|---| ------ --- --- ------ ----- - -----
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    15209.srv11     username qexp     Name0        5530   4 64    --  01:00 R 00:00
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
       cn17/0*16+cn108/0*16+cn109/0*16+cn110/0*16
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, the nodes cn17, cn108, cn109, and cn110 were allocated for 1 hour via the qexp queue. The jobscript myjob will be executed on the node cn17, while the nodes cn108, cn109, and cn110 are available for use as well.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The jobscript or interactive shell is by default executed in the home directory
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ qsub -q qexp -l select=4:ncpus=16 -I
    qsub: waiting for job 15210.srv11 to start
    qsub: job 15210.srv11 ready
    
    $ pwd
    /home/username
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    In this example, 4 nodes were allocated interactively for 1 hour via the qexp queue. The interactive shell is executed in the home directory.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
        All nodes within the allocation may be accessed via ssh.  Unallocated nodes are not accessible to the user.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    The allocated nodes are accessible via ssh from login nodes. The nodes may access each other via ssh as well.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    Calculations on allocated nodes may be executed remotely via the MPI, ssh, pdsh or clush. You may find out which nodes belong to the allocation by reading the $PBS_NODEFILE file
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```console
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    qsub -q qexp -l select=4:ncpus=16 -I
    qsub: waiting for job 15210.srv11 to start
    qsub: job 15210.srv11 ready
    
    $ pwd
    /home/username
    
    $ sort -u $PBS_NODEFILE
    cn17.bullx
    cn108.bullx
    cn109.bullx
    cn110.bullx
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    $ pdsh -w cn17,cn[108-110] hostname
    cn17: cn17
    cn108: cn108
    cn109: cn109
    cn110: cn110
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    In this example, the hostname program is executed via pdsh from the interactive shell. The execution runs on all four allocated nodes. The same result would be achieved if the pdsh is called from any of the allocated nodes or from the login nodes.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ### Example Jobscript for MPI Calculation
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        Production jobs must use the /scratch directory for I/O
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    The recommended way to run production jobs is to change to the /scratch directory early in the jobscript, copy all inputs to /scratch, execute the calculations and copy outputs to the home directory.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    #!/bin/bash
    
    # change to scratch directory, exit on failure
    SCRDIR=/scratch/$USER/myjob
    mkdir -p $SCRDIR
    cd $SCRDIR || exit
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    # copy input file to scratch
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    cp $PBS_O_WORKDIR/input .
    cp $PBS_O_WORKDIR/mympiprog.x .
    
    
    # load the MPI module
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ml OpenMPI
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    # execute the calculation
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    mpirun -pernode ./mympiprog.x
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    # copy output file to home
    cp output $PBS_O_WORKDIR/.
    
    #exit
    exit
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    
    In this example, a directory in /home holds the input file input and executable mympiprog.x . We create the directory myjob on the /scratch filesystem, copy input and executable files from the /home directory where the qsub was invoked ($PBS_O_WORKDIR) to /scratch, execute the MPI program mympiprog.x and copy the output file back to the /home directory. mympiprog.x is executed as one process per node, on all allocated nodes.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    David Hrbáč's avatar
    David Hrbáč committed
        Consider preloading inputs and executables onto [shared scratch][4] memory before the calculation starts.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In some cases, it may be impractical to copy the inputs to the scratch memory and the outputs to the home directory. This is especially true when very large input and output files are expected, or when the files should be reused by a subsequent calculation. In such cases, it is the users' responsibility to preload the input files on shared /scratch memory before the job submission, and retrieve the outputs manually after all calculations are finished.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
        Store the qsub options within the jobscript. Use **mpiprocs** and **ompthreads** qsub options to control the MPI job execution.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    ### Example Jobscript for MPI Calculation With Preloaded Inputs
    
    
    Example jobscript for an MPI job with preloaded inputs and executables, options for qsub are stored within the script:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    #!/bin/bash
    #PBS -q qprod
    #PBS -N MYJOB
    #PBS -l select=100:ncpus=16:mpiprocs=1:ompthreads=16
    #PBS -A OPEN-0-0
    
    # change to scratch directory, exit on failure
    SCRDIR=/scratch/$USER/myjob
    cd $SCRDIR || exit
    
    
    # load the MPI module
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ml OpenMPI
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    # execute the calculation
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    mpirun ./mympiprog.x
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    #exit
    exit
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    
    In this example, input and executable files are assumed to be preloaded manually in the /scratch/$USER/myjob directory. Note the **mpiprocs** and **ompthreads** qsub options controlling the behavior of the MPI execution. mympiprog.x is executed as one process per node, on all 100 allocated nodes. If mympiprog.x implements OpenMP threads, it will run 16 threads per node.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    More information can be found in the [Running OpenMPI][5] and [Running MPICH2][6] sections.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ### Example Jobscript for Single Node Calculation
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    !!! note
    
        The local scratch directory is often useful for single node jobs. Local scratch memory will be deleted immediately after the job ends.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    Example jobscript for single node calculation, using [local scratch][4] memory on the node:
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```bash
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    #!/bin/bash
    
    # change to local scratch directory
    cd /lscratch/$PBS_JOBID || exit
    
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    # copy input file to scratch
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    cp $PBS_O_WORKDIR/input .
    cp $PBS_O_WORKDIR/myprog.x .
    
    # execute the calculation
    ./myprog.x
    
    # copy output file to home
    cp output $PBS_O_WORKDIR/.
    
    #exit
    exit
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    ```
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    
    In this example, a directory in /home holds the input file input and executable myprog.x . We copy input and executable files from the home directory where the qsub was invoked ($PBS_O_WORKDIR) to local scratch memory /lscratch/$PBS_JOBID, execute myprog.x and copy the output file back to the /home directory. myprog.x runs on one node only and may use threads.
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    
    ### Other Jobscript Examples
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    Further jobscript examples may be found in the software section and the [Capacity computing][7] section.
    
    
    David Hrbáč's avatar
    David Hrbáč committed
    [1]: #example-jobscript-for-mpi-calculation-with-preloaded-inputs
    
    Lukáš Krupčík's avatar
    Lukáš Krupčík committed
    [2]: ../anselm/network.md
    [3]: ../anselm/hardware-overview.md
    [4]: ../anselm/storage.md
    
    David Hrbáč's avatar
    David Hrbáč committed
    [5]: ../software/mpi/running_openmpi.md
    
    David Hrbáč's avatar
    David Hrbáč committed
    [6]: ../software/mpi/running-mpich2.md
    
    David Hrbáč's avatar
    David Hrbáč committed
    [7]: capacity-computing.md