6.2 How to use liveViz with CHARM++ program

The liveViz routines are in the Charm++ header ``liveViz.h''.

A typical program provides a chare array with one entry method with the following prototype:

  entry void functionName(liveVizRequestMsg *m);

This entry method is supposed to deposit its (array element's) chunk of the image. This entry method has following structure:

  void myArray::functionName (liveVizRequestMsg *m)
  {
    // prepare image chunk
       ...

    liveVizDeposit (m, startX, startY, width, height, imageBuff, this);

    // delete image buffer if it was dynamically allocated
  }

Here, ``width'' and ``height'' are the size, in pixels, of this array element's portion of the image, contributed in ``imageBuff'' (described below). This will show up on the client's assembled image at 0-based pixel (startX,startY). The client's display width and height are stored in m->req.wid and m->req.ht.

By default liveViz combines image chunks by doing a saturating sum of overlapping pixel values. If you want liveViz to combine image chunks by using max (i.e. for overlapping pixels in deposited image chunks, final image will have the pixel with highest intensity or in other words largest value), you need to pass one more parameter (liveVizCombine_t) to the ``liveVizDeposit'' function:

 liveVizDeposit (m, startX, startY, width, height, imageBuff, this,
                   max_image_data);

You can also reduce floating-point image data using sum_float_image_data or max_float_image_data.

November 23, 2009
Charm Homepage