| Academic Computing and Communications Center | ||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
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):
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. |
||
| Requirements For Running Interactive Jobs | ||
|
There are four requirements to running an interactive program:
|
||
| 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:
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:
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:
"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): 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:
There are two ways to establish a secure connection with argo:
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:
DISPLAY: Undefined variable.
export DISPLAY=128.248.012.345:0
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:
|
||
| 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:
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 |
|