cell programming

Just another WordPress.com weblog

My first distributed program (My first convollution in Cell)

Last week I developed my first successful distributed program in Cell. It consist in perform a median filter on raw image data.

I developed two programs. The first one runs only on the PPU, the second one runs in both PPU and SPU. The SPU gives to the SPUs the information needed to perform its operations.

Once the ppm image is loaded, the information stored appears as a raw format: an array of bytes containing the corresponding RGB components of each pixel. The algorithm is quite simple but sometimes it could be difficult to apply SIMD instructions because the raw data has to be prepared for.

In the distributed program the PPU sends to the SPUs the following information:

  1. Pointer to the original image data.
  2. With of the original image.
  3. Heigh of the original image.
  4. Pointer to the destination image data.
  5. Initial row to compute.
  6. Final row to compute.

The SPUs are responsible of getting the data, apply the filter, compute the destintation memory for writting the result, and finally of writting the result.

The PPU loads the original image, reserve the required memory for the destination image, waits the SPUs to complete and at last writes the destination image to verify the algorithm works fine.

The load/store of the images hasn’t been taken in consideration, just the computing time.

Results for 256×196 image size

  • ONLY ON PPU:     Time spent [16.79] milliseconds
  • ON PPU AND SPUs: Time spent [3.38] milliseconds               4,96x

Results for 512×512 image size

  • ONLY ON PPU:     Time spent [88.59] milliseconds
  • ON PPU AND SPUs: Time spent [11.02] milliseconds               8,03x

March 16, 2008 Posted by Javier Sánchez Egido | Application, Cell | | 6 Comments