Interactive Jobs

Sometimes you might want to test or debug a calculation interactively but running interactively on the login node is discouraged and not an option.

What you can do instead is to ask the batch system to allocate compute resources for you and once assigned, you can run the job(s) interactively for as long as requested: The example below covers the development quality of service, but this procedure also holds for the other job types (see Job Types for more info)

$ srun --nodes=1 --time=01:00:00 --account=nnXXXXk --qos=devel --pty bash -i

The arguments between srun and --pty could be any arguments you would have given to sbatch when submitting a non-interactive job. However, --qos=devel is probably a good idea to avoid waiting too long in the queue.

Note that interactive jobs dies when you log out from the machine, so unless you have very long days in office (or elsewhere, for that matter), specifying more than 6-8 hrs runtime is not very useful.

GUI Commands

It is possible to run X commands, i.e., programs with a graphical user interface (GUI), in interactive jobs.

First, you must make sure that you have turned on X forwarding when logging in to the cluster. With ssh from a Linux or MacOS machine, you do this with the -Y flag, e.g.:

$ ssh -Y

Check that the X forwarding works by running a graphical command like emacs & and verify that it sets up a window. (Note that due to network latency, it can take a long time to set up a window.)

To be able to run X commands in interactive jobs, add the argument --x11 (note: lower case x) to srun, like this:

$ srun --nodes=1 --time=01:00:00 --account=nnXXXXk --qos=devel --x11 --pty bash -i

Alternative Method: salloc

An alternative to using srun ... --pty bash -i is to use

$ salloc --nodes=1 --time=01:00:00 --account=nnXXXXk --qos=devel

As with srun, the arguments to salloc can be any you would have given to sbatch. salloc will also give you an interactive shell, but note that the shell will be running on the login node. That means that you must start all calculations with srun or mpirun or equivalent, to make sure they run on the allocated compute node(s). For this reason, the srun method is probably preferrable in most cases (it also works more like a batch job). However, there might be situations when the srun method doesn't work properly, in which case you can try with salloc.

With this method, you can run X commands without adding any switch to the salloc command, but note again that the commands will be run on the login node. In some cases, this is what you want (see for instance interactive TotalView debugging).

results matching ""

    No results matching ""