Changeset 32
- Timestamp:
- Dec 1, 2011, 8:36:22 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oarutils/oar-parexec
r28 r32 14 14 use IO::File; 15 15 use POSIX qw( WNOHANG WEXITSTATUS ); 16 use Cwd qw( getcwd ); 16 17 17 18 my $file = ''; 18 19 my $verbose; 20 my $nodefile = $ENV{OAR_NODE_FILE} || ''; 21 my $masterio; 19 22 my $switchio; 20 23 my $help; … … 22 25 23 26 Getopt::Long::GetOptions( 24 'file=s' => \$file, 25 'verbose' => \$verbose, 26 'help' => \$help, 27 'oarsh' => \$oarsh, 28 'switchio' => \$switchio, 27 'file=s' => \$file, 28 'verbose' => \$verbose, 29 'help' => \$help, 30 'oarsh=s' => \$oarsh, 31 'nodefile=s' => \$nodefile, 32 'masterio=s' => \$masterio, 33 'switchio' => \$switchio, 29 34 ) || pod2usage( -verbose => 0 ); 30 35 pod2usage( -verbose => 2 ) if $help; … … 36 41 chomp; 37 42 next if m/^#/; 38 push @job, $_ if not m/^\s*$/; 43 next if m/^\s*$/; 44 push @job, $_ ; 39 45 } 40 46 close JOB_LIST; 41 47 42 my $stderr = $ENV{OAR_STDERR} ;48 my $stderr = $ENV{OAR_STDERR} || ''; 43 49 $stderr =~ s/\.stderr$//; 44 my $stdout = $ENV{OAR_STDOUT}; 50 $stderr = $masterio if $masterio; 51 my $stdout = $ENV{OAR_STDOUT} || ''; 45 52 $stdout =~ s/\.stdout$//; 53 $stdout = $masterio if $masterio; 54 55 my $current_dir = getcwd(); 46 56 47 57 my $finished = new Coro::Signal; … … 50 60 51 61 my $ressources = new Coro::Channel; 52 open( NODE_FILE, '<', "$ ENV{OAR_NODE_FILE}" )53 or die "can't open ENV{OAR_NODE_FILE}: $!";62 open( NODE_FILE, '<', "$nodefile" ) 63 or die "can't open $nodefile: $!"; 54 64 while (<NODE_FILE>) { 55 65 chomp; 66 next if m/^#/; 67 next if m/^\s*$/; 56 68 $ressources->put($_); 57 69 } … … 84 96 $job_stderr = "2> $stderr-$job_num.stderr" if $stderr ne '' and $switchio; 85 97 86 $fh->print("cd $ ENV{OAR_WORKDIR}\n");98 $fh->print("cd $current_dir\n"); 87 99 $fh->print("$job $job_stdout $job_stderr\n"); 88 100 $fh->print("exit\n"); … … 124 136 =head1 SYNOPSIS 125 137 126 oar-parexec --file file path [--verbose] [--switchio] [--oarsh sssh]138 oar-parexec --file filecommand [--verbose] [--nodefile filenode] [--masterio basefileio] [--switchio] [--oarsh sssh] 127 139 oar-parexec --help 128 140 141 =head1 DESCRIPTION 142 143 C<oar-parexec> execute lot of small job.in parallel inside a cluster. 144 Number of parallel job at one time cannot excede core number in the node file. 145 C<oar-parexec> is easier to use inside an OAR job environment 146 which define automatically theses strategics parameters... 147 148 Option C<--file> is the only mandatory one. 149 150 Small job will be launch in the same folder as the master job. 151 152 129 153 =head1 OPTIONS 130 154 131 --file file name which content job list 132 133 --verbose 134 135 --switchio each small job will have it's own output STDOUT and STDERR 136 base on master OAR job with JOB_NUM inside. Example : 137 138 OAR.151524.stdout -> OAR.151524-JOB_NUM.stdout 139 140 where 151524 here is the master OAR_JOB_ID 141 142 -oarsh command use to connect a shell on a node 143 by default 155 =over 12 156 157 =item B<-f|--file filecommand> 158 159 File name which content job list. 160 161 =item B<-v|--verbose> 162 163 =item B<-n|nodefile filenode> 164 165 File name that list all the node to launch job. 166 By defaut, it's define automatically by OAR via 167 environment variable C<OAR_NODE_FILE>. 168 169 For example, if you want to use 6 core on your cluster node, 170 you need to put 6 times the hostname node in this file, 171 one per line... 172 It's a very common file in MPI process ! 173 174 =item B<-m|--masterio basefileio> 175 176 The C<basefileio> will be use in place of environment variable 177 C<OAR_STDOUT> and C<OAR_STDERR> (without extension) to build the base name of the small job standart output 178 (only when option C<swithio> is activated). 179 180 =item B<-s|--switchio> 181 182 Each small job will have it's own output STDOUT and STDERR 183 base on master OAR job with C<JOB_NUM> inside 184 (or base on C<basefileio> if option C<masterio>). 185 Example : 186 187 OAR.151524.stdout -> OAR.151524-JOB_NUM.stdout 188 189 where 151524 here is the master C<OAR_JOB_ID> 190 and C<JOB_NUM> is the small job nnumber. 191 192 =item B<-o|-oarsh command> 193 194 Command use to launch a shell on a node. 195 By default 144 196 145 197 oarsh -q -T 146 198 147 --help 148 149 150 =head1 DESCRIPTION 151 152 C<oar-parexec> need to be executed inside an OAR job environment. 153 because it need the two environment variable that OAR define by 154 default: 155 156 OAR_NODE_FILE path to a file which content one node by line 157 158 OAR_WORKDIR dir to launch job and do a chdir inside 199 =item B<-h|--help> 200 201 =back 202 203 204 =head1 EXAMPLE 159 205 160 206 Content for the job file (option C<--file>) could have: … … 170 216 $HOME/test/subjob3.sh 171 217 $HOME/test/subjob4.sh 172 218 ... 173 219 $HOME/test/subjob38.sh 174 220 $HOME/test/subjob39.sh
Note: See TracChangeset
for help on using the changeset viewer.