Configuring a Distributed Application
Creating a distributed application is relatively straightforward to do. The only two things required are to match the viewport of the window opened to the viewport of the tiled display, and to create a tiles.cfg file. After those are accounted for just compile the application with MPI enabled and you have a distributed application.
Matching the Viewport
When a window is resized in any application the content in the window may end up warped and hard to view properly. The same thing happens when a graphics application's window is resized to an improper aspect ratio. Shade does not communicate to a distributed application what the total resolution of the tiled display is. It is left up to the developer to create the proper aspect ratio for the display so everything is drawn properly.
If the dimensions of the window created on the master node are multiples of the total resolution of the tiled display then the scene displayed on the master node will be identical to the scene displayed on the tiled display.
The Configuration File
Whenever a distributed application is run the application will check within its current directory for a file named tiles.cfg. This is a simple text file describing the layout of the slave nodes making up the tiled display. The format is as follows.
Name of the computer Number of surfaces to create (equal to the number of attached displays) Resolution of the window (width, height) For each surface Local surface attributes (left, right, top, bottom) Global surface attributes (left, right, top, bottom)
Lets consider a cluster of three computers. Each computer has two displays attached to it, with each display having a native resolution of 2560x1600 pixels. The displays for each computer are arranged vertically for a total resolution of 2560x3200 on each computer. So the first computer's definition in the tiles.cfg file would look like this
server1 2560 3600 2 0.0 1.0 1.0 0.5 ...fill in the global values later... 0.0 1.0 0.5 0.0 ...fill in the global values later...
Next up is determining the values of the global surface. For this tiled display the tiles are arranged in a 3x2 fashion as seen in the picture below
Each display has a total width of 690mm and a total height of 449.55mm. The viewable width of the display is 641.28mm and a viewable height of 400.8mm. So after some computation we determine that the width of the tiled display is 2021.28mm and the height of the tiled display is 850.35mm. The formula for computing this number is (totalWidth * numberOfDisplays) - (totalWidth - viewableWidth). So we just need to calculate the percentage of the display used for each local surface. Calculating all the values for each display gives us the following configuration file.
server1 2560 3200 2 0.0 1.0 1.0 0.5 0.682735692 1.0 1.0 0.528664667 0.0 1.0 0.5 0.0 0.682735692 1.0 0.471335333 0.0 server2 2560 3200 2 0.0 1.0 1.0 0.5 0.341367846 0.658632154 1.0 0.528664667 0.0 1.0 0.5 0.0 0.341367846 0.658632154 0.471335333 0.0 server3 2560 3200 2 0.0 1.0 1.0 0.5 0.0 0.317264308 1.0 0.528664667 0.0 1.0 0.5 0.0 0.0 0.317264308 0.471335333 0.0
When loaded this file will correctly display the scene exactly as it is displayed on the desktop window.
Automated Tools
Calculating by hand the global surface for a tiled display is time consuming but fairly straightforward. Unfortunately, at the time of this writing there is no way to generate a tiles.cfg file automatically. A tool for creating a tiles.cfg will be bundled with the official 1.0 release of Shade.