Changeset 2033
- Timestamp:
- 05/09/08 08:56:01 (3 days ago)
- Files:
-
- trunk/tsuite/slow/run_parallel.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/tsuite/slow/run_parallel.pl
r1883 r2033 3 3 # I have written a little perl script that runs the test suite in 4 4 # parallel on suitable machines. The syntax is: 5 # 6 # run_parallel.pl cloudy.exe 7 # 8 # or 5 9 # 6 10 # run_parallel.pl cloudy.exe 16 … … 9 13 # should either be in your search path, or the full pathname should 10 14 # be used. The second number is the number of processors to use. It 11 # can be any number >= 1. However, using numbers larger than roughly15 # can be any number >= 0. However, using numbers larger than roughly 12 16 # 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) ! 14 28 # 15 29 # The script uses "gmake" (GNU make) to run the test cases. In case … … 17 31 # "make". If the version is not too old, that should work as well 18 32 # 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 # 21 34 # Peter van Hoof 22 35 23 36 if( "$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"; 25 38 exit; 26 39 } 27 40 28 41 if( "$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 } 68 else { 69 $nproc = $ARGV[1]; 31 70 } 32 71 … … 43 82 $i = 0; 44 83 45 while( defined( $input = glob("*.in") ) ) { 84 # this funny sequence is to assure that the heavy jobs are upfront... 85 while( defined( $input = glob("h*.in [A-Za-gi-z]*.in") ) ) { 46 86 $i++; 47 87 $output = $input; 88 $output2 = $input; 48 89 $output =~ s/\.in/.out/gi; 90 $output2 =~ s/\.in/.err/gi; 49 91 $all = "$all$output "; 50 92 if( $i%4 == 0 ) { … … 52 94 } 53 95 $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" 55 97 } 56 98 open( foo, ">Makefile" ); … … 61 103 62 104 # if number of processors is 0 only create Makefile and exit 63 if( $ARGV[1] > 0 ) { 105 if( $nproc > 0 ) { 106 print "\nNow I will run the test suite using $nproc processors\n\n"; 107 64 108 # this does the heavy lifting... 65 109 # try make instead if gmake doesn't exist on your system 66 system "gmake -i -j $ ARGV[1]";110 system "gmake -i -j $nproc"; 67 111 68 112 # this was produced by the optimizers and is not really part of the test suite … … 70 114 unlink "optimal.in"; 71 115 72 if( $ ARGV[1]> 1 ) {116 if( $nproc > 1 ) { 73 117 # just in case func_trans_read was run before func_trans_punch was complete 74 118 unlink "func_trans_read.out"; 75 119 # try make instead if gmake doesn't exist on your system 76 system "gmake -i -j $ ARGV[1]";120 system "gmake -i -j $nproc"; 77 121 } 78 122
