Visit the new ACCC website! (beta)
ACCC Home Page Academic Computing and Communications Center  
Accounts / Passwords Email Labs / Classrooms Telecom Network Security Software Computing and Network Services Education / Teaching Getting Help
 

ARGO: Interactive Jobs

     
 
     
Interactive Jobs On Argo - An Overview
  Interactive jobs can be run on argo.

A batch job is broadly defined as one where the program runs with no user interaction. Any input is provided by one or more files and there are no GUI-type screens and menus, like the kind you would see with software running in a PC/Windows environment. Results are written to one or more output files. The classic hello_world program (source code shown later) is an example of a batch program. A VERY simple example. Sample output (from standard out):
    Hello-world

An interactive job is the opposite of a batch program. It is one where the user has some interaction, maybe considerable, with screens and menus via a mouse and/or keyboard. The interaction may be nothing more than closing the screen. Or, it may be much more, involving moving or rotating objects. An example of a simple interactive program in UNIX/Linux is xclock (for more information, man xclock):

    text

You may interact with the clock by moving it (clicking and dragging) from one location on the screen to another. Or, you may interact with it by expanding or shrinking the size of the clock face. Terminating the program by clicking on the box with the X (upper right corner) is another way to interact with it.

Interactive programs on argo REQUIRE the use of the X11 protocol. More on this in a moment. Two of the more popular interactive programs on argo are ANSYS and GaussView.

When you run software on your personal computer or laptop, the binary program executes on one or more processors in the system unit and all screens and menus appear on the attached monitor. Your selections, actions, and input are made available to the program by means of a wireless or attached mouse/keyboard that communicates with the system unit. (With a laptop, all the components - system unit, screen, keyboard, and mouse are combined into a single entity.) But, the components are ALL together (i.e., local to your desktop). You can do the same thing using argo. The difference is the program executes not on the computer next to your monitor but somewhere else. Think of argo as the system unit, the location where the program will execute. But, the unit is now separate (i.e., remote) from your monitor, keyboard, and mouse. But, argo will communicate to your monitor (displaying things) and mouse/keyboard actions by you will be sent back to argo. It's the X Windows system that allows this type of execution to take place. The X Windows system is a GUI, a (G)raphical (U)ser (I)nterface; it allows you to display the graphical output from commands that are run on a remote system onto your local system.

 
     
Requirements For Running Interactive Jobs
 

There are four requirements to running an interactive program:

  • The application program on argo must use the X11 protocol,
  • An X-Server or an X-Windows emulation package must be running on your PC or laptop,
  • Argo must be informed where the X-Server or the emulation package is running, and
  • The X-Server/emulator is told from who it will accept connections.
 
     
The X11 Protocol
  The X Window System, also referred to as X or X11, is a software system and network protocol that provides a graphical user interface (GUI) for networked computers. A discussion of X protocols and how to program using them is beyond the scope of this document. For a more detailed discussion, see here. Instead, the document gives you a VERY basic overview of X and how you can configure your PC so that the GUI from an X application, run on argo, appears on your local monitor. If you want to learn how to program code using X library calls, great. The document at the following is a nice introduction: You don't need to know how to write X to use software that contains X. However, for the purpose of showing the complexity of X code, source code for two hello_world programs is presented below. The first is without X; the second, with X. As is apparent, writing X code is not a trivial task:

The classic hello_world program - source in C without X11:

  #include <stdio.h>
  void main(int argc, char** argv) {
  printf("Hello-world\n");
    }
Very straightforward. The type of code that you would write as your first assignment in a C programming course.

Now, the same program written using the X11 protocol with Xlib:
  #include <X11/Xlib.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>

  int main(void) {
  Display *d;
  Window w;
  XEvent e;
  char *msg = "Hello, World!";
  int s;

  d = XOpenDisplay(NULL);
  if (d == NULL) {
  fprintf(stderr, "Cannot open display\n");
  exit(1);
    }

  s = DefaultScreen(d);
  w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 100, 100, 1,
	     BlackPixel(d, s), WhitePixel(d, s));
  XSelectInput(d, w, ExposureMask | KeyPressMask);
  XMapWindow(d, w);

  while (1) {
  XNextEvent(d, &e);
  if (e.type == Expose) {
  XFillRectangle(d, w, DefaultGC(d, s), 20, 20, 10, 10);
  XDrawString(d, w, DefaultGC(d, s), 10, 50, msg, strlen(msg));
    }
  if (e.type == KeyPress)
  break;
    }

  XCloseDisplay(d);
  return 0;
    }
A bit more involved. By the way, did you ask yourself what is Xlib; it is referenced in the first line? Xlib is an X protocol client library written in the C programming language. It contains functions for interacting with an X-Server. These functions allow programmers to write programs without knowing the details of the protocol.

The simplest way to determine if software uses X is to check the vendor website and the software documentation.
 
     
The X-Server/X-Windows Emulator Must Be Running On Your PC
 

As was stated above:

    ...it contains functions for interacting with an X-Server...
What is an X-Server? It is both hardware and software. An X-Server is the software that displays the GUI to you. Specifically, it accepts requests for graphical output (windows) and sends back user input (from keyboard, mouse, or touchscreen). The X-Server also refers to the hardware (the local machine, your PC) that runs the X-Server software.

The X-Server does not run on argo (where your X application program runs) but rather on your personal computer. Though it seems backwards and counter-intuitive, as regards X:

    Argo is the client and your PC is the server
That bears repeating. Argo is NOT the server - it is the client (where your X application program runs). Your PC, on the other hand, is NOT the client but the server:
    text
For clients using UNIX/Linux on their local PC, it is possible to have the PC be BOTH the X-Server and the X application host (where the X application runs). For example, you could run the the xclock application locally (on your PC) and the X-Server (running on your PC) would display it:
    text

But, then you are not using argo.

If the operating system on your PC is some variant of UNIX or Linux, then, most likely, you have the X-Server software already installed. If not, then you will have to install it. To see if your local machine has the X-Server software installed, do:

    rpm -qa | grep x11
In a RedHat Linux environment, X can be started by issuing the startx command or by running an /etc/rc3.d script. In OpenBSD, X is started by means of either the xdm command or the /etc/rc script. In any event, look at the man page for X or review your system documentation about how to start the X-Server. But,
    The X-Server MUST be running on the PC.

    "My PC doesn't have UNIX or Linux on it; I use Windows. And, I don't have an X-Server." If your desktop has some release of the Microsoft Windows operating system (XP, Vista, Windows 7), then you must install an X-Windows emulation package on it and have the program running. An X-Windows emulator provides X-Server functionality for a Windows system. That's why it is called an emulation package - it emulates in a Windows OS environment the functionality of an X-Server. There are several available packages (many more but these are the ones we support):

    • Xming
    • cygwin
    • X-Win32
    • Exceed

    Each has its strengths. The first two are free and readily available on the internet; the latter, two, are proprietary. Which one you opt to use is left to you though Xming is very popular. There are quirks about each. Some are easier to install and/or configure. Some are easier to use. Others offer greater functionality and control. But, each may have compatibility issues with particular X software applications. Software might work with one emulator but have problems with another. Resolving the issue might be as simple as a minor change to a server configuration file. Or, you may be expending considerable time and effort. You may be looking in a log file trying to make sense of a cryptic message. Not all emulation packages are alike. In any event, select the one with which you are most comfortable.
 
     
Where Is The X-Server/X-Windows Emulator Running
 

You have your X-Server or X-Windows emulation package running on your PC. Now what? Before you run the application program, argo must be told where to find the X-Server or emulator. As stated, this is done on argo and not on your PC. The DISPLAY variable on argo contains the location of the server or will be set to the location:

    text

There are two ways to establish a secure connection with argo:

  • An ssh client without X11-Forwarding, or
  • An ssh client with X11-Forwarding

X11-Forwarding is a way to establish an encrypted tunnel using the SSH protocol connection.

If you ARE NOT using X11-Forwarding, then YOU, as the argo user, must set the DISPLAY variable. After logging into argo, you can see that the DISPLAY variable is not set by entering the command:

    echo $DISPLAY
    DISPLAY: Undefined variable.
Your PC or laptop has an IP associated with it. You set the DISPLAY variable to the IP address (or the associated domain name). Sample commands:
    setenv DISPLAY 128.248.012.345:0
    export DISPLAY=128.248.012.345:0
Each of the above commands says to argo:
    the X-Server is located on the machine whose IP address is 128.248.012.345.
Which command you use is dictated by the argo shell you are using. For users of the C-shell, the setenv command; for the Bash shell, export.

Determining if you are using X11-Forwarding is a matter of checking the argo profile file of your ssh client. For example, in PUTTY (a popular ssh client used to connect to argo), is the X11-Forwarding box checked? If not, then you aren't using X11-Forwarding:

    text
X11 forwarding is defined by the features it gives you:
  • You no longer have to set the DISPLAY variable each time you login to argo.
  • You don't have to use xauth/xhost commands to ensure that the X-Server will display information sent by argo (more on this later), and
  • The content of the communication between argo and your PC is encrypted.
With X11 Forwarding, the setting of the DISPLAY variable is taken care of by the ssh client; all you have to do is tell the client to use X11 Forwarding. For example, you tell the PUTTY client to forward by putting a check in the Enable X11 Forwarding box. That's it. After you login to argo, you will see that the DISPLAY variable is set:
    localhost:12.0
No using the setenv or export commands. No trying to get your IP address. Just tell the client to forward.
 
     
From Whom Will The X-Server/X Windows Emulator Accept Connections
  The DISPLAY variable tells argo where to find the X-Server or emulator. But, ANYONE can set his DISPLAY variable to your IP address. Will your X-Server respond to connections from that user? Unfortunately, the answer is yes. So, something else is needed, something to constrain the server or emulator so that it responds only to requests from your X application. How this is done is dependent on three factors:
  • The operating system you are using on your PC,
  • Which X-Server emulation package you are using, and
  • Whether or not you are using X11-forwarding.
If the operating system on your PC is UNIX/Linux, then you will have to use commands like xhost and/or xauth to create and maintain a list of permitted hosts or users who may communicate with the X-Server.
  • xhost adds and removes names and user ids to a list of entities that are allowed to make connections to the X-Server
  • xauth allows you to generate and share between your PC and the application host a key, called a MIT-MAGIC-COOKIE-1. Hosts with the key, in this case, argo, are permitted to make connections to the X-Server.
If, as a result of a Windows operating system, you are using one of the X-Server emulation packages, most likely there is a file that you edit, adding the IPs of hosts permitted to make connections to the emulator. As an example, Xming uses the file X0.hosts. If you are using Xming but not forwarding, the you will have to add argo.cc.uic.edu to the file. Adding entries can be done via a standard Windows editor. X-Win32 also uses a file. Adding and/or removing entries from it is controlled by a configuration GUI (X-Config).

A MAJOR advantages of X11-Forwarding is that you don't have to mess with access lists and the commands/GUIs. The emulator will respond only to connections from the localhost (your PC). If you are using Xming and X11-Forwarding, then you don't have to add argo to the X0.hosts file; the file should contain the single entry localhost and that's all that's needed.

 
     
Double (multiple) X11-Forwarding jumps
  Suppose you SSH to tigger and, subsequently, SSH from one of those machines to argo. Will an X11 screen get forwarded from the client argo to the client tigger and then to your PC. The answer is yes so long as you ensure that each SSH session has X11-Forwarding enabled. If, for example, you use the SSH command to connect from your PC to tigger, you must include the -X arguement. For more information, click here. On the other hand, if you use the SSH GUI client PUTTY, then you must enable the X11-Forwarding option (see here). In both cases (command line SSH or SSH BUI), you must not change the setting of the DISPLAY environmental variable; it will be properly set by SSH.  


2011-9-10  ACCC Systems Group
UIC Home Page Search UIC Pages Contact UIC