[cig-commits] commit: Adding some new commandline options for these scripts.

Mercurial hg at geodynamics.org
Mon Feb 1 15:30:14 PST 2010


changeset:   221:814cc1c4f5fc
branch:      1.4.x
parent:      216:eb68aaf81ec8
user:        JulianGiordani
date:        Tue Jan 05 13:04:38 2010 +1100
files:       script/checkpointTest-noStokes.pl script/checkpointTest-withConstant.pl script/checkpointTest.pl script/restartTest.pl script/systest.pl
description:
Adding some new commandline options for these scripts.
The '-serial' options will be useful for running small tests on lcuster machines which don't allow explicit use of mpirun or mpiexec.
Also the environment variable $UNDERWORLD_MPI can be set to specify the mpi binary to be used

Possible options are now:

   -optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
   -D <outputPath>           : the output path were the checkpoint files are directed.
   -c                        : will "create" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.
   -n <#>                    : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.
   -np <#>                   : the number of processors to run. (This value will overwrite the number of preocessors given in the optionsFile
   -serial                   : will execute test without any mpi binary prefix. (Overwrites "-np" option).
   -h                        : this help message


diff -r eb68aaf81ec8 -r 814cc1c4f5fc script/checkpointTest-noStokes.pl
--- a/script/checkpointTest-noStokes.pl	Tue Jan 05 13:53:42 2010 +1100
+++ b/script/checkpointTest-noStokes.pl	Tue Jan 05 13:04:38 2010 +1100
@@ -19,10 +19,14 @@ our $helpStr = "To run checkpoint tests:
 ./checkpointTest.pl <xmlFile> [ OPTIONS ]
 
 where OPTIONS:
-	-optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
-	-c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
-	-n                        : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
-	-h                        : this help message
+   -optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
+   -c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
+   -n <#>                    : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
+   -np <#>                   : the number of processors to run. (This value will overwrite the number of preocessors given in the optionsFile  
+   -serial                   : will execute test without any mpi binary prefix. (Overwrites \"-np\" option).
+   -h                        : this help message
+
+Also the environment variable \$UNDERWORLD_MPI can be set to specify the mpi binary to be used 
 
 EXAMPLE:
   ./checkpointTest.pl testVelicSolS.xml -optionsFile OFile.dat
@@ -55,16 +59,21 @@ sub runTests {
 	my @procs = (1,1,1,1);
 	my @commandLines = ""; #("--elementResI=32 --elementResJ=32 " );
 	my $outputPath = " ";
+   my $nProcs = -1;
+	my $isSerial = 0;
+	my $mpiBin = $ENV{'UNDERWORLD_MPI'};
 												
 	# check if xml exists and options file is specified
-	foreach $arg (@ARGV) {
+        for( $ii = 0; $ii < scalar(@ARGV); $ii++ ) {
+                $arg = $ARGV[$ii];
 		if( $arg =~ m/.*\.xml$/ ) { $xmlFile = $arg; }
 		elsif( $arg =~ m/\-optionsFile/ ) { $optFile = $ARGV[$ii+1]; $ii++; }
 		elsif( $arg =~ m/^\-h$/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-\-help$/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-c/ ) { $createTest=1; }
 		elsif( $arg =~ m/^\-n/ ) { $numberOfTimeSteps=$ARGV[$ii+1]; $ii++; }
-		$ii++;
+      elsif( $arg =~ m/^\-np/ ) { $nProcs=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-serial/ ) { $isSerial=1; }
 	}
 	if( $xmlFile eq " " ) { die "\n\n### ERROR ###\nNo xml file specified, stopped" ; }
 	if( !(-e $xmlFile) ) { die "\n\n### ERROR ###\nCannot find input file: $xmlFile, stopped" ; }
@@ -75,8 +84,15 @@ sub runTests {
 
 		# read in run options file
 		&readOptionsFile( $optFile, \@procs, \@commandLines );
+	}
+
+   # if commandline option np is valid use it
+   if( $nProcs > 0 ) { $procs[0] = $nProcs; }
+   if( $isSerial ) { $procs[0] = 1; }
+
+	if( $optFile ne " " ) {
 		print "\nUsing options file $optFile, specifed options are:\n-n $procs[0] "; foreach (@commandLines) { print "$_ "; }
-	}
+   }
 
 	my $exec = "udw"; # executable name
 	my $stdout;
@@ -170,8 +186,16 @@ sub runTests {
 	}
 	&executeCommandline($command);
 
-	# run test case
-	$command = "mpiexec -n $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   # run test case
+   if( defined($mpiBin) ) { # if custom mpi is specified use it
+      $command = "$mpiBin -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( $isSerial ) { # if the serial flag is specified don't add anything parallel
+      $command = "./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( !defined($mpiBin) && !$isSerial ) { # by default use mpich2 standard
+      $command = "mpiexec -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
 	$command .= " 2>$stderr";
 	print "$command";
 	&executeCommandline( $command );
diff -r eb68aaf81ec8 -r 814cc1c4f5fc script/checkpointTest-withConstant.pl
--- a/script/checkpointTest-withConstant.pl	Tue Jan 05 13:53:42 2010 +1100
+++ b/script/checkpointTest-withConstant.pl	Tue Jan 05 13:04:38 2010 +1100
@@ -19,14 +19,18 @@ our $helpStr = "To run checkpoint tests:
 ./checkpointTest.pl <xmlFile> [ OPTIONS ]
 
 where OPTIONS:
-	-optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
-	-c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
-	-n                        : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
-	-h                        : this help message
+   -optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
+   -c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
+   -n <#>                    : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
+   -np <#>                   : the number of processors to run. (This value will overwrite the number of preocessors given in the optionsFile  
+   -serial                   : will execute test without any mpi binary prefix. (Overwrites \"-np\" option).
+   -h                        : this help message
+
+Also the environment variable \$UNDERWORLD_MPI can be set to specify the mpi binary to be used 
 
 EXAMPLE:
-  ./checkpointTest.pl testVelicSolS.xml -optionsFile OFile.dat
-		(Runs with option file OFile.dat and checks against the expected file)
+   ./checkpointTest.pl testVelicSolS.xml -optionsFile OFile.dat
+	   (Runs with option file OFile.dat and checks against the expected file)
 	
 ";
 
@@ -55,6 +59,9 @@ sub runTests {
 	my @procs = (1,1,1,1);
 	my @commandLines = ""; #("--elementResI=32 --elementResJ=32 " );
 	my $outputPath = " ";
+   my $nProcs = -1;
+	my $isSerial = 0;
+	my $mpiBin = $ENV{'UNDERWORLD_MPI'};
 												
 	# check if xml exists and options file is specified
         for( $ii = 0; $ii < scalar(@ARGV); $ii++ ) {
@@ -65,6 +72,8 @@ sub runTests {
 		elsif( $arg =~ m/^\-\-help$/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-c/ ) { $createTest=1; }
 		elsif( $arg =~ m/^\-n/ ) { $numberOfTimeSteps=$ARGV[$ii+1]; $ii++; }
+      elsif( $arg =~ m/^\-np/ ) { $nProcs=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-serial/ ) { $isSerial=1; }
 	}
 	if( $xmlFile eq " " ) { die "\n\n### ERROR ###\nNo xml file specified, stopped" ; }
 	if( !(-e $xmlFile) ) { die "\n\n### ERROR ###\nCannot find input file: $xmlFile, stopped" ; }
@@ -75,8 +84,15 @@ sub runTests {
 
 		# read in run options file
 		&readOptionsFile( $optFile, \@procs, \@commandLines );
+	}
+
+   # if commandline option np is valid use it
+   if( $nProcs > 0 ) { $procs[0] = $nProcs; }
+   if( $isSerial ) { $procs[0] = 1; }
+
+	if( $optFile ne " " ) {
 		print "\nUsing options file $optFile, specifed options are:\n-n $procs[0] "; foreach (@commandLines) { print "$_ "; }
-	}
+   }
 
 	my $exec = "udw"; # executable name
 	my $stdout;
@@ -173,8 +189,16 @@ sub runTests {
 	}
 	&executeCommandline($command);
 
-	# run test case
-	$command = "mpiexec -n $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   # run test case
+   if( defined($mpiBin) ) { # if custom mpi is specified use it
+      $command = "$mpiBin -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( $isSerial ) { # if the serial flag is specified don't add anything parallel
+      $command = "./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( !defined($mpiBin) && !$isSerial ) { # by default use mpich2 standard
+      $command = "mpiexec -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
 	$command .= " 2>$stderr";
 	print "$command";
 	&executeCommandline( $command );
diff -r eb68aaf81ec8 -r 814cc1c4f5fc script/checkpointTest.pl
--- a/script/checkpointTest.pl	Tue Jan 05 13:53:42 2010 +1100
+++ b/script/checkpointTest.pl	Tue Jan 05 13:04:38 2010 +1100
@@ -21,8 +21,12 @@ where OPTIONS:
 where OPTIONS:
 	-optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
 	-c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
-	-n                        : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
+   -n <#>                    : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
+	-np <#>                   : the number of processors to run. (This value will overwrite the number of preocessors given in the optionsFile  
+   -serial                   : will execute test without any mpi binary prefix. (Overwrites \"-np\" option).
 	-h                        : this help message
+
+Also the environment variable \$UNDERWORLD_MPI can be set to specify the mpi binary to be used 
 
 EXAMPLE:
   ./checkpointTest.pl testVelicSolS.xml -optionsFile OFile.dat
@@ -55,16 +59,21 @@ sub runTests {
 	my @procs = (1,1,1,1);
 	my @commandLines = ""; #("--elementResI=32 --elementResJ=32 " );
 	my $outputPath = " ";
+   my $nProcs = -1;
+	my $isSerial = 0;
+	my $mpiBin = $ENV{'UNDERWORLD_MPI'};
 												
 	# check if xml exists and options file is specified
-	foreach $arg (@ARGV) {
+        for( $ii = 0; $ii < scalar(@ARGV); $ii++ ) {
+                $arg = $ARGV[$ii];
 		if( $arg =~ m/.*\.xml$/ ) { $xmlFile = $arg; }
 		elsif( $arg =~ m/\-optionsFile/ ) { $optFile = $ARGV[$ii+1]; $ii++; }
 		elsif( $arg =~ m/^\-h$/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-\-help$/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-c/ ) { $createTest=1; }
 		elsif( $arg =~ m/^\-n/ ) { $numberOfTimeSteps=$ARGV[$ii+1]; $ii++; }
-		$ii++;
+      elsif( $arg =~ m/^\-np/ ) { $nProcs=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-serial/ ) { $isSerial=1; }
 	}
 	if( $xmlFile eq " " ) { die "\n\n### ERROR ###\nNo xml file specified, stopped" ; }
 	if( !(-e $xmlFile) ) { die "\n\n### ERROR ###\nCannot find input file: $xmlFile, stopped" ; }
@@ -75,8 +84,15 @@ sub runTests {
 
 		# read in run options file
 		&readOptionsFile( $optFile, \@procs, \@commandLines );
+	}
+
+   # if commandline option np is valid use it
+   if( $nProcs > 0 ) { $procs[0] = $nProcs; }
+   if( $isSerial ) { $procs[0] = 1; }
+
+	if( $optFile ne " " ) {
 		print "\nUsing options file $optFile, specifed options are:\n-n $procs[0] "; foreach (@commandLines) { print "$_ "; }
-	}
+   }
 
 	my $exec = "udw"; # executable name
 	my $stdout;
@@ -172,8 +188,16 @@ sub runTests {
 	}
 	&executeCommandline($command);
 
-	# run test case
-	$command = "mpiexec -n $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   # run test case
+   if( defined($mpiBin) ) { # if custom mpi is specified use it
+      $command = "$mpiBin -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( $isSerial ) { # if the serial flag is specified don't add anything parallel
+      $command = "./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( !defined($mpiBin) && !$isSerial ) { # by default use mpich2 standard
+      $command = "mpiexec -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
 	$command .= " 2>$stderr";
 	print "$command";
 	&executeCommandline( $command );
diff -r eb68aaf81ec8 -r 814cc1c4f5fc script/restartTest.pl
--- a/script/restartTest.pl	Tue Jan 05 13:53:42 2010 +1100
+++ b/script/restartTest.pl	Tue Jan 05 13:04:38 2010 +1100
@@ -19,13 +19,17 @@ our $helpStr = "To run restart tests:
 ./restartTest.pl <xmlFile> [ OPTIONS ]
 
 where OPTIONS:
-	-optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
-	-n                        : the timestep checkpoint writing (if -c is defined). testing will occur at twice this timestep
-	-h                        : this help message
+   -optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
+   -n  <#>                   : the timestep checkpoint writing. Testing will occur at twice this timestep
+   -np <#>                   : the number of processors to run. (This value will overwrite the number of preocessors given in the optionsFile  
+   -serial                   : will execute test without any mpi binary prefix. (Overwrites \"-np\" option).
+   -h                        : this help message
+
+Also the environment variable \$UNDERWORLD_MPI can be set to specify the mpi binary to be used 
 
 EXAMPLE:
   ./restartTest.pl RayleighTaylorBenchmark.xml -optionsFile OFile.dat
-		(Runs with option file OFile.dat and checks against the expected file)
+   (Runs with option file OFile.dat and checks against the expected file)
 	
 ";
 
@@ -53,16 +57,22 @@ sub runTests {
 	my @procs = (1,1,1,1);
 	my @commandLines = ""; #("--elementResI=32 --elementResJ=32 " );
 	my $outputPath = " ";
+   my $nProcs = -1;
+	my $isSerial = 0;
+	my $mpiBin = $ENV{'UNDERWORLD_MPI'};
 												
 	# check if xml exists and options file is specified
-	foreach $arg (@ARGV) {
+   for( $ii = 0 ; $ii < scalar(@ARGV) ; $ii++ ) {
+      $arg = $ARGV[$ii];
 		if( $arg =~ m/.*\.xml$/ ) { $xmlFile = $arg; }
 		elsif( $arg =~ m/\-optionsFile/ ) { $optFile = $ARGV[$ii+1]; $ii++; }
 		elsif( $arg =~ m/^\-h$/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-\-help$/ ) { print $helpStr; exit }
-		elsif( $arg =~ m/^\-n/ ) { $checkpointAndRestartAt=$ARGV[$ii+1]; $ii++; }
-		$ii++;
+		elsif( $arg =~ m/^\-n$/ ) { $checkpointAndRestartAt=$ARGV[$ii+1]; $ii++; }
+      elsif( $arg =~ m/^\-np/ ) { $nProcs=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-serial/ ) { $isSerial=1; }
 	}
+
 	my $numberOfTimeSteps = 2*$checkpointAndRestartAt; # testing timestep is twice that of checkpoint	
 	if( $xmlFile eq " " ) { die "\n\n### ERROR ###\nNo xml file specified, stopped" ; }
 	if( !(-e $xmlFile) ) { die "\n\n### ERROR ###\nCannot find input file: $xmlFile, stopped" ; }
@@ -73,8 +83,15 @@ sub runTests {
 
 		# read in run options file
 		&readOptionsFile( $optFile, \@procs, \@commandLines );
+	}
+
+   # if commandline option np is valid use it
+   if( $nProcs > 0 ) { $procs[0] = $nProcs; }
+   if( $isSerial ) { $procs[0] = 1; }
+
+	if( $optFile ne " " ) {
 		print "\nUsing options file $optFile, specifed options are:\n-n $procs[0] "; foreach (@commandLines) { print "$_ "; }
-	}
+   }
 
 	my $exec = "udw"; # executable name
 	my $stdout;
@@ -172,7 +189,15 @@ sub runTests {
 	print "\n--- Performing the initial run, checkpointing every $checkpointAndRestartAt steps, running for $numberOfTimeSteps steps ---\n";
 
 	# perform initial run
-	$command = "mpiexec -n $procs[0] ./$exec $xmlFile help.xml $commandLines[0] >$stdout";
+   if( defined($mpiBin) ) { # if custom mpi is specified use it
+      $command = "$mpiBin -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( $isSerial ) { # if the serial flag is specified don't add anything parallel
+      $command = "./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( !defined($mpiBin) && !$isSerial ) { # by default use mpich2 standard
+      $command = "mpiexec -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
 	$command .= " 2>$stderr";
 	print "$command";
 	&executeCommandline( $command );
@@ -202,7 +227,15 @@ sub runTests {
 	print "\n\n--- Performing the restart run, restarting at step $checkpointAndRestartAt and comparing with initial run at step $numberOfTimeSteps ---\n";
 
 	# perform restart run
-	$command = "mpiexec -n $procs[0] ./$exec $xmlFile help.xml $commandLines[0] >$stdout";
+   if( defined($mpiBin) ) { # if custom mpi is specified use it
+      $command = "$mpiBin -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( $isSerial ) { # if the serial flag is specified don't add anything parallel
+      $command = "./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( !defined($mpiBin) && !$isSerial) { # by default use mpich2 standard
+      $command = "mpiexec -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
 	$command .= " 2>$stderr";
 	print "$command";
 	&executeCommandline( $command );
diff -r eb68aaf81ec8 -r 814cc1c4f5fc script/systest.pl
--- a/script/systest.pl	Tue Jan 05 13:53:42 2010 +1100
+++ b/script/systest.pl	Tue Jan 05 13:04:38 2010 +1100
@@ -16,17 +16,22 @@ our $cvgFileName = "";
 our $cvgFileName = "";
 our $helpStr = "To run checkpoint tests:
 
-./$ARGV[0] <xmlFile> [ OPTIONS ]
+   systest.pl <xmlFile> [ OPTIONS ]
 
 where OPTIONS:
-	-optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
-	-c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
-	-n                        : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
-	-h                        : this help message
+   -optionsFile <fileName>   : where <fileName> is the options file. Command line agruments in StGermain format.
+   -D <outputPath>           : the output path were the checkpoint files are directed.  
+   -c                        : will \"create\" checkpointed data only. By default this flag in not set and the script only checks against previous checkpointed data.  
+   -n <#>                    : the timestep checkpoint writing (if -c is defined) or checkpoint testing will occur on. By default this is timestep 10.  
+   -np <#>                   : the number of processors to run. (This value will overwrite the number of preocessors given in the optionsFile  
+   -serial                   : will execute test without any mpi binary prefix. (Overwrites \"-np\" option).
+   -h                        : this help message
+
+Also the environment variable \$UNDERWORLD_MPI can be set to specify the mpi binary to be used 
 
 EXAMPLE:
-  ./checkpointTest.pl testVelicSolS.xml -optionsFile OFile.dat
-		(Runs with option file OFile.dat and checks against the expected file)
+  ./systest.pl RayleighTaylorBenchmark.xml -optionsFile OFile.dat
+   (Runs with option file OFile.dat and checks against the expected file)
 	
 ";
 
@@ -55,17 +60,22 @@ sub runTests {
 	my @procs = (1,1,1,1);
 	my @commandLines = ""; #("--elementResI=32 --elementResJ=32 " );
 	my $outputPath = "./expected/";
+	my $nProcs = -1;
+	my $isSerial = 0;
+	my $mpiBin = $ENV{'UNDERWORLD_MPI'};
 												
 	# check if xml exists and options file is specified
    for( $ii = 0 ; $ii < scalar(@ARGV) ; $ii++ ) {
       $arg = $ARGV[$ii];
 		if( $arg =~ m/.*\.xml$/ ) { $xmlFile = $arg; }
 		elsif( $arg =~ m/\-optionsFile/ ) { $optFile = $ARGV[$ii+1]; $ii++; }
-		elsif( $arg =~ m/^\-h$/ ) { print $helpStr; exit }
-		elsif( $arg =~ m/^\-\-help$/ ) { print $helpStr; exit }
+		elsif( $arg =~ m/^\-h/ ) { print $helpStr; exit }
+		elsif( $arg =~ m/^\-\-help/ ) { print $helpStr; exit }
 		elsif( $arg =~ m/^\-c/ ) { $createTest=1; }
-		elsif( $arg =~ m/^\-n/ ) { $numberOfTimeSteps=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-n$/ ) { $numberOfTimeSteps=$ARGV[$ii+1]; $ii++; }
 		elsif( $arg =~ m/^\-D/ ) { $outputPath=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-np/ ) { $nProcs=$ARGV[$ii+1]; $ii++; }
+		elsif( $arg =~ m/^\-serial/ ) { $isSerial=1; }
 	}
 	if( $xmlFile eq " " ) { die "\n\n### ERROR ###\nNo xml file specified, stopped" ; }
 	if( !(-e $xmlFile) ) { die "\n\n### ERROR ###\nCannot find input file: $xmlFile, stopped" ; }
@@ -76,8 +86,15 @@ sub runTests {
 
 		# read in run options file
 		&readOptionsFile( $optFile, \@procs, \@commandLines );
+	}
+
+   # if commandline option np is valid use it
+   if( $nProcs > 0 ) { $procs[0] = $nProcs; }
+   if( $isSerial ) { $procs[0] = 1; }
+
+	if( $optFile ne " " ) {
 		print "\nUsing options file $optFile, specifed options are:\n-n $procs[0] "; foreach (@commandLines) { print "$_ "; }
-	}
+   }
 
 	my $exec = "udw"; # executable name
 	my $stdout;
@@ -176,7 +193,15 @@ sub runTests {
 	&executeCommandline($command);
 
 	# run test case
-	$command = "mpiexec -n $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   if( defined($mpiBin) ) { # if custom mpi is specified use it
+      $command = "$mpiBin -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( $isSerial ) { # if the serial flag is specified don't add anything parallel
+      $command = "./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
+   if( !defined($mpiBin) && !$isSerial ) { # by default use mpich2 standard
+      $command = "mpiexec -np $procs[0] ./$exec $xmlFile help.xml $commandLines[0] --pluginData.appendToAnalysisFile=True >$stdout";
+   }
 	$command .= " 2>$stderr";
 	print "$command";
 	&executeCommandline( $command );



More information about the CIG-COMMITS mailing list