Changeset 2033 for trunk/tsuite

Show
Ignore:
Timestamp:
05/09/08 08:56:01 (8 months ago)
Author:
peter
Message:

tsuite/slow/run_parallel.pl:

Port changes from version in auto test suite, update sequence to put h2 models upfront.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tsuite/slow/run_parallel.pl

    r1883 r2033  
    33# I have written a little perl script that runs the test suite in 
    44# parallel on suitable machines. The syntax is: 
     5# 
     6# run_parallel.pl cloudy.exe 
     7# 
     8# or 
    59# 
    610# run_parallel.pl cloudy.exe 16 
     
    913# should either be in your search path, or the full pathname should 
    1014# be used. The second number is the number of processors to use. It 
    11 # can be any number >= 1. However, using numbers larger than roughly 
     15# can be any number >= 0. However, using numbers larger than roughly 
    1216# 16 will not give any speed advantage since the time will then be 
    13 # set by the longest running test sims. 
     17# set by the longest running test sims. The second number is optional 
     18# and will default to the number of processosrs on your computer 
     19# (this number is only correctly determined under Linux and Windows, 
     20# it will be set to 1 on other systems). 
     21# 
     22# If the number of processors is set to 0, the script will exit after 
     23# creating the Makefile (i.e., the test suite will not be run). 
     24# 
     25# NB NB - The script will first delete any remaining output from a 
     26# previous run of the test suite by calling the script clean_tsuite.pl 
     27# (this includes calls with the number of processors set to 0) ! 
    1428# 
    1529# The script uses "gmake" (GNU make) to run the test cases. In case 
     
    1731# "make". If the version is not too old, that should work as well 
    1832# provided it supports the -j parameter for parallel execution. 
    19 # The script may need some other tinkering too, but I find it very 
    20 # useful here. 
     33# 
    2134# Peter van Hoof 
    2235 
    2336if( "$ARGV[0]" eq "" ) { 
    24     print "The name for the cloudy binary must be supplied...\n"; 
     37    print "The path to the cloudy binary must be supplied as the first parameter to this script...\n"; 
    2538    exit; 
    2639} 
    2740 
    2841if( "$ARGV[1]" eq "" ) { 
    29     print "The number of processors must be supplied...\n"; 
    30     exit; 
     42#     the following should work under Windows. 
     43    $nproc = $ENV{'NUMBER_OF_PROCESSORS'}; 
     44    if( $nproc eq "" ) 
     45    { 
     46#         this branch is for non-Windows 
     47        if( -r "/proc/cpuinfo" ) 
     48        { 
     49#             this branch is for Linux 
     50            $nproc = 0; 
     51            open( foo, "</proc/cpuinfo" ); 
     52            while( <foo> ) 
     53            { 
     54                if( /^processor/ ) 
     55                { 
     56                    ++$nproc; 
     57                } 
     58            } 
     59            close( foo ); 
     60        } 
     61        else 
     62        { 
     63#             we don't know how to determine the number of CPUs 
     64            $nproc = 1; 
     65        } 
     66    } 
     67} 
     68else { 
     69    $nproc = $ARGV[1]; 
    3170} 
    3271 
     
    4382$i = 0; 
    4483 
    45 while( defined( $input = glob("*.in") ) ) { 
     84# this funny sequence is to assure that the heavy jobs are upfront... 
     85while( defined( $input = glob("h*.in [A-Za-gi-z]*.in") ) ) { 
    4686    $i++; 
    4787    $output = $input; 
     88    $output2 = $input; 
    4889    $output =~ s/\.in/.out/gi; 
     90    $output2 =~ s/\.in/.err/gi; 
    4991    $all = "$all$output "; 
    5092    if( $i%4 == 0 ) { 
     
    5294    } 
    5395    $rules = "$rules$output: $input\n"; 
    54     $rules = "$rules\t$ARGV[0] < $input > $output\n" 
     96    $rules = "$rules\t$ARGV[0] < $input > $output 2> $output2\n" 
    5597} 
    5698open( foo, ">Makefile" ); 
     
    61103 
    62104# if number of processors is 0 only create Makefile and exit 
    63 if( $ARGV[1] > 0 ) { 
     105if( $nproc > 0 ) { 
     106    print "\nNow I will run the test suite using $nproc processors\n\n"; 
     107 
    64108#     this does the heavy lifting... 
    65109#     try make instead if gmake doesn't exist on your system 
    66     system "gmake -i -j $ARGV[1]"; 
     110    system "gmake -i -j $nproc"; 
    67111 
    68112#     this was produced by the optimizers and is not really part of the test suite 
     
    70114    unlink "optimal.in"; 
    71115 
    72     if( $ARGV[1] > 1 ) { 
     116    if( $nproc > 1 ) { 
    73117#         just in case func_trans_read was run before func_trans_punch was complete 
    74118        unlink "func_trans_read.out"; 
    75119#         try make instead if gmake doesn't exist on your system 
    76         system "gmake -i -j $ARGV[1]"; 
     120        system "gmake -i -j $nproc"; 
    77121    } 
    78122