2 srun signal handling, 3 srun run-mode options – HP XC System 2.x Software User Manual

Page 74

Advertising
background image

This command forwards the standard output and error messages
from the running job with SLURM ID 6543 to the attaching

srun

command to reveal the job’s current status, and (with

-j

) also joins

the job so that you can send it signals as if this

srun

command had

initiated the job. Omit -j for read-only attachments. Because you
are attaching to a running job whose resources have already been
allocated, the

srun

resource-allocation options (such as

-N

) are

incompatible with

-a

.

Batch (with LSF)

You can submit a script to LSF that contains (simple)

srun

commands within it to execute parallel jobs later. In this case, LSF
takes the place of the

srun -b

option for indirect, across-machine

job-queue management.

6.4.2

srun

Signal Handling

Signals sent to

srun

are automatically forwarded to the tasks that

srun

controls, with a few

special cases.

srun

handles the

Ctrl/C

sequence differently, depending on how many times

it receives

Ctrl/C

in one second. The following defines how

Ctrl/C

is handled by

srun

:

If

srun

receives one

Ctrl/C

, it reports the state of all tasks associated with

srun

.

If

srun

receives a second

Ctrl/C

within one second, it sends the

SIGINT

signal to all

associated

srun

tasks.

If

srun

receives a third

Ctrl/C

within one second, it terminates the job at once, without

waiting for remote tasks to exit.

6.4.3

srun

Run-Mode Options

This section explains the mutually exclusive

srun

options that enable its different run modes.

-b

(

--batch

)

This option runs a script in batch mode. The script name must appear at the end of the

srun

execute line, not as an argument to

-b

. You cannot use

-b

with

-A

or

-a

.

srun

copies the script, submits the request to run (with your specified resource allocation) to

the local SLURM-managed job queue, and ends. When resources become available and no
higher priority job is pending, SLURM runs the script on the first node allocated to the job,
with

stdin

redirected from

/dev/null

and

stdout

and

stderr

redirected to a file called

jobname.out

in the current working directory (unless you request a different name or a more

elaborate set of output files by using

-J

or

-o

).

The

-b

option has the following script requirements:

You must use the script’s absolute pathname, or a pathname relative to the current working
directory (

srun

ignores your search path).

srun

interprets the script using your default shell unless the file begins with the character

pair

#!

followed by the absolute pathname of a valid shell.

The script must contain MPI commands or other (simple)

srun

commands to initiate

parallel tasks.

-A

(

--allocate

)

The

-A

option allocates compute resources (as specified by other

srun

options) and starts

(spawns) a subshell that has access to those allocated resources. No remote tasks are started.
You cannot use

-A

with

-b

or

-a

.

6-4

Using SLURM

Advertising