Helpful hints

From TAMUQ Research Computing User Documentation Wiki
Jump to navigation Jump to search

Screen

When running interactive workloads it can be a good practice to perform your work inside of a "virtual" terminal screen using the Linux screen utility. The screen command creates a new virtual terminal that is independent of the terminal or console presented to you by a program such as MobaXterm or putty (in Windows systems) or Terminal (in Macs), etc. Even when you close a MobaXterm or PuTTY terminal, a screen session running within it would still survive undisturbed.

Below, we see how to employ screen to launch an interactive job on raad2, and then detach from that screen session while allowing the interactive job to continue running.

fachaud74@raad2-login1:~> screen -S "my R program"

This appears to blank out the terminal an give you a clean screen with a single shell prompt. We are actually now inside of the virtual screen session. We can type an appropriate srun command here to launch a 1-hour long interactive job in the s_debug partition. Once the job launches, we can start to load the relevant R module file, and finally run some R code.

fachaud74@raad2-login1:~> srun --pty --qos sd -p s_debug --time=1:00:00 /bin/bash
fachaud74@nid000190:~> module load R/362
fachaud74@nid000190:~> Rscript mycode.R

# output omitted for brevity

...then I press "ctrl + a" and then a "d". This will take me out of (or "detach" me from) the screen session and I will see the message below:

[detached from 13830.my R program]
fachaud74@raad2-login1:~>

Then I can close connection to raad2 fachaud74@raad2-login1:~> exit

.. and later after lunch come back login to raad2 again and issue;

<fachaud74@raad2-login1:~> screen -ls
There is a screen on:
        13830.my R program      (Detached)

fachaud74@raad2-login1:~> screen -R "13830.my R program"
fachaud74@nid00190:~>

Setup X11 forwarding

When launching a GUI based application interactively on raad2, you will have to rely on "X11 forwarding" to have the remotely executing application render its graphical interface on your local system (PC, laptop, etc). In order for this to work, the compute node launching the application needs to know the IP address of your local system, which it can fetch from the value of an environment variable called DISPLAY. In other words, you will need to set the value of DISPLAY appropriately before launching your application.

If you are using MobaXterm to access raad2, you can conveniently find the value of your DISPLAY variable by opening a local terminal (click the short tab marked with "+"). Copy the complete display variable value i.e. <IP_address>:0.0

    ┌────────────────────────────────────────────────────────────────────┐
    │             (X server, SSH client and network tools)               │
    │                                                                    │
    │ ➤ Your computer drives are accessible through the /drives path    │
    │ ➤ Your DISPLAY is set to <IP_ADDRESS>:0.0                         │
    │ ➤ When using SSH, your remote DISPLAY is automatically forwarded  │
    │ ➤ Each command status is specified by a special symbol (✔ or ✘)  │
    │                                                                    │
    └────────────────────────────────────────────────────────────────────┘

On the raad2 compute node, set the value of the DISPLAY variable as follows (of course, replace "IP_ADDRESS" with the actual address):

export DISPLAY=IP_ADDRESS:0.0