Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r421 - branches/itanium2/StandAlone


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r421 - branches/itanium2/StandAlone
  • Date: Sun, 3 Jul 2005 17:12:36 -0600 (MDT)

Author: abe
Date: Sun Jul  3 17:12:35 2005
New Revision: 421

Added:
   branches/itanium2/StandAlone/manta_tile_size.pl
Log:
Added script for testing tile sizes

Added: branches/itanium2/StandAlone/manta_tile_size.pl
==============================================================================
--- (empty file)
+++ branches/itanium2/StandAlone/manta_tile_size.pl     Sun Jul  3 17:12:35 
2005
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+
+
+######################################################################
+# Default args.
+$np    = 1;
+@min   = (1, 1);
+@max   = (32, 32);
+@bench = (5, 5);
+$file  = 0;
+
+######################################################################
+# Parse args.
+for ($i=0;$i<@ARGV;++$i) {
+    if ($ARGV[$i] eq "-np") {
+       $np = $ARGV[++$i];
+    }
+    elsif ($ARGV[$i] eq "-min") {
+       $res = $ARGV[++$i];
+       if ($res =~ /(\d+)x(\d+)/) {
+           $min[0] = $1;
+           $min[1] = $2;
+       }
+       else {
+           print "Bad resolution should be NxN\n";
+       }
+    }
+    elsif ($ARGV[$i] eq "-max") {
+       $res = $ARGV[++$i];
+       if ($res =~ /(\d+)x(\d+)/) {
+           $max[0] = $1;
+           $max[1] = $2;
+       }
+       else {
+           print "Bad resolution should be NxN\n";
+       }
+    }
+    elsif ($ARGV[$i] eq "-o") {
+       $file = $ARGV[++$i];
+
+    }
+    elsif ($ARGV[$i] eq "-bench") {
+       $bench[0] = $ARGV[++$i];
+       $bench[1] = $ARGV[++$i];
+    }    
+}
+
+# Determine output file.
+if (!$file) {
+
+    # Print usage.
+    print "Usage: manta_tile_size.pl -o <filename or ->\n";
+    print "\t-np <num procs>   (default 1)\n";
+    print "\t-min NxN          (default 1x1)\n";
+    print "\t-max NxN          (default 32x32)\n";
+    print "\t-o <out_file>     (required)\n";
+    print "\t-bench N M        (default is 5 5)\n";
+    exit(0);
+
+}
+elsif ($file ne "-") {
+    if (!open( $out, "+>".$file )) {
+       print "Could not open output file.\n";
+       exit(0);
+    }
+}
+else {
+    $out = STDOUT;
+}
+
+
+######################################################################
+######################################################################
+# Main benchmark.
+
+$iter = 0;
+$total = ($max[0]-$min[0]+1)*($max[1]-$min[1]+1);
+
+for ($y=$min[1];$y<=$max[1];++$y) {
+
+    for ($x=$min[0];$x<=$max[0];++$x) {
+       
+       # Create the command.
+       $command = "bin/manta " .
+           " -np " . $np .
+           " -ui null -imagedisplay null " .
+           " -bench " . $bench[0] . " " . $bench[1] . " " .
+           " -imagetraverser \"tiled( -tilesize " . $x . "x" . $y . " )\" ";
+
+       print "" . ($iter+1) . " of " . $total . 
+             " (" . (($iter+1)/$total*100) . "%)\n";
+       print $command . "\n";
+
+       # Run the command.
+       if (!open( CMD, $command . "|" )) {
+           print "Error command failed.\n";
+           return 0;
+       }
+
+       # Read the result 
+       $result = <CMD>;
+
+       # Output result.
+       print $out $result;
+
+       ++$iter;
+    }
+} 
+
+
+




  • [MANTA] r421 - branches/itanium2/StandAlone, abe, 07/03/2005

Archive powered by MHonArc 2.6.16.

Top of page