diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2007-01-18 10:12:25 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2007-01-18 10:12:25 +0000 |
commit | e7430df8803343554e8484c02d992e3b42b766d5 (patch) | |
tree | e0420459117e5991ac45da3b54fe40ff6e6e7a48 | |
parent | 2cdc4de7af6b210a0ee3ca3503a9f069742d5f30 (diff) |
Implement and document the new possibility to specify the number of processors
required to run a testsuite in a thorn's test.ccl configuration file.
This closes PR 2078/Cactus: "specify the number of processors required to run a
testsuite".
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4401 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | doc/UsersGuide/ThornWriters.tex | 14 | ||||
-rw-r--r-- | lib/sbin/RunTest.pl | 2 | ||||
-rw-r--r-- | lib/sbin/RunTestUtils.pl | 173 |
3 files changed, 116 insertions, 73 deletions
diff --git a/doc/UsersGuide/ThornWriters.tex b/doc/UsersGuide/ThornWriters.tex index 13a44076..2f0d0bec 100644 --- a/doc/UsersGuide/ThornWriters.tex +++ b/doc/UsersGuide/ThornWriters.tex @@ -3527,18 +3527,20 @@ rest of the line is a comment. If the last non-blank character of a line in a config file is a backslash `\texttt{$\backslash$}', the following line is treated as a continuation of the current line. Options include test specific absolute and relative tolerances, thorn -specific absolute and relative tolerances and file extensions. The -configuration file has the form: +specific absolute and relative tolerances, the number of procesors required +to run, and file extensions. The configuration file has the form: \begin{alltt} ABSTOL <\var{thorn_absolute_tolerance}> RELTOL <\var{thorn_relative_tolerance}> +NPROCS <\var{thorn_nprocs}> EXTENSIONS <\var{extension_1} \var{extension_2} \var{extension_3}> TEST <\var{test_example}> \{ ABSTOL <\var{absolute_tol}> RELTOL <\var{relative_tol}> + NPROCS <\var{nprocs}> \} \end{alltt} @@ -3546,8 +3548,12 @@ which states that when comparing files of test \verb|test_example|, \verb|absolute_tol| and \verb|relative_tol| {\space} should be used as the absolute and relative tolerances. For all other tests in the thorn, the default value of absolute and relative tolerances are set -to \verb|thorn_absolute_tolerance| and -\verb|thorn_relative_tolerance|. The \texttt{EXTENSIONS} option adds +to \verb|thorn_absolute_tolerance| and \verb|thorn_relative_tolerance|. +The \texttt{NPROCS} option specifies the number of processors required to +run a given testsuite \var{test\_example} or all testsuites of a thorn +successfully. If no \texttt{NPROCS} option is present, the testsuite(s) +are assumed to run with any number of processors. +The \texttt{EXTENSIONS} option adds \verb|extension_1|, \verb|extension_2| and \verb|extension_3| to the list of file extensions that are compared. This list is global over all tests in a configuration. diff --git a/lib/sbin/RunTest.pl b/lib/sbin/RunTest.pl index 55ef0daa..2ee02192 100644 --- a/lib/sbin/RunTest.pl +++ b/lib/sbin/RunTest.pl @@ -57,7 +57,7 @@ $testdata = &ParseTestConfigs($testdata,$config_data,\%runconfig); $testdata = &FindTestArchiveFiles($testdata); # Parse test parameter files -$testdata = &ParseAllParameterFiles($testdata); +$testdata = &ParseAllParameterFiles($testdata,$config_data,\%runconfig); # Print database #&PrintDataBase($testdata); diff --git a/lib/sbin/RunTestUtils.pl b/lib/sbin/RunTestUtils.pl index 5dc51115..77faf9cd 100644 --- a/lib/sbin/RunTestUtils.pl +++ b/lib/sbin/RunTestUtils.pl @@ -145,62 +145,68 @@ sub ParseParFile sub ParseTestConfigs { - my($testdata,$config_data,$runconfig) = @_; + my($testdata,$config_data,$rundata) = @_; my($line_number, $line); my($test, $ABSTOL, $RELTOL); + my $arrangement_dir = "$config_data->{'CCTK_DIR'}${sep}arrangements${sep}"; foreach $thorn (split(" ",$testdata->{"THORNS"})) { - $arrangement = $testdata->{"$thorn ARRANGEMENT"}; - if (-r "$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}test.ccl" && -r "$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}config") - { - print " Thorn $thorn has a test.ccl file and a config file.\n Config files will be deprecated, using test.ccl file.\n"; - @config = &read_file("$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}config"); - } - elsif(-r "$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}test.ccl") + my $testdir = $arrangement_dir . $testdata->{"$thorn ARRANGEMENT"} . + "${sep}$thorn${sep}test"; + my $old_config_file = "$testdir${sep}test.ccl"; + my $new_config_file = "$testdir${sep}config"; + my $config_file = ''; + + if (-r $old_config_file and -r $new_config_file) { - @config = &read_file("$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}test.ccl"); + print " Thorn $thorn has a test.ccl file and a config file.\n" . + " Config files will be deprecated, using test.ccl file.\n"; + $config_file = $new_config_file; } - elsif(-r "$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}config") + elsif (-r $new_config_file) { - @config = &read_file("$config_data->{\"CCTK_DIR\"}${sep}arrangements${sep}$arrangement${sep}$thorn${sep}test${sep}config"); + $config_file = $new_config_file; } - else + elsif (-r $old_config_file) { - next; + $config_file = $old_config_file; } + next unless ($config_file); - - if ($config) + my @config = &read_file($config_file); + for($line_number = 0; $line_number < @config; $line_number++) { - $global = 1; - for($line_number = 0; $line_number < @config; $line_number++) - { - $line = $config[$line_number]; + $line = $config[$line_number]; - # Parse tokens - if ($line =~ m/^\s*ABSTOL\s*(.*)/i) - { - $ABSTOL = $runconfig->{"$thorn ABSTOL"}=$1; - } - elsif ($line =~ m/^\s*RELTOL\s*(.*)/i) - { - $RELTOL = $runconfig->{"$thorn RELTOL"}=$1; - } - elsif ($line =~ m/^\s*EXTENSIONS\s*(.*)/i) - { - $testdata->{"EXTENSIONS"} .= "$1 "; - } - elsif ($line =~ m/^\s*TEST\s*(.*)/i) - { - ($test, $ABSTOL, $RELTOL, $line_number) = &ParseTestBlock($line_number, \@config); - $runconfig->{"$thorn $test ABSTOL"} = $ABSTOL; - $runconfig->{"$thorn $test RELTOL"} = $RELTOL; - } - else - { - print " Unrecognised token $line in config file for thorn $thorn\n"; - } + # Parse tokens + if ($line =~ m/^\s*ABSTOL\s*(.*)/i) + { + $ABSTOL = $rundata->{"$thorn ABSTOL"}=$1; + } + elsif ($line =~ m/^\s*RELTOL\s*(.*)/i) + { + $RELTOL = $rundata->{"$thorn RELTOL"}=$1; + } + elsif ($line =~ m/^\s*NPROCS\s+(\d+)\s*$/i) + { + $NPROCS = $rundata->{"$thorn NPROCS"} = $1; + } + elsif ($line =~ m/^\s*EXTENSIONS\s*(.*)/i) + { + $testdata->{"EXTENSIONS"} .= "$1 "; + } + elsif ($line =~ m/^\s*TEST\s*(.*)/i) + { + ($test, $ABSTOL, $RELTOL, $NPROCS, $line_number) = + &ParseTestBlock($line_number, \@config); + $rundata->{"$thorn $test ABSTOL"} = $ABSTOL; + $rundata->{"$thorn $test RELTOL"} = $RELTOL; + $rundata->{"$thorn $test NPROCS"} = $NPROCS; + } + else + { + print " Unrecognised token $line in config file for thorn $thorn\n"; } } } @@ -211,11 +217,7 @@ sub ParseTestConfigs sub ParseTestBlock { my ($line_number, $data) = @_; - my ($Test, $ABSTOL, $RELTOL); - - $Test = ""; - $ABSTOL = ""; - $RELTOL = ""; + my ($Test, $ABSTOL, $RELTOL, $NPROCS) = (); $data->[$line_number] =~ m/^\s*PROVIDES\s*(.*)/i; @@ -242,6 +244,11 @@ sub ParseTestBlock $RELTOL = $1; next; } + elsif ($data->[$line_number] =~ m/^\s*NPROCS\s+(\d+)\s*$/i) + { + $NPROCS = $1; + next; + } elsif($data->[$line_number] =~ m:\s*\}\s*:) { # do nothing. @@ -252,7 +259,7 @@ sub ParseTestBlock } } } - return ($Test, $ABSTOL, $RELTOL, $line_number); + return ($Test, $ABSTOL, $RELTOL, $NPROCS, $line_number); } sub FindTestArchiveFiles @@ -634,13 +641,32 @@ sub WriteFullResults $message = " Tests missed for lack of thorns:\n"; $missingtests = 0; - foreach $thorn (split(" ",$testdata->{"UNRUNNABLETHORNS"})) + foreach $thorn (split(' ',$testdata->{'THORNS'})) + { + foreach $parfile (split(' ',$testdata->{"$thorn TESTS"})) + { + my $missing = $testdata->{"$thorn $parfile MISSING"}; + next unless ($missing); + $message .= "\n ".$parfile." in ". $thorn."\n"; + $message .= " (". $testdata->{"$thorn $parfile DESC"}.")\n"; + $message .= " Missing: $missing\n"; + $missingtests++; + } + } + print "$message\n" if ($missingtests > 0); + + # Different number of processors required + $message = " Tests missed for different number of processors required:\n"; + $missingtests = 0; + foreach $thorn (split(' ',$testdata->{'THORNS'})) { - foreach $parfile (split(" ",$testdata->{"$thorn UNRUNNABLE"})) + foreach $parfile (split(' ',$testdata->{"$thorn TESTS"})) { + my $nprocs = $testdata->{"$thorn $parfile NPROCS"}; + next unless ($nprocs); $message .= "\n ".$parfile." in ". $thorn."\n"; $message .= " (". $testdata->{"$thorn $parfile DESC"}.")\n"; - $message .= " Missing: ".$testdata->{"$thorn $parfile MISSING"}."\n"; + $message .= " Requires $nprocs processors\n"; $missingtests++; } } @@ -1360,15 +1386,21 @@ sub ResetTestStatistics sub ParseAllParameterFiles { - my($testdata) = @_; + my($testdata, $config_data, $rundata) = @_; + my $nprocs_available = $config_data->{'NPROCS'}; # Collect thorns needed for each testsuite foreach $thorn (split(" ",$testdata->{"THORNS"})) { $arr = $testdata->{"$thorn ARRANGEMENT"}; + my $nprocs = $rundata->{"$thorn NPROCS"}; + $nprocs = $nprocs_available unless ($nprocs); + my $nrunnable = 0; foreach $testbase (split(" ",$testdata->{"$thorn TESTS"})) { + my $nprocs_required = $rundata->{"$thorn $testbase NPROCS"}; + $nprocs_required = $nprocs unless ($nprocs_required); $parfile = "$testbase.par"; @@ -1383,33 +1415,38 @@ sub ParseAllParameterFiles $testdata->{"THORNS"}); # Set whether test is runnable or not - if($nmissing == 0) + if($nmissing) { - $testdata->{"$thorn RUNNABLE"} .= "$testbase "; - $testdata->{"NRUNNABLE"}++; - $testdata->{"$thorn TESTED"} = 1; - $testdata->{"$thorn NRUNNABLE"}++; + $testdata->{"$thorn UNRUNNABLE"} .= "$testbase "; + $testdata->{"$thorn $testbase MISSING"} .= $missing; + $testdata->{'NUNRUNNABLE'}++; } - else + elsif ($nprocs_required != $nprocs_available) { $testdata->{"$thorn UNRUNNABLE"} .= "$testbase "; - $testdata->{"$thorn $testbase MISSING"} .= "$missing"; - $testdata->{"NUNRUNNABLE"}++; - $testdata->{"$thorn NUNRUNNABLE"}++; + $testdata->{"$thorn $testbase NPROCS"} = $nprocs_required; + $testdata->{'NUNRUNNABLE'}++; + } + else + { + $testdata->{"$thorn RUNNABLE"} .= "$testbase "; + $testdata->{"$thorn TESTED"} = 1; + $testdata->{'NRUNNABLE'}++; + $nrunnable++; } } - if ($testdata->{"$thorn NRUNNABLE"} > 0) + if ($nrunnable) { - $testdata->{"RUNNABLETHORNS"} .= "$thorn "; - if ($testdata->{"RUNNABLEARRANGEMENTS"} !~ m:\b$arr\s:) + $testdata->{'RUNNABLETHORNS'} .= "$thorn "; + if ($testdata->{'RUNNABLEARRANGEMENTS'} !~ m:\b$arr\s:) { - $testdata->{"RUNNABLEARRANGEMENTS"} .= "$arr "; + $testdata->{'RUNNABLEARRANGEMENTS'} .= "$arr "; } } else { - $testdata->{"UNRUNNABLETHORNS"} .= "$thorn "; + $testdata->{'UNRUNNABLETHORNS'} .= "$thorn "; } } @@ -1417,9 +1454,9 @@ sub ParseAllParameterFiles foreach $arr (split(" ",$testdata->{"ARRANGEMENTS"})) { - if ($testdata->{"RUNNABLEARRANGEMENTS"} !~ m:\b$arr\s:) + if ($testdata->{'RUNNABLEARRANGEMENTS'} !~ m:\b$arr\s:) { - $testdata->{"UNRUNNABLEARRANGEMENTS"} .= "$arr "; + $testdata->{'UNRUNNABLEARRANGEMENTS'} .= "$arr "; } } |