Tutorial for Handling Files
===========================

Content

This tutorial shows how to pass files to and from a remote host. In the example
a tool is developed which allows you to distribute the task of rendering POV
files across a GridSolve network. Povray is executed at the servers to render a
part of the picture and the parts from all the server are put together from the
client. The tutorial includes the following steps:

  1. building and configuring the library
  2. installing the problem to the GridSolve repository
  3. rendering a test image via GridSolve


Requirements

o on each server
  o libpovray.c
  o povray.idl - a file which describes how the problem should be included
               into the GridSolve repository (Interface Definition Language)
  o the image renderer PovRay - available at http://www.povray.org/
o on the client
  o gspovray.c - the client program which invokes the various instances of
    PovRay via GridSolve and puts together the final image
  o *.pov and *.ini - sample PovRay files
  o the image processing tool ImageMagick - available at
    http://www.imagemagick.org/
  o the mpeg encoder mpeg_encode - available at
    http://bmrc.berkeley.edu/frame/research/mpeg/mpeg_encode.html
  o the Netpbm library - available at
    http://netpbm.sourceforge.net/
  o Multiple Move (mmv) - available at
    http://http.us.debian.org/debian/pool/main/m/mmv/mmv_1.01b.orig.tar.gz



Instructions
------------

1.  Building and Configuring the Library

  o At first make sure to have a working copy of PovRay
    (http://www.povray.org/) on the server. Either it is already installed or
    otherwise download it and run(configure and make). To test povray try to
    render a POV file on the server,e.g. (assuming icl.pov in the current
    directory):

    $ povray +Iicl.pov +Oicl.png +L/home/user/povray/include

  o Edit libpovray.c and provide in the first two lines the povray executable
    (if the executable is not in your PATH include the path) and the path to
    the PovRay include directory (contains all the INC files)

  o Execute the following steps to build libpovray.a
    $ cd $GRIDSOLVE_ROOT/examples/C/povray
    $ make libpovray.a

2. Installing the Problem to the GridSolve Repository

  o Use the GridSolve IDL compiler to generate the service executable from
    povray.idl.
    $ $GRIDSOLVE_ROOT/src/problem/GS_problem_compile povray.idl
    if the server is already running, it should register the new problem
    automatically within a couple of minutes.  There's no need to restart 
    the server.

3. Rendering a Test Image Via GridSolve

  The file gspovray.c demonstrates how to invoke the newly created function
  povray via GridSolve.
  o edit gspovray.c and provide in the first three lines the path to
    ImageMagick, mpeg_encode and mmv.
  o edit animation.parm and set in the 4. line the path to the programm
    tgatoppm if it is not in your path.
  o Compile gspovray then with the following command:

  $ cd $GRIDSOLVE_ROOT/examples/C/povray
  $ make gspovray

  To render an example file you have the following options:
  o blocking calls: provides exactly the same syntax as calling povray, but use
    the command gspovray instead; e.g.:
    $ ./gspovray +Iicl.pov +Oicl.png +H400 +W500

  o non-blocking calls: uses non-blocking calls and is invoked with the option
    '-nonblocking'; additionally you can specify with the '-n' option how many
    instances (= parallel GridSolve calls) you want to start;e.g.:
    $ ./gspovray +Iicl1.pov +Oicl1.png +H400 +W500 -n2 -nonblocking

  o task-farming: again as above but use with the option '-farming'; to produce
    an animation use for example:
    $ ./gspovray icl_animation.ini -oanimation.mpg -n2 -farming

Note: Be sure to have an agent and at least one instance of the new server
running. Also check that the GRIDSOLVE_AGENT enironment variable is set on the
client.

Last modified: July 27th, 2003
Christoph L. Fabianek, fabianek@cs.utk.edu
