beautypg.com

Running preexecution programs, Example 5-12 – HP XC System 3.x Software User Manual

Page 51

background image

Example 5-12

Submitting a Batch job Script That Uses the srun --overcommit Option

$ bsub -n4 -I ./myscript.sh

Job <81> is submitted to default queue .

<>

<>

n1

n1

n1

n1

n2

n2

n2

n2

Hello world! I'm 0 of 8 on n1

Hello world! I'm 1 of 8 on n1

Hello world! I'm 2 of 8 on n1

Hello world! I'm 3 of 8 on n1

Hello world! I'm 4 of 8 on n2

Hello world! I'm 5 of 8 on n2

Hello world! I'm 6 of 8 on n2

Hello world! I'm 7 of 8 on n2

Example 5-13

shows some of the environment variables that are available in a batch script. The LSB_HOSTS

and LSB_MCPU_HOSTS environment variables are defined in

Platform LSF Reference. The SLURM_JOBID

and SLURM_NPROCS environment variables are defined in the

SLURM Reference Manual.

Example 5-13

Environment Variables Available in a Batch Job Script

$ cat ./envscript.sh

#!/bin/sh

name=`hostname`

echo "hostname = $name"

echo "LSB_HOSTS = '$LSB_HOSTS'"

echo "LSB_MCPU_HOSTS = '$LSB_MCPU_HOSTS'"

echo "SLURM_JOBID = $SLURM_JOBID"

echo "SLURM_NPROCS = $SLURM_NPROCS"

$ bsub -n4 -I ./envscript.sh

Job <82> is submitted to default queue .

<>

<>

hostname = n1

LSB_HOSTS = 'n1 n1 n2 n2'

LSB_MCPU_HOSTS = 'n1 2 n2 2'

SLURM_JOBID = 176

SLURM_NPROCS = 4

Running Preexecution Programs

A

preexecution program is a program that performs needed setup tasks that an application needs. It may

create directories, input files, and so on.

Though LSF-HPC daemons only run on a node with resource manager role, batch jobs can run on any
compute node that satisfies the scheduling and allocation requirements.

Where preexecution commands run depends on the type of job:

For interactive jobs, preexecution commands run on the node where the sbatchd daemon runs,
typically, the resource manager node.

For normal batch jobs, preexecution commands run on the first node of the SLURM allocation.

Before starting a preexecution program, LSF-HPC sets the SLURM_JOBID environment variable. To enable
srun

to launch pre-execution on the first allocated node and other allocated nodes, your preexecution

Running Preexecution Programs

51