SAGE Development July 2007 GCB SAGE workshop Architecture
SAGE Development July, 2007 GCB SAGE workshop
Architecture … • Free Space manager provides central control between apps, UI and system • SAGE applications send their streams directly to the display nodes July, 2007 GCB SAGE workshop
Writing/Porting SAGE applications • Modify an existing application. – Source code should be open. – Source should be in C++. – If source code is not easily modifiable we can try using shared memory. Requires a separate C++ program to read the shared memory and send pixels to SAGE • Write an application from scratch – Cleanest solution July, 2007 GCB SAGE workshop
Serial vs Distributed Apps • Simple SAGE apps run on a single machine. Have one frame buffer – E. g. atlantis • Distributed SAGE apps can run across multiple machines (cluster). Have many frame-buffers across multiple machines. – E. g. Magic. Carpet July, 2007 GCB SAGE workshop
Distributed Apps • Use MPI or simple ssh to spawn instances across machines • Responsible for internal syncing before doing a collective sage. Swap. Buffer() • Magic. Carpet • Juxta. View July, 2007 GCB SAGE workshop
Open. GL Code SAGEified // headers for SAGE #include "sail. h" #include "misc. h" void reshape(int width, int height) { // blah } //display function void redraw(void) { // draw code gl. Read. Pixels(0, 0, win. Width, win. Height, GL_RGB, GL_UNSIGNED_BYTE, rgb. Buffer); sage. Inf. swap. Buffer((void *)rgb. Buffer); glut. Swap. Buffers(); • } • July, 2007 GCB SAGE workshop int main(int argc, char *argv[]) { // application code gl. Pixel. Storei( GL_UNPACK_ALIGNMENT, 1 ); sail. Config scfg; scfg. File = "sage. conf"; scfg. app. Name = "render"; scfg. rank = 0; scfg. ip = argv[2]; scfg. res. X = 400; scfg. res. Y = 400; sage. Rect render. Image. Map; render. Image. Map. left = 0. 0; render. Image. Map. right = 1. 0; render. Image. Map. bottom = 0. 0; render. Image. Map. top = 1. 0; scfg. image. Map = render. Image. Map; scfg. color. Depth = 24; scfg. pix. Fmt = TVPIXFMT_888; scfg. row. Ord = BOTTOM_TO_TOP; sage. Inf. init(scfg); cout << "sail initialized " << endl; glut. Main. Loop(); }
A Native SAGE App • • • // for SAGE #include <sail. h> #include <misc. h> // SAGE Stuff int win. Width, win. Height; sail sage. Inf; // sail object // initialize SAGE sail. Config scfg; scfg. File = "sage. conf"; scfg. app. Name = “my. App"; • • • scfg. rank = rank; scfg. ip = NULL; scfg. res. X = (extent. w / extent. zoom); scfg. res. Y = (extent. h / extent. zoom); sage. Rect render. Image. Map; render. Image. Map. left = 0. 0; render. Image. Map. right = 1. 0; render. Image. Map. bottom = 0. 0; render. Image. Map. top = 1. 0; • July, 2007 GCB SAGE workshop scfg. image. Map = render. Image. Map; scfg. color. Depth = 24; scfg. pix. Fmt = TVPIXFMT_888; scfg. row. Ord = TOP_TO_BOTTOM; sage. Inf. init(scfg); // Main while loop while (!quit) { // Generate pixels and copy into ‘buffer’ . . // swap buffer sage. Inf. swap. Buffer(buffer); }
TCP vs UDP • Protocol to be used can be specified in sage. conf – No need to recompile code • TCP works well locally (within the cluster backplane) – Suffers from performance hits over long fat networks • UDP is fast but missing packets lead to missing pixels. • New experimental protocols are used for testing July, 2007 GCB SAGE workshop
Troubleshooting And Debugging • Failure to Init ports – fs. Manager already running in the background • Failure of SAGE UI to start – Make sure that fs. Manager is running. Then make sure that sageui. conf contains the correct IP address and port of the machine that runs fs. Manager. July, 2007 GCB SAGE workshop
Troubleshooting and Debugging • A socket error appears in the console window – It is likely that something caused fs. Manager to stop working. Close SAGE UI. And kill sage. Wait for a a few seconds before trying to restart SAGE. • Noticeable delay in SAGE UI actions and updates on the SAGE display – The machine running fs. Manager may be somewhat loaded and not be as responsive to SAGE UI requests as one would like it to be. July, 2007 GCB SAGE workshop
The New SAGE • SAGE 2. 0 • The main differences – Pixel block streaming – Every app has its own configuration • UI remains same. User experience is same • Looks better and more stable PLAY sage-vga. mov July, 2007 GCB SAGE workshop
What is pixel block streaming? • SAGE 2. x supports pixel blocks – Frame is broken into tiny blocks – Sets of blocks sent to appropriate tiles – Efficient since the application can send only the updated blocks and not the entire frame • Good for overlapped windows July, 2007 GCB SAGE workshop
Developing SAGE application on Windows July, 2007 GCB SAGE workshop
The Goal July, 2007 GCB SAGE workshop
Bandwidth (BW) Requirement in Megabits per sec. (Mbps) • Calculate bandwidth requirements for streaming apps. – Pixels x bpp (bits per pixel) x fps (frames per sec. ) • • • Image Width: 640, Image Height: 480 = 307200 pixels Image format: RGB (Red, Green, Blue: 3 colors) Color Depth: 8 bits per color = 24 bits per pixel Image frame rate: 30 fps Bandwidth: 307200 x 24 x 30 = 221 Mbps – If BW > 1 Gbps, expect slower frame rate. July, 2007 GCB SAGE workshop
Direct. Show SAGE App • Windows application – Uses Win 32 version of SAIL (sail. lib) • Streams any video source seen by Direct. X to SAGE – – Web cams Files (avi, dv, wmv. . Etc) HD cameras Frame grabbers July, 2007 GCB SAGE workshop
Direct. Show SAIL/SAGE App DSSAGE • What is Direct. Show? • What is COM? • Graph Editor for visual creation and test video pipeline • Easy and intuitive for programming • Not user friendly – Needs a better UI – Just for development July, 2007 GCB SAGE workshop
DSSAGE: The SAIL/SAGE COM Object • Standard query-able interface • Most Multimedia devices (including files) come as a COM objects under MS Windows • Can communicate with a device without prior knowledge of video format. Interface is exposed and agreed upon during initialization July, 2007 GCB SAGE workshop
DSAGE Main Code Structure DSSAGE : : Set. Media. Type(){ // Agree with Media type (video format) // e. g: Greylevel, RGB 8, RGB 555, YUV 422, etc. // Populate the SAIL config structure …. // Do SAIL/SAGE init with this input media type …. } DSSAGE : : send(buffer) { // Get frame buffer pointer from input DShow COM p. Imedia. Sample->Get. Pointer(&buffer); // Using SAIL swap buffer to SAGE sage. Inf. swap. Buffer(buffer); } July, 2007 GCB SAGE workshop
Problems Faced • SAGE is developed for Linux and there is an alpha port for Windows • Linux assumes the program runs in a terminal • Debugging under Windows is not intuitive. – Not enough feedback from SAIL – No Console to see messages unless redirected – Console messages not clear – Configuration files have to be adjusted for every application added to SAGE. No central registry support. July, 2007 GCB SAGE workshop
Problem Faced (cont. ) • SAGE 1. 4 b is unstable – Looking at SAGE 2. x integration with ROCKS – SAIL 3. 0 promises to handle error messages in a better way • Still is developed mainly for Linux then ported to Windows. July, 2007 GCB SAGE workshop
Online SAGE resources • For documentation, papers, latest stable releases: http: //www. evl. uic. edu/cavern/sage/ July, 2007 GCB SAGE workshop
Q and A ? July, 2007 GCB SAGE workshop
- Slides: 23