Version 0 of Running a Cuda program from a Tcl loop

Updated 2009-12-22 14:19:54 by theover

I'm into High Definition video filming and processing, and wanted to get a fast Cuda based image filter to act on a number of frames of some HD footage I shot, so of course I called for the help of a Tcl program.

I appears a command line version foa cuda 1.3 filter program can be run with no problems reported thus far from a normal tcl script (version 8.5, on Fedora 10/64) with simple tricks:

 foreach i [lsort -dict [glob /T/home/theo/Fc10/Frames/00*.ppm]] {
   set im [file tail $i]
   puts -nonewline " $im "
   flush stdout
   exec ~theo/Cuda/C/bin/linux/release/recursiveGaussian -image=$im -sigma=0.3 -qatest << "\n"

   exec mv lena_10.ppm /T/home/theo/Fc10/Frames/cu/$im
   puts -nonewline ","
   flush stdout
 }

Clearly a hack, but now I get gaussian filtred 1829x1080 HD frames automatically from a set of recorded frames, with such a heay filter run in under as second per invocation+result save (The cude smoothing filter itself runs over 12 per second on the machine). For those who want to experiment with this here is the diff from the cuda program compared with the 1.3 devkit:

 80c80
 < float sigma = 0.333f;
 ---
 > float sigma = 10.0f;
 390,391d389
 < //    sigma += 4;
 < 
 397a396
 >     while (sigma <= 22) {    
 404d402
 <     cutilCheckError( cutStopTimer( timer));
 406c404,406
 < //            g_TotalErrors++;
 ---
 >         if (!g_CheckRender->PPMvsPPM(sOriginal[g_Index], sReference[g_Index], MAX_EPSILON_ERROR, THRESHOLD)) {
 >             g_TotalErrors++;
 >         }
 407a408,409
 >         sigma += 4;
 >     }
 408a411
 >     cutilCheckError( cutStopTimer( timer));

Nothing all too fancy.

This approach would also work with BWise as processing block interface, which I think could be cool.

Example frame just after smoothing:

http://82.171.148.176/Wiki/00000033.png

Other frame after additonal postprocessing and playing back mp4 of that:

http://82.171.148.176/Wiki/Screenshot-Untitled%20Window.png